2019-07-17 18:15:25 +00:00
|
|
|
// Copyright 2019 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-07-17 18:15:25 +00:00
|
|
|
|
2023-04-29 02:41:09 +00:00
|
|
|
#include "DolphinQt/Config/ConfigControls/ConfigInteger.h"
|
2019-07-17 18:15:25 +00:00
|
|
|
|
|
|
|
#include <QSignalBlocker>
|
|
|
|
|
|
|
|
#include "Common/Config/Config.h"
|
|
|
|
|
|
|
|
#include "DolphinQt/Settings.h"
|
|
|
|
|
2023-04-29 02:41:09 +00:00
|
|
|
ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step)
|
2020-10-17 05:05:43 +00:00
|
|
|
: ToolTipSpinBox(), m_setting(setting)
|
2019-07-17 18:15:25 +00:00
|
|
|
{
|
|
|
|
setMinimum(minimum);
|
|
|
|
setMaximum(maximum);
|
|
|
|
setSingleStep(step);
|
|
|
|
|
|
|
|
setValue(Config::Get(setting));
|
|
|
|
|
2023-11-04 21:01:39 +00:00
|
|
|
connect(this, &ConfigInteger::valueChanged, this, &ConfigInteger::Update);
|
2020-09-12 22:06:17 +00:00
|
|
|
connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
|
2019-07-17 18:15:25 +00:00
|
|
|
QFont bf = font();
|
|
|
|
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);
|
|
|
|
setFont(bf);
|
|
|
|
|
|
|
|
const QSignalBlocker blocker(this);
|
|
|
|
setValue(Config::Get(m_setting));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-04-29 02:41:09 +00:00
|
|
|
void ConfigInteger::Update(int value)
|
2019-07-17 18:15:25 +00:00
|
|
|
{
|
|
|
|
Config::SetBaseOrCurrent(m_setting, value);
|
|
|
|
}
|