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
|
|
|
|
|
|
|
#include "DolphinQt/Config/Graphics/GraphicsInteger.h"
|
|
|
|
|
|
|
|
#include <QSignalBlocker>
|
|
|
|
|
|
|
|
#include "Common/Config/Config.h"
|
|
|
|
|
|
|
|
#include "DolphinQt/Settings.h"
|
|
|
|
|
2020-05-02 12:39:40 +00:00
|
|
|
GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::Info<int>& setting,
|
2019-07-17 18:15:25 +00:00
|
|
|
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));
|
|
|
|
|
2019-07-30 13:35:46 +00:00
|
|
|
connect(this, qOverload<int>(&GraphicsInteger::valueChanged), this, &GraphicsInteger::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));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void GraphicsInteger::Update(int value)
|
|
|
|
{
|
|
|
|
Config::SetBaseOrCurrent(m_setting, value);
|
|
|
|
}
|