diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 83261ea..647bc0f 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -153,9 +153,11 @@ qt_target_qml_sources(astra_static ui/Setup/AccountSetup.qml ui/Setup/AddSquareEnix.qml ui/Setup/BenchmarkInstallProgress.qml - ui/Setup/ExistingSetup.qml ui/Setup/InstallProgress.qml ui/Setup/SetupPage.qml + ui/Setup/InstallBenchmark.qml + ui/Setup/InstallGame.qml + ui/Setup/UseExistingInstall.qml ui/Main.qml ) diff --git a/launcher/ui/Setup/InstallBenchmark.qml b/launcher/ui/Setup/InstallBenchmark.qml new file mode 100644 index 0000000..2c17d2e --- /dev/null +++ b/launcher/ui/Setup/InstallBenchmark.qml @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2023 Joshua Goins +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtCore +import QtQuick +import QtQuick.Dialogs +import QtQuick.Layouts + +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.formcard as FormCard + +import zone.xiv.astra + +FormCard.FormCardPage { + id: page + + property var profile + + title: i18n("Install Benchmark") + + data: FolderDialog { + id: installFolderDialog + + onAccepted: page.profile.config.gamePath = decodeURIComponent(selectedFolder.toString().replace("file://", "")) + } + + FormCard.FormCard { + Layout.fillWidth: true + Layout.topMargin: Kirigami.Units.largeSpacing + + FormCard.FormButtonDelegate { + id: selectInstallFolder + + icon.name: "document-open-folder" + text: i18n("Select Install Folder") + description: profile.config.gamePath + + onClicked: installFolderDialog.open() + } + } + + FormCard.FormCard { + Layout.topMargin: Kirigami.Units.largeSpacing + Layout.fillWidth: true + + FormCard.FormButtonDelegate { + id: downloadBenchmark + + text: i18n("Download & Install Benchmark") + description: i18n("Download the benchmark from the official website.") + icon.name: "cloud-download" + onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BenchmarkInstallProgress"), { + benchmarkInstaller: LauncherCore.createBenchmarkInstaller(page.profile) + }) + } + + FormCard.FormDelegateSeparator { + above: downloadBenchmark + below: selectBenchmark + } + + FormCard.FormButtonDelegate { + id: selectBenchmark + + text: i18n("Select Existing Benchmark…") + description: i18n("Use this if you're offline or are unable to access the server.") + icon.name: "edit-find" + + FileDialog { + id: benchmarkDialog + + currentFolder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] + nameFilters: [i18n("Benchmark zip archive (*.zip)")] + + onAccepted: { + const url = decodeURIComponent(selectedFile.toString().replace("file://", "")); + page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BenchmarkInstallProgress"), { + benchmarkInstaller: LauncherCore.createBenchmarkInstallerFromExisting(page.profile, url) + }); + } + } + + onClicked: benchmarkDialog.open() + } + } +} diff --git a/launcher/ui/Setup/InstallGame.qml b/launcher/ui/Setup/InstallGame.qml new file mode 100644 index 0000000..7c454ad --- /dev/null +++ b/launcher/ui/Setup/InstallGame.qml @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: 2023 Joshua Goins +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtCore +import QtQuick +import QtQuick.Dialogs +import QtQuick.Layouts + +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.formcard as FormCard + +import zone.xiv.astra + +FormCard.FormCardPage { + id: page + + property var profile + + title: i18n("Install Game") + + data: FolderDialog { + id: installFolderDialog + + onAccepted: page.profile.config.gamePath = decodeURIComponent(selectedFolder.toString().replace("file://", "")) + } + + FormCard.FormCard { + Layout.fillWidth: true + Layout.topMargin: Kirigami.Units.largeSpacing + + FormCard.FormButtonDelegate { + id: selectInstallFolder + + icon.name: "document-open-folder" + text: i18n("Select Install Folder") + description: profile.config.gamePath + + onClicked: installFolderDialog.open() + } + } + + FormCard.FormCard { + Layout.topMargin: Kirigami.Units.largeSpacing + Layout.fillWidth: true + + FormCard.FormButtonDelegate { + id: downloadDelegate + + text: i18n("Download Installer") + description: i18n("Download the installer from the official website.") + icon.name: "cloud-download" + onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "InstallProgress"), { + gameInstaller: LauncherCore.createInstaller(page.profile) + }) + } + + FormCard.FormDelegateSeparator { + above: downloadDelegate + below: selectInstallDelegate + } + + FormCard.FormButtonDelegate { + id: selectInstallDelegate + + text: i18n("Select Existing Installer…") + description: i18n("Use this if you're offline or are unable to access the server.") + icon.name: "edit-find" + + FileDialog { + id: dialog + + currentFolder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] + nameFilters: [i18n("Windows executable (*.exe)")] + + onAccepted: { + const url = decodeURIComponent(selectedFile.toString().replace("file://", "")); + page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "InstallProgress"), { + gameInstaller: LauncherCore.createInstallerFromExisting(page.profile, url) + }); + } + } + + onClicked: dialog.open() + } + } +} diff --git a/launcher/ui/Setup/SetupPage.qml b/launcher/ui/Setup/SetupPage.qml index cfa4db8..96aa375 100644 --- a/launcher/ui/Setup/SetupPage.qml +++ b/launcher/ui/Setup/SetupPage.qml @@ -18,6 +18,11 @@ FormCard.FormCardPage { readonly property bool isInitialSetup: !LauncherCore.profileManager.hasAnyExistingInstallations() title: isInitialSetup ? i18n("Initial Setup") : i18n("Profile Setup") + globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None + + header: Kirigami.Separator { + width: root.width + } data: FolderDialog { id: installFolderDialog @@ -45,37 +50,19 @@ FormCard.FormCardPage { text: { if (page.isInitialSetup) { - return i18n("You must have a legitimate installation of FFXIV to continue."); + return i18n("You have to setup the game to continue."); } else { - return i18n("Select a game installation for '%1'.", page.profile.config.name); + return i18n("You need to select a game installation for '%1'.", page.profile.config.name); } } } - - FormCard.FormDelegateSeparator { - above: helpText - below: selectInstallFolder - } - - FormCard.FormButtonDelegate { - id: selectInstallFolder - - icon.name: "document-open-folder" - text: i18n("Select Install Folder") - description: profile.config.gamePath - - onClicked: installFolderDialog.open() - } } - FormCard.FormHeader { - title: i18n("Existing Installation") - visible: LauncherCore.profileManager.hasAnyExistingInstallations() - } FormCard.FormCard { visible: LauncherCore.profileManager.hasAnyExistingInstallations() + Layout.topMargin: Kirigami.Units.largeSpacing Layout.fillWidth: true FormCard.FormTextDelegate { @@ -104,118 +91,67 @@ FormCard.FormCardPage { } } } + } + + FormCard.FormCard { + Layout.topMargin: Kirigami.Units.largeSpacing + + FormCard.FormButtonDelegate { + id: installGameDelegate + + text: i18n("Install Game") + description: i18n("This installation will be managed by Astra.") + icon.name: "cloud-download" + onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "InstallGame"), { + profile: page.profile + }) + } FormCard.FormDelegateSeparator { - below: importDelegate + above: installGameDelegate + below: installBenchmarkDelegate } FormCard.FormButtonDelegate { - id: importDelegate + id: installBenchmarkDelegate - text: i18n("Import Existing Installation…") - description: i18n("Select an existing installation on disk or import from another launcher.") + text: i18n("Install Benchmark") + description: i18n("This installation will be managed by Astra.") + icon.name: "cloud-download" + onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "InstallBenchmark"), { + profile: page.profile + }) + } + + FormCard.FormDelegateSeparator { + above: installBenchmarkDelegate + below: useExistingDelegate + } + + FormCard.FormButtonDelegate { + id: useExistingDelegate + + text: i18n("Select an Existing Installation") + description: i18n("Use an existing installation from another launcher.") icon.name: "document-import-symbolic" - onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ExistingSetup"), { + onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "UseExistingInstall"), { profile: page.profile }) } } - FormCard.FormHeader { - title: i18n("Retail Game") - } - FormCard.FormCard { + visible: root.isInitialSetup + Layout.topMargin: Kirigami.Units.largeSpacing - Layout.fillWidth: true FormCard.FormButtonDelegate { - id: downloadDelegate + id: settingsButton - text: i18n("Download & Install Game") - description: i18n("Download the retail installer online from Square Enix.") - icon.name: "cloud-download" - onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "InstallProgress"), { - gameInstaller: LauncherCore.createInstaller(page.profile) - }) - } + text: i18nc("@action:button Application settings", "Settings") + icon.name: "settings-configure" - FormCard.FormDelegateSeparator { - above: downloadDelegate - below: selectInstallDelegate - } - - FormCard.FormButtonDelegate { - id: selectInstallDelegate - - text: i18n("Select Existing Installer…") - description: i18n("Use a previously downloaded installer. Useful if offline or can't otherwise access the official servers.") - icon.name: "edit-find" - - FileDialog { - id: dialog - - currentFolder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] - nameFilters: [i18n("Windows executable (*.exe)")] - - onAccepted: { - const url = decodeURIComponent(selectedFile.toString().replace("file://", "")); - page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "InstallProgress"), { - gameInstaller: LauncherCore.createInstallerFromExisting(page.profile, url) - }); - } - } - - onClicked: dialog.open() - } - } - - FormCard.FormHeader { - title: i18n("Benchmark") - } - - FormCard.FormCard { - Layout.topMargin: Kirigami.Units.largeSpacing - Layout.fillWidth: true - - FormCard.FormButtonDelegate { - id: downloadBenchmark - - text: i18n("Download & Install Benchmark") - description: i18n("Download the official benchmark from Square Enix.") - icon.name: "cloud-download" - onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BenchmarkInstallProgress"), { - benchmarkInstaller: LauncherCore.createBenchmarkInstaller(page.profile) - }) - } - - FormCard.FormDelegateSeparator { - above: downloadBenchmark - below: selectBenchmark - } - - FormCard.FormButtonDelegate { - id: selectBenchmark - - text: i18n("Select Existing Benchmark…") - description: i18n("Use a previously downloaded benchmark. Useful if offline or can't otherwise access the official servers.") - icon.name: "edit-find" - - FileDialog { - id: benchmarkDialog - - currentFolder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0] - nameFilters: [i18n("Benchmark zip archive (*.zip)")] - - onAccepted: { - const url = decodeURIComponent(selectedFile.toString().replace("file://", "")); - page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BenchmarkInstallProgress"), { - benchmarkInstaller: LauncherCore.createBenchmarkInstallerFromExisting(page.profile, url) - }); - } - } - - onClicked: benchmarkDialog.open() + onClicked: Qt.createComponent("zone.xiv.astra", "SettingsPage").createObject(page, { window: applicationWindow() }).open() } } } diff --git a/launcher/ui/Setup/ExistingSetup.qml b/launcher/ui/Setup/UseExistingInstall.qml similarity index 77% rename from launcher/ui/Setup/ExistingSetup.qml rename to launcher/ui/Setup/UseExistingInstall.qml index d46c974..96ad518 100644 --- a/launcher/ui/Setup/ExistingSetup.qml +++ b/launcher/ui/Setup/UseExistingInstall.qml @@ -17,7 +17,7 @@ FormCard.FormCardPage { property var profile - title: i18n("Find Existing Installation") + title: i18n("Select Existing Installation") data: FolderDialog { id: dialog @@ -29,10 +29,23 @@ FormCard.FormCardPage { } FormCard.FormCard { + visible: existingInstallRepeater.count > 0 + Layout.fillWidth: true Layout.topMargin: Kirigami.Units.largeSpacing + FormCard.FormTextDelegate { + id: foundTextDelegate + + text: i18n("Astra has found the following installations:") + } + + FormCard.FormDelegateSeparator { + above: foundTextDelegate + } + Repeater { + id: existingInstallRepeater model: ExistingInstallModel {} delegate: FormCard.FormButtonDelegate { @@ -57,7 +70,7 @@ FormCard.FormCardPage { FormCard.FormTextDelegate { id: helpTextDelegate - text: i18n("If you can't find your existing game installation, manually select the folder below.") + text: i18n("If Astra did not detect your installation automatically, try selecting it manually below.") } FormCard.FormDelegateSeparator { above: helpTextDelegate @@ -73,4 +86,3 @@ FormCard.FormCardPage { } } } -