From d1045c450046f98eb0a0bf35f66ad57798e8cf92 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 16 Sep 2023 17:32:38 -0400 Subject: [PATCH] Begin port to Qt6 --- BUILDING.md | 6 +- CMakeLists.txt | 16 ++--- launcher/CMakeLists.txt | 24 ++++---- launcher/src/launchercore.cpp | 4 +- launcher/src/main.cpp | 7 +-- launcher/ui/Components/FormFileDelegate.qml | 7 ++- launcher/ui/Components/FormFolderDelegate.qml | 9 ++- launcher/ui/Pages/LoginPage.qml | 3 +- launcher/ui/Pages/MainPage.qml | 58 +++++++++---------- launcher/ui/Pages/NewsPage.qml | 2 +- launcher/ui/Settings/AccountsPage.qml | 3 +- 11 files changed, 69 insertions(+), 70 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 89a53bf..5284379 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -8,9 +8,9 @@ All of these packages are required for Astra to build with a minimal set of feat * Linux * Windows, macOS and other systems may work but are currently unsupported. -* CMake 3.16 or later -* Qt 5.15 or later -* KDE Frameworks 5.83 or later +* CMake 3.25 or later +* Qt 6.5 or later +* KDE Frameworks 6 * Extra CMake Modules, Kirigami, I18n, Config, and CoreAddons. * Rust * unshield diff --git a/CMakeLists.txt b/CMakeLists.txt index 90ba341..7084b47 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2023 Joshua Goins # SPDX-License-Identifier: CC0-1.0 -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.25) project(Astra VERSION 0.5.0 LANGUAGES CXX) # build options used for distributors @@ -19,8 +19,8 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(QT_MIN_VERSION 5.15) -set(KF5_MIN_VERSION 5.83) +set(QT_MIN_VERSION 6.5) +set(KF_MIN_VERSION 5.240) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) @@ -40,13 +40,13 @@ ecm_setup_version(${PROJECT_VERSION} VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/astra-version.h ) -find_package(Qt5 ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS +find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Widgets Network QuickControls2 - WebEngine) -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n Config CoreAddons) + WebView) +find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n Config CoreAddons) find_package(PkgConfig REQUIRED) if (ENABLE_WATCHDOG) @@ -69,8 +69,8 @@ if (ENABLE_STEAM) endif () endif () -find_package(Qt5Keychain REQUIRED) -find_package(QuaZip-Qt5 REQUIRED) +find_package(Qt6Keychain REQUIRED) +find_package(QuaZip-Qt6 REQUIRED) add_subdirectory(external) add_subdirectory(launcher) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 3b414e1..abdfe3a 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -45,18 +45,18 @@ target_link_libraries(astra PRIVATE cotp crypto QuaZip::QuaZip - Qt5Keychain::Qt5Keychain - Qt5::Core - Qt5::Network - Qt5::Widgets - Qt5::Quick - Qt5::QuickControls2 - Qt5::WebEngine - KF5::Kirigami2 - KF5::I18n - KF5::ConfigCore - KF5::ConfigGui - KF5::CoreAddons) + Qt6Keychain::Qt6Keychain + Qt6::Core + Qt6::Network + Qt6::Widgets + Qt6::Quick + Qt6::QuickControls2 + Qt6::WebView + KF6::Kirigami2 + KF6::I18n + KF6::ConfigCore + KF6::ConfigGui + KF6::CoreAddons) if (ENABLE_WATCHDOG) target_sources(astra PRIVATE diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index 5e87f7a..b961e8c 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -93,7 +93,7 @@ void LauncherCore::beginVanillaGame(const QString &gameExecutablePath, const Pro { auto gameProcess = new QProcess(this); gameProcess->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); - connect(gameProcess, qOverload(&QProcess::finished), this, [this](int exitCode) { + connect(gameProcess, &QProcess::finished, this, [this](int exitCode) { Q_UNUSED(exitCode) Q_EMIT gameClosed(); }); @@ -133,7 +133,7 @@ void LauncherCore::beginDalamudGame(const QString &gameExecutablePath, const Pro const QString dalamudInjector = dalamudInstallDir.absoluteFilePath("Dalamud.Injector.exe"); auto dalamudProcess = new QProcess(this); - connect(dalamudProcess, qOverload(&QProcess::finished), this, [this](int exitCode) { + connect(dalamudProcess, &QProcess::finished, this, [this](int exitCode) { Q_UNUSED(exitCode) Q_EMIT gameClosed(); }); diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp index 8d42261..d520e77 100755 --- a/launcher/src/main.cpp +++ b/launcher/src/main.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include "astra-version.h" #include "compatibilitytoolinstaller.h" @@ -17,10 +17,7 @@ int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); - - QtWebEngine::initialize(); + QtWebView::initialize(); QApplication app(argc, argv); // Default to org.kde.desktop style unless the user forces another style diff --git a/launcher/ui/Components/FormFileDelegate.qml b/launcher/ui/Components/FormFileDelegate.qml index b668ca8..6a36cfd 100644 --- a/launcher/ui/Components/FormFileDelegate.qml +++ b/launcher/ui/Components/FormFileDelegate.qml @@ -1,13 +1,14 @@ // SPDX-FileCopyrightText: 2023 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later +import QtCore import QtQuick 2.15 import QtQuick.Window 2.15 import org.kde.kirigami 2.20 as Kirigami import QtQuick.Controls 2.15 as Controls import QtQuick.Layouts 1.15 import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm -import QtQuick.Dialogs 1.0 +import QtQuick.Dialogs import zone.xiv.astra 1.0 MobileForm.FormButtonDelegate { @@ -22,7 +23,7 @@ MobileForm.FormButtonDelegate { FileDialog { id: dialog - - folder: shortcuts.home + + currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] } } \ No newline at end of file diff --git a/launcher/ui/Components/FormFolderDelegate.qml b/launcher/ui/Components/FormFolderDelegate.qml index 1ea3e19..2f52830 100644 --- a/launcher/ui/Components/FormFolderDelegate.qml +++ b/launcher/ui/Components/FormFolderDelegate.qml @@ -1,13 +1,14 @@ // SPDX-FileCopyrightText: 2023 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later +import QtCore import QtQuick 2.15 import QtQuick.Window 2.15 import org.kde.kirigami 2.20 as Kirigami import QtQuick.Controls 2.15 as Controls import QtQuick.Layouts 1.15 import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm -import QtQuick.Dialogs 1.0 +import QtQuick.Dialogs import zone.xiv.astra 1.0 MobileForm.FormButtonDelegate { @@ -20,11 +21,9 @@ MobileForm.FormButtonDelegate { onClicked: dialog.open() - FileDialog { + FolderDialog { id: dialog - selectFolder: true - - folder: shortcuts.home + currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] } } \ No newline at end of file diff --git a/launcher/ui/Pages/LoginPage.qml b/launcher/ui/Pages/LoginPage.qml index fa6799b..9666fc3 100644 --- a/launcher/ui/Pages/LoginPage.qml +++ b/launcher/ui/Pages/LoginPage.qml @@ -7,6 +7,7 @@ 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 org.kde.kirigamiaddons.components as Components import zone.xiv.astra 1.0 Controls.Control { @@ -91,7 +92,7 @@ Controls.Control { text: i18n("Current Account") description: page.profile.account.name - leading: Kirigami.Avatar + leading: Components.Avatar { source: page.profile.account.avatarUrl } diff --git a/launcher/ui/Pages/MainPage.qml b/launcher/ui/Pages/MainPage.qml index 9d6bf13..1341df1 100644 --- a/launcher/ui/Pages/MainPage.qml +++ b/launcher/ui/Pages/MainPage.qml @@ -16,40 +16,40 @@ Kirigami.Page { title: i18n("Home") - actions.contextualActions: Kirigami.Action { - text: i18n("Settings") - icon.name: "configure" - onTriggered: applicationWindow().pushDialogLayer('qrc:/ui/Settings/SettingsPage.qml') - } - - actions.right: Kirigami.Action { - text: i18n("Server Status") - icon.name: "cloudstatus" - onTriggered: applicationWindow().openUrl('https://na.finalfantasyxiv.com/lodestone/worldstatus/') - } - - actions.main: Kirigami.Action { - text: i18n("Tools") - icon.name: "tools-symbolic" - + actions: [ Kirigami.Action { - text: i18n("Open Official Launcher") - icon.name: "application-x-executable" - onTriggered: LauncherCore.openOfficialLauncher(loginPage.profile) - } + text: i18n("Tools") + icon.name: "tools-symbolic" - Kirigami.Action { - text: i18n("Open System Info") - icon.name: "application-x-executable" - onTriggered: LauncherCore.openSystemInfo(loginPage.profile) - } + Kirigami.Action { + text: i18n("Open Official Launcher") + icon.name: "application-x-executable" + onTriggered: LauncherCore.openOfficialLauncher(loginPage.profile) + } + Kirigami.Action { + text: i18n("Open System Info") + icon.name: "application-x-executable" + onTriggered: LauncherCore.openSystemInfo(loginPage.profile) + } + + Kirigami.Action { + text: i18n("Open Config Backup") + icon.name: "application-x-executable" + onTriggered: LauncherCore.openConfigBackup(loginPage.profile) + } + }, Kirigami.Action { - text: i18n("Open Config Backup") - icon.name: "application-x-executable" - onTriggered: LauncherCore.openConfigBackup(loginPage.profile) + text: i18n("Server Status") + icon.name: "cloudstatus" + onTriggered: applicationWindow().openUrl('https://na.finalfantasyxiv.com/lodestone/worldstatus/') + }, + Kirigami.Action { + text: i18n("Settings") + icon.name: "configure" + onTriggered: applicationWindow().pushDialogLayer('qrc:/ui/Settings/SettingsPage.qml') } - } + ] RowLayout { anchors.fill: parent diff --git a/launcher/ui/Pages/NewsPage.qml b/launcher/ui/Pages/NewsPage.qml index a4472ef..95ff0f5 100644 --- a/launcher/ui/Pages/NewsPage.qml +++ b/launcher/ui/Pages/NewsPage.qml @@ -7,7 +7,7 @@ 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 QtGraphicalEffects 1.0 +import Qt5Compat.GraphicalEffects 1.0 import zone.xiv.astra 1.0 Controls.Control { diff --git a/launcher/ui/Settings/AccountsPage.qml b/launcher/ui/Settings/AccountsPage.qml index 07ec152..8941d4b 100644 --- a/launcher/ui/Settings/AccountsPage.qml +++ b/launcher/ui/Settings/AccountsPage.qml @@ -7,6 +7,7 @@ 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 org.kde.kirigamiaddons.components as Components import zone.xiv.astra 1.0 FormCard.FormCardPage { @@ -25,7 +26,7 @@ FormCard.FormCardPage { text: account.name - leading: Kirigami.Avatar + leading: Components.Avatar { source: account.avatarUrl }