2023-05-09 05:36:05 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-05-09 02:37:03 +00:00
|
|
|
#include "yuzu/configuration/configuration_shared.h"
|
|
|
|
#include "yuzu/configuration/shared_translation.h"
|
|
|
|
|
|
|
|
class QPushButton;
|
2023-05-09 19:46:07 +00:00
|
|
|
class QSpinBox;
|
2023-05-09 02:37:03 +00:00
|
|
|
class QComboBox;
|
|
|
|
class QLineEdit;
|
|
|
|
class QSlider;
|
|
|
|
class QCheckBox;
|
2023-06-09 20:53:26 +00:00
|
|
|
class QLabel;
|
|
|
|
class QHBoxLayout;
|
2023-05-10 21:57:25 +00:00
|
|
|
class QDateTimeEdit;
|
2023-05-09 02:37:03 +00:00
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
class BasicSetting;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ConfigurationShared {
|
|
|
|
|
|
|
|
enum class RequestType {
|
|
|
|
Default,
|
|
|
|
ComboBox,
|
|
|
|
SpinBox,
|
|
|
|
Slider,
|
|
|
|
ReverseSlider,
|
|
|
|
LineEdit,
|
2023-05-10 21:57:25 +00:00
|
|
|
HexEdit,
|
|
|
|
DateTimeEdit,
|
2023-05-09 02:37:03 +00:00
|
|
|
MaxEnum,
|
|
|
|
};
|
|
|
|
|
|
|
|
class Widget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-05-19 02:17:36 +00:00
|
|
|
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_,
|
2023-05-09 02:37:03 +00:00
|
|
|
RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f,
|
2023-05-18 21:54:22 +00:00
|
|
|
Settings::BasicSetting* other_setting = nullptr,
|
|
|
|
const QString& string = QStringLiteral(""));
|
2023-05-09 02:37:03 +00:00
|
|
|
virtual ~Widget();
|
|
|
|
|
2023-06-06 19:45:44 +00:00
|
|
|
bool Valid() const;
|
2023-05-09 02:37:03 +00:00
|
|
|
|
2023-05-18 21:54:22 +00:00
|
|
|
[[nodiscard]] static QPushButton* CreateRestoreGlobalButton(bool using_global, QWidget* parent);
|
2023-05-09 18:26:03 +00:00
|
|
|
|
2023-05-09 02:37:03 +00:00
|
|
|
QPushButton* restore_button{};
|
|
|
|
QLineEdit* line_edit{};
|
2023-05-09 19:46:07 +00:00
|
|
|
QSpinBox* spinbox{};
|
2023-05-09 02:37:03 +00:00
|
|
|
QCheckBox* checkbox{};
|
|
|
|
QSlider* slider{};
|
|
|
|
QComboBox* combobox{};
|
2023-05-10 21:57:25 +00:00
|
|
|
QDateTimeEdit* date_time_edit{};
|
2023-05-09 02:37:03 +00:00
|
|
|
|
|
|
|
private:
|
2023-06-06 19:45:44 +00:00
|
|
|
void SetupComponent(const QString& label, std::function<void()>& load_func, bool managed,
|
|
|
|
RequestType request, Settings::BasicSetting* other_setting);
|
|
|
|
|
2023-06-09 20:53:26 +00:00
|
|
|
QLabel* CreateLabel(const QString& text);
|
|
|
|
QHBoxLayout* CreateCheckBox(Settings::BasicSetting* bool_setting, const QString& label,
|
|
|
|
std::function<void()>& load_func, bool managed);
|
|
|
|
|
2023-06-06 19:45:44 +00:00
|
|
|
QWidget* CreateCombobox(std::function<std::string()>& serializer,
|
|
|
|
std::function<void()>& restore_func,
|
|
|
|
const std::function<void()>& touched);
|
2023-06-09 20:53:26 +00:00
|
|
|
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);
|
2023-05-09 02:37:03 +00:00
|
|
|
void CreateSlider(const QString& label, bool reversed, float multiplier,
|
2023-05-18 21:54:22 +00:00
|
|
|
std::function<void()>& load_func, bool managed, const QString& format,
|
2023-06-09 20:53:26 +00:00
|
|
|
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,
|
2023-05-18 21:54:22 +00:00
|
|
|
const QString& suffix, Settings::BasicSetting* other_setting = nullptr);
|
2023-05-09 02:37:03 +00:00
|
|
|
|
|
|
|
QWidget* parent;
|
|
|
|
const TranslationMap& translations;
|
2023-05-19 02:17:36 +00:00
|
|
|
const ComboboxTranslationMap& combobox_enumerations;
|
2023-05-09 02:37:03 +00:00
|
|
|
Settings::BasicSetting& setting;
|
2023-06-09 20:53:26 +00:00
|
|
|
std::forward_list<std::function<void(bool)>>& apply_funcs;
|
2023-05-09 02:37:03 +00:00
|
|
|
|
|
|
|
bool created{false};
|
2023-05-18 21:54:22 +00:00
|
|
|
bool runtime_lock{false};
|
2023-05-09 02:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ConfigurationShared
|