diff --git a/CMakeLists.txt b/CMakeLists.txt index 7084b47..b2e6661 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS WebView) find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n Config CoreAddons) find_package(PkgConfig REQUIRED) +qt_policy(SET QTP0001 NEW) if (ENABLE_WATCHDOG) pkg_search_module(TESSERACT REQUIRED tesseract) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index abdfe3a..b87af91 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -2,6 +2,11 @@ # SPDX-License-Identifier: CC0-1.0 add_executable(astra) + +qt_add_qml_module(astra + URI zone.xiv.astra + VERSION 1.0) + target_sources(astra PRIVATE include/account.h include/accountmanager.h @@ -35,9 +40,34 @@ target_sources(astra PRIVATE src/squareboot.cpp src/squarelauncher.cpp src/steamapi.cpp - src/utility.cpp - - resources.qrc) + src/utility.cpp) +qt_target_qml_sources(astra + QML_FILES + ui/Components/FormFileDelegate.qml + ui/Components/FormFolderDelegate.qml + ui/Pages/BrowserPage.qml + ui/Pages/LoginPage.qml + ui/Pages/MainPage.qml + ui/Pages/NewsPage.qml + ui/Pages/StatusPage.qml + ui/Settings/AboutPage.qml + ui/Settings/AccountSettings.qml + ui/Settings/AccountsPage.qml + ui/Settings/CompatibilityToolSetup.qml + ui/Settings/DeveloperSettings.qml + ui/Settings/GeneralSettings.qml + ui/Settings/ProfileSettings.qml + ui/Settings/ProfilesPage.qml + ui/Settings/SettingsPage.qml + ui/Setup/AccountSetup.qml + ui/Setup/AddSapphire.qml + ui/Setup/AddSquareEnix.qml + ui/Setup/DownloadSetup.qml + ui/Setup/ExistingSetup.qml + ui/Setup/InstallProgress.qml + ui/Setup/SetupPage.qml + ui/Main.qml +) kconfig_add_kcfg_files(astra GENERATE_MOC config.kcfgc accountconfig.kcfgc profileconfig.kcfgc) target_include_directories(astra PRIVATE include ${CMAKE_BINARY_DIR}) target_link_libraries(astra PRIVATE diff --git a/launcher/resources.qrc b/launcher/resources.qrc deleted file mode 100644 index c77a8ab..0000000 --- a/launcher/resources.qrc +++ /dev/null @@ -1,32 +0,0 @@ - - - - ui/Components/FormFileDelegate.qml - ui/Components/FormFolderDelegate.qml - ui/Pages/BrowserPage.qml - ui/Pages/LoginPage.qml - ui/Pages/MainPage.qml - ui/Pages/NewsPage.qml - ui/Pages/StatusPage.qml - ui/Settings/AboutPage.qml - ui/Settings/AccountSettings.qml - ui/Settings/AccountsPage.qml - ui/Settings/CompatibilityToolSetup.qml - ui/Settings/DeveloperSettings.qml - ui/Settings/GeneralSettings.qml - ui/Settings/ProfileSettings.qml - ui/Settings/ProfilesPage.qml - ui/Settings/SettingsPage.qml - ui/Setup/AccountSetup.qml - ui/Setup/AddSapphire.qml - ui/Setup/AddSquareEnix.qml - ui/Setup/DownloadSetup.qml - ui/Setup/ExistingSetup.qml - ui/Setup/InstallProgress.qml - ui/Setup/SetupPage.qml - ui/main.qml - - \ No newline at end of file diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp index d520e77..abd2338 100755 --- a/launcher/src/main.cpp +++ b/launcher/src/main.cpp @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); QObject::connect(&engine, &QQmlApplicationEngine::quit, &app, &QCoreApplication::quit); - engine.load(QUrl(QStringLiteral("qrc:/ui/main.qml"))); + engine.loadFromModule(QStringLiteral("zone.xiv.astra"), QStringLiteral("Main")); if (engine.rootObjects().isEmpty()) { return -1; } diff --git a/launcher/ui/main.qml b/launcher/ui/Main.qml similarity index 86% rename from launcher/ui/main.qml rename to launcher/ui/Main.qml index 9773d08..ee60767 100644 --- a/launcher/ui/main.qml +++ b/launcher/ui/Main.qml @@ -39,16 +39,16 @@ Kirigami.ApplicationWindow { if (!currentSetupProfile.isGameInstalled) { // User must set up the profile - pageStack.layers.replace('qrc:/ui/Setup/SetupPage.qml', { + pageStack.layers.replace(Qt.createComponent("zone.xiv.astra", "SetupPage"), { profile: currentSetupProfile }) } else if (!currentSetupProfile.account) { // User must select an account for the profile - pageStack.layers.replace('qrc:/ui/Setup/AccountSetup.qml', { + pageStack.layers.replace(Qt.createComponent("zone.xiv.astra", "AccountSetup"), { profile: currentSetupProfile }) } else { - pageStack.layers.replace('qrc:/ui/Pages/MainPage.qml') + pageStack.layers.replace(Qt.createComponent("zone.xiv.astra", "MainPage")) } } @@ -62,7 +62,7 @@ Kirigami.ApplicationWindow { function openUrl(url) { if (LauncherCore.isSteamDeck) { - pageStack.layers.push('qrc:/ui/Pages/BrowserPage.qml', { + pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "BrowserPage"), { url: url }) } else { @@ -96,7 +96,7 @@ Kirigami.ApplicationWindow { function onShowNewsChanged() { // workaround annoying Qt layouting bug // TODO: see if this changed in Qt6 - pageStack.layers.replace('qrc:/ui/Pages/MainPage.qml') + pageStack.layers.replace(Qt.createComponent("zone.xiv.astra", "MainPage")) } } diff --git a/launcher/ui/Pages/LoginPage.qml b/launcher/ui/Pages/LoginPage.qml index 9666fc3..2d78552 100644 --- a/launcher/ui/Pages/LoginPage.qml +++ b/launcher/ui/Pages/LoginPage.qml @@ -173,7 +173,7 @@ Controls.Control { enabled: page.isLoginValid onClicked: { LauncherCore.login(page.profile, usernameField.text, passwordField.text, otpField.text) - pageStack.layers.push('qrc:/ui/Pages/StatusPage.qml') + pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "StatusPage")) } } diff --git a/launcher/ui/Pages/MainPage.qml b/launcher/ui/Pages/MainPage.qml index 1341df1..6991435 100644 --- a/launcher/ui/Pages/MainPage.qml +++ b/launcher/ui/Pages/MainPage.qml @@ -47,7 +47,7 @@ Kirigami.Page { Kirigami.Action { text: i18n("Settings") icon.name: "configure" - onTriggered: applicationWindow().pushDialogLayer('qrc:/ui/Settings/SettingsPage.qml') + onTriggered: applicationWindow().pushDialogLayer(Qt.createComponent("zone.xiv.astra", "SettingsPage")) } ] diff --git a/launcher/ui/Settings/AboutPage.qml b/launcher/ui/Settings/AboutPage.qml index a66cbd7..7c5f9c2 100644 --- a/launcher/ui/Settings/AboutPage.qml +++ b/launcher/ui/Settings/AboutPage.qml @@ -7,8 +7,8 @@ import org.kde.kirigami 2.20 as Kirigami import QtQuick.Controls 2.15 as Controls import QtQuick.Layouts 1.15 import org.kde.kirigamiaddons.formcard 1.0 as FormCard -import zone.xiv.astra 1.0 +import org.kde.coreaddons FormCard.AboutPage { - aboutData: About + aboutData: AboutData } \ No newline at end of file diff --git a/launcher/ui/Settings/AccountsPage.qml b/launcher/ui/Settings/AccountsPage.qml index 8941d4b..18c7898 100644 --- a/launcher/ui/Settings/AccountsPage.qml +++ b/launcher/ui/Settings/AccountsPage.qml @@ -33,7 +33,7 @@ FormCard.FormCardPage { leadingPadding: Kirigami.Units.largeSpacing * 2 - onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/AccountSettings.qml', { + onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AccountSettings"), { account: account }) } @@ -48,7 +48,7 @@ FormCard.FormCardPage { text: i18n("Add Square Enix Account") icon.name: "list-add-symbolic" - onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSquareEnix.qml') + onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix")) } FormCard.FormDelegateSeparator { @@ -61,7 +61,7 @@ FormCard.FormCardPage { text: i18n("Add Sapphire Account") icon.name: "list-add-symbolic" - onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSapphire.qml') + onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire")) } } } \ No newline at end of file diff --git a/launcher/ui/Settings/ProfilesPage.qml b/launcher/ui/Settings/ProfilesPage.qml index 15a0b86..4cfc80f 100644 --- a/launcher/ui/Settings/ProfilesPage.qml +++ b/launcher/ui/Settings/ProfilesPage.qml @@ -26,7 +26,7 @@ FormCard.FormCardPage { required property var profile text: profile.name - onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/ProfileSettings.qml', { + onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), { profile: profile }) } diff --git a/launcher/ui/Settings/SettingsPage.qml b/launcher/ui/Settings/SettingsPage.qml index 6c682f9..cf18b50 100644 --- a/launcher/ui/Settings/SettingsPage.qml +++ b/launcher/ui/Settings/SettingsPage.qml @@ -15,38 +15,38 @@ KirigamiSettings.CategorizedSettings { actionName: "general" text: i18n("General") icon.name: "zone.xiv.astra" - page: Qt.resolvedUrl("GeneralSettings.qml") + page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/GeneralSettings.qml") }, KirigamiSettings.SettingAction { actionName: "profiles" text: i18n("Profiles") icon.name: "preferences-desktop-gaming" - page: Qt.resolvedUrl("ProfilesPage.qml") + page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/ProfilesPage.qml") }, KirigamiSettings.SettingAction { actionName: "accounts" text: i18n("Accounts") icon.name: "preferences-system-users" - page: Qt.resolvedUrl("AccountsPage.qml") + page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/AccountsPage.qml") }, KirigamiSettings.SettingAction { actionName: "compattool" text: i18n("Compatibility Tool") icon.name: "system-run" - page: Qt.resolvedUrl("CompatibilityToolSetup.qml") + page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/CompatibilityToolSetup.qml") }, KirigamiSettings.SettingAction { actionName: "devtool" text: i18n("Developer Settings") icon.name: "preferences-others" - page: Qt.resolvedUrl("DeveloperSettings.qml") + page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/DeveloperSettings.qml") visible: LauncherCore.showDevTools }, KirigamiSettings.SettingAction { actionName: "about" text: i18n("About Astra") icon.name: "help-about" - page: Qt.resolvedUrl("AboutPage.qml") + page: Qt.resolvedUrl("/qt/qml/zone/xiv/astra/ui/Settings/AboutPage.qml") } ] } diff --git a/launcher/ui/Setup/AccountSetup.qml b/launcher/ui/Setup/AccountSetup.qml index ab6f941..a5f907d 100644 --- a/launcher/ui/Setup/AccountSetup.qml +++ b/launcher/ui/Setup/AccountSetup.qml @@ -58,7 +58,7 @@ Kirigami.Page { MobileForm.FormButtonDelegate { text: i18n("Add Square Enix Account") icon.name: "list-add-symbolic" - onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSquareEnix.qml', { + onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix"), { profile: page.profile }) } @@ -69,7 +69,7 @@ Kirigami.Page { MobileForm.FormButtonDelegate { text: i18n("Add Sapphire Account") icon.name: "list-add-symbolic" - onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSapphire.qml', { + onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire"), { profile: page.profile }) } diff --git a/launcher/ui/Setup/DownloadSetup.qml b/launcher/ui/Setup/DownloadSetup.qml index f83c939..abff04d 100644 --- a/launcher/ui/Setup/DownloadSetup.qml +++ b/launcher/ui/Setup/DownloadSetup.qml @@ -39,7 +39,7 @@ Kirigami.Page { MobileForm.FormButtonDelegate { text: i18n("Begin installation") icon.name: "cloud-download" - onClicked: pageStack.layers.push('qrc:/ui/Setup/InstallProgress.qml', { + onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "InstallProgress"), { gameInstaller: LauncherCore.createInstaller(page.profile) }) } diff --git a/launcher/ui/Setup/SetupPage.qml b/launcher/ui/Setup/SetupPage.qml index 5a18c6e..e7367d1 100644 --- a/launcher/ui/Setup/SetupPage.qml +++ b/launcher/ui/Setup/SetupPage.qml @@ -43,7 +43,7 @@ Kirigami.Page { MobileForm.FormButtonDelegate { text: i18n("Find Existing Installation") icon.name: "edit-find" - onClicked: pageStack.layers.push('qrc:/ui/Setup/ExistingSetup.qml', { + onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ExistingSetup"), { profile: page.profile }) } @@ -54,7 +54,7 @@ Kirigami.Page { MobileForm.FormButtonDelegate { text: i18n("Download Game") icon.name: "cloud-download" - onClicked: pageStack.layers.push('qrc:/ui/Setup/DownloadSetup.qml', { + onClicked: pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "DownloadSetup"), { profile: page.profile }) }