summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
new file mode 100644
index 0000000000..98977dfdc9
--- /dev/null
+++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
@@ -0,0 +1,34 @@
+// Copyright 2018 Dolphin Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#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)
+{
+ 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);
+
+ const QSignalBlocker blocker(this);
+ setChecked(Config::Get(m_setting) == m_value);
+ });
+}
+
+void ConfigRadioInt::Update()
+{
+ if (!isChecked())
+ return;
+
+ Config::SetBaseOrCurrent(m_setting, m_value);
+}