From c7a30d8728edb6e1b1650cb000fedd37ecba1af4 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 12 Oct 2022 22:15:58 -0500 Subject: [PATCH] Allow a pairing attempt even if the PC is busy Pairing while busy doesn't work with GFE but works with Sunshine --- app/backend/computermanager.cpp | 7 ++++++- app/cli/pair.cpp | 5 ----- app/gui/PcView.qml | 20 ++++++-------------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/app/backend/computermanager.cpp b/app/backend/computermanager.cpp index 33c3f272..8c75d05c 100644 --- a/app/backend/computermanager.cpp +++ b/app/backend/computermanager.cpp @@ -481,7 +481,12 @@ private: emit pairingCompleted(m_Computer, "The PIN from the PC didn't match. Please try again."); break; case NvPairingManager::PairState::FAILED: - emit pairingCompleted(m_Computer, "Pairing failed. Please try again."); + if (m_Computer->currentGameId != 0) { + emit pairingCompleted(m_Computer, "You cannot pair while a previous session is still running on the host PC. Quit any running games or reboot the host PC, then try pairing again."); + } + else { + emit pairingCompleted(m_Computer, "Pairing failed. Please try again."); + } break; case NvPairingManager::PairState::ALREADY_IN_PROGRESS: emit pairingCompleted(m_Computer, "Another pairing attempt is already in progress."); diff --git a/app/cli/pair.cpp b/app/cli/pair.cpp index ebf10101..20121662 100644 --- a/app/cli/pair.cpp +++ b/app/cli/pair.cpp @@ -80,11 +80,6 @@ public: QString msg = QObject::tr("%1 is already paired").arg(event.computer->name); emit q->failed(msg); } - else if (event.computer->currentGameId != 0) { - m_State = StateFailure; - QString msg = QObject::tr("You cannot pair while a previous session is still running on the host PC. Quit any running games or reboot the host PC, then try pairing again."); - emit q->failed(msg); - } else { Q_ASSERT(!m_PredefinedPin.isEmpty()); diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 123314ce..ef8be15e 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -232,22 +232,14 @@ CenteredGridView { stackView.push(appView) } else { - if (!model.busy) { - var pin = computerModel.generatePinString() + var pin = computerModel.generatePinString() - // Kick off pairing in the background - computerModel.pairComputer(index, pin) + // Kick off pairing in the background + computerModel.pairComputer(index, pin) - // Display the pairing dialog - pairDialog.pin = pin - pairDialog.open() - } - else { - // cannot pair while something is streaming or attempting to pair - errorDialog.text = qsTr("You cannot pair while a previous session is still running on the host PC. Quit any running games or reboot the host PC, then try pairing again.") - errorDialog.helpText = "" - errorDialog.open() - } + // Display the pairing dialog + pairDialog.pin = pin + pairDialog.open() } } else if (!model.online) { // Using open() here because it may be activated by keyboard