mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 06:29:00 +01:00
![TryTwo](/assets/img/avatar_default.png)
This reduces code duplication in the different ConfigControls. This is helpful for the next commit, which will modify the now deduplicated code.
27 lines
657 B
C++
27 lines
657 B
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "DolphinQt/Config/ConfigControls/ConfigSlider.h"
|
|
|
|
ConfigSlider::ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick)
|
|
: ConfigControl(Qt::Horizontal, setting.GetLocation()), m_setting(setting)
|
|
|
|
{
|
|
setMinimum(minimum);
|
|
setMaximum(maximum);
|
|
setTickInterval(tick);
|
|
setValue(ReadValue(setting));
|
|
|
|
connect(this, &ConfigSlider::valueChanged, this, &ConfigSlider::Update);
|
|
}
|
|
|
|
void ConfigSlider::Update(int value)
|
|
{
|
|
SaveValue(m_setting, value);
|
|
}
|
|
|
|
void ConfigSlider::OnConfigChanged()
|
|
{
|
|
setValue(ReadValue(m_setting));
|
|
}
|