1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00

Properly save gamescope settings when changed

This commit is contained in:
Joshua Goins 2022-02-24 08:27:25 -05:00
parent 73ef1c87e2
commit 5b8fde48ee
3 changed files with 13 additions and 3 deletions

View file

@ -16,7 +16,7 @@
#include "launchercore.h"
#include "launcherwindow.h"
GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWidget* parent) : QDialog(parent) {
GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent) : QDialog(parent) {
setWindowTitle("Gamescope Settings");
setWindowModality(Qt::WindowModality::ApplicationModal);
@ -27,6 +27,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
fullscreenBox->setChecked(settings.gamescope.fullscreen);
connect(fullscreenBox, &QCheckBox::clicked, [&](bool checked) {
settings.gamescope.fullscreen = checked;
core.saveSettings();
});
mainLayout->addWidget(fullscreenBox);
@ -34,6 +36,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
borderlessBox->setChecked(settings.gamescope.fullscreen);
connect(borderlessBox, &QCheckBox::clicked, [&](bool checked) {
settings.gamescope.borderless = checked;
core.saveSettings();
});
mainLayout->addWidget(borderlessBox);
@ -42,6 +46,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
widthBox->setSpecialValueText("Default");
connect(widthBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
settings.gamescope.width = value;
core.saveSettings();
});
mainLayout->addRow("Width", widthBox);
@ -50,6 +56,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
heightBox->setSpecialValueText("Default");
connect(heightBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
settings.gamescope.height = value;
core.saveSettings();
});
mainLayout->addRow("Height", heightBox);
@ -58,6 +66,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
refreshRateBox->setSpecialValueText("Default");
connect(refreshRateBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
settings.gamescope.refreshRate = value;
core.saveSettings();
});
mainLayout->addRow("Refresh Rate", refreshRateBox);
}

View file

@ -14,5 +14,5 @@ struct ProfileSettings;
class GamescopeSettingsWindow : public QDialog {
public:
GamescopeSettingsWindow(ProfileSettings& settings, QWidget* parent = nullptr);
GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent = nullptr);
};

View file

@ -275,7 +275,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
auto gamescopeCfg = new QPushButton("Configure...");
connect(gamescopeCfg, &QPushButton::pressed, [&] {
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this);
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
gamescopeSettingsWindow->show();
});
gamescopeButtonLayout->addWidget(gamescopeCfg);