magpie/qml/Welcome.qml

71 lines
1.7 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import magpie.API
import "Forms" as Forms
Page {
signal pickServer(address: string)
title: qsTr("Welcome")
Column {
anchors.centerIn: parent
spacing: 10
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)
}
}
}
Row {
id: forms
property bool registering: false
visible: API.state === API.NotAuthenticated
anchors.horizontalCenter: parent.horizontalCenter
topPadding: 10
Forms.Login {
id: login
visible: !forms.registering
onRegister: forms.registering = true
}
Forms.Register {
id: register
visible: forms.registering
onLogin: forms.registering = false
}
}
}
}