now with pairing and add-host dialogs

This commit is contained in:
R. Aidan Campbell 2018-07-04 18:48:09 -07:00
parent 485c014490
commit 95eebdbe66

View File

@ -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
}
}
}