From 5b8fde48ee589297ee5d3efa0891e8930bd304a9 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 24 Feb 2022 08:27:25 -0500 Subject: [PATCH] Properly save gamescope settings when changed --- src/gamescopesettingswindow.cpp | 12 +++++++++++- src/gamescopesettingswindow.h | 2 +- src/settingswindow.cpp | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gamescopesettingswindow.cpp b/src/gamescopesettingswindow.cpp index 9da1175..0c5fb58 100644 --- a/src/gamescopesettingswindow.cpp +++ b/src/gamescopesettingswindow.cpp @@ -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::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::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::of(&QSpinBox::valueChanged), [&](int value) { settings.gamescope.refreshRate = value; + + core.saveSettings(); }); mainLayout->addRow("Refresh Rate", refreshRateBox); } \ No newline at end of file diff --git a/src/gamescopesettingswindow.h b/src/gamescopesettingswindow.h index 4dd822b..7a96f30 100644 --- a/src/gamescopesettingswindow.h +++ b/src/gamescopesettingswindow.h @@ -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); }; diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index ebec801..389ff23 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -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);