Now with WoL and PC deletion from QML. Deletion needs bugfix, possibly not committed to storage?

This commit is contained in:
R. Aidan Campbell 2018-07-29 16:04:45 -07:00
parent 277594139b
commit 9e744ce169

View File

@ -142,9 +142,27 @@ GridView {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
Menu {
id: pcContextMenu
MenuItem {
text: "Wake PC"
onTriggered: computerModel.wakeComputer(index)
}
MenuItem {
text: "Delete PC"
onTriggered: {
deletePcDialog.pcIndex = index
// get confirmation first, actual closing is called from the dialog
deletePcDialog.open()
}
}
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton;
onClicked: { onClicked: {
if(mouse.button === Qt.LeftButton) {
if (model.addPc) { if (model.addPc) {
addPcDialog.open() addPcDialog.open()
} }
@ -178,8 +196,12 @@ GridView {
} }
} }
} }
else {
// TODO: Wake on LAN and delete PC options }
else { // right click
if(!model.addPc) { // but only for actual PCs, not the add-pc option
pcContextMenu.open()
}
} }
} }
} }
@ -218,6 +240,22 @@ GridView {
} }
} }
MessageDialog {
id: deletePcDialog
// 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?"
standardButtons: StandardButton.Yes |StandardButton.No
onYes: {
console.log("deleting PC pairing for PC at index: " + pcIndex)
computerModel.deleteComputer(pcIndex);
// hack to remove the child from the gridview
model = createModel()
}
}
Dialog { Dialog {
id: addPcDialog id: addPcDialog
property string label: "Enter the IP address of your GameStream PC" property string label: "Enter the IP address of your GameStream PC"