dolphin/Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp
TryTwo 08df9a66e0 DolphinQt: Refactor, add ConfigControl class
This reduces code duplication in the different ConfigControls. This is
helpful for the next commit, which will modify the now deduplicated
code.
2024-12-07 16:31:34 +01:00

25 lines
645 B
C++

// Copyright 2019 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "DolphinQt/Config/ConfigControls/ConfigInteger.h"
ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step)
: ConfigControl(setting.GetLocation()), m_setting(setting)
{
setMinimum(minimum);
setMaximum(maximum);
setSingleStep(step);
setValue(ReadValue(setting));
connect(this, &ConfigInteger::valueChanged, this, &ConfigInteger::Update);
}
void ConfigInteger::Update(int value)
{
SaveValue(m_setting, value);
}
void ConfigInteger::OnConfigChanged()
{
setValue(ReadValue(m_setting));
}