diff options
| author | TryTwo <taolas@gmail.com> | 2024-09-17 23:29:13 -0700 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2024-12-07 16:31:34 +0100 |
| commit | 08df9a66e03acb614dca6d1c118818f84f1cbcfd (patch) | |
| tree | c8f1e1c18b24ec4e4aaa50e572a78776aac37092 /Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp | |
| parent | 0a84d93a8e64d946405b0e17edd1a29ccfac0606 (diff) | |
DolphinQt: Refactor, add ConfigControl class
This reduces code duplication in the different ConfigControls. This is
helpful for the next commit, which will modify the now deduplicated
code.
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp index 11a049d910..baaf7e6f48 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp @@ -3,33 +3,20 @@ #include "DolphinQt/Config/ConfigControls/ConfigRadio.h" -#include <QSignalBlocker> - -#include "Common/Config/Config.h" - -#include "DolphinQt/Settings.h" - ConfigRadioInt::ConfigRadioInt(const QString& label, const Config::Info<int>& setting, int value) - : ToolTipRadioButton(label), m_setting(setting), m_value(value) + : ConfigControl(label, setting.GetLocation()), m_setting(setting), m_value(value) { - setChecked(Config::Get(m_setting) == m_value); - connect(this, &QRadioButton::toggled, this, &ConfigRadioInt::Update); - - connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] { - QFont bf = font(); - bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base); - setFont(bf); + setChecked(ReadValue(setting) == value); - const QSignalBlocker blocker(this); - setChecked(Config::Get(m_setting) == m_value); - }); + connect(this, &QRadioButton::toggled, this, &ConfigRadioInt::Update); } void ConfigRadioInt::Update() { if (isChecked()) { - Config::SetBaseOrCurrent(m_setting, m_value); + SaveValue(m_setting, m_value); + emit OnSelected(m_value); } else @@ -37,3 +24,8 @@ void ConfigRadioInt::Update() emit OnDeselected(m_value); } } + +void ConfigRadioInt::OnConfigChanged() +{ + setChecked(ReadValue(m_setting) == m_value); +} |
