1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-01 08:27:45 +00:00

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.
This commit is contained in:
Joshua Goins 2025-04-29 15:12:07 -04:00
parent 871637261e
commit d69ebf91c7
5 changed files with 87 additions and 0 deletions

View file

@ -17,6 +17,9 @@ public:
/// Begins the game executable, but calls to Dalamud if needed. /// Begins the game executable, but calls to Dalamud if needed.
void beginGameExecutable(Profile &profile, const std::optional<LoginAuth> &auth); void beginGameExecutable(Profile &profile, const std::optional<LoginAuth> &auth);
void openOfficialLauncher(Profile &profile);
void openSystemInfo(Profile &profile);
void openConfigBackup(Profile &profile);
private: private:
/// Starts a vanilla game session with no Dalamud injection. /// Starts a vanilla game session with no Dalamud injection.

View file

@ -134,6 +134,21 @@ public:
[[nodiscard]] Headline *headline() const; [[nodiscard]] Headline *headline() const;
[[nodiscard]] QString cachedLogoImage() 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 #ifdef BUILD_SYNC
[[nodiscard]] SyncManager *syncManager() const; [[nodiscard]] SyncManager *syncManager() const;
#endif #endif

View file

@ -40,6 +40,36 @@ void GameRunner::beginGameExecutable(Profile &profile, const std::optional<Login
Q_EMIT m_launcher.successfulLaunch(); Q_EMIT m_launcher.successfulLaunch();
} }
void GameRunner::openOfficialLauncher(Profile &profile)
{
const auto process = new QProcess(this);
process->setProcessEnvironment(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<LoginAuth> &auth) void GameRunner::beginVanillaGame(const QString &gameExecutablePath, Profile &profile, const std::optional<LoginAuth> &auth)
{ {
const auto gameProcess = new QProcess(this); const auto gameProcess = new QProcess(this);

View file

@ -687,4 +687,22 @@ QString LauncherCore::currentProfileId() const
return KSharedConfig::openStateConfig()->group(QStringLiteral("General")).readEntry(QStringLiteral("CurrentProfile")); 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" #include "moc_launchercore.cpp"

View file

@ -25,6 +25,27 @@ Kirigami.Page {
icon.name: "cloudstatus" icon.name: "cloudstatus"
onTriggered: applicationWindow().openUrl('https://na.finalfantasyxiv.com/lodestone/worldstatus/') 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 { Kirigami.Action {
text: i18nc("@action:button", "Settings") text: i18nc("@action:button", "Settings")
icon.name: "configure" icon.name: "configure"