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:
parent
73ef1c87e2
commit
5b8fde48ee
3 changed files with 13 additions and 3 deletions
|
@ -16,7 +16,7 @@
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
#include "launcherwindow.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");
|
setWindowTitle("Gamescope Settings");
|
||||||
setWindowModality(Qt::WindowModality::ApplicationModal);
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
|
||||||
fullscreenBox->setChecked(settings.gamescope.fullscreen);
|
fullscreenBox->setChecked(settings.gamescope.fullscreen);
|
||||||
connect(fullscreenBox, &QCheckBox::clicked, [&](bool checked) {
|
connect(fullscreenBox, &QCheckBox::clicked, [&](bool checked) {
|
||||||
settings.gamescope.fullscreen = checked;
|
settings.gamescope.fullscreen = checked;
|
||||||
|
|
||||||
|
core.saveSettings();
|
||||||
});
|
});
|
||||||
mainLayout->addWidget(fullscreenBox);
|
mainLayout->addWidget(fullscreenBox);
|
||||||
|
|
||||||
|
@ -34,6 +36,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
|
||||||
borderlessBox->setChecked(settings.gamescope.fullscreen);
|
borderlessBox->setChecked(settings.gamescope.fullscreen);
|
||||||
connect(borderlessBox, &QCheckBox::clicked, [&](bool checked) {
|
connect(borderlessBox, &QCheckBox::clicked, [&](bool checked) {
|
||||||
settings.gamescope.borderless = checked;
|
settings.gamescope.borderless = checked;
|
||||||
|
|
||||||
|
core.saveSettings();
|
||||||
});
|
});
|
||||||
mainLayout->addWidget(borderlessBox);
|
mainLayout->addWidget(borderlessBox);
|
||||||
|
|
||||||
|
@ -42,6 +46,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
|
||||||
widthBox->setSpecialValueText("Default");
|
widthBox->setSpecialValueText("Default");
|
||||||
connect(widthBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(widthBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
||||||
settings.gamescope.width = value;
|
settings.gamescope.width = value;
|
||||||
|
|
||||||
|
core.saveSettings();
|
||||||
});
|
});
|
||||||
mainLayout->addRow("Width", widthBox);
|
mainLayout->addRow("Width", widthBox);
|
||||||
|
|
||||||
|
@ -50,6 +56,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
|
||||||
heightBox->setSpecialValueText("Default");
|
heightBox->setSpecialValueText("Default");
|
||||||
connect(heightBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(heightBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
||||||
settings.gamescope.height = value;
|
settings.gamescope.height = value;
|
||||||
|
|
||||||
|
core.saveSettings();
|
||||||
});
|
});
|
||||||
mainLayout->addRow("Height", heightBox);
|
mainLayout->addRow("Height", heightBox);
|
||||||
|
|
||||||
|
@ -58,6 +66,8 @@ GamescopeSettingsWindow::GamescopeSettingsWindow(ProfileSettings& settings, QWid
|
||||||
refreshRateBox->setSpecialValueText("Default");
|
refreshRateBox->setSpecialValueText("Default");
|
||||||
connect(refreshRateBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
connect(refreshRateBox, QOverload<int>::of(&QSpinBox::valueChanged), [&](int value) {
|
||||||
settings.gamescope.refreshRate = value;
|
settings.gamescope.refreshRate = value;
|
||||||
|
|
||||||
|
core.saveSettings();
|
||||||
});
|
});
|
||||||
mainLayout->addRow("Refresh Rate", refreshRateBox);
|
mainLayout->addRow("Refresh Rate", refreshRateBox);
|
||||||
}
|
}
|
|
@ -14,5 +14,5 @@ struct ProfileSettings;
|
||||||
|
|
||||||
class GamescopeSettingsWindow : public QDialog {
|
class GamescopeSettingsWindow : public QDialog {
|
||||||
public:
|
public:
|
||||||
GamescopeSettingsWindow(ProfileSettings& settings, QWidget* parent = nullptr);
|
GamescopeSettingsWindow(ProfileSettings& settings, LauncherCore& core, QWidget* parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
|
@ -275,7 +275,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
||||||
|
|
||||||
auto gamescopeCfg = new QPushButton("Configure...");
|
auto gamescopeCfg = new QPushButton("Configure...");
|
||||||
connect(gamescopeCfg, &QPushButton::pressed, [&] {
|
connect(gamescopeCfg, &QPushButton::pressed, [&] {
|
||||||
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this);
|
auto gamescopeSettingsWindow = new GamescopeSettingsWindow(getCurrentProfile(), this->core, this);
|
||||||
gamescopeSettingsWindow->show();
|
gamescopeSettingsWindow->show();
|
||||||
});
|
});
|
||||||
gamescopeButtonLayout->addWidget(gamescopeCfg);
|
gamescopeButtonLayout->addWidget(gamescopeCfg);
|
||||||
|
|
Loading…
Add table
Reference in a new issue