mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 20:27:45 +00:00
Move various things around on login page, fix initial focus
This commit is contained in:
parent
2a9dd52224
commit
8bf02bcd1d
2 changed files with 68 additions and 50 deletions
|
@ -40,19 +40,19 @@ QQC2.Control {
|
||||||
|
|
||||||
readonly property bool isLoginValid: {
|
readonly property bool isLoginValid: {
|
||||||
if (!LauncherCore.currentProfile.account) {
|
if (!LauncherCore.currentProfile.account) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usernameField.text.length === 0) {
|
if (usernameField.text.length === 0) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LauncherCore.currentProfile.account.rememberPassword && passwordField.text.length === 0) {
|
if (!LauncherCore.currentProfile.account.rememberPassword && passwordField.text.length === 0) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LauncherCore.currentProfile.account.useOTP && !LauncherCore.currentProfile.account.rememberOTP && otpField.text.length === 0) {
|
if (LauncherCore.currentProfile.account.useOTP && !LauncherCore.currentProfile.account.rememberOTP && otpField.text.length === 0) {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LauncherCore.currentProfile.loggedIn) {
|
if (LauncherCore.currentProfile.loggedIn) {
|
||||||
|
@ -63,9 +63,9 @@ QQC2.Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFields() {
|
function updateFields() {
|
||||||
usernameField.text = LauncherCore.currentProfile.account.name
|
usernameField.text = LauncherCore.currentProfile.account.name;
|
||||||
passwordField.text = LauncherCore.currentProfile.account.rememberPassword ? LauncherCore.currentProfile.account.getPassword() : ""
|
passwordField.text = LauncherCore.currentProfile.account.rememberPassword ? LauncherCore.currentProfile.account.getPassword() : "";
|
||||||
otpField.text = ""
|
otpField.text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -80,7 +80,19 @@ QQC2.Control {
|
||||||
target: LauncherCore.currentProfile
|
target: LauncherCore.currentProfile
|
||||||
|
|
||||||
function onAccountChanged() {
|
function onAccountChanged() {
|
||||||
updateFields()
|
updateFields();
|
||||||
|
|
||||||
|
if (!LauncherCore.currentProfile.account.rememberPassword) {
|
||||||
|
passwordField.forceActiveFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LauncherCore.currentProfile.account.useOTP) {
|
||||||
|
otpField.forceActiveFocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loginButton.forceActiveFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +135,12 @@ QQC2.Control {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
|
id: currentAccountDelegate
|
||||||
|
|
||||||
text: i18n("Current Account")
|
text: i18n("Current Account")
|
||||||
description: LauncherCore.currentProfile.account.name
|
description: LauncherCore.currentProfile.account.name
|
||||||
|
|
||||||
leading: Components.Avatar
|
leading: Components.Avatar {
|
||||||
{
|
|
||||||
source: LauncherCore.currentProfile.account.avatarUrl
|
source: LauncherCore.currentProfile.account.avatarUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,6 +173,8 @@ QQC2.Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormDelegateSeparator {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: currentAccountDelegate
|
||||||
|
below: usernameField
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormTextFieldDelegate {
|
FormCard.FormTextFieldDelegate {
|
||||||
|
@ -170,6 +185,8 @@ QQC2.Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormDelegateSeparator {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: usernameField
|
||||||
|
below: passwordField
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormTextFieldDelegate {
|
FormCard.FormTextFieldDelegate {
|
||||||
|
@ -189,16 +206,25 @@ QQC2.Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormDelegateSeparator {
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: passwordField
|
||||||
|
below: otpField
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormTextFieldDelegate {
|
FormCard.FormTextFieldDelegate {
|
||||||
id: otpField
|
id: otpField
|
||||||
label: i18n("One-time Password")
|
label: i18n("One-time Password")
|
||||||
visible: LauncherCore.currentProfile.account.useOTP
|
visible: LauncherCore.currentProfile.account.useOTP
|
||||||
onAccepted: loginButton.clicked()
|
onAccepted: {
|
||||||
|
if (page.isLoginValid) {
|
||||||
|
loginButton.clicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormDelegateSeparator {}
|
FormCard.FormDelegateSeparator {
|
||||||
|
above: otpField
|
||||||
|
below: loginButton
|
||||||
|
}
|
||||||
|
|
||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
id: loginButton
|
id: loginButton
|
||||||
|
@ -214,7 +240,8 @@ QQC2.Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormDelegateSeparator {
|
FormCard.FormDelegateSeparator {
|
||||||
visible: forgotPasswordButton.visible
|
above: loginButton
|
||||||
|
below: forgotPasswordButton
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
|
@ -226,7 +253,28 @@ QQC2.Control {
|
||||||
onClicked: applicationWindow().openUrl('https://secure.square-enix.com/account/app/svc/reminder')
|
onClicked: applicationWindow().openUrl('https://secure.square-enix.com/account/app/svc/reminder')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: passwordField.forceActiveFocus()
|
FormCard.FormCard {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
FormCard.FormButtonDelegate {
|
||||||
|
id: serverStatusButton
|
||||||
|
|
||||||
|
text: i18n("Server Status")
|
||||||
|
icon.name: "cloudstatus"
|
||||||
|
onClicked: applicationWindow().openUrl('https://na.finalfantasyxiv.com/lodestone/worldstatus/')
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormDelegateSeparator {
|
||||||
|
}
|
||||||
|
|
||||||
|
FormCard.FormButtonDelegate {
|
||||||
|
id: settingsButton
|
||||||
|
|
||||||
|
text: i18n("Settings")
|
||||||
|
icon.name: "configure"
|
||||||
|
onClicked: applicationWindow().pushDialogLayer(Qt.createComponent("zone.xiv.astra", "SettingsPage"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,44 +12,14 @@ import zone.xiv.astra
|
||||||
Kirigami.Page {
|
Kirigami.Page {
|
||||||
id: page
|
id: page
|
||||||
|
|
||||||
padding: 0
|
|
||||||
|
|
||||||
title: i18n("Home")
|
title: i18n("Home")
|
||||||
|
|
||||||
actions: [
|
globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Tools")
|
|
||||||
icon.name: "tools-symbolic"
|
|
||||||
|
|
||||||
Kirigami.Action {
|
topPadding: Kirigami.Units.largeSpacing
|
||||||
text: i18n("Open Official Launcher")
|
leftPadding: Kirigami.Units.largeSpacing
|
||||||
icon.name: "application-x-executable"
|
rightPadding: Kirigami.Units.largeSpacing
|
||||||
onTriggered: LauncherCore.openOfficialLauncher(LauncherCore.currentProfile)
|
bottomPadding: 0
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Open System Info")
|
|
||||||
icon.name: "application-x-executable"
|
|
||||||
onTriggered: LauncherCore.openSystemInfo(LauncherCore.currentProfile)
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Open Config Backup")
|
|
||||||
icon.name: "application-x-executable"
|
|
||||||
onTriggered: LauncherCore.openConfigBackup(LauncherCore.currentProfile)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Server Status")
|
|
||||||
icon.name: "cloudstatus"
|
|
||||||
onTriggered: applicationWindow().openUrl('https://na.finalfantasyxiv.com/lodestone/worldstatus/')
|
|
||||||
},
|
|
||||||
Kirigami.Action {
|
|
||||||
text: i18n("Settings")
|
|
||||||
icon.name: "configure"
|
|
||||||
onTriggered: applicationWindow().pushDialogLayer(Qt.createComponent("zone.xiv.astra", "SettingsPage"))
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
Loading…
Add table
Reference in a new issue