summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar lat9nq2023-06-15 16:45:09 -0400
committerGravatar lat9nq2023-07-21 10:56:54 -0400
commit6935332cbab11b08ce6b644c48c6d82e94bd90f9 (patch)
tree19f45243c7490e52c07fc8f5a0d127380792aa21 /src
parentconfig: Remove unused functions (diff)
downloadyuzu-6935332cbab11b08ce6b644c48c6d82e94bd90f9.tar.gz
yuzu-6935332cbab11b08ce6b644c48c6d82e94bd90f9.tar.xz
yuzu-6935332cbab11b08ce6b644c48c6d82e94bd90f9.zip
shared_widget: Some documentation, add shorter constructor
The shorter constructor enables us to specify some options without needing to specify the default values of multiplier which wasn't always appropriate and could be confusing.
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/configuration/shared_widget.cpp8
-rw-r--r--src/yuzu/configuration/shared_widget.h65
2 files changed, 65 insertions, 8 deletions
diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp
index f644b2ade..a855559b6 100644
--- a/src/yuzu/configuration/shared_widget.cpp
+++ b/src/yuzu/configuration/shared_widget.cpp
@@ -527,4 +527,12 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati
527 527
528 this->setToolTip(tooltip); 528 this->setToolTip(tooltip);
529} 529}
530
531Widget::Widget(Settings::BasicSetting* setting, const TranslationMap& translations,
532 const ComboboxTranslationMap& combobox_translations, QWidget* parent,
533 bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_,
534 Settings::BasicSetting* other_setting, RequestType request, const QString& string)
535 : Widget(setting, translations, combobox_translations, parent, runtime_lock, apply_funcs_,
536 request, true, 1.0f, other_setting, string) {}
537
530} // namespace ConfigurationShared 538} // namespace ConfigurationShared
diff --git a/src/yuzu/configuration/shared_widget.h b/src/yuzu/configuration/shared_widget.h
index 8ce72b238..10d2d353e 100644
--- a/src/yuzu/configuration/shared_widget.h
+++ b/src/yuzu/configuration/shared_widget.h
@@ -44,20 +44,69 @@ class Widget : public QWidget {
44 Q_OBJECT 44 Q_OBJECT
45 45
46public: 46public:
47 Widget(Settings::BasicSetting* setting, const TranslationMap& translations, 47 /**
48 const ComboboxTranslationMap& combobox_translations, QWidget* parent, bool runtime_lock, 48 * Shorter-hand version of the constructor
49 std::forward_list<std::function<void(bool)>>& apply_funcs_, 49 *
50 RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f, 50 * @param setting The primary Setting to create the Widget for
51 Settings::BasicSetting* other_setting = nullptr, 51 * @param translations Map of translations to display on the left side label/checkbox
52 const QString& string = QStringLiteral("")); 52 * @param combobox_translations Map of translations for enumerating combo boxes
53 * @param parent Qt parent
54 * @param runtime_lock Emulated guest powered on state, for use on settings that should be
55 * configured during guest execution
56 * @param apply_funcs_ List to append, functions to run to apply the widget state to the setting
57 * @param other_setting Second setting to modify, to replace the label with a checkbox
58 * @param request What type of data representation component to create -- not always respected
59 * for the Setting data type
60 * @param string Set to specify formats for Slider feedback labels or SpinBox
61 */
62 explicit Widget(Settings::BasicSetting* setting, const TranslationMap& translations,
63 const ComboboxTranslationMap& combobox_translations, QWidget* parent,
64 bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_,
65 Settings::BasicSetting* other_setting,
66 RequestType request = RequestType::Default,
67 const QString& string = QStringLiteral(""));
68
69 /**
70 * @param setting The primary Setting to create the Widget for
71 * @param translations Map of translations to display on the left side label/checkbox
72 * @param combobox_translations Map of translations for enumerating combo boxes
73 * @param parent Qt parent
74 * @param runtime_lock Emulated guest powered on state, for use on settings that should be
75 * configured during guest execution
76 * @param apply_funcs_ List to append, functions to run to apply the widget state to the setting
77 * @param request What type of data representation component to create -- not always respected
78 * for the Setting data type
79 * @param managed Set true if the caller will set up component data and handling
80 * @param multiplier Value to multiply the slider feedback label
81 * @param other_setting Second setting to modify, to replace the label with a checkbox
82 * @param string Set to specify formats for Slider feedback labels or SpinBox
83 */
84 explicit Widget(Settings::BasicSetting* setting, const TranslationMap& translations,
85 const ComboboxTranslationMap& combobox_translations, QWidget* parent,
86 bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_,
87 RequestType request = RequestType::Default, bool managed = true,
88 float multiplier = 1.0f, Settings::BasicSetting* other_setting = nullptr,
89 const QString& string = QStringLiteral(""));
53 virtual ~Widget(); 90 virtual ~Widget();
54 91
92 /**
93 * @returns True if the Widget successfully created the components for the setting
94 */
55 bool Valid() const; 95 bool Valid() const;
56 96
97 /**
98 * Creates a button to appear when a setting has been modified. This exists for custom
99 * configurations and wasn't designed to work for the global configuration. It has public access
100 * for settings that need to be unmanaged but can be custom.
101 *
102 * @param using_global The global state of the setting this button is for
103 * @param parent QWidget parent
104 */
57 [[nodiscard]] static QPushButton* CreateRestoreGlobalButton(bool using_global, QWidget* parent); 105 [[nodiscard]] static QPushButton* CreateRestoreGlobalButton(bool using_global, QWidget* parent);
58 106
59 QPushButton* restore_button{}; 107 // Direct handles to sub components created
60 QLineEdit* line_edit{}; 108 QPushButton* restore_button{}; ///< Restore button for custom configurations
109 QLineEdit* line_edit{}; ///< QLineEdit, used for LineEdit and HexEdit
61 QSpinBox* spinbox{}; 110 QSpinBox* spinbox{};
62 QCheckBox* checkbox{}; 111 QCheckBox* checkbox{};
63 QSlider* slider{}; 112 QSlider* slider{};