mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Avoid inflating MessageDialogs for each app in the grid. Fixes scrolling jank on app grid.
This commit is contained in:
+28
-32
@@ -18,10 +18,6 @@ GridView {
|
|||||||
anchors.bottomMargin: 5
|
anchors.bottomMargin: 5
|
||||||
cellWidth: 225; cellHeight: 385;
|
cellWidth: 225; cellHeight: 385;
|
||||||
|
|
||||||
// Cache delegates for 1000px in both directions to improve
|
|
||||||
// scrolling and resizing performance
|
|
||||||
cacheBuffer: 1000
|
|
||||||
|
|
||||||
// The StackView will trigger a visibility change when
|
// The StackView will trigger a visibility change when
|
||||||
// we're pushed onto it, causing our onVisibleChanged
|
// we're pushed onto it, causing our onVisibleChanged
|
||||||
// routine to run, but only if we start as invisible
|
// routine to run, but only if we start as invisible
|
||||||
@@ -104,34 +100,6 @@ GridView {
|
|||||||
stackView.push(segue)
|
stackView.push(segue)
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageDialog {
|
|
||||||
id: quitAppDialog
|
|
||||||
modality:Qt.WindowModal
|
|
||||||
property string appName : "";
|
|
||||||
property bool segueToStream : false
|
|
||||||
text:"Are you sure you want to quit " + appName +"? Any unsaved progress will be lost."
|
|
||||||
standardButtons: StandardButton.Yes | StandardButton.No
|
|
||||||
onYes: {
|
|
||||||
var component = Qt.createComponent("QuitSegue.qml")
|
|
||||||
var params = {"appName": appName}
|
|
||||||
if (segueToStream) {
|
|
||||||
// Store the session and app name if we're going to stream after
|
|
||||||
// successfully quitting the old app.
|
|
||||||
params.nextAppName = model.name
|
|
||||||
params.nextSession = appModel.createSessionForApp(index)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
params.nextAppName = null
|
|
||||||
params.nextSession = null
|
|
||||||
}
|
|
||||||
|
|
||||||
stackView.push(component.createObject(stackView, params))
|
|
||||||
|
|
||||||
// Trigger the quit after pushing the quit segue on screen
|
|
||||||
appModel.quitRunningApp()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// Nothing is running or this app is running
|
// Nothing is running or this app is running
|
||||||
launchOrResumeSelectedApp()
|
launchOrResumeSelectedApp()
|
||||||
@@ -169,6 +137,34 @@ GridView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
id: quitAppDialog
|
||||||
|
modality:Qt.WindowModal
|
||||||
|
property string appName : "";
|
||||||
|
property bool segueToStream : false
|
||||||
|
text:"Are you sure you want to quit " + appName +"? Any unsaved progress will be lost."
|
||||||
|
standardButtons: StandardButton.Yes | StandardButton.No
|
||||||
|
onYes: {
|
||||||
|
var component = Qt.createComponent("QuitSegue.qml")
|
||||||
|
var params = {"appName": appName}
|
||||||
|
if (segueToStream) {
|
||||||
|
// Store the session and app name if we're going to stream after
|
||||||
|
// successfully quitting the old app.
|
||||||
|
params.nextAppName = model.name
|
||||||
|
params.nextSession = appModel.createSessionForApp(index)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
params.nextAppName = null
|
||||||
|
params.nextSession = null
|
||||||
|
}
|
||||||
|
|
||||||
|
stackView.push(component.createObject(stackView, params))
|
||||||
|
|
||||||
|
// Trigger the quit after pushing the quit segue on screen
|
||||||
|
appModel.quitRunningApp()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {
|
ScrollBar.vertical: ScrollBar {
|
||||||
parent: appGrid.parent
|
parent: appGrid.parent
|
||||||
anchors {
|
anchors {
|
||||||
|
|||||||
Reference in New Issue
Block a user