diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2018-07-07 00:40:15 +0200 |
|---|---|---|
| committer | spycrab <spycrab@users.noreply.github.com> | 2018-07-07 00:48:38 +0200 |
| commit | 13ba24c5a6795532c8893eccf2a21ae95682e1b7 (patch) | |
| tree | 747e394036c189c46add1b3e1451e50f48230e11 /Source/Core/DolphinQt/Config/Graphics/GraphicsSlider.cpp | |
| parent | 059880bb1640d5a3b0e1fbbf66e1a356df4b9f41 (diff) | |
Move DolphinQt2 to DolphinQt
Diffstat (limited to 'Source/Core/DolphinQt/Config/Graphics/GraphicsSlider.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/Graphics/GraphicsSlider.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsSlider.cpp b/Source/Core/DolphinQt/Config/Graphics/GraphicsSlider.cpp new file mode 100644 index 0000000000..6f4aaddec0 --- /dev/null +++ b/Source/Core/DolphinQt/Config/Graphics/GraphicsSlider.cpp @@ -0,0 +1,37 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt/Config/Graphics/GraphicsSlider.h" + +#include "Common/Config/Config.h" + +#include "DolphinQt/Settings.h" + +GraphicsSlider::GraphicsSlider(int minimum, int maximum, const Config::ConfigInfo<int>& setting, + int tick) + : QSlider(Qt::Horizontal), m_setting(setting) +{ + setMinimum(minimum); + setMaximum(maximum); + setTickInterval(tick); + + setValue(Config::Get(setting)); + + connect(this, &GraphicsSlider::valueChanged, this, &GraphicsSlider::Update); + + connect(&Settings::Instance(), &Settings::ConfigChanged, [this] { + QFont bf = font(); + bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base); + setFont(bf); + + bool old = blockSignals(true); + setValue(Config::Get(m_setting)); + blockSignals(old); + }); +} + +void GraphicsSlider::Update(int value) +{ + Config::SetBaseOrCurrent(m_setting, value); +} |
