Improve welcome page

- Don't use card for welcome message and instead use same layout as
  kwordquiz
- Add separator between login and register button
- Add type annotation in functions
This commit is contained in:
Carl Schwan
2023-11-11 12:18:27 +01:00
committed by Tobias Fella
parent 197ff984fd
commit 624578ec77
2 changed files with 23 additions and 19 deletions

View File

@@ -21,6 +21,8 @@ LoginStep {
onClicked: root.processed("qrc:/org/kde/neochat/qml/Login.qml") onClicked: root.processed("qrc:/org/kde/neochat/qml/Login.qml")
} }
FormCard.FormDelegateSeparator {}
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Register") text: i18nc("@action:button", "Register")
onClicked: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml") onClicked: root.processed("qrc:/org/kde/neochat/qml/Homeserver.qml")

View File

@@ -32,23 +32,20 @@ FormCard.FormCardPage {
} }
} }
FormCard.FormCard { Kirigami.Icon {
id: contentCard source: "org.kde.neochat"
Layout.alignment: Qt.AlignHCenter
implicitWidth: Math.round(Kirigami.Units.iconSizes.huge * 1.5)
implicitHeight: Math.round(Kirigami.Units.iconSizes.huge * 1.5)
}
FormCard.AbstractFormDelegate { Kirigami.Heading {
contentItem: Kirigami.Icon { id: welcomeMessage
source: "org.kde.neochat"
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 16
}
background: Item {}
onActiveFocusChanged: if (activeFocus) module.item.forceActiveFocus()
}
FormCard.FormTextDelegate { text: i18n("Welcome to NeoChat")
id: welcomeMessage
text: i18n("Welcome to NeoChat") Layout.alignment: Qt.AlignHCenter
} Layout.topMargin: Kirigami.Units.largeSpacing
} }
FormCard.FormHeader { FormCard.FormHeader {
@@ -83,6 +80,7 @@ FormCard.FormCardPage {
FormCard.FormHeader { FormCard.FormHeader {
title: i18nc("@title", "Log in or Create a New Account") title: i18nc("@title", "Log in or Create a New Account")
} }
FormCard.FormCard { FormCard.FormCard {
Loader { Loader {
id: module id: module
@@ -93,7 +91,7 @@ FormCard.FormCardPage {
id: stepConnections id: stepConnections
target: currentStep target: currentStep
function onProcessed(nextUrl) { function onProcessed(nextUrl: string): void {
module.source = nextUrl; module.source = nextUrl;
headerMessage.text = ""; headerMessage.text = "";
headerMessage.visible = false; headerMessage.visible = false;
@@ -103,19 +101,23 @@ FormCard.FormCardPage {
continueButton.forceActiveFocus() continueButton.forceActiveFocus()
} }
} }
function onShowMessage(message) {
function onShowMessage(message: string): void {
headerMessage.text = message; headerMessage.text = message;
headerMessage.visible = true; headerMessage.visible = true;
headerMessage.type = Kirigami.MessageType.Information; headerMessage.type = Kirigami.MessageType.Information;
} }
function onClearError() {
function onClearError(): void {
headerMessage.text = ""; headerMessage.text = "";
headerMessage.visible = false; headerMessage.visible = false;
} }
function onCloseDialog() {
function onCloseDialog(): void {
root.closeDialog(); root.closeDialog();
} }
} }
Connections { Connections {
target: Registration target: Registration
function onNextStepChanged() { function onNextStepChanged() {