You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a context menu item that sends the Wake-on-LAN packet and
automatically opens the PC's app view once it comes online, instead
of requiring the user to wake it and then click it separately.
Includes a 2-minute timeout with an error dialog if the PC does not
come online.
Copy file name to clipboardExpand all lines: app/gui/PcView.qml
+60-21Lines changed: 60 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,11 @@ CenteredGridView {
171
171
font.bold:true
172
172
enabled:false
173
173
}
174
+
NavigableMenuItem {
175
+
text:qsTr("Wake and Open")
176
+
onTriggered:wakeAndOpen()
177
+
visible:!model.online&&model.wakeable
178
+
}
174
179
NavigableMenuItem {
175
180
text:qsTr("View All Apps")
176
181
onTriggered: {
@@ -219,29 +224,63 @@ CenteredGridView {
219
224
}
220
225
}
221
226
222
-
onClicked: {
223
-
if (model.online) {
224
-
if (!model.serverSupported) {
225
-
errorDialog.text=qsTr("The version of GeForce Experience on %1 is not supported by this build of Moonlight. You must update Moonlight to stream from %1.").arg(model.name)
226
-
errorDialog.helpText=""
227
-
errorDialog.open()
228
-
}
229
-
elseif (model.paired) {
230
-
// go to game view
231
-
var component =Qt.createComponent("AppView.qml")
232
-
var appView =component.createObject(stackView, {"computerIndex": index, "objectName":model.name})
233
-
stackView.push(appView)
234
-
}
235
-
else {
236
-
var pin =computerModel.generatePinString()
227
+
// Set when the user chose "Wake and Open"; we open the PC
228
+
// automatically once it comes online.
229
+
property bool wakeAndOpenPending:false
230
+
property bool onlineRole:model.online
237
231
238
-
// Kick off pairing in the background
239
-
computerModel.pairComputer(index, pin)
232
+
onOnlineRoleChanged: {
233
+
if (wakeAndOpenPending && onlineRole) {
234
+
wakeAndOpenPending =false
235
+
wakeOpenTimeout.stop()
236
+
activatePc()
237
+
}
238
+
}
240
239
241
-
// Display the pairing dialog
242
-
pairDialog.pin= pin
243
-
pairDialog.open()
244
-
}
240
+
Timer {
241
+
id: wakeOpenTimeout
242
+
interval:120000
243
+
onTriggered: {
244
+
wakeAndOpenPending =false
245
+
errorDialog.text=qsTr("Timed out waiting for %1 to wake up.").arg(model.name)
246
+
errorDialog.helpText=""
247
+
errorDialog.open()
248
+
}
249
+
}
250
+
251
+
functionwakeAndOpen() {
252
+
wakeAndOpenPending =true
253
+
wakeOpenTimeout.restart()
254
+
computerModel.wakeComputer(index)
255
+
}
256
+
257
+
functionactivatePc() {
258
+
if (!model.serverSupported) {
259
+
errorDialog.text=qsTr("The version of GeForce Experience on %1 is not supported by this build of Moonlight. You must update Moonlight to stream from %1.").arg(model.name)
260
+
errorDialog.helpText=""
261
+
errorDialog.open()
262
+
}
263
+
elseif (model.paired) {
264
+
// go to game view
265
+
var component =Qt.createComponent("AppView.qml")
266
+
var appView =component.createObject(stackView, {"computerIndex": index, "objectName":model.name})
267
+
stackView.push(appView)
268
+
}
269
+
else {
270
+
var pin =computerModel.generatePinString()
271
+
272
+
// Kick off pairing in the background
273
+
computerModel.pairComputer(index, pin)
274
+
275
+
// Display the pairing dialog
276
+
pairDialog.pin= pin
277
+
pairDialog.open()
278
+
}
279
+
}
280
+
281
+
onClicked: {
282
+
if (model.online) {
283
+
activatePc()
245
284
} elseif (!model.online) {
246
285
// Using open() here because it may be activated by keyboard
0 commit comments