Debian Codegraph @

Source/Core/DolphinQt/Config/ConfigControls/ConfigSlider.h

raw symbols SCIP
1 // Copyright 2017 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <vector>
7
8 #include <QLabel>
9 #include <QPointer>
10
11 #include "DolphinQt/Config/ConfigControls/ConfigControl.h"
12 #include "DolphinQt/Config/ToolTipControls/ToolTipSlider.h"
13
14 #include "Common/CommonTypes.h"
15 #include "Common/Config/ConfigInfo.h"
16
17 class ConfigSlider final : public ConfigControl<ToolTipSlider>
18 {
19 Q_OBJECT
20 public:
21 ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, int tick = 0);
22 ConfigSlider(int minimum, int maximum, const Config::Info<int>& setting, Config::Layer* layer,
23 int tick = 0);
24
25 // Generates a slider with tick_values.size() ticks. Each tick corresponds to the integer at that
26 // index in the vector.
27 ConfigSlider(std::vector<int> tick_values, const Config::Info<int>& setting,
28 Config::Layer* layer);
29
30 void Update(int value);
31
32 protected:
33 void OnConfigChanged() override;
34
35 private:
36 const Config::Info<int> m_setting;
37
38 // Mappings for slider ticks to config values. Identity mapping is assumed if this is empty.
39 std::vector<int> m_tick_values;
40 };
41
42 class ConfigSliderU32 final : public ConfigControl<ToolTipSlider>
43 {
44 Q_OBJECT
45 public:
46 ConfigSliderU32(u32 minimum, u32 maximum, const Config::Info<u32>& setting, u32 scale = 1);
47 ConfigSliderU32(u32 minimum, u32 maximum, const Config::Info<u32>& setting, Config ::Layer* layer,
48 u32 scale = 1);
49
50 void Update(u32 value);
51
52 protected:
53 void OnConfigChanged() override;
54
55 private:
56 const Config::Info<u32> m_setting;
57
58 u32 m_scale = 1;
59 };
60
61 class ConfigSliderLabel final : public QLabel
62 {
63 Q_OBJECT
64
65 public:
66 ConfigSliderLabel(const QString& text, ConfigSlider* slider);
67
68 private:
69 QPointer<ConfigSlider> m_slider;
70 };