mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-23 04:57:44 +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() {
|
void LauncherCore::readInitialInformation() {
|
||||||
defaultProfileIndex = settings.value("defaultProfile", 0).toInt();
|
defaultProfileIndex = settings.value("defaultProfile", 0).toInt();
|
||||||
|
|
||||||
|
gamescopeAvailable = checkIfInPath("gamescope");
|
||||||
|
gamemodeAvailable = checkIfInPath("gamemoderun");
|
||||||
|
|
||||||
auto profiles = settings.childGroups();
|
auto profiles = settings.childGroups();
|
||||||
|
|
||||||
// create the Default profile if it doesnt exist
|
// create the Default profile if it doesnt exist
|
||||||
|
@ -348,8 +351,13 @@ void LauncherCore::readInitialInformation() {
|
||||||
|
|
||||||
profile.useDX9 = settings.value("useDX9", false).toBool();
|
profile.useDX9 = settings.value("useDX9", false).toBool();
|
||||||
profile.useEsync = settings.value("useEsync", false).toBool();
|
profile.useEsync = settings.value("useEsync", false).toBool();
|
||||||
profile.useGamemode = settings.value("useGamemode", false).toBool();
|
|
||||||
|
if(gamescopeAvailable)
|
||||||
profile.useGamescope = settings.value("useGamescope", false).toBool();
|
profile.useGamescope = settings.value("useGamescope", false).toBool();
|
||||||
|
|
||||||
|
if(gamemodeAvailable)
|
||||||
|
profile.useGamemode = settings.value("useGamemode", false).toBool();
|
||||||
|
|
||||||
profile.enableDXVKhud = settings.value("enableDXVKhud", false).toBool();
|
profile.enableDXVKhud = settings.value("enableDXVKhud", false).toBool();
|
||||||
profile.enableWatchdog = settings.value("enableWatchdog", 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++)
|
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))));
|
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 addProfile();
|
||||||
int deleteProfile(QString name);
|
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, QStringList args);
|
||||||
void launchExecutable(const ProfileSettings& settings, QProcess* process, QStringList args);
|
void launchExecutable(const ProfileSettings& settings, QProcess* process, QStringList args);
|
||||||
void buildRequest(QNetworkRequest& request);
|
void buildRequest(QNetworkRequest& request);
|
||||||
|
@ -109,12 +109,16 @@ public:
|
||||||
AssetUpdater* assetUpdater;
|
AssetUpdater* assetUpdater;
|
||||||
Watchdog* watchdog;
|
Watchdog* watchdog;
|
||||||
|
|
||||||
|
bool gamescopeAvailable = false;
|
||||||
|
bool gamemodeAvailable = false;
|
||||||
|
|
||||||
int defaultProfileIndex = 0;
|
int defaultProfileIndex = 0;
|
||||||
signals:
|
signals:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readExpansionVersions(ProfileSettings& info, int max);
|
void readExpansionVersions(ProfileSettings& info, int max);
|
||||||
|
bool checkIfInPath(QString program);
|
||||||
|
|
||||||
QVector<ProfileSettings> profileSettings;
|
QVector<ProfileSettings> profileSettings;
|
||||||
};
|
};
|
||||||
|
|
|
@ -273,17 +273,18 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
||||||
});
|
});
|
||||||
gamescopeButtonLayout->addWidget(gamescopeLabel);
|
gamescopeButtonLayout->addWidget(gamescopeLabel);
|
||||||
|
|
||||||
auto gamescopeCfg = new QPushButton("Configure...");
|
configureGamescopeButton = new QPushButton("Configure...");
|
||||||
connect(gamescopeCfg, &QPushButton::pressed, [&] {
|
connect(configureGamescopeButton, &QPushButton::pressed, [&] {
|
||||||
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
|
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
|
||||||
gamescopeSettingsWindow->show();
|
gamescopeSettingsWindow->show();
|
||||||
});
|
});
|
||||||
gamescopeButtonLayout->addWidget(gamescopeCfg);
|
gamescopeButtonLayout->addWidget(configureGamescopeButton);
|
||||||
|
|
||||||
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
|
connect(useGamescope, &QCheckBox::stateChanged, [this](int state) {
|
||||||
getCurrentProfile().useGamescope = state;
|
getCurrentProfile().useGamescope = state;
|
||||||
|
|
||||||
this->core.saveSettings();
|
this->core.saveSettings();
|
||||||
|
this->reloadControls();
|
||||||
});
|
});
|
||||||
|
|
||||||
useGamemode = new QCheckBox("Use Gamemode");
|
useGamemode = new QCheckBox("Use Gamemode");
|
||||||
|
@ -393,6 +394,11 @@ void SettingsWindow::reloadControls() {
|
||||||
useEsync->setChecked(profile.useEsync);
|
useEsync->setChecked(profile.useEsync);
|
||||||
useGamescope->setChecked(profile.useGamescope);
|
useGamescope->setChecked(profile.useGamescope);
|
||||||
useGamemode->setChecked(profile.useGamemode);
|
useGamemode->setChecked(profile.useGamemode);
|
||||||
|
|
||||||
|
useGamemode->setEnabled(core.gamemodeAvailable);
|
||||||
|
useGamescope->setEnabled(core.gamescopeAvailable);
|
||||||
|
|
||||||
|
configureGamescopeButton->setEnabled(profile.useGamescope);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_WATCHDOG
|
#ifdef ENABLE_WATCHDOG
|
||||||
|
|
|
@ -37,6 +37,7 @@ private:
|
||||||
QPushButton* selectWineButton;
|
QPushButton* selectWineButton;
|
||||||
QLineEdit* winePathLabel;
|
QLineEdit* winePathLabel;
|
||||||
QLineEdit* winePrefixDirectory;
|
QLineEdit* winePrefixDirectory;
|
||||||
|
QPushButton* configureGamescopeButton;
|
||||||
|
|
||||||
QCheckBox* useGamescope, *useEsync, *useGamemode;
|
QCheckBox* useGamescope, *useEsync, *useGamemode;
|
||||||
QCheckBox* enableWatchdog;
|
QCheckBox* enableWatchdog;
|
||||||
|
|
Loading…
Add table
Reference in a new issue