From 95eebdbe66c3e6d7070ae629aa3c0613b84d080c Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Wed, 4 Jul 2018 18:48:09 -0700 Subject: [PATCH] now with pairing and add-host dialogs --- app/gui/PcView.qml | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 677c566a..22c0a4d9 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -1,5 +1,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 +import QtQuick.Dialogs 1.3 +import QtQuick.Layouts 1.11 import ComputerModel 1.0 @@ -83,6 +85,75 @@ Frame { anchors.fill: parent onClicked: { parent.GridView.view.currentIndex = index + if(model.addPc) { + // TODO: read the output of the dialog + inputDialog.on + inputDialog.open() + + } else if(!model.paired && !model.busy) { + + // TODO: generate pin + pairDialog.text = pairDialog.text.replace("XXXX", "1234") + // TODO: initiate pairing request + pairDialog.open() + } else if (model.online) { + // go to game view + } + } + } + } + } + + MessageDialog { + id: pairDialog + // don't allow edits to the rest of the window while open + modality:Qt.WindowModal + + title:"pair to a PC" + text:"please enter XXXX on your GeForce enabled PC" + standardButtons: Dialog.Ok | Dialog.Cancel + onAccepted: { + console.log("accepted") + } + onRejected: { + console.log("rejected") + } + } + + + Dialog { + id: inputDialog + property string label: "enter the address of your GeForce enabled PC" + property string hint: "example.foo.local" + property alias editText : editTextItem + + standardButtons: StandardButton.Ok | StandardButton.Cancel + onVisibleChanged: { + editTextItem.focus = true + editTextItem.selectAll() + } + onAccepted: { + console.log("accepted, with value: " + editText.text) + } + onRejected: { + console.log("rejected") + } + + ColumnLayout { + Text { + id: inputDialogLabel + text: inputDialog.label + } + Rectangle { + implicitWidth: parent.parent.width + height: editTextItem.height + + TextInput { + // TODO: calculate this properly + height: 20 + id: editTextItem + inputMethodHints: Qt.ImhPreferUppercase + text: inputDialog.hint } } }