some more tinkering with qml
This commit is contained in:
parent
ed1ed9fb49
commit
89aa830bfa
@ -6,7 +6,7 @@ import magpie.API
|
|||||||
Column {
|
Column {
|
||||||
signal register()
|
signal register()
|
||||||
|
|
||||||
spacing: 10
|
spacing: 5
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -6,7 +6,7 @@ import magpie.API
|
|||||||
Column {
|
Column {
|
||||||
signal login()
|
signal login()
|
||||||
|
|
||||||
spacing: 10
|
spacing: 5
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -6,13 +6,15 @@ import magpie.API
|
|||||||
import "Forms" as Forms
|
import "Forms" as Forms
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
|
id: page
|
||||||
signal pickServer(address: string)
|
signal pickServer(address: string)
|
||||||
|
|
||||||
title: qsTr("Welcome")
|
title: qsTr("Welcome")
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
id: column
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 10
|
spacing: 5
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
@ -46,24 +48,31 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Item {
|
||||||
id: forms
|
|
||||||
property bool registering: false
|
|
||||||
|
|
||||||
visible: API.state === API.NotAuthenticated
|
visible: API.state === API.NotAuthenticated
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
topPadding: 10
|
|
||||||
|
|
||||||
|
width: page.width
|
||||||
|
height: stack.currentItem ? stack.currentItem.implicitHeight: 0
|
||||||
|
|
||||||
|
StackView {
|
||||||
|
id: stack
|
||||||
|
initialItem: loginForm
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: 20
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: loginForm
|
||||||
Forms.Login {
|
Forms.Login {
|
||||||
id: login
|
onRegister: stack.replace(registerForm)
|
||||||
visible: !forms.registering
|
}
|
||||||
onRegister: forms.registering = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: registerForm
|
||||||
Forms.Register {
|
Forms.Register {
|
||||||
id: register
|
onLogin: stack.replace(loginForm, StackView.PopTransition)
|
||||||
visible: forms.registering
|
}
|
||||||
onLogin: forms.registering = false
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
37
qml/main.qml
37
qml/main.qml
@ -10,7 +10,6 @@ ApplicationWindow {
|
|||||||
property int counter: 0
|
property int counter: 0
|
||||||
property bool pickingServer: false
|
property bool pickingServer: false
|
||||||
|
|
||||||
id: window
|
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
visible: true
|
visible: true
|
||||||
@ -25,7 +24,23 @@ ApplicationWindow {
|
|||||||
id: stack
|
id: stack
|
||||||
initialItem: welcome
|
initialItem: welcome
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
StackView.onRemoved: pickingServer = false
|
|
||||||
|
Component {
|
||||||
|
id: welcome
|
||||||
|
Welcome {
|
||||||
|
onPickServer: stack.push(serverPick)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: serverPick
|
||||||
|
ServerPick {
|
||||||
|
address: API.address
|
||||||
|
onBack: stack.pop()
|
||||||
|
StackView.onActivating: pickingServer = true;
|
||||||
|
StackView.onDeactivating: pickingServer = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@ -35,22 +50,4 @@ ApplicationWindow {
|
|||||||
stack.pop()
|
stack.pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Welcome {
|
|
||||||
id: welcome
|
|
||||||
onPickServer: function (address) {
|
|
||||||
const pick = pickComponent.createObject(stack);
|
|
||||||
pick.address = address;
|
|
||||||
stack.push(pick);
|
|
||||||
pickingServer = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: pickComponent
|
|
||||||
ServerPick {
|
|
||||||
StackView.onRemoved: destroy()
|
|
||||||
onBack: stack.pop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user