magpie/qml/Welcome.qml

80 lines
1.9 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import magpie.API
import "Forms" as Forms
Page {
id: page
signal pickServer(address: string)
title: qsTr("Welcome")
Column {
id: column
anchors.centerIn: parent
spacing: 5
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Welcome to Magpie!")
font {
pixelSize: 22
bold: true
}
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 5
Label {
horizontalAlignment: Label.AlignRight
text: qsTr("Current server:")
}
Label {
horizontalAlignment: Label.AlignLeft
text: API.state === API.NoServer ? qsTr("choose") : API.address
font {
italic: true
underline: true
}
MouseArea {
anchors.fill: parent
onClicked: pickServer(API.address)
}
}
}
Item {
visible: API.state === API.NotAuthenticated
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 {
onRegister: stack.replace(registerForm)
}
}
Component {
id: registerForm
Forms.Register {
onLogin: stack.replace(loginForm, StackView.PopTransition)
}
}
}
}
}
}