diff --git a/launcher/include/profile.h b/launcher/include/profile.h index 46d72c0..3382d2a 100644 --- a/launcher/include/profile.h +++ b/launcher/include/profile.h @@ -128,7 +128,7 @@ public: void setAccount(Account *account); void readGameData(); - void readGameVersion(); + Q_INVOKABLE void readGameVersion(); void readWineInfo(); [[nodiscard]] QString expansionVersionText() const; diff --git a/launcher/ui/Settings/AccountSettings.qml b/launcher/ui/Settings/AccountSettings.qml index 470e1a0..b153924 100644 --- a/launcher/ui/Settings/AccountSettings.qml +++ b/launcher/ui/Settings/AccountSettings.qml @@ -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(); } } diff --git a/launcher/ui/Settings/AccountsPage.qml b/launcher/ui/Settings/AccountsPage.qml index 2ac401c..48c8007 100644 --- a/launcher/ui/Settings/AccountsPage.qml +++ b/launcher/ui/Settings/AccountsPage.qml @@ -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")) } } } \ No newline at end of file diff --git a/launcher/ui/Settings/ProfileSettings.qml b/launcher/ui/Settings/ProfileSettings.qml index 570c2ff..4133d74 100644 --- a/launcher/ui/Settings/ProfileSettings.qml +++ b/launcher/ui/Settings/ProfileSettings.qml @@ -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(); } } diff --git a/launcher/ui/Settings/ProfilesPage.qml b/launcher/ui/Settings/ProfilesPage.qml index 27346bd..5f67e89 100644 --- a/launcher/ui/Settings/ProfilesPage.qml +++ b/launcher/ui/Settings/ProfilesPage.qml @@ -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(); } } } diff --git a/launcher/ui/Setup/AccountSetup.qml b/launcher/ui/Setup/AccountSetup.qml index 6829cec..3840484 100644 --- a/launcher/ui/Setup/AccountSetup.qml +++ b/launcher/ui/Setup/AccountSetup.qml @@ -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 { diff --git a/launcher/ui/Setup/AddSapphire.qml b/launcher/ui/Setup/AddSapphire.qml index 798f0bb..182e4e6 100644 --- a/launcher/ui/Setup/AddSapphire.qml +++ b/launcher/ui/Setup/AddSapphire.qml @@ -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() } } } diff --git a/launcher/ui/Setup/AddSquareEnix.qml b/launcher/ui/Setup/AddSquareEnix.qml index 47a3411..38c199d 100644 --- a/launcher/ui/Setup/AddSquareEnix.qml +++ b/launcher/ui/Setup/AddSquareEnix.qml @@ -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() } } } diff --git a/launcher/ui/Setup/InstallProgress.qml b/launcher/ui/Setup/InstallProgress.qml index 49aed3f..ae6e8c6 100644 --- a/launcher/ui/Setup/InstallProgress.qml +++ b/launcher/ui/Setup/InstallProgress.qml @@ -37,7 +37,8 @@ Kirigami.Page { target: gameInstaller function onInstallFinished() { - applicationWindow().checkSetup() + LauncherCore.currentProfile.readGameVersion(); + applicationWindow().checkSetup(); } function onError(message) { diff --git a/launcher/ui/Setup/SetupPage.qml b/launcher/ui/Setup/SetupPage.qml index d922386..f06f936 100644 --- a/launcher/ui/Setup/SetupPage.qml +++ b/launcher/ui/Setup/SetupPage.qml @@ -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