mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-03-04 22:57:14 +00:00
Return to the PC grid if the selected PC goes offline or becomes unpaired
This commit is contained in:
parent
c61182bcb2
commit
3f81d055af
3 changed files with 21 additions and 0 deletions
|
@ -28,14 +28,24 @@ GridView {
|
||||||
// routine to run, but only if we start as invisible
|
// routine to run, but only if we start as invisible
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
function computerLost()
|
||||||
|
{
|
||||||
|
// Go back to the PC view on PC loss
|
||||||
|
stackView.pop()
|
||||||
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
// Start polling when this view is shown
|
// Start polling when this view is shown
|
||||||
ComputerManager.startPolling()
|
ComputerManager.startPolling()
|
||||||
|
|
||||||
|
appModel.computerLost.connect(computerLost)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Stop polling when this view is not on top
|
// Stop polling when this view is not on top
|
||||||
ComputerManager.stopPollingAsync()
|
ComputerManager.stopPollingAsync()
|
||||||
|
|
||||||
|
appModel.computerLost.disconnect(computerLost)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,14 @@ void AppModel::handleComputerStateChanged(NvComputer* computer)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the computer has gone offline or we've been unpaired,
|
||||||
|
// signal the UI so we can go back to the PC view.
|
||||||
|
if (m_Computer->state == NvComputer::CS_OFFLINE ||
|
||||||
|
m_Computer->pairState == NvComputer::PS_NOT_PAIRED) {
|
||||||
|
emit computerLost();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// First, process additions/removals from the app list. This
|
// First, process additions/removals from the app list. This
|
||||||
// is required because the new game may now be running, so
|
// is required because the new game may now be running, so
|
||||||
// we can't check that first.
|
// we can't check that first.
|
||||||
|
|
|
@ -42,6 +42,9 @@ private slots:
|
||||||
|
|
||||||
void handleBoxArtLoaded(NvComputer* computer, NvApp app, QUrl image);
|
void handleBoxArtLoaded(NvComputer* computer, NvApp app, QUrl image);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void computerLost();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NvComputer* m_Computer;
|
NvComputer* m_Computer;
|
||||||
BoxArtManager m_BoxArtManager;
|
BoxArtManager m_BoxArtManager;
|
||||||
|
|
Loading…
Add table
Reference in a new issue