diff options
| author | Dentomologist <dentomologist@gmail.com> | 2023-04-28 20:11:55 -0700 |
|---|---|---|
| committer | Dentomologist <dentomologist@gmail.com> | 2023-04-28 20:14:11 -0700 |
| commit | 1a2a99c9b3b4878dc8e212e80d1317706961eac3 (patch) | |
| tree | 05d3cc68b6a8ce2f1b75991cec2f827cff706a68 /Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp | |
| parent | 8e6e6f3c4ac691f3db9c045945a61ecf271afdd7 (diff) | |
Qt: Rename GraphicsSlider to ConfigSlider
GraphicsSlider is used by the panes in the Graphics config window to
create sliders that change their associated config setting, and update
their own state when something else changes the config setting.
Despite its current name nothing about this class is particular to the
Graphics window, so renaming it to ConfigSlider better reflects its
purpose. This should also make it less confusing when ConfigSliders are
added to other config panes.
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp new file mode 100644 index 0000000000..9732909edc --- /dev/null +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.cpp @@ -0,0 +1,36 @@ +// Copyright 2017 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "DolphinQt/Config/ConfigControls/ConfigSlider.h" + +#include <QSignalBlocker> + +#include "Common/Config/Config.h" + +#include "DolphinQt/Settings.h" + +ConfigSlider::ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick) + : ToolTipSlider(Qt::Horizontal), m_setting(setting) +{ + setMinimum(minimum); + setMaximum(maximum); + setTickInterval(tick); + + setValue(Config::Get(setting)); + + connect(this, &ConfigSlider::valueChanged, this, &ConfigSlider::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 ConfigSlider::Update(int value) +{ + Config::SetBaseOrCurrent(m_setting, value); +} |
