More UI work including hooking up PcView -> AppView transition

This commit is contained in:
Cameron Gutman 2018-07-05 20:37:51 -07:00
parent f83c13ad85
commit ebf27cdcaf
2 changed files with 38 additions and 34 deletions

View File

@ -81,20 +81,31 @@ GridView {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
parent.GridView.view.currentIndex = index
if (model.addPc) { if (model.addPc) {
// TODO: read the output of the dialog addPcDialog.open()
inputDialog.on }
inputDialog.open() else if (model.online) {
if (model.paired) {
} else if(!model.paired && !model.busy) { // go to game view
var component = Qt.createComponent("AppView.qml")
var appView = component.createObject(stackView)
appView.computerIndex = index
stackView.push(appView)
}
else {
if (!model.busy) {
// TODO: generate pin // TODO: generate pin
pairDialog.text = pairDialog.text.replace("XXXX", "1234") pairDialog.text = pairDialog.text.replace("XXXX", "1234")
// TODO: initiate pairing request // TODO: initiate pairing request
pairDialog.open() pairDialog.open()
} else if (model.online) { }
// go to game view else {
// TODO: error dialog
}
}
}
else {
// TODO: Wake on LAN and delete PC options
} }
} }
} }
@ -105,22 +116,17 @@ GridView {
// don't allow edits to the rest of the window while open // don't allow edits to the rest of the window while open
modality:Qt.WindowModal modality:Qt.WindowModal
title:"pair to a PC" text:"Please enter XXXX on your GameStream PC. This dialog will close when pairing is completed."
text:"please enter XXXX on your GeForce enabled PC" standardButtons: Dialog.Cancel
standardButtons: Dialog.Ok | Dialog.Cancel
onAccepted: {
console.log("accepted")
}
onRejected: { onRejected: {
console.log("rejected") // FIXME: We should interrupt pairing here
} }
} }
Dialog { Dialog {
id: inputDialog id: addPcDialog
property string label: "enter the address of your GeForce enabled PC" property string label: "Enter the IP address of your GameStream PC"
property string hint: "example.foo.local" property string hint: "192.168.1.100"
property alias editText : editTextItem property alias editText : editTextItem
standardButtons: StandardButton.Ok | StandardButton.Cancel standardButtons: StandardButton.Ok | StandardButton.Cancel
@ -131,25 +137,20 @@ GridView {
onAccepted: { onAccepted: {
console.log("accepted, with value: " + editText.text) console.log("accepted, with value: " + editText.text)
} }
onRejected: {
console.log("rejected")
}
ColumnLayout { ColumnLayout {
Text { Text {
id: inputDialogLabel id: addPcDialogLabel
text: inputDialog.label text: addPcDialog.label
} }
Rectangle { Rectangle {
implicitWidth: parent.parent.width implicitWidth: parent.parent.width
height: editTextItem.height height: editTextItem.height
TextInput { TextInput {
// TODO: calculate this properly
height: 20
id: editTextItem id: editTextItem
inputMethodHints: Qt.ImhPreferUppercase inputMethodHints: Qt.ImhPreferUppercase
text: inputDialog.hint text: addPcDialog.hint
} }
} }
} }

View File

@ -9,6 +9,9 @@ ApplicationWindow {
title: qsTr("Stack") title: qsTr("Stack")
color: "#333333" color: "#333333"
PcView { StackView {
id: stackView
initialItem: "PcView.qml"
anchors.fill: parent
} }
} }