summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
diff options
context:
space:
mode:
authorMai <mai.iam2048@gmail.com>2023-04-28 12:42:16 -0400
committerGitHub <noreply@github.com>2023-04-28 12:42:16 -0400
commit8e6e6f3c4ac691f3db9c045945a61ecf271afdd7 (patch)
treedb6c125775d7e4cb9a7ba9fcb3b6e098f4cfd3bb /Source/Core/DolphinQt/Config/ConfigControls/ConfigRadio.cpp
parent88320f385de7c79f90df88ab97ea9436a78a50aa (diff)
parenta7abd7dba0221c786d5d3031f61ecf8583daca7f (diff)
Merge pull request #11800 from Dentomologist/rename_graphicsradioint_to_configradioint
Qt: Rename GraphicsRadioInt to ConfigRadioInt
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);
+}