Debian Codegraph @

Source/Core/DolphinQt/Config/ConfigControls/ConfigInteger.cpp

raw symbols SCIP
1 // Copyright 2019 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #include "DolphinQt/Config/ConfigControls/ConfigInteger.h"
5
6 ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting, int step)
7 : ConfigInteger(minimum, maximum, setting, nullptr, step)
8 {
9 }
10
11 ConfigInteger::ConfigInteger(int minimum, int maximum, const Config::Info<int>& setting,
12 Config::Layer* layer, int step)
13 : ConfigControl(setting.GetLocation(), layer), m_setting(setting)
14 {
15 setMinimum(minimum);
16 setMaximum(maximum);
17 setSingleStep(step);
18 setValue(ReadValue(setting));
19
20 connect(this, &ConfigInteger::valueChanged, this, &ConfigInteger::Update);
21 }
22
23 void ConfigInteger::Update(int value)
24 {
25 SaveValue(m_setting, value);
26 }
27
28 void ConfigInteger::OnConfigChanged()
29 {
30 setValue(ReadValue(m_setting));
31 }
32
33 ConfigIntegerLabel::ConfigIntegerLabel(const QString& text, ConfigInteger* widget)
34 : QLabel(text), m_widget(QPointer<ConfigInteger>(widget))
35 {
36 connect(&Settings::Instance(), &Settings::ConfigChanged, this, [this] {
37 // Label shares font changes with ConfigInteger to mark game ini settings.
38 if (m_widget)
39 setFont(m_widget->font());
40 });
41 }