diff options
| author | JosJuice <josjuice@gmail.com> | 2024-12-22 20:42:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-22 20:42:28 +0100 |
| commit | 5641b83d4ee5775dc244db0007dea582b559893e (patch) | |
| tree | f18bf153dbe039e3f4892f3807c6d0885518432c /Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp | |
| parent | bb8c0a795f35490c5959aade4ea0abb430d4edc8 (diff) | |
| parent | 9541bb6cf7f966cc9fefaaa4ef2bc4d45babed22 (diff) | |
Merge pull request #13063 from TryTwo/PR_GameSettings
Add ability to edit game-specific GFX settings from game properties tab.
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp index c8c3e5074a..a81bfd7aed 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp @@ -3,33 +3,39 @@ #include "DolphinQt/Config/ConfigControls/ConfigInteger.h" -#include <QSignalBlocker> - -#include "Common/Config/Config.h" - -#include "DolphinQt/Settings.h" - ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step) - : ToolTipSpinBox(), m_setting(setting) + : ConfigInteger(minimum, maximum, setting, nullptr, step) +{ +} + +ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, + Config::Layer* layer, int step) + : ConfigControl(setting.GetLocation(), layer), m_setting(setting) { setMinimum(minimum); setMaximum(maximum); setSingleStep(step); - - setValue(Config::Get(setting)); + setValue(ReadValue(setting)); connect(this, &ConfigInteger::valueChanged, this, &ConfigInteger::Update); - connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] { - QFont bf = font(); - bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base); - setFont(bf); - - const QSignalBlocker blocker(this); - setValue(Config::Get(m_setting)); - }); } void ConfigInteger::Update(int value) { - Config::SetBaseOrCurrent(m_setting, value); + SaveValue(m_setting, value); +} + +void ConfigInteger::OnConfigChanged() +{ + setValue(ReadValue(m_setting)); +} + +ConfigIntegerLabel::ConfigIntegerLabel(const QString& text, ConfigInteger* widget) + : QLabel(text), m_widget(QPointer<ConfigInteger>(widget)) +{ + connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this]() { + // Label shares font changes with ConfigInteger to mark game ini settings. + if (m_widget) + setFont(m_widget->font()); + }); } |
