Return to the PC grid if the selected PC goes offline or becomes unpaired

This commit is contained in:
Cameron Gutman 2018-08-09 18:48:40 -07:00
parent c61182bcb2
commit 3f81d055af
3 changed files with 21 additions and 0 deletions

View file

@ -28,14 +28,24 @@ GridView {
// routine to run, but only if we start as invisible
visible: false
function computerLost()
{
// Go back to the PC view on PC loss
stackView.pop()
}
onVisibleChanged: {
if (visible) {
// Start polling when this view is shown
ComputerManager.startPolling()
appModel.computerLost.connect(computerLost)
}
else {
// Stop polling when this view is not on top
ComputerManager.stopPollingAsync()
appModel.computerLost.disconnect(computerLost)
}
}

View file

@ -108,6 +108,14 @@ void AppModel::handleComputerStateChanged(NvComputer* computer)
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
// is required because the new game may now be running, so
// we can't check that first.

View file

@ -42,6 +42,9 @@ private slots:
void handleBoxArtLoaded(NvComputer* computer, NvApp app, QUrl image);
signals:
void computerLost();
private:
NvComputer* m_Computer;
BoxArtManager m_BoxArtManager;