mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-22 20:47:45 +00:00
Only enable the gamescope config button if it's actually enabled
This commit is contained in:
parent
5b8fde48ee
commit
7b96e422df
4 changed files with 34 additions and 6 deletions
|
@ -266,6 +266,9 @@ QString LauncherCore::readVersion(QString path) {
|
|||
void LauncherCore::readInitialInformation() {
|
||||
defaultProfileIndex = settings.value("defaultProfile", 0).toInt();
|
||||
|
||||
gamescopeAvailable = checkIfInPath("gamescope");
|
||||
gamemodeAvailable = checkIfInPath("gamemoderun");
|
||||
|
||||
auto profiles = settings.childGroups();
|
||||
|
||||
// create the Default profile if it doesnt exist
|
||||
|
@ -348,8 +351,13 @@ void LauncherCore::readInitialInformation() {
|
|||
|
||||
profile.useDX9 = settings.value("useDX9", false).toBool();
|
||||
profile.useEsync = settings.value("useEsync", false).toBool();
|
||||
profile.useGamemode = settings.value("useGamemode", false).toBool();
|
||||
profile.useGamescope = settings.value("useGamescope", false).toBool();
|
||||
|
||||
if(gamescopeAvailable)
|
||||
profile.useGamescope = settings.value("useGamescope", false).toBool();
|
||||
|
||||
if(gamemodeAvailable)
|
||||
profile.useGamemode = settings.value("useGamemode", false).toBool();
|
||||
|
||||
profile.enableDXVKhud = settings.value("enableDXVKhud", false).toBool();
|
||||
profile.enableWatchdog = settings.value("enableWatchdog", false).toBool();
|
||||
|
||||
|
@ -560,3 +568,12 @@ void LauncherCore::readExpansionVersions(ProfileSettings& info, int max) {
|
|||
for(int i = 0; i < max; i++)
|
||||
info.expansionVersions.push_back(readVersion(QString("%1/game/sqpack/ex%2/ex%2.ver").arg(info.gamePath, QString::number(i + 1))));
|
||||
}
|
||||
|
||||
bool LauncherCore::checkIfInPath(const QString program) {
|
||||
// TODO: also check /usr/local/bin, /bin32 etc (basically read $PATH)
|
||||
const QString directory = "/usr/bin";
|
||||
|
||||
QFileInfo fileInfo(directory + "/" + program);
|
||||
|
||||
return fileInfo.exists() && fileInfo.isFile();
|
||||
}
|
|
@ -88,7 +88,7 @@ public:
|
|||
int addProfile();
|
||||
int deleteProfile(QString name);
|
||||
|
||||
void launchGame(const ProfileSettings& settings, const LoginAuth auth);
|
||||
void launchGame(const ProfileSettings& settings, LoginAuth auth);
|
||||
void launchExecutable(const ProfileSettings& settings, QStringList args);
|
||||
void launchExecutable(const ProfileSettings& settings, QProcess* process, QStringList args);
|
||||
void buildRequest(QNetworkRequest& request);
|
||||
|
@ -109,12 +109,16 @@ public:
|
|||
AssetUpdater* assetUpdater;
|
||||
Watchdog* watchdog;
|
||||
|
||||
bool gamescopeAvailable = false;
|
||||
bool gamemodeAvailable = false;
|
||||
|
||||
int defaultProfileIndex = 0;
|
||||
signals:
|
||||
void settingsChanged();
|
||||
|
||||
private:
|
||||
void readExpansionVersions(ProfileSettings& info, int max);
|
||||
bool checkIfInPath(QString program);
|
||||
|
||||
QVector<ProfileSettings> profileSettings;
|
||||
};
|
||||
|
|
|
@ -273,17 +273,18 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
|||
});
|
||||
gamescopeButtonLayout->addWidget(gamescopeLabel);
|
||||
|
||||
auto gamescopeCfg = new QPushButton("Configure...");
|
||||
connect(gamescopeCfg, &QPushButton::pressed, [&] {
|
||||
configureGamescopeButton = new QPushButton("Configure...");
|
||||
connect(configureGamescopeButton, &QPushButton::pressed, [&] {
|
||||
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
|
||||
gamescopeSettingsWindow->show();
|
||||
});
|
||||
gamescopeButtonLayout->addWidget(gamescopeCfg);
|
||||
gamescopeButtonLayout->addWidget(configureGamescopeButton);
|
||||
|
||||
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
|
||||
getCurrentProfile().useGamescope = state;
|
||||
|
||||
this->core.saveSettings();
|
||||
this->reloadControls();
|
||||
});
|
||||
|
||||
useGamemode = new QCheckBox("Use Gamemode");
|
||||
|
@ -393,6 +394,11 @@ void SettingsWindow::reloadControls() {
|
|||
useEsync->setChecked(profile.useEsync);
|
||||
useGamescope->setChecked(profile.useGamescope);
|
||||
useGamemode->setChecked(profile.useGamemode);
|
||||
|
||||
useGamemode->setEnabled(core.gamemodeAvailable);
|
||||
useGamescope->setEnabled(core.gamescopeAvailable);
|
||||
|
||||
configureGamescopeButton->setEnabled(profile.useGamescope);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
|
|
|
@ -37,6 +37,7 @@ private:
|
|||
QPushButton* selectWineButton;
|
||||
QLineEdit* winePathLabel;
|
||||
QLineEdit* winePrefixDirectory;
|
||||
QPushButton* configureGamescopeButton;
|
||||
|
||||
QCheckBox* useGamescope, *useEsync, *useGamemode;
|
||||
QCheckBox* enableWatchdog;
|
||||
|
|
Loading…
Add table
Reference in a new issue