1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#pragma once
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/shared_translation.h"
class QPushButton;
class QSpinBox;
class QComboBox;
class QLineEdit;
class QSlider;
class QCheckBox;
class QLabel;
class QHBoxLayout;
class QDateTimeEdit;
namespace Settings {
class BasicSetting;
}
namespace ConfigurationShared {
enum class RequestType {
Default,
ComboBox,
SpinBox,
Slider,
ReverseSlider,
LineEdit,
HexEdit,
DateTimeEdit,
MaxEnum,
};
class Widget : public QWidget {
Q_OBJECT
public:
Widget(Settings::BasicSetting* setting, const TranslationMap& translations,
const ComboboxTranslationMap& combobox_translations, QWidget* parent, bool runtime_lock,
std::forward_list<std::function<void(bool)>>& apply_funcs_,
RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f,
Settings::BasicSetting* other_setting = nullptr,
const QString& string = QStringLiteral(""));
virtual ~Widget();
bool Valid() const;
[[nodiscard]] static QPushButton* CreateRestoreGlobalButton(bool using_global, QWidget* parent);
QPushButton* restore_button{};
QLineEdit* line_edit{};
QSpinBox* spinbox{};
QCheckBox* checkbox{};
QSlider* slider{};
QComboBox* combobox{};
QDateTimeEdit* date_time_edit{};
private:
void SetupComponent(const QString& label, std::function<void()>& load_func, bool managed,
RequestType request, Settings::BasicSetting* other_setting);
QLabel* CreateLabel(const QString& text);
QHBoxLayout* CreateCheckBox(Settings::BasicSetting* bool_setting, const QString& label,
std::function<void()>& load_func, bool managed);
QWidget* CreateCombobox(std::function<std::string()>& serializer,
std::function<void()>& restore_func,
const std::function<void()>& touched);
void CreateLineEdit(const QString& label, std::function<void()>& load_func, bool managed,
Settings::BasicSetting* const other_setting = nullptr);
void CreateHexEdit(const QString& label, std::function<void()>& load_func, bool managed,
Settings::BasicSetting* const other_setting = nullptr);
void CreateSlider(const QString& label, bool reversed, float multiplier,
std::function<void()>& load_func, bool managed, const QString& format,
Settings::BasicSetting* const other_setting = nullptr);
void CreateDateTimeEdit(const QString& label, std::function<void()>& load_func, bool managed,
bool restrict, Settings::BasicSetting* const other_setting = nullptr);
void CreateSpinBox(const QString& label, std::function<void()>& load_func, bool managed,
const QString& suffix, Settings::BasicSetting* other_setting = nullptr);
QWidget* parent;
const TranslationMap& translations;
const ComboboxTranslationMap& combobox_enumerations;
Settings::BasicSetting& setting;
std::forward_list<std::function<void(bool)>>& apply_funcs;
bool created{false};
bool runtime_lock{false};
};
} // namespace ConfigurationShared
|