WelcomePage: Redesign to center the contents, other misc improvements

We now remove the header from the page, and replace it with a separator
(it still lives with an InlineMessage for error handling.) The contents
of this page are now centered, and the maximum width of the buttons are
reduced.

Along with that are two smaller misc improvements. One is that the
duplicate separator underneath "Register" is now gone. Another is that
the full settings page may now be opened from here, allowing users to
access more than proxy settings.
This commit is contained in:
Joshua Goins
2024-09-01 08:54:37 -04:00
parent 05a2f03c18
commit f574c12adc

View File

@@ -11,7 +11,7 @@ import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat import org.kde.neochat
import org.kde.neochat.settings import org.kde.neochat.settings
FormCard.FormCardPage { Kirigami.Page {
id: root id: root
property bool showExisting: false property bool showExisting: false
@@ -23,15 +23,42 @@ FormCard.FormCardPage {
signal connectionChosen signal connectionChosen
title: i18n("Welcome") title: i18n("Welcome")
globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None
header: QQC2.Control { header: QQC2.Control {
contentItem: Kirigami.InlineMessage { topPadding: 0
bottomPadding: 0
leftPadding: 0
rightPadding: 0
contentItem: ColumnLayout {
spacing: 0
Kirigami.Separator {
Layout.fillWidth: true
}
Kirigami.InlineMessage {
id: headerMessage id: headerMessage
type: Kirigami.MessageType.Error type: Kirigami.MessageType.Error
showCloseButton: true showCloseButton: true
visible: false visible: false
Layout.fillWidth: true
Layout.margins: Kirigami.Units.largeSpacing
} }
} }
}
contentItem: Item {
ColumnLayout {
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
spacing: 0
Kirigami.Icon { Kirigami.Icon {
source: "org.kde.neochat" source: "org.kde.neochat"
@@ -43,7 +70,7 @@ FormCard.FormCardPage {
Kirigami.Heading { Kirigami.Heading {
id: welcomeMessage id: welcomeMessage
text: i18n("Welcome to NeoChat") text: i18n("NeoChat")
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: Kirigami.Units.largeSpacing Layout.topMargin: Kirigami.Units.largeSpacing
@@ -53,10 +80,12 @@ FormCard.FormCardPage {
id: existingAccountsHeader id: existingAccountsHeader
title: i18nc("@title", "Continue with an existing account") title: i18nc("@title", "Continue with an existing account")
visible: (loadedAccounts.count > 0 || loadingAccounts.count > 0) && root._showExisting visible: (loadedAccounts.count > 0 || loadingAccounts.count > 0) && root._showExisting
maximumWidth: Kirigami.Units.gridUnit * 20
} }
FormCard.FormCard { FormCard.FormCard {
visible: existingAccountsHeader.visible visible: existingAccountsHeader.visible
maximumWidth: Kirigami.Units.gridUnit * 20
Repeater { Repeater {
id: loadedAccounts id: loadedAccounts
model: AccountRegistry model: AccountRegistry
@@ -122,9 +151,11 @@ 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")
maximumWidth: Kirigami.Units.gridUnit * 20
} }
FormCard.FormCard { FormCard.FormCard {
maximumWidth: Kirigami.Units.gridUnit * 20
Loader { Loader {
id: module id: module
Layout.fillWidth: true Layout.fillWidth: true
@@ -164,6 +195,7 @@ FormCard.FormCardPage {
Connections { Connections {
target: Registration target: Registration
function onNextStepChanged() { function onNextStepChanged() {
if (Registration.nextStep === "m.login.recaptcha") { if (Registration.nextStep === "m.login.recaptcha") {
stepConnections.onProcessed("Captcha"); stepConnections.onProcessed("Captcha");
@@ -181,6 +213,7 @@ FormCard.FormCardPage {
} }
Connections { Connections {
target: LoginHelper target: LoginHelper
function onErrorOccured(message) { function onErrorOccured(message) {
headerMessage.text = message; headerMessage.text = message;
headerMessage.visible = message.length > 0; headerMessage.visible = message.length > 0;
@@ -191,6 +224,7 @@ FormCard.FormCardPage {
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {
below: continueButton below: continueButton
visible: root.currentStep.nextAction
} }
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
@@ -212,13 +246,14 @@ FormCard.FormCardPage {
} }
FormCard.FormCard { FormCard.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing Layout.topMargin: Kirigami.Units.largeSpacing * 2
maximumWidth: Kirigami.Units.gridUnit * 20
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Open proxy settings") text: i18nc("@action:button", "Settings")
icon.name: "settings-configure" icon.name: "settings-configure"
onClicked: pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat.settings", "NetworkProxyPage"), {}, { onClicked: NeoChatSettingsView.open()
title: i18nc("@title:window", "Proxy Settings") }
}); }
} }
} }