From 017362a5d13610ee1cb3f5a445411736be51c3ce Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 31 Jul 2018 22:10:38 -0700 Subject: [PATCH] Only allow waking PCs that are not online and paired --- app/gui/PcView.qml | 5 +++-- app/gui/computermodel.cpp | 3 +++ app/gui/computermodel.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 15797301..bb008b39 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -147,6 +147,8 @@ GridView { MenuItem { text: "Wake PC" onTriggered: computerModel.wakeComputer(index) + visible: !model.online && model.wakeable + height: visible ? implicitHeight : 0 } MenuItem { text: "Delete PC" @@ -247,7 +249,7 @@ GridView { // don't allow edits to the rest of the window while open modality:Qt.WindowModal property int pcIndex : -1; - text:"Are you sure you want to unpair from this PC?" + text:"Are you sure you want to remove this PC?" standardButtons: StandardButton.Yes |StandardButton.No onYes: { console.log("deleting PC pairing for PC at index: " + pcIndex) @@ -257,7 +259,6 @@ GridView { } } - Dialog { id: addPcDialog property string label: "Enter the IP address of your GameStream PC" diff --git a/app/gui/computermodel.cpp b/app/gui/computermodel.cpp index f1dcb29c..ad52af05 100644 --- a/app/gui/computermodel.cpp +++ b/app/gui/computermodel.cpp @@ -46,6 +46,8 @@ QVariant ComputerModel::data(const QModelIndex& index, int role) const return computer->pairState == NvComputer::PS_PAIRED; case BusyRole: return computer->currentGameId != 0; + case WakeableRole: + return !computer->macAddress.isEmpty(); case AddPcRole: return false; default: @@ -74,6 +76,7 @@ QHash ComputerModel::roleNames() const names[PairedRole] = "paired"; names[BusyRole] = "busy"; names[AddPcRole] = "addPc"; + names[WakeableRole] = "wakeable"; return names; } diff --git a/app/gui/computermodel.h b/app/gui/computermodel.h index 2b076cfe..e749cf0e 100644 --- a/app/gui/computermodel.h +++ b/app/gui/computermodel.h @@ -13,6 +13,7 @@ class ComputerModel : public QAbstractListModel OnlineRole, PairedRole, BusyRole, + WakeableRole, AddPcRole };