From d69ebf91c79478c62fc6f1c9b4b1afdfcb7fe9e5 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Tue, 29 Apr 2025 15:12:07 -0400 Subject: [PATCH] Add tools menu back to the main toolbar This was lost in the QML rewrite, even though it's still useful. In this menu you can launch the official launcher, system information and the config backup tool easily. --- launcher/include/gamerunner.h | 3 +++ launcher/include/launchercore.h | 15 +++++++++++++++ launcher/src/gamerunner.cpp | 30 ++++++++++++++++++++++++++++++ launcher/src/launchercore.cpp | 18 ++++++++++++++++++ launcher/ui/Pages/MainPage.qml | 21 +++++++++++++++++++++ 5 files changed, 87 insertions(+) diff --git a/launcher/include/gamerunner.h b/launcher/include/gamerunner.h index 6157810..1224d1a 100644 --- a/launcher/include/gamerunner.h +++ b/launcher/include/gamerunner.h @@ -17,6 +17,9 @@ public: /// Begins the game executable, but calls to Dalamud if needed. void beginGameExecutable(Profile &profile, const std::optional &auth); + void openOfficialLauncher(Profile &profile); + void openSystemInfo(Profile &profile); + void openConfigBackup(Profile &profile); private: /// Starts a vanilla game session with no Dalamud injection. diff --git a/launcher/include/launchercore.h b/launcher/include/launchercore.h index 99c06d1..c094ef2 100755 --- a/launcher/include/launchercore.h +++ b/launcher/include/launchercore.h @@ -134,6 +134,21 @@ public: [[nodiscard]] Headline *headline() const; [[nodiscard]] QString cachedLogoImage() const; + /** + * @brief Opens the official launcher. Useful if Astra decides not to work that day! + */ + Q_INVOKABLE void openOfficialLauncher(Profile *profile); + + /** + * @brief Opens the official system information executable. + */ + Q_INVOKABLE void openSystemInfo(Profile *profile); + + /** + * @brief Opens the config backup tool. + */ + Q_INVOKABLE void openConfigBackup(Profile *profile); + #ifdef BUILD_SYNC [[nodiscard]] SyncManager *syncManager() const; #endif diff --git a/launcher/src/gamerunner.cpp b/launcher/src/gamerunner.cpp index ff38fa6..1ccffe4 100644 --- a/launcher/src/gamerunner.cpp +++ b/launcher/src/gamerunner.cpp @@ -40,6 +40,36 @@ void GameRunner::beginGameExecutable(Profile &profile, const std::optionalsetProcessEnvironment(QProcessEnvironment::systemEnvironment()); + + new ProcessLogger(QStringLiteral("ffxivlauncher"), process); + + launchExecutable(profile, process, {profile.config()->gamePath() + QStringLiteral("/boot/ffxivboot64.exe")}, true, true); +} + +void GameRunner::openConfigBackup(Profile &profile) +{ + const auto process = new QProcess(this); + process->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); + + new ProcessLogger(QStringLiteral("ffxivconfig"), process); + + launchExecutable(profile, process, {profile.config()->gamePath() + QStringLiteral("/boot/ffxivconfig64.exe")}, true, true); +} + +void GameRunner::openSystemInfo(Profile &profile) +{ + const auto process = new QProcess(this); + process->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); + + new ProcessLogger(QStringLiteral("ffxivsysinfo"), process); + + launchExecutable(profile, process, {profile.config()->gamePath() + QStringLiteral("/boot/ffxivsysinfo64.exe")}, true, true); +} + void GameRunner::beginVanillaGame(const QString &gameExecutablePath, Profile &profile, const std::optional &auth) { const auto gameProcess = new QProcess(this); diff --git a/launcher/src/launchercore.cpp b/launcher/src/launchercore.cpp index 8474fd3..f6cd257 100755 --- a/launcher/src/launchercore.cpp +++ b/launcher/src/launchercore.cpp @@ -687,4 +687,22 @@ QString LauncherCore::currentProfileId() const return KSharedConfig::openStateConfig()->group(QStringLiteral("General")).readEntry(QStringLiteral("CurrentProfile")); } +void LauncherCore::openOfficialLauncher(Profile *profile) +{ + Q_ASSERT(profile != nullptr); + m_runner->openOfficialLauncher(*profile); +} + +void LauncherCore::openSystemInfo(Profile *profile) +{ + Q_ASSERT(profile != nullptr); + m_runner->openSystemInfo(*profile); +} + +void LauncherCore::openConfigBackup(Profile *profile) +{ + Q_ASSERT(profile != nullptr); + m_runner->openConfigBackup(*profile); +} + #include "moc_launchercore.cpp" diff --git a/launcher/ui/Pages/MainPage.qml b/launcher/ui/Pages/MainPage.qml index 8014b56..12ba608 100644 --- a/launcher/ui/Pages/MainPage.qml +++ b/launcher/ui/Pages/MainPage.qml @@ -25,6 +25,27 @@ Kirigami.Page { icon.name: "cloudstatus" onTriggered: applicationWindow().openUrl('https://na.finalfantasyxiv.com/lodestone/worldstatus/') }, + Kirigami.Action { + text: i18nc("@action:menu", "Tools") + icon.name: "tools" + visible: !LauncherCore.currentProfile.config.isBenchmark + + Kirigami.Action { + text: i18nc("@action:inmenu", "Official Launcher") + icon.name: "application-x-executable" + onTriggered: LauncherCore.openOfficialLauncher(LauncherCore.currentProfile) + } + Kirigami.Action { + text: i18nc("@action:inmenu", "System Info") + icon.name: "application-x-executable" + onTriggered: LauncherCore.openSystemInfo(LauncherCore.currentProfile) + } + Kirigami.Action { + text: i18nc("@action:inmenu", "Config Backup") + icon.name: "application-x-executable" + onTriggered: LauncherCore.openConfigBackup(LauncherCore.currentProfile) + } + }, Kirigami.Action { text: i18nc("@action:button", "Settings") icon.name: "configure"