mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
1a2a99c9b3
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.
37 lines
957 B
C++
37 lines
957 B
C++
// 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);
|
|
}
|