1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Improve profile/account creation and deletion experience

The windows should properly close when necessary, and the setup can no
longer loop itself because it didn't re-read the game version. You can
now select another profile's game installation when setting up a new
profile.
This commit is contained in:
Joshua Goins 2023-09-20 16:44:43 -04:00
parent b34b74bf89
commit 1cbfc17c1a
10 changed files with 62 additions and 14 deletions

View file

@ -128,7 +128,7 @@ public:
void setAccount(Account *account);
void readGameData();
void readGameVersion();
Q_INVOKABLE void readGameVersion();
void readWineInfo();
[[nodiscard]] QString expansionVersionText() const;

View file

@ -3,6 +3,7 @@
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Window
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
@ -236,7 +237,7 @@ FormCard.FormCardPage {
onAccepted: {
LauncherCore.accountManager.deleteAccount(page.account);
applicationWindow().pageStack.layers.pop();
page.Window.window.pageStack.layers.pop();
}
}

View file

@ -3,6 +3,7 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
@ -11,6 +12,8 @@ import org.kde.kirigamiaddons.components as Components
import zone.xiv.astra
FormCard.FormCardPage {
id: root
title: i18nc("@title:window", "Accounts")
FormCard.FormCard {
@ -31,7 +34,7 @@ FormCard.FormCardPage {
leadingPadding: Kirigami.Units.largeSpacing * 2
onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AccountSettings"), {
onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AccountSettings"), {
account: account
})
}
@ -46,7 +49,7 @@ FormCard.FormCardPage {
text: i18n("Add Square Enix Account")
icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix"))
onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix"))
}
FormCard.FormDelegateSeparator {
@ -59,7 +62,7 @@ FormCard.FormCardPage {
text: i18n("Add Sapphire Account")
icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire"))
onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire"))
}
}
}

View file

@ -4,6 +4,7 @@
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import QtQuick.Window
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
@ -334,7 +335,7 @@ FormCard.FormCardPage {
onAccepted: {
LauncherCore.profileManager.deleteProfile(page.profile);
applicationWindow().pageStack.layers.pop();
page.Window.window.pageStack.layers.pop();
}
}

View file

@ -3,6 +3,7 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
@ -10,6 +11,8 @@ import org.kde.kirigamiaddons.formcard as FormCard
import zone.xiv.astra
FormCard.FormCardPage {
id: page
title: i18nc("@title:window", "Profiles")
FormCard.FormCard {
@ -23,7 +26,7 @@ FormCard.FormCardPage {
required property var profile
text: profile.name
onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), {
onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), {
profile: profile
})
}
@ -39,8 +42,8 @@ FormCard.FormCardPage {
text: i18n("Add Profile")
icon.name: "list-add"
onClicked: {
applicationWindow().currentSetupProfile = LauncherCore.profileManager.addProfile()
applicationWindow().checkSetup()
page.Window.window.close();
LauncherCore.currentProfile = LauncherCore.profileManager.addProfile();
}
}
}

View file

@ -29,7 +29,7 @@ Kirigami.Page {
}
MobileForm.FormTextDelegate {
text: i18n("Select an account below to use.")
text: i18n("Select an account below to use for profile '%1'.", LauncherCore.currentProfile.name)
}
Repeater {

View file

@ -3,6 +3,7 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.labs.mobileform as MobileForm
@ -56,7 +57,7 @@ Kirigami.Page {
page.profile.account = account
applicationWindow().checkSetup()
} else {
applicationWindow().pageStack.layers.pop()
page.Window.window.pageStack.layers.pop()
}
}
}

View file

@ -3,6 +3,7 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.labs.mobileform as MobileForm
@ -68,7 +69,7 @@ Kirigami.Page {
page.profile.account = account
applicationWindow().checkSetup()
} else {
applicationWindow().pageStack.layers.pop()
page.Window.window.pageStack.layers.pop()
}
}
}

View file

@ -37,7 +37,8 @@ Kirigami.Page {
target: gameInstaller
function onInstallFinished() {
applicationWindow().checkSetup()
LauncherCore.currentProfile.readGameVersion();
applicationWindow().checkSetup();
}
function onError(message) {

View file

@ -29,12 +29,49 @@ Kirigami.Page {
}
MobileForm.FormTextDelegate {
text: i18n("The game must be installed to continue. Please select a setup option below.")
text: i18n("The profile '%1' must be set up before first.", LauncherCore.currentProfile.name)
}
MobileForm.FormTextDelegate {
text: i18n("A copy of the game must be located or installed.")
description: i18n("A valid game account will be required at the end of installation.")
}
}
}
MobileForm.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Existing Installations")
}
MobileForm.FormTextDelegate {
text: i18n("Select an existing installation from another profile below.")
}
Repeater {
model: LauncherCore.profileManager
MobileForm.FormButtonDelegate {
required property var profile
text: profile.name
description: profile.gamePath
onClicked: {
LauncherCore.currentProfile.gamePath = profile.gamePath;
LauncherCore.currentProfile.readGameVersion();
applicationWindow().checkSetup();
}
}
}
}
}
MobileForm.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true