1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 12:47:44 +00:00

Use qt_target_qml_sources

This commit is contained in:
Joshua Goins 2023-09-16 17:41:51 -04:00
parent d1045c4500
commit f4a8b9ac78
14 changed files with 59 additions and 60 deletions

View file

@ -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)

View file

@ -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

View file

@ -1,32 +0,0 @@
<RCC>
<!--
SPDX-FileCopyrightText: Joshua Goins <josh@redstrate.com>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<qresource prefix="/">
<file>ui/Components/FormFileDelegate.qml</file>
<file>ui/Components/FormFolderDelegate.qml</file>
<file>ui/Pages/BrowserPage.qml</file>
<file>ui/Pages/LoginPage.qml</file>
<file>ui/Pages/MainPage.qml</file>
<file>ui/Pages/NewsPage.qml</file>
<file>ui/Pages/StatusPage.qml</file>
<file>ui/Settings/AboutPage.qml</file>
<file>ui/Settings/AccountSettings.qml</file>
<file>ui/Settings/AccountsPage.qml</file>
<file>ui/Settings/CompatibilityToolSetup.qml</file>
<file>ui/Settings/DeveloperSettings.qml</file>
<file>ui/Settings/GeneralSettings.qml</file>
<file>ui/Settings/ProfileSettings.qml</file>
<file>ui/Settings/ProfilesPage.qml</file>
<file>ui/Settings/SettingsPage.qml</file>
<file>ui/Setup/AccountSetup.qml</file>
<file>ui/Setup/AddSapphire.qml</file>
<file>ui/Setup/AddSquareEnix.qml</file>
<file>ui/Setup/DownloadSetup.qml</file>
<file>ui/Setup/ExistingSetup.qml</file>
<file>ui/Setup/InstallProgress.qml</file>
<file>ui/Setup/SetupPage.qml</file>
<file>ui/main.qml</file>
</qresource>
</RCC>

View file

@ -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;
}

View file

@ -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"))
}
}

View file

@ -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"))
}
}

View file

@ -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"))
}
]

View file

@ -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
}

View file

@ -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"))
}
}
}

View file

@ -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
})
}

View file

@ -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")
}
]
}

View file

@ -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
})
}

View file

@ -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)
})
}

View file

@ -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
})
}