mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 06:30:55 +00:00
Improve loading speed of PC and app grids
This commit is contained in:
+113
-97
@@ -73,6 +73,8 @@ CenteredGridView {
|
|||||||
width: 220; height: 287;
|
width: 220; height: 287;
|
||||||
grid: appGrid
|
grid: appGrid
|
||||||
|
|
||||||
|
property alias appContextMenu: appContextMenuLoader.item
|
||||||
|
|
||||||
// Dim the app if it's hidden
|
// Dim the app if it's hidden
|
||||||
opacity: model.hidden ? 0.4 : 1.0
|
opacity: model.hidden ? 0.4 : 1.0
|
||||||
|
|
||||||
@@ -107,78 +109,88 @@ CenteredGridView {
|
|||||||
ToolTip.visible: (parent.hovered || parent.highlighted) && (!appNameText.visible || appNameText.truncated)
|
ToolTip.visible: (parent.hovered || parent.highlighted) && (!appNameText.visible || appNameText.truncated)
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton {
|
Loader {
|
||||||
id: resumeButton
|
active: model.running
|
||||||
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? -47 : 0
|
asynchronous: true
|
||||||
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : -60
|
anchors.fill: appIcon
|
||||||
anchors.centerIn: appIcon
|
|
||||||
visible: model.running
|
|
||||||
implicitWidth: 125
|
|
||||||
implicitHeight: 125
|
|
||||||
|
|
||||||
Image {
|
sourceComponent: Item {
|
||||||
source: "qrc:/res/baseline-play_circle_filled_white-48px.svg"
|
ToolButton {
|
||||||
anchors.centerIn: parent
|
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? -47 : 0
|
||||||
sourceSize {
|
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : -60
|
||||||
width: 75
|
anchors.centerIn: parent
|
||||||
height: 75
|
implicitWidth: 125
|
||||||
|
implicitHeight: 125
|
||||||
|
|
||||||
|
Image {
|
||||||
|
source: "qrc:/res/baseline-play_circle_filled_white-48px.svg"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
sourceSize {
|
||||||
|
width: 75
|
||||||
|
height: 75
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
launchOrResumeSelectedApp(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolTip.text: qsTr("Resume Game")
|
||||||
|
ToolTip.delay: 1000
|
||||||
|
ToolTip.timeout: 3000
|
||||||
|
ToolTip.visible: hovered
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolButton {
|
||||||
|
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? 47 : 0
|
||||||
|
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : 60
|
||||||
|
anchors.centerIn: parent
|
||||||
|
implicitWidth: 125
|
||||||
|
implicitHeight: 125
|
||||||
|
|
||||||
|
Image {
|
||||||
|
source: "qrc:/res/baseline-cancel-24px.svg"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
sourceSize {
|
||||||
|
width: 75
|
||||||
|
height: 75
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
doQuitGame()
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolTip.text: qsTr("Quit Game")
|
||||||
|
ToolTip.delay: 1000
|
||||||
|
ToolTip.timeout: 3000
|
||||||
|
ToolTip.visible: hovered
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
launchOrResumeSelectedApp(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolTip.text: qsTr("Resume Game")
|
|
||||||
ToolTip.delay: 1000
|
|
||||||
ToolTip.timeout: 3000
|
|
||||||
ToolTip.visible: hovered
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton {
|
Loader {
|
||||||
id: quitButton
|
active: appIcon.isPlaceholder
|
||||||
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? 47 : 0
|
asynchronous: true
|
||||||
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : 60
|
|
||||||
anchors.centerIn: appIcon
|
|
||||||
visible: model.running
|
|
||||||
implicitWidth: 125
|
|
||||||
implicitHeight: 125
|
|
||||||
|
|
||||||
Image {
|
|
||||||
source: "qrc:/res/baseline-cancel-24px.svg"
|
|
||||||
anchors.centerIn: parent
|
|
||||||
sourceSize {
|
|
||||||
width: 75
|
|
||||||
height: 75
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
doQuitGame()
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolTip.text: qsTr("Quit Game")
|
|
||||||
ToolTip.delay: 1000
|
|
||||||
ToolTip.timeout: 3000
|
|
||||||
ToolTip.visible: hovered
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: appNameText
|
|
||||||
visible: appIcon.isPlaceholder
|
|
||||||
text: model.name
|
|
||||||
width: appIcon.width
|
width: appIcon.width
|
||||||
height: model.running ? 175 : appIcon.height
|
height: model.running ? 175 : appIcon.height
|
||||||
leftPadding: 20
|
|
||||||
rightPadding: 20
|
|
||||||
anchors.left: appIcon.left
|
anchors.left: appIcon.left
|
||||||
anchors.right: appIcon.right
|
anchors.right: appIcon.right
|
||||||
anchors.bottom: appIcon.bottom
|
anchors.bottom: appIcon.bottom
|
||||||
font.pointSize: 22
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
sourceComponent: Label {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
id: appNameText
|
||||||
wrapMode: Text.Wrap
|
text: model.name
|
||||||
elide: Text.ElideRight
|
font.pointSize: 22
|
||||||
|
leftPadding: 20
|
||||||
|
rightPadding: 20
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function launchOrResumeSelectedApp(quitExistingApp)
|
function launchOrResumeSelectedApp(quitExistingApp)
|
||||||
@@ -267,44 +279,48 @@ CenteredGridView {
|
|||||||
quitAppDialog.open()
|
quitAppDialog.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigableMenu {
|
Loader {
|
||||||
id: appContextMenu
|
id: appContextMenuLoader
|
||||||
NavigableMenuItem {
|
asynchronous: true
|
||||||
parentMenu: appContextMenu
|
sourceComponent: NavigableMenu {
|
||||||
text: model.running ? qsTr("Resume Game") : qsTr("Launch Game")
|
id: appContextMenu
|
||||||
onTriggered: launchOrResumeSelectedApp(true)
|
NavigableMenuItem {
|
||||||
}
|
parentMenu: appContextMenu
|
||||||
NavigableMenuItem {
|
text: model.running ? qsTr("Resume Game") : qsTr("Launch Game")
|
||||||
parentMenu: appContextMenu
|
onTriggered: launchOrResumeSelectedApp(true)
|
||||||
text: qsTr("Quit Game")
|
}
|
||||||
onTriggered: doQuitGame()
|
NavigableMenuItem {
|
||||||
visible: model.running
|
parentMenu: appContextMenu
|
||||||
}
|
text: qsTr("Quit Game")
|
||||||
NavigableMenuItem {
|
onTriggered: doQuitGame()
|
||||||
parentMenu: appContextMenu
|
visible: model.running
|
||||||
checkable: true
|
}
|
||||||
checked: model.directLaunch
|
NavigableMenuItem {
|
||||||
text: qsTr("Direct Launch")
|
parentMenu: appContextMenu
|
||||||
onTriggered: appModel.setAppDirectLaunch(model.index, !model.directLaunch)
|
checkable: true
|
||||||
enabled: !model.hidden
|
checked: model.directLaunch
|
||||||
|
text: qsTr("Direct Launch")
|
||||||
|
onTriggered: appModel.setAppDirectLaunch(model.index, !model.directLaunch)
|
||||||
|
enabled: !model.hidden
|
||||||
|
|
||||||
ToolTip.text: qsTr("Launch this app immediately when the host is selected, bypassing the app selection grid.")
|
ToolTip.text: qsTr("Launch this app immediately when the host is selected, bypassing the app selection grid.")
|
||||||
ToolTip.delay: 1000
|
ToolTip.delay: 1000
|
||||||
ToolTip.timeout: 3000
|
ToolTip.timeout: 3000
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
}
|
}
|
||||||
NavigableMenuItem {
|
NavigableMenuItem {
|
||||||
parentMenu: appContextMenu
|
parentMenu: appContextMenu
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.hidden
|
checked: model.hidden
|
||||||
text: qsTr("Hide Game")
|
text: qsTr("Hide Game")
|
||||||
onTriggered: appModel.setAppHidden(model.index, !model.hidden)
|
onTriggered: appModel.setAppHidden(model.index, !model.hidden)
|
||||||
enabled: model.hidden || (!model.running && !model.directLaunch)
|
enabled: model.hidden || (!model.running && !model.directLaunch)
|
||||||
|
|
||||||
ToolTip.text: qsTr("Hide this game from the app grid. To access hidden games, right-click on the host and choose %1.").arg(qsTr("View All Apps"))
|
ToolTip.text: qsTr("Hide this game from the app grid. To access hidden games, right-click on the host and choose %1.").arg(qsTr("View All Apps"))
|
||||||
ToolTip.delay: 1000
|
ToolTip.delay: 1000
|
||||||
ToolTip.timeout: 5000
|
ToolTip.timeout: 5000
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-44
@@ -113,6 +113,8 @@ CenteredGridView {
|
|||||||
width: 300; height: 320;
|
width: 300; height: 320;
|
||||||
grid: pcGrid
|
grid: pcGrid
|
||||||
|
|
||||||
|
property alias pcContextMenu : pcContextMenuLoader.item
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: pcIcon
|
id: pcIcon
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
@@ -160,54 +162,58 @@ CenteredGridView {
|
|||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigableMenu {
|
Loader {
|
||||||
id: pcContextMenu
|
id: pcContextMenuLoader
|
||||||
MenuItem {
|
asynchronous: true
|
||||||
text: qsTr("PC Status: %1").arg(model.online ? qsTr("Online") : qsTr("Offline"))
|
sourceComponent: NavigableMenu {
|
||||||
font.bold: true
|
id: pcContextMenu
|
||||||
enabled: false
|
MenuItem {
|
||||||
}
|
text: qsTr("PC Status: %1").arg(model.online ? qsTr("Online") : qsTr("Offline"))
|
||||||
NavigableMenuItem {
|
font.bold: true
|
||||||
parentMenu: pcContextMenu
|
enabled: false
|
||||||
text: qsTr("View All Apps")
|
|
||||||
onTriggered: {
|
|
||||||
var component = Qt.createComponent("AppView.qml")
|
|
||||||
var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name, "showHiddenGames": true})
|
|
||||||
stackView.push(appView)
|
|
||||||
}
|
}
|
||||||
visible: model.online && model.paired
|
NavigableMenuItem {
|
||||||
}
|
parentMenu: pcContextMenu
|
||||||
NavigableMenuItem {
|
text: qsTr("View All Apps")
|
||||||
parentMenu: pcContextMenu
|
onTriggered: {
|
||||||
text: qsTr("Wake PC")
|
var component = Qt.createComponent("AppView.qml")
|
||||||
onTriggered: computerModel.wakeComputer(index)
|
var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name, "showHiddenGames": true})
|
||||||
visible: !model.online && model.wakeable
|
stackView.push(appView)
|
||||||
}
|
}
|
||||||
NavigableMenuItem {
|
visible: model.online && model.paired
|
||||||
parentMenu: pcContextMenu
|
}
|
||||||
text: qsTr("Test Network")
|
NavigableMenuItem {
|
||||||
onTriggered: {
|
parentMenu: pcContextMenu
|
||||||
computerModel.testConnectionForComputer(index)
|
text: qsTr("Wake PC")
|
||||||
testConnectionDialog.open()
|
onTriggered: computerModel.wakeComputer(index)
|
||||||
|
visible: !model.online && model.wakeable
|
||||||
|
}
|
||||||
|
NavigableMenuItem {
|
||||||
|
parentMenu: pcContextMenu
|
||||||
|
text: qsTr("Test Network")
|
||||||
|
onTriggered: {
|
||||||
|
computerModel.testConnectionForComputer(index)
|
||||||
|
testConnectionDialog.open()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
NavigableMenuItem {
|
NavigableMenuItem {
|
||||||
parentMenu: pcContextMenu
|
parentMenu: pcContextMenu
|
||||||
text: qsTr("Rename PC")
|
text: qsTr("Rename PC")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
renamePcDialog.pcIndex = index
|
renamePcDialog.pcIndex = index
|
||||||
renamePcDialog.originalName = model.name
|
renamePcDialog.originalName = model.name
|
||||||
renamePcDialog.open()
|
renamePcDialog.open()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
NavigableMenuItem {
|
||||||
NavigableMenuItem {
|
parentMenu: pcContextMenu
|
||||||
parentMenu: pcContextMenu
|
text: qsTr("Delete PC")
|
||||||
text: qsTr("Delete PC")
|
onTriggered: {
|
||||||
onTriggered: {
|
deletePcDialog.pcIndex = index
|
||||||
deletePcDialog.pcIndex = index
|
// get confirmation first, actual closing is called from the dialog
|
||||||
// get confirmation first, actual closing is called from the dialog
|
deletePcDialog.open()
|
||||||
deletePcDialog.open()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user