mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 04:17:56 -05:00
configuration: Move CreateWidget to a class
We were passing so many objects between the function and the caller that it needed to be redesigned.
This commit is contained in:
64
src/yuzu/configuration/shared_widget.h
Normal file
64
src/yuzu/configuration/shared_widget.h
Normal file
@ -0,0 +1,64 @@
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
#include "yuzu/configuration/shared_translation.h"
|
||||
|
||||
class QPushButton;
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QSlider;
|
||||
class QCheckBox;
|
||||
|
||||
namespace Settings {
|
||||
class BasicSetting;
|
||||
}
|
||||
|
||||
namespace ConfigurationShared {
|
||||
|
||||
enum class RequestType {
|
||||
Default,
|
||||
ComboBox,
|
||||
SpinBox,
|
||||
Slider,
|
||||
ReverseSlider,
|
||||
LineEdit,
|
||||
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,
|
||||
const std::string& text_box_default = "");
|
||||
virtual ~Widget();
|
||||
|
||||
bool Valid();
|
||||
|
||||
QPushButton* restore_button{};
|
||||
QLineEdit* line_edit{};
|
||||
QCheckBox* checkbox{};
|
||||
QSlider* slider{};
|
||||
QComboBox* combobox{};
|
||||
|
||||
private:
|
||||
void CreateCheckBox(const QString& label, std::function<void()>& load_func);
|
||||
void CreateCheckBoxWithLineEdit(const QString& label, const std::string& text_box_default,
|
||||
std::function<void()>& load_func);
|
||||
void CreateCheckBoxWithSpinBox(const QString& label, const std::string& text_box_default,
|
||||
std::function<void()>& load_func);
|
||||
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);
|
||||
|
||||
void CreateRestoreGlobalButton();
|
||||
|
||||
QWidget* parent;
|
||||
const TranslationMap& translations;
|
||||
Settings::BasicSetting& setting;
|
||||
|
||||
bool created{false};
|
||||
};
|
||||
|
||||
} // namespace ConfigurationShared
|
Reference in New Issue
Block a user