summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp
diff options
context:
space:
mode:
authorTryTwo <taolas@gmail.com>2024-09-17 23:29:13 -0700
committerJosJuice <josjuice@gmail.com>2024-12-07 16:31:34 +0100
commit08df9a66e03acb614dca6d1c118818f84f1cbcfd (patch)
treec8f1e1c18b24ec4e4aaa50e572a78776aac37092 /Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp
parent0a84d93a8e64d946405b0e17edd1a29ccfac0606 (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/ConfigInteger.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp
index c8c3e5074a..ba85e64617 100644
--- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp
+++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp
@@ -3,33 +3,23 @@
#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)
+ : ConfigControl(setting.GetLocation()), 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));
}