summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2024-12-22 20:42:28 +0100
committerGitHub <noreply@github.com>2024-12-22 20:42:28 +0100
commit5641b83d4ee5775dc244db0007dea582b559893e (patch)
treef18bf153dbe039e3f4892f3807c6d0885518432c /Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
parentbb8c0a795f35490c5959aade4ea0abb430d4edc8 (diff)
parent9541bb6cf7f966cc9fefaaa4ef2bc4d45babed22 (diff)
Merge pull request #13063 from TryTwo/PR_GameSettings
Add ability to edit game-specific GFX settings from game properties tab.
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
index 89ab9c15be..4fad525e6f 100644
--- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
+++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigBool.cpp
@@ -3,31 +3,28 @@
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
-#include <QEvent>
-#include <QFont>
-#include <QSignalBlocker>
-
-#include "Common/Config/Config.h"
-
-#include "DolphinQt/Settings.h"
-
ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting, bool reverse)
- : ToolTipCheckBox(label), m_setting(setting), m_reverse(reverse)
+ : ConfigBool(label, setting, nullptr, reverse)
{
- connect(this, &QCheckBox::toggled, this, &ConfigBool::Update);
- setChecked(Config::Get(m_setting) ^ reverse);
+}
- connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
- QFont bf = font();
- bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
- setFont(bf);
+ConfigBool::ConfigBool(const QString& label, const Config::Info<bool>& setting,
+ Config::Layer* layer, bool reverse)
+ : ConfigControl(label, setting.GetLocation(), layer), m_setting(setting), m_reverse(reverse)
+{
+ setChecked(ReadValue(setting) ^ reverse);
- const QSignalBlocker blocker(this);
- setChecked(Config::Get(m_setting) ^ m_reverse);
- });
+ connect(this, &QCheckBox::toggled, this, &ConfigBool::Update);
}
void ConfigBool::Update()
{
- Config::SetBaseOrCurrent(m_setting, static_cast<bool>(isChecked() ^ m_reverse));
+ const bool value = static_cast<bool>(isChecked() ^ m_reverse);
+
+ SaveValue(m_setting, value);
+}
+
+void ConfigBool::OnConfigChanged()
+{
+ setChecked(ReadValue(m_setting) ^ m_reverse);
}