mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-15 21:22:40 +00:00
Implement manually adding PCs
This commit is contained in:
@@ -16,6 +16,16 @@ GridView {
|
||||
cellWidth: 225; cellHeight: 350;
|
||||
focus: true
|
||||
|
||||
Component.onCompleted: {
|
||||
// Start polling when this view is shown
|
||||
ComputerManager.startPolling()
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
// Stop polling when this view is destroyed
|
||||
ComputerManager.stopPollingAsync()
|
||||
}
|
||||
|
||||
function createModel()
|
||||
{
|
||||
var model = Qt.createQmlObject('import AppModel 1.0; AppModel {}', parent, '')
|
||||
|
||||
+17
-6
@@ -21,6 +21,9 @@ GridView {
|
||||
Component.onCompleted: {
|
||||
// Start polling when this view is shown
|
||||
ComputerManager.startPolling()
|
||||
|
||||
// Setup signals on CM
|
||||
ComputerManager.computerAddCompleted.connect(addComplete)
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
@@ -38,8 +41,16 @@ GridView {
|
||||
|
||||
// Display a failed dialog if we got an error
|
||||
if (error !== null) {
|
||||
pairingFailedDialog.text = error
|
||||
pairingFailedDialog.open()
|
||||
errorDialog.text = error
|
||||
errorDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
function addComplete(success)
|
||||
{
|
||||
if (!success) {
|
||||
errorDialog.text = "Unable to connect to the specified PC. Ensure GameStream is enabled in GeForce Experience."
|
||||
errorDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,8 +156,8 @@ GridView {
|
||||
}
|
||||
else {
|
||||
// cannot pair while something is streaming or attempting to pair
|
||||
pairingFailedDialog.text = "This PC is currently busy. Make sure to quit any running games and try again."
|
||||
pairingFailedDialog.open()
|
||||
errorDialog.text = "This PC is currently busy. Make sure to quit any running games and try again."
|
||||
errorDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +169,7 @@ GridView {
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: pairingFailedDialog
|
||||
id: errorDialog
|
||||
// don't allow edits to the rest of the window while open
|
||||
modality:Qt.WindowModal
|
||||
icon: StandardIcon.Critical
|
||||
@@ -189,7 +200,7 @@ GridView {
|
||||
editTextItem.selectAll()
|
||||
}
|
||||
onAccepted: {
|
||||
console.log("accepted, with value: " + editText.text)
|
||||
ComputerManager.addNewHost(editText.text, false)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
||||
@@ -93,6 +93,13 @@ void ComputerModel::deleteComputer(int computerIndex)
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
bool ComputerModel::wakeComputer(int computerIndex)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
|
||||
return m_Computers[computerIndex]->wake();
|
||||
}
|
||||
|
||||
void ComputerModel::pairComputer(int computerIndex, QString pin)
|
||||
{
|
||||
Q_ASSERT(computerIndex < m_Computers.count());
|
||||
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
|
||||
Q_INVOKABLE void pairComputer(int computerIndex, QString pin);
|
||||
|
||||
Q_INVOKABLE bool wakeComputer(int computerIndex);
|
||||
|
||||
signals:
|
||||
void pairingCompleted(QVariant error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user