diff --git a/src/launcherwindow.cpp b/src/launcherwindow.cpp index 4a74d72..2a6042f 100644 --- a/src/launcherwindow.cpp +++ b/src/launcherwindow.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "settingswindow.h" #include "squareboot.h" @@ -16,53 +17,61 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo connect(&core, &LauncherCore::settingsChanged, this, &LauncherWindow::reloadControls); - QMenu* fileMenu = menuBar()->addMenu("File"); + QMenu* toolsMenu = menuBar()->addMenu("Tools"); - QAction* settingsAction = fileMenu->addAction("Settings..."); + QAction* launchOfficial = toolsMenu->addAction("Open Official Client..."); + launchOfficial->setIcon(QIcon::fromTheme("application-x-executable")); + connect(launchOfficial, &QAction::triggered, [=] { + this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivboot.exe"}); + }); + + QAction* launchSysInfo = toolsMenu->addAction("Open System Info..."); + launchSysInfo->setIcon(QIcon::fromTheme("application-x-executable")); + connect(launchSysInfo, &QAction::triggered, [=] { + this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivsysinfo64.exe"}); + }); + + QAction* launchCfgBackup = toolsMenu->addAction("Open Config Backup..."); + launchCfgBackup->setIcon(QIcon::fromTheme("application-x-executable")); + connect(launchCfgBackup, &QAction::triggered, [=] { + this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivconfig64.exe"}); + }); + + toolsMenu->addSeparator(); + + QAction* openGameDir = toolsMenu->addAction("Open Game Directory..."); + openGameDir->setIcon(QIcon::fromTheme("document-open")); + connect(openGameDir, &QAction::triggered, [=] { + openPath(currentProfile().gamePath); + }); + + QMenu* fileMenu = menuBar()->addMenu("Settings"); + + QAction* settingsAction = fileMenu->addAction("Configure Astra..."); + settingsAction->setIcon(QIcon::fromTheme("settings")); connect(settingsAction, &QAction::triggered, [=] { auto window = new SettingsWindow(*this, this->core, this); connect(&this->core, &LauncherCore::settingsChanged, window, &SettingsWindow::reloadControls); window->show(); }); - QMenu* toolsMenu = menuBar()->addMenu("Tools"); - - QAction* launchOfficial = toolsMenu->addAction("Launch Official Client..."); - connect(launchOfficial, &QAction::triggered, [=] { - this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivboot.exe"}); - }); - - QAction* launchSysInfo = toolsMenu->addAction("Launch System Info..."); - connect(launchSysInfo, &QAction::triggered, [=] { - this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivsysinfo64.exe"}); - }); - - QAction* launchCfgBackup = toolsMenu->addAction("Launch Config Backup..."); - connect(launchCfgBackup, &QAction::triggered, [=] { - this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivconfig64.exe"}); - }); - #if defined(Q_OS_MAC) || defined(Q_OS_LINUX) - QMenu* wineMenu = toolsMenu->addMenu("Wine"); - - QAction* wineCfg = wineMenu->addAction("winecfg"); + QAction* wineCfg = fileMenu->addAction("Configure Wine..."); + wineCfg->setIcon(QIcon::fromTheme("settings")); connect(wineCfg, &QAction::triggered, [=] { this->core.launchExecutable(currentProfile(), {"winecfg.exe"}); }); - - QAction* controlPanel = wineMenu->addAction("Control Panel"); - connect(controlPanel, &QAction::triggered, [=] { - this->core.launchExecutable(currentProfile(), {"control.exe"}); - }); #endif QMenu* helpMenu = menuBar()->addMenu("Help"); QAction* showAbout = helpMenu->addAction("About Astra"); + showAbout->setIcon(QIcon::fromTheme("help-about")); connect(showAbout, &QAction::triggered, [=] { QMessageBox::about(this, "About Astra", "The source code is available here."); }); QAction* showAboutQt = helpMenu->addAction("About Qt"); + showAboutQt->setIcon(QIcon::fromTheme("help-about")); connect(showAboutQt, &QAction::triggered, [=] { QApplication::aboutQt(); }); @@ -221,4 +230,15 @@ void LauncherWindow::reloadControls() { otpEdit->setEnabled(!currentProfile().isSapphire); currentlyReloadingControls = false; -} \ No newline at end of file +} + +void LauncherWindow::openPath(const QString path) { +#if defined(Q_OS_WIN) + // for some reason, windows requires special treatment (what else is new?) + const QFileInfo fileInfo(path); + + QProcess::startDetached("explorer.exe", QStringList(QDir::toNativeSeparators(fileInfo.canonicalFilePath()))); +#else + QDesktopServices::openUrl("file://" + path); +#endif +} diff --git a/src/launcherwindow.h b/src/launcherwindow.h index 12a8889..6c473e9 100644 --- a/src/launcherwindow.h +++ b/src/launcherwindow.h @@ -15,6 +15,8 @@ public: ProfileSettings currentProfile() const; ProfileSettings& currentProfile(); + void openPath(const QString path); + public slots: void reloadControls(); diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index 8b9b1d1..797b2a0 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -129,7 +129,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg auto gameDirectoryButton = new QPushButton("Open Game Directory"); connect(gameDirectoryButton, &QPushButton::pressed, - [this] { openPath(getCurrentProfile().gamePath); }); + [&window, this] { window.openPath(getCurrentProfile().gamePath); }); gameDirButtonLayout->addWidget(gameDirectoryButton); #ifdef ENABLE_WATCHDOG @@ -275,7 +275,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg auto openPrefixButton = new QPushButton("Open Wine Prefix"); connect(openPrefixButton, &QPushButton::pressed, - [this] { openPath(getCurrentProfile().winePrefixPath); }); + [&window, this] { window.openPath(getCurrentProfile().winePrefixPath); }); winePrefixButtonLayout->addWidget(openPrefixButton); auto enableDXVKhud = new QCheckBox("Enable DXVK HUD"); @@ -485,15 +485,4 @@ void SettingsWindow::reloadControls() { ProfileSettings& SettingsWindow::getCurrentProfile() { return this->core.getProfile(profileWidget->currentRow()); -} - -void SettingsWindow::openPath(const QString path) { -#if defined(Q_OS_WIN) - // for some reason, windows requires special treatment (what else is new?) - const QFileInfo fileInfo(path); - - QProcess::startDetached("explorer.exe", QStringList(QDir::toNativeSeparators(fileInfo.canonicalFilePath()))); -#else - QDesktopServices::openUrl("file://" + path); -#endif -} +} \ No newline at end of file diff --git a/src/settingswindow.h b/src/settingswindow.h index 089132d..94df0ec 100644 --- a/src/settingswindow.h +++ b/src/settingswindow.h @@ -20,7 +20,6 @@ public slots: void reloadControls(); private: - void openPath(const QString path); ProfileSettings& getCurrentProfile(); QListWidget* profileWidget = nullptr;