mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-04 00:36:36 +00:00
Use a Loader to be able to use StackView.onActivated to trigger stream start
This commit is contained in:
parent
49b67b3e18
commit
ccd0777ce9
@ -15,11 +15,6 @@ Item {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
// The StackView will trigger a visibility change when
|
|
||||||
// we're pushed onto it, causing our onVisibleChanged
|
|
||||||
// routine to run, but only if we start as invisible
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
function stageStarting(stage)
|
function stageStarting(stage)
|
||||||
{
|
{
|
||||||
// Update the spinner text
|
// Update the spinner text
|
||||||
@ -111,22 +106,10 @@ Item {
|
|||||||
toolBar.visible = true
|
toolBar.visible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// !!! Changing this to use the StackView activation callbacks
|
StackView.onActivated: {
|
||||||
// causes our mouse polling rate to drop significantly on
|
|
||||||
// Windows for some reason !!!
|
|
||||||
onVisibleChanged: {
|
|
||||||
if (visible) {
|
|
||||||
// Hide the toolbar before we start loading
|
// Hide the toolbar before we start loading
|
||||||
toolBar.visible = false
|
toolBar.visible = false
|
||||||
|
|
||||||
// Set the hint text. We do this here rather than
|
|
||||||
// in the hintText control itself to synchronize
|
|
||||||
// with Session.exec() which requires no concurrent
|
|
||||||
// gamepad usage.
|
|
||||||
hintText.text = gamepadKeyNav.getConnectedGamepads() > 0 ?
|
|
||||||
"Tip: Press Start+Select+L1+R1 to disconnect your session" :
|
|
||||||
"Tip: Press Ctrl+Alt+Shift+Q to disconnect your session"
|
|
||||||
|
|
||||||
// Hook up our signals
|
// Hook up our signals
|
||||||
session.stageStarting.connect(stageStarting)
|
session.stageStarting.connect(stageStarting)
|
||||||
session.stageFailed.connect(stageFailed)
|
session.stageFailed.connect(stageFailed)
|
||||||
@ -136,9 +119,29 @@ Item {
|
|||||||
session.quitStarting.connect(quitStarting)
|
session.quitStarting.connect(quitStarting)
|
||||||
session.sessionFinished.connect(sessionFinished)
|
session.sessionFinished.connect(sessionFinished)
|
||||||
|
|
||||||
|
// Kick off the stream
|
||||||
|
streamLoader.active = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: streamLoader
|
||||||
|
active: false
|
||||||
|
asynchronous: true
|
||||||
|
|
||||||
|
onLoaded: {
|
||||||
|
// Set the hint text. We do this here rather than
|
||||||
|
// in the hintText control itself to synchronize
|
||||||
|
// with Session.exec() which requires no concurrent
|
||||||
|
// gamepad usage.
|
||||||
|
hintText.text = gamepadKeyNav.getConnectedGamepads() > 0 ?
|
||||||
|
"Tip: Press Start+Select+L1+R1 to disconnect your session" :
|
||||||
|
"Tip: Press Ctrl+Alt+Shift+Q to disconnect your session"
|
||||||
|
|
||||||
// Run the streaming session to completion
|
// Run the streaming session to completion
|
||||||
session.exec(Screen.virtualX, Screen.virtualY)
|
session.exec(Screen.virtualX, Screen.virtualY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceComponent: Item {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user