summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp42
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());
+ });
}