diff --git a/include/launchercore.h b/include/launchercore.h index bc6edc9..5d609c4 100755 --- a/include/launchercore.h +++ b/include/launchercore.h @@ -33,6 +33,10 @@ struct ProfileSettings { QList expansionVersions; bool enableWatchdog = false; + bool isGameInstalled() const { + return !gameVersion.isEmpty(); + } + // wine // 0 = system, 1 = custom, 2 = built-in (mac only) // TODO: yes, i know this should be an enum diff --git a/include/launcherwindow.h b/include/launcherwindow.h index 712fab9..e1fa7de 100644 --- a/include/launcherwindow.h +++ b/include/launcherwindow.h @@ -32,6 +32,11 @@ private: QLabel* bannerImageView; QTreeWidget* newsListView; + QAction* launchOfficial; + QAction* launchSysInfo; + QAction* launchCfgBackup; + QAction* openGameDir; + QComboBox* profileSelect; QLineEdit* usernameEdit, *passwordEdit; QLineEdit* otpEdit; diff --git a/include/settingswindow.h b/include/settingswindow.h index 1a86212..65d74ba 100644 --- a/include/settingswindow.h +++ b/include/settingswindow.h @@ -33,6 +33,7 @@ private: QComboBox* directXCombo = nullptr; QLineEdit* currentGameDirectory = nullptr; QLabel* expansionVersionLabel = nullptr; + QPushButton* gameDirectoryButton = nullptr; // wine QComboBox* wineVersionCombo; diff --git a/src/launcherwindow.cpp b/src/launcherwindow.cpp index f6725ef..ccf1daa 100644 --- a/src/launcherwindow.cpp +++ b/src/launcherwindow.cpp @@ -24,19 +24,19 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo QMenu* toolsMenu = menuBar()->addMenu("Tools"); - QAction* launchOfficial = toolsMenu->addAction("Open Official Client..."); + 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 = 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 = 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"}); @@ -44,7 +44,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo toolsMenu->addSeparator(); - QAction* openGameDir = toolsMenu->addAction("Open Game Directory..."); + openGameDir = toolsMenu->addAction("Open Game Directory..."); openGameDir->setIcon(QIcon::fromTheme("document-open")); connect(openGameDir, &QAction::triggered, [=] { openPath(currentProfile().gamePath); @@ -312,18 +312,25 @@ void LauncherWindow::reloadControls() { } #endif - const bool canLogin = currentProfile().isSapphire || (!currentProfile().isSapphire && core.squareLauncher->isGateOpen); + const bool canLogin = currentProfile().isSapphire || (!currentProfile().isSapphire && core.squareLauncher->isGateOpen) && currentProfile().isGameInstalled(); if(canLogin) { loginButton->setText("Login"); - } else { + } else if(!core.squareLauncher->isGateOpen) { loginButton->setText("Login (Maintenance is in progress)"); + } else { + loginButton->setText("Login (Game is not installed)"); } loginButton->setEnabled(canLogin); registerButton->setEnabled(currentProfile().isSapphire); otpEdit->setEnabled(!currentProfile().isSapphire); + launchOfficial->setEnabled(currentProfile().isGameInstalled()); + launchSysInfo->setEnabled(currentProfile().isGameInstalled()); + launchCfgBackup->setEnabled(currentProfile().isGameInstalled()); + openGameDir->setEnabled(currentProfile().isGameInstalled()); + currentlyReloadingControls = false; } diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index 6ed392b..3de873c 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -127,7 +127,7 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC }); gameDirButtonLayout->addWidget(selectDirectoryButton); - auto gameDirectoryButton = new QPushButton("Open Game Directory"); + gameDirectoryButton = new QPushButton("Open Game Directory"); connect(gameDirectoryButton, &QPushButton::pressed, [&window, this] { window.openPath(getCurrentProfile().gamePath); }); gameDirButtonLayout->addWidget(gameDirectoryButton); @@ -143,6 +143,8 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC }); #endif + gameDirectoryButton->setEnabled(getCurrentProfile().isGameInstalled()); + expansionVersionLabel = new QLabel(); gameBoxLayout->addRow("Game Version", expansionVersionLabel); @@ -410,7 +412,7 @@ void SettingsWindow::reloadControls() { directXCombo->setCurrentIndex(profile.useDX9 ? 1 : 0); currentGameDirectory->setText(profile.gamePath); - if(profile.gameVersion.isEmpty()) { + if(!profile.isGameInstalled()) { expansionVersionLabel->setText("No game installed."); } else { QString expacString;