2023-05-09 06:36:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
2023-05-09 03:37:03 +01:00
|
|
|
#include "yuzu/configuration/configuration_shared.h"
|
|
|
|
#include "yuzu/configuration/shared_translation.h"
|
|
|
|
|
|
|
|
class QPushButton;
|
2023-05-09 20:46:07 +01:00
|
|
|
class QSpinBox;
|
2023-05-09 03:37:03 +01:00
|
|
|
class QComboBox;
|
|
|
|
class QLineEdit;
|
|
|
|
class QSlider;
|
|
|
|
class QCheckBox;
|
2023-05-10 22:57:25 +01:00
|
|
|
class QDateTimeEdit;
|
2023-05-09 03:37:03 +01:00
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
class BasicSetting;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ConfigurationShared {
|
|
|
|
|
|
|
|
enum class RequestType {
|
|
|
|
Default,
|
|
|
|
ComboBox,
|
|
|
|
SpinBox,
|
|
|
|
Slider,
|
|
|
|
ReverseSlider,
|
|
|
|
LineEdit,
|
2023-05-10 22:57:25 +01:00
|
|
|
HexEdit,
|
|
|
|
DateTimeEdit,
|
2023-05-09 03:37:03 +01:00
|
|
|
MaxEnum,
|
|
|
|
};
|
|
|
|
|
|
|
|
class Widget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Widget(Settings::BasicSetting* setting, const TranslationMap& 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,
|
2023-05-10 22:57:25 +01:00
|
|
|
Settings::BasicSetting* other_setting = nullptr, const std::string& format = "");
|
2023-05-09 03:37:03 +01:00
|
|
|
virtual ~Widget();
|
|
|
|
|
|
|
|
bool Valid();
|
|
|
|
|
2023-05-09 19:26:03 +01:00
|
|
|
[[nodiscard]] static QPushButton* CreateRestoreGlobalButton(Settings::BasicSetting& setting,
|
|
|
|
QWidget* parent);
|
|
|
|
|
2023-05-09 03:37:03 +01:00
|
|
|
QPushButton* restore_button{};
|
|
|
|
QLineEdit* line_edit{};
|
2023-05-09 20:46:07 +01:00
|
|
|
QSpinBox* spinbox{};
|
2023-05-09 03:37:03 +01:00
|
|
|
QCheckBox* checkbox{};
|
|
|
|
QSlider* slider{};
|
|
|
|
QComboBox* combobox{};
|
2023-05-10 22:57:25 +01:00
|
|
|
QDateTimeEdit* date_time_edit{};
|
2023-05-09 03:37:03 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void CreateCheckBox(const QString& label, std::function<void()>& load_func);
|
2023-05-09 21:36:09 +01:00
|
|
|
void CreateCheckBoxWithLineEdit(const QString& label, Settings::BasicSetting* other_setting,
|
2023-05-09 03:37:03 +01:00
|
|
|
std::function<void()>& load_func);
|
2023-05-10 22:57:25 +01:00
|
|
|
void CreateCheckBoxWithHexEdit(const QString& label, Settings::BasicSetting* other_setting,
|
|
|
|
std::function<void()>& load_func);
|
2023-05-09 21:36:09 +01:00
|
|
|
void CreateCheckBoxWithSpinBox(const QString& label, Settings::BasicSetting* other_setting,
|
2023-05-10 22:57:25 +01:00
|
|
|
std::function<void()>& load_func, const std::string& suffix);
|
|
|
|
void CreateCheckBoxWithDateTimeEdit(const QString& label, Settings::BasicSetting* other_setting,
|
|
|
|
std::function<void()>& load_func);
|
2023-05-09 03:37:03 +01:00
|
|
|
void CreateCombobox(const QString& label, bool managed, std::function<void()>& load_func);
|
|
|
|
void CreateLineEdit(const QString& label, bool managed, std::function<void()>& load_func);
|
|
|
|
void CreateSlider(const QString& label, bool reversed, float multiplier,
|
|
|
|
std::function<void()>& load_func);
|
|
|
|
|
|
|
|
QWidget* parent;
|
|
|
|
const TranslationMap& translations;
|
|
|
|
Settings::BasicSetting& setting;
|
|
|
|
|
|
|
|
bool created{false};
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ConfigurationShared
|