mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 14:40:56 +00:00
Improve loading speed of PC and app grids
This commit is contained in:
+29
-13
@@ -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,12 +109,16 @@ CenteredGridView {
|
|||||||
ToolTip.visible: (parent.hovered || parent.highlighted) && (!appNameText.visible || appNameText.truncated)
|
ToolTip.visible: (parent.hovered || parent.highlighted) && (!appNameText.visible || appNameText.truncated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: model.running
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: appIcon
|
||||||
|
|
||||||
|
sourceComponent: Item {
|
||||||
ToolButton {
|
ToolButton {
|
||||||
id: resumeButton
|
|
||||||
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? -47 : 0
|
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? -47 : 0
|
||||||
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : -60
|
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : -60
|
||||||
anchors.centerIn: appIcon
|
anchors.centerIn: parent
|
||||||
visible: model.running
|
|
||||||
implicitWidth: 125
|
implicitWidth: 125
|
||||||
implicitHeight: 125
|
implicitHeight: 125
|
||||||
|
|
||||||
@@ -136,11 +142,9 @@ CenteredGridView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ToolButton {
|
ToolButton {
|
||||||
id: quitButton
|
|
||||||
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? 47 : 0
|
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? 47 : 0
|
||||||
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : 60
|
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : 60
|
||||||
anchors.centerIn: appIcon
|
anchors.centerIn: parent
|
||||||
visible: model.running
|
|
||||||
implicitWidth: 125
|
implicitWidth: 125
|
||||||
implicitHeight: 125
|
implicitHeight: 125
|
||||||
|
|
||||||
@@ -162,24 +166,32 @@ CenteredGridView {
|
|||||||
ToolTip.timeout: 3000
|
ToolTip.timeout: 3000
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: appIcon.isPlaceholder
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
sourceComponent: Label {
|
||||||
|
id: appNameText
|
||||||
|
text: model.name
|
||||||
font.pointSize: 22
|
font.pointSize: 22
|
||||||
|
leftPadding: 20
|
||||||
|
rightPadding: 20
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function launchOrResumeSelectedApp(quitExistingApp)
|
function launchOrResumeSelectedApp(quitExistingApp)
|
||||||
{
|
{
|
||||||
@@ -267,7 +279,10 @@ CenteredGridView {
|
|||||||
quitAppDialog.open()
|
quitAppDialog.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigableMenu {
|
Loader {
|
||||||
|
id: appContextMenuLoader
|
||||||
|
asynchronous: true
|
||||||
|
sourceComponent: NavigableMenu {
|
||||||
id: appContextMenu
|
id: appContextMenu
|
||||||
NavigableMenuItem {
|
NavigableMenuItem {
|
||||||
parentMenu: appContextMenu
|
parentMenu: appContextMenu
|
||||||
@@ -308,6 +323,7 @@ CenteredGridView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NavigableMessageDialog {
|
NavigableMessageDialog {
|
||||||
id: quitAppDialog
|
id: quitAppDialog
|
||||||
|
|||||||
+7
-1
@@ -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,7 +162,10 @@ CenteredGridView {
|
|||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigableMenu {
|
Loader {
|
||||||
|
id: pcContextMenuLoader
|
||||||
|
asynchronous: true
|
||||||
|
sourceComponent: NavigableMenu {
|
||||||
id: pcContextMenu
|
id: pcContextMenu
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("PC Status: %1").arg(model.online ? qsTr("Online") : qsTr("Offline"))
|
text: qsTr("PC Status: %1").arg(model.online ? qsTr("Online") : qsTr("Offline"))
|
||||||
@@ -211,6 +216,7 @@ CenteredGridView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (model.online) {
|
if (model.online) {
|
||||||
|
|||||||
Reference in New Issue
Block a user