diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/settings.h | 26 | ||||
| -rw-r--r-- | src/common/settings_common.cpp | 6 | ||||
| -rw-r--r-- | src/common/settings_common.h | 33 | ||||
| -rw-r--r-- | src/common/settings_setting.h | 15 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_audio.cpp | 13 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 11 | ||||
| -rw-r--r-- | src/yuzu/configuration/shared_widget.cpp | 47 | ||||
| -rw-r--r-- | src/yuzu/configuration/shared_widget.h | 12 |
9 files changed, 93 insertions, 74 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index b87301d4e..c4339cb1f 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -137,8 +137,15 @@ struct Values { | |||
| 137 | SwitchableSetting<AudioMode, true> sound_index{linkage, AudioMode::Stereo, | 137 | SwitchableSetting<AudioMode, true> sound_index{linkage, AudioMode::Stereo, |
| 138 | AudioMode::Mono, AudioMode::Surround, | 138 | AudioMode::Mono, AudioMode::Surround, |
| 139 | "sound_index", Category::SystemAudio}; | 139 | "sound_index", Category::SystemAudio}; |
| 140 | SwitchableSetting<u8, true> volume{ | 140 | SwitchableSetting<u8, true> volume{linkage, |
| 141 | linkage, 100, 0, 200, "volume", Category::Audio, Specialization::Scalar, true, true}; | 141 | 100, |
| 142 | 0, | ||
| 143 | 200, | ||
| 144 | "volume", | ||
| 145 | Category::Audio, | ||
| 146 | Specialization::Scalar | Specialization::Percentage, | ||
| 147 | true, | ||
| 148 | true}; | ||
| 142 | Setting<bool, false> audio_muted{ | 149 | Setting<bool, false> audio_muted{ |
| 143 | linkage, false, "audio_muted", Category::Audio, Specialization::Default, false}; | 150 | linkage, false, "audio_muted", Category::Audio, Specialization::Default, false}; |
| 144 | Setting<bool, false> dump_audio_commands{ | 151 | Setting<bool, false> dump_audio_commands{ |
| @@ -156,7 +163,7 @@ struct Values { | |||
| 156 | 9999, | 163 | 9999, |
| 157 | "speed_limit", | 164 | "speed_limit", |
| 158 | Category::Core, | 165 | Category::Core, |
| 159 | Specialization::Countable, | 166 | Specialization::Countable | Specialization::Percentage, |
| 160 | true, | 167 | true, |
| 161 | true, | 168 | true, |
| 162 | &use_speed_limit}; | 169 | &use_speed_limit}; |
| @@ -268,9 +275,16 @@ struct Values { | |||
| 268 | Specialization::Default, | 275 | Specialization::Default, |
| 269 | true, | 276 | true, |
| 270 | true}; | 277 | true}; |
| 271 | SwitchableSetting<int, true> fsr_sharpening_slider{ | 278 | SwitchableSetting<int, true> fsr_sharpening_slider{linkage, |
| 272 | linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer, Specialization::Scalar, | 279 | 25, |
| 273 | true, true}; | 280 | 0, |
| 281 | 200, | ||
| 282 | "fsr_sharpening_slider", | ||
| 283 | Category::Renderer, | ||
| 284 | Specialization::Scalar | | ||
| 285 | Specialization::Percentage, | ||
| 286 | true, | ||
| 287 | true}; | ||
| 274 | 288 | ||
| 275 | SwitchableSetting<u8, false> bg_red{ | 289 | SwitchableSetting<u8, false> bg_red{ |
| 276 | linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true}; | 290 | linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true}; |
diff --git a/src/common/settings_common.cpp b/src/common/settings_common.cpp index 53d4548f5..799942980 100644 --- a/src/common/settings_common.cpp +++ b/src/common/settings_common.cpp | |||
| @@ -7,8 +7,8 @@ | |||
| 7 | namespace Settings { | 7 | namespace Settings { |
| 8 | 8 | ||
| 9 | BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, | 9 | BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, |
| 10 | bool save_, bool runtime_modifiable_, | 10 | bool save_, bool runtime_modifiable_, u32 specialization_, |
| 11 | enum Specialization specialization_, BasicSetting* other_setting_) | 11 | BasicSetting* other_setting_) |
| 12 | : label{name}, category{category_}, id{linkage.count}, save{save_}, | 12 | : label{name}, category{category_}, id{linkage.count}, save{save_}, |
| 13 | runtime_modifiable{runtime_modifiable_}, specialization{specialization_}, | 13 | runtime_modifiable{runtime_modifiable_}, specialization{specialization_}, |
| 14 | other_setting{other_setting_} { | 14 | other_setting{other_setting_} { |
| @@ -40,7 +40,7 @@ Category BasicSetting::Category() const { | |||
| 40 | return category; | 40 | return category; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | Specialization BasicSetting::Specialization() const { | 43 | u32 BasicSetting::Specialization() const { |
| 44 | return specialization; | 44 | return specialization; |
| 45 | } | 45 | } |
| 46 | 46 | ||
diff --git a/src/common/settings_common.h b/src/common/settings_common.h index ad005ca4e..6b717deb1 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h | |||
| @@ -43,15 +43,21 @@ enum class Category : u32 { | |||
| 43 | MaxEnum, | 43 | MaxEnum, |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | enum class Specialization : u32 { | 46 | constexpr u8 SpecializationTypeMask = 0xf; |
| 47 | Default, | 47 | constexpr u8 SpecializationAttributeMask = 0xf0; |
| 48 | Time, | 48 | constexpr u8 SpecializationAttributeOffset = 4; |
| 49 | Hex, | 49 | |
| 50 | List, | 50 | enum Specialization : u8 { |
| 51 | RuntimeList, | 51 | Default = 0, |
| 52 | Scalar, | 52 | Time = 1, |
| 53 | Countable, | 53 | Hex = 2, |
| 54 | Paired, | 54 | List = 3, |
| 55 | RuntimeList = 4, | ||
| 56 | Scalar = 5, | ||
| 57 | Countable = 6, | ||
| 58 | Paired = 7, | ||
| 59 | |||
| 60 | Percentage = (1 << SpecializationAttributeOffset), | ||
| 55 | }; | 61 | }; |
| 56 | 62 | ||
| 57 | bool IsConfiguringGlobal(); | 63 | bool IsConfiguringGlobal(); |
| @@ -75,7 +81,7 @@ public: | |||
| 75 | class BasicSetting { | 81 | class BasicSetting { |
| 76 | protected: | 82 | protected: |
| 77 | explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, | 83 | explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, |
| 78 | bool save_, bool runtime_modifiable_, Specialization spec, | 84 | bool save_, bool runtime_modifiable_, u32 specialization, |
| 79 | BasicSetting* other_setting); | 85 | BasicSetting* other_setting); |
| 80 | 86 | ||
| 81 | public: | 87 | public: |
| @@ -195,7 +201,7 @@ public: | |||
| 195 | /** | 201 | /** |
| 196 | * @returns Extra metadata for data representation in frontend implementations. | 202 | * @returns Extra metadata for data representation in frontend implementations. |
| 197 | */ | 203 | */ |
| 198 | [[nodiscard]] enum Specialization Specialization() const; | 204 | [[nodiscard]] u32 Specialization() const; |
| 199 | 205 | ||
| 200 | /** | 206 | /** |
| 201 | * @returns Another BasicSetting if one is paired, or nullptr otherwise. | 207 | * @returns Another BasicSetting if one is paired, or nullptr otherwise. |
| @@ -240,9 +246,8 @@ private: | |||
| 240 | const u32 id; ///< Unique integer for the setting | 246 | const u32 id; ///< Unique integer for the setting |
| 241 | const bool save; ///< Suggests if the setting should be saved and read to a frontend config | 247 | const bool save; ///< Suggests if the setting should be saved and read to a frontend config |
| 242 | const bool | 248 | const bool |
| 243 | runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running | 249 | runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running |
| 244 | const enum Specialization | 250 | const u32 specialization; ///< Extra data to identify representation of a setting |
| 245 | specialization; ///< Extra data to identify representation of a setting | ||
| 246 | BasicSetting* const other_setting; ///< A paired setting | 251 | BasicSetting* const other_setting; ///< A paired setting |
| 247 | }; | 252 | }; |
| 248 | 253 | ||
diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h index dd91250a1..d1915cb43 100644 --- a/src/common/settings_setting.h +++ b/src/common/settings_setting.h | |||
| @@ -35,8 +35,7 @@ public: | |||
| 35 | * @param category_ Category of the setting AKA INI group | 35 | * @param category_ Category of the setting AKA INI group |
| 36 | */ | 36 | */ |
| 37 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, | 37 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, |
| 38 | enum Category category_, | 38 | enum Category category_, u32 specialization = Specialization::Default, |
| 39 | enum Specialization specialization = Specialization::Default, | ||
| 40 | bool save_ = true, bool runtime_modifiable_ = false, | 39 | bool save_ = true, bool runtime_modifiable_ = false, |
| 41 | BasicSetting* other_setting = nullptr) | 40 | BasicSetting* other_setting = nullptr) |
| 42 | requires(!ranged) | 41 | requires(!ranged) |
| @@ -57,9 +56,8 @@ public: | |||
| 57 | */ | 56 | */ |
| 58 | explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val, | 57 | explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val, |
| 59 | const Type& max_val, const std::string& name, enum Category category_, | 58 | const Type& max_val, const std::string& name, enum Category category_, |
| 60 | enum Specialization specialization = Specialization::Default, | 59 | u32 specialization = Specialization::Default, bool save_ = true, |
| 61 | bool save_ = true, bool runtime_modifiable_ = false, | 60 | bool runtime_modifiable_ = false, BasicSetting* other_setting = nullptr) |
| 62 | BasicSetting* other_setting = nullptr) | ||
| 63 | requires(ranged) | 61 | requires(ranged) |
| 64 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_, specialization, | 62 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_, specialization, |
| 65 | other_setting), | 63 | other_setting), |
| @@ -237,8 +235,7 @@ public: | |||
| 237 | * @param category_ Category of the setting AKA INI group | 235 | * @param category_ Category of the setting AKA INI group |
| 238 | */ | 236 | */ |
| 239 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name, | 237 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name, |
| 240 | Category category_, | 238 | Category category_, u32 specialization = Specialization::Default, |
| 241 | enum Specialization specialization = Specialization::Default, | ||
| 242 | bool save_ = true, bool runtime_modifiable_ = false, | 239 | bool save_ = true, bool runtime_modifiable_ = false, |
| 243 | BasicSetting* other_setting = nullptr) | 240 | BasicSetting* other_setting = nullptr) |
| 244 | requires(!ranged) | 241 | requires(!ranged) |
| @@ -261,8 +258,8 @@ public: | |||
| 261 | */ | 258 | */ |
| 262 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val, | 259 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val, |
| 263 | const Type& max_val, const std::string& name, Category category_, | 260 | const Type& max_val, const std::string& name, Category category_, |
| 264 | enum Specialization specialization = Specialization::Default, | 261 | u32 specialization = Specialization::Default, bool save_ = true, |
| 265 | bool save_ = true, bool runtime_modifiable_ = false, | 262 | bool runtime_modifiable_ = false, |
| 266 | BasicSetting* other_setting = nullptr) | 263 | BasicSetting* other_setting = nullptr) |
| 267 | requires(ranged) | 264 | requires(ranged) |
| 268 | : Setting<Type, true>{ | 265 | : Setting<Type, true>{ |
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index cdb89ccda..11714b86d 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -43,17 +43,7 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { | |||
| 43 | push(Settings::Category::SystemAudio); | 43 | push(Settings::Category::SystemAudio); |
| 44 | 44 | ||
| 45 | for (auto* setting : settings) { | 45 | for (auto* setting : settings) { |
| 46 | auto* widget = [&]() { | 46 | auto* widget = builder.BuildWidget(setting, apply_funcs); |
| 47 | // TODO (lat9nq): Let the system manage sink_id | ||
| 48 | if (setting->Id() == Settings::values.volume.Id()) { | ||
| 49 | // volume needs to be a slider (default is line edit) | ||
| 50 | return builder.BuildWidget(setting, apply_funcs, nullptr, | ||
| 51 | ConfigurationShared::RequestType::Slider, | ||
| 52 | tr("%1%", "Volume percentage (e.g. 50%)")); | ||
| 53 | } else { | ||
| 54 | return builder.BuildWidget(setting, apply_funcs); | ||
| 55 | } | ||
| 56 | }(); | ||
| 57 | 47 | ||
| 58 | if (widget == nullptr) { | 48 | if (widget == nullptr) { |
| 59 | continue; | 49 | continue; |
| @@ -66,6 +56,7 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { | |||
| 66 | layout.addWidget(widget); | 56 | layout.addWidget(widget); |
| 67 | 57 | ||
| 68 | if (setting->Id() == Settings::values.sink_id.Id()) { | 58 | if (setting->Id() == Settings::values.sink_id.Id()) { |
| 59 | // TODO (lat9nq): Let the system manage sink_id | ||
| 69 | sink_combo_box = widget->combobox; | 60 | sink_combo_box = widget->combobox; |
| 70 | InitializeAudioSinkComboBox(); | 61 | InitializeAudioSinkComboBox(); |
| 71 | 62 | ||
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 74449e6d4..7263af13f 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -232,10 +232,10 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { | |||
| 232 | for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { | 232 | for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { |
| 233 | ConfigurationShared::Widget* widget = [&]() { | 233 | ConfigurationShared::Widget* widget = [&]() { |
| 234 | if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { | 234 | if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { |
| 235 | // FSR needs a reversed slider | 235 | // FSR needs a reversed slider and a 0.5 multiplier |
| 236 | return builder.BuildWidget( | 236 | return builder.BuildWidget( |
| 237 | setting, apply_funcs, ConfigurationShared::RequestType::ReverseSlider, true, | 237 | setting, apply_funcs, ConfigurationShared::RequestType::ReverseSlider, true, |
| 238 | 0.5f, nullptr, tr("%1%", "FSR sharpening percentage (e.g. 50%)")); | 238 | 0.5f, nullptr, tr("%", "FSR sharpening percentage (e.g. 50%)")); |
| 239 | } else { | 239 | } else { |
| 240 | return builder.BuildWidget(setting, apply_funcs); | 240 | return builder.BuildWidget(setting, apply_funcs); |
| 241 | } | 241 | } |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index cb708051e..05706c4de 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -106,16 +106,7 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { | |||
| 106 | push(Settings::values.linkage.by_category[Settings::Category::System]); | 106 | push(Settings::values.linkage.by_category[Settings::Category::System]); |
| 107 | 107 | ||
| 108 | for (auto setting : settings) { | 108 | for (auto setting : settings) { |
| 109 | ConfigurationShared::Widget* widget = [this, setting, &builder]() { | 109 | ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs); |
| 110 | if (setting->Id() == Settings::values.speed_limit.Id()) { | ||
| 111 | // speed_limit must be specified to translate the percentage | ||
| 112 | return builder.BuildWidget(setting, apply_funcs, &Settings::values.use_speed_limit, | ||
| 113 | ConfigurationShared::RequestType::SpinBox, | ||
| 114 | tr("%", "Limit speed percentage (e.g. 50%)")); | ||
| 115 | } else { | ||
| 116 | return builder.BuildWidget(setting, apply_funcs); | ||
| 117 | } | ||
| 118 | }(); | ||
| 119 | 110 | ||
| 120 | if (widget == nullptr) { | 111 | if (widget == nullptr) { |
| 121 | continue; | 112 | continue; |
diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index bbcee7488..978bfa590 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp | |||
| @@ -50,6 +50,20 @@ static std::string RelevantDefault(const Settings::BasicSetting& setting) { | |||
| 50 | return Settings::IsConfiguringGlobal() ? setting.DefaultToString() : setting.ToStringGlobal(); | 50 | return Settings::IsConfiguringGlobal() ? setting.DefaultToString() : setting.ToStringGlobal(); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | static QString DefaultSuffix(QWidget* parent, Settings::BasicSetting& setting) { | ||
| 54 | const auto tr = [parent](const char* text, const char* context) { | ||
| 55 | return parent->tr(text, context); | ||
| 56 | }; | ||
| 57 | |||
| 58 | if ((setting.Specialization() & Settings::SpecializationAttributeMask) == | ||
| 59 | Settings::Specialization::Percentage) { | ||
| 60 | std::string context{fmt::format("{} percentage (e.g. 50%)", setting.GetLabel())}; | ||
| 61 | return tr("%", context.c_str()); | ||
| 62 | } | ||
| 63 | |||
| 64 | return QStringLiteral(""); | ||
| 65 | } | ||
| 66 | |||
| 53 | QPushButton* Widget::CreateRestoreGlobalButton(bool using_global, QWidget* parent) { | 67 | QPushButton* Widget::CreateRestoreGlobalButton(bool using_global, QWidget* parent) { |
| 54 | restore_button_count++; | 68 | restore_button_count++; |
| 55 | 69 | ||
| @@ -180,7 +194,7 @@ QWidget* Widget::CreateLineEdit(std::function<std::string()>& serializer, | |||
| 180 | return line_edit; | 194 | return line_edit; |
| 181 | } | 195 | } |
| 182 | 196 | ||
| 183 | QWidget* Widget::CreateSlider(bool reversed, float multiplier, const QString& format, | 197 | QWidget* Widget::CreateSlider(bool reversed, float multiplier, const QString& given_suffix, |
| 184 | std::function<std::string()>& serializer, | 198 | std::function<std::string()>& serializer, |
| 185 | std::function<void()>& restore_func, | 199 | std::function<void()>& restore_func, |
| 186 | const std::function<void()>& touch) { | 200 | const std::function<void()>& touch) { |
| @@ -205,7 +219,10 @@ QWidget* Widget::CreateSlider(bool reversed, float multiplier, const QString& fo | |||
| 205 | 219 | ||
| 206 | int max_val = std::stoi(setting.MaxVal()); | 220 | int max_val = std::stoi(setting.MaxVal()); |
| 207 | 221 | ||
| 208 | const QString use_format = format == QStringLiteral("") ? QStringLiteral("%1") : format; | 222 | QString suffix = |
| 223 | given_suffix == QStringLiteral("") ? DefaultSuffix(this, setting) : given_suffix; | ||
| 224 | |||
| 225 | const QString use_format = QStringLiteral("%1").append(suffix); | ||
| 209 | 226 | ||
| 210 | QObject::connect(slider, &QAbstractSlider::valueChanged, [=](int value) { | 227 | QObject::connect(slider, &QAbstractSlider::valueChanged, [=](int value) { |
| 211 | int present = (reversed ? max_val - value : value) * multiplier + 0.5f; | 228 | int present = (reversed ? max_val - value : value) * multiplier + 0.5f; |
| @@ -228,7 +245,8 @@ QWidget* Widget::CreateSlider(bool reversed, float multiplier, const QString& fo | |||
| 228 | return container; | 245 | return container; |
| 229 | } | 246 | } |
| 230 | 247 | ||
| 231 | QWidget* Widget::CreateSpinBox(const QString& suffix, std::function<std::string()>& serializer, | 248 | QWidget* Widget::CreateSpinBox(const QString& given_suffix, |
| 249 | std::function<std::string()>& serializer, | ||
| 232 | std::function<void()>& restore_func, | 250 | std::function<void()>& restore_func, |
| 233 | const std::function<void()>& touch) { | 251 | const std::function<void()>& touch) { |
| 234 | const int min_val = | 252 | const int min_val = |
| @@ -237,6 +255,9 @@ QWidget* Widget::CreateSpinBox(const QString& suffix, std::function<std::string( | |||
| 237 | setting.Ranged() ? std::stoi(setting.MaxVal()) : std::numeric_limits<int>::max(); | 255 | setting.Ranged() ? std::stoi(setting.MaxVal()) : std::numeric_limits<int>::max(); |
| 238 | const int default_val = std::stoi(setting.ToString()); | 256 | const int default_val = std::stoi(setting.ToString()); |
| 239 | 257 | ||
| 258 | QString suffix = | ||
| 259 | given_suffix == QStringLiteral("") ? DefaultSuffix(this, setting) : given_suffix; | ||
| 260 | |||
| 240 | spinbox = new QSpinBox(this); | 261 | spinbox = new QSpinBox(this); |
| 241 | spinbox->setRange(min_val, max_val); | 262 | spinbox->setRange(min_val, max_val); |
| 242 | spinbox->setValue(default_val); | 263 | spinbox->setValue(default_val); |
| @@ -338,7 +359,7 @@ QWidget* Widget::CreateDateTimeEdit(bool disabled, bool restrict, | |||
| 338 | 359 | ||
| 339 | void Widget::SetupComponent(const QString& label, std::function<void()>& load_func, bool managed, | 360 | void Widget::SetupComponent(const QString& label, std::function<void()>& load_func, bool managed, |
| 340 | RequestType request, float multiplier, | 361 | RequestType request, float multiplier, |
| 341 | Settings::BasicSetting* other_setting, const QString& string) { | 362 | Settings::BasicSetting* other_setting, const QString& suffix) { |
| 342 | created = true; | 363 | created = true; |
| 343 | const auto type = setting.TypeId(); | 364 | const auto type = setting.TypeId(); |
| 344 | 365 | ||
| @@ -391,7 +412,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu | |||
| 391 | if (request != RequestType::Default) { | 412 | if (request != RequestType::Default) { |
| 392 | return request; | 413 | return request; |
| 393 | } | 414 | } |
| 394 | switch (setting.Specialization()) { | 415 | switch (setting.Specialization() & Settings::SpecializationTypeMask) { |
| 395 | case Settings::Specialization::Default: | 416 | case Settings::Specialization::Default: |
| 396 | return RequestType::Default; | 417 | return RequestType::Default; |
| 397 | case Settings::Specialization::Time: | 418 | case Settings::Specialization::Time: |
| @@ -422,7 +443,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu | |||
| 422 | switch (request) { | 443 | switch (request) { |
| 423 | case RequestType::Slider: | 444 | case RequestType::Slider: |
| 424 | case RequestType::ReverseSlider: | 445 | case RequestType::ReverseSlider: |
| 425 | data_component = CreateSlider(request == RequestType::ReverseSlider, multiplier, string, | 446 | data_component = CreateSlider(request == RequestType::ReverseSlider, multiplier, suffix, |
| 426 | serializer, restore_func, touch); | 447 | serializer, restore_func, touch); |
| 427 | break; | 448 | break; |
| 428 | case RequestType::Default: | 449 | case RequestType::Default: |
| @@ -434,7 +455,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu | |||
| 434 | serializer, restore_func, touch); | 455 | serializer, restore_func, touch); |
| 435 | break; | 456 | break; |
| 436 | case RequestType::SpinBox: | 457 | case RequestType::SpinBox: |
| 437 | data_component = CreateSpinBox(string, serializer, restore_func, touch); | 458 | data_component = CreateSpinBox(suffix, serializer, restore_func, touch); |
| 438 | break; | 459 | break; |
| 439 | case RequestType::HexEdit: | 460 | case RequestType::HexEdit: |
| 440 | data_component = CreateHexEdit(serializer, restore_func, touch); | 461 | data_component = CreateHexEdit(serializer, restore_func, touch); |
| @@ -527,7 +548,7 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati | |||
| 527 | const ComboboxTranslationMap& combobox_translations_, QWidget* parent_, | 548 | const ComboboxTranslationMap& combobox_translations_, QWidget* parent_, |
| 528 | bool runtime_lock_, std::forward_list<std::function<void(bool)>>& apply_funcs_, | 549 | bool runtime_lock_, std::forward_list<std::function<void(bool)>>& apply_funcs_, |
| 529 | RequestType request, bool managed, float multiplier, | 550 | RequestType request, bool managed, float multiplier, |
| 530 | Settings::BasicSetting* other_setting, const QString& string) | 551 | Settings::BasicSetting* other_setting, const QString& suffix) |
| 531 | : QWidget(parent_), parent{parent_}, translations{translations_}, | 552 | : QWidget(parent_), parent{parent_}, translations{translations_}, |
| 532 | combobox_enumerations{combobox_translations_}, setting{*setting_}, apply_funcs{apply_funcs_}, | 553 | combobox_enumerations{combobox_translations_}, setting{*setting_}, apply_funcs{apply_funcs_}, |
| 533 | runtime_lock{runtime_lock_} { | 554 | runtime_lock{runtime_lock_} { |
| @@ -555,7 +576,7 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati | |||
| 555 | 576 | ||
| 556 | std::function<void()> load_func = []() {}; | 577 | std::function<void()> load_func = []() {}; |
| 557 | 578 | ||
| 558 | SetupComponent(label, load_func, managed, request, multiplier, other_setting, string); | 579 | SetupComponent(label, load_func, managed, request, multiplier, other_setting, suffix); |
| 559 | 580 | ||
| 560 | if (!created) { | 581 | if (!created) { |
| 561 | LOG_WARNING(Frontend, "No widget was created for \"{}\"", setting.GetLabel()); | 582 | LOG_WARNING(Frontend, "No widget was created for \"{}\"", setting.GetLabel()); |
| @@ -587,7 +608,7 @@ Builder::~Builder() = default; | |||
| 587 | Widget* Builder::BuildWidget(Settings::BasicSetting* setting, | 608 | Widget* Builder::BuildWidget(Settings::BasicSetting* setting, |
| 588 | std::forward_list<std::function<void(bool)>>& apply_funcs, | 609 | std::forward_list<std::function<void(bool)>>& apply_funcs, |
| 589 | RequestType request, bool managed, float multiplier, | 610 | RequestType request, bool managed, float multiplier, |
| 590 | Settings::BasicSetting* other_setting, const QString& string) const { | 611 | Settings::BasicSetting* other_setting, const QString& suffix) const { |
| 591 | if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) { | 612 | if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) { |
| 592 | return nullptr; | 613 | return nullptr; |
| 593 | } | 614 | } |
| @@ -598,14 +619,14 @@ Widget* Builder::BuildWidget(Settings::BasicSetting* setting, | |||
| 598 | } | 619 | } |
| 599 | 620 | ||
| 600 | return new Widget(setting, *translations, *combobox_translations, parent, runtime_lock, | 621 | return new Widget(setting, *translations, *combobox_translations, parent, runtime_lock, |
| 601 | apply_funcs, request, managed, multiplier, other_setting, string); | 622 | apply_funcs, request, managed, multiplier, other_setting, suffix); |
| 602 | } | 623 | } |
| 603 | 624 | ||
| 604 | Widget* Builder::BuildWidget(Settings::BasicSetting* setting, | 625 | Widget* Builder::BuildWidget(Settings::BasicSetting* setting, |
| 605 | std::forward_list<std::function<void(bool)>>& apply_funcs, | 626 | std::forward_list<std::function<void(bool)>>& apply_funcs, |
| 606 | Settings::BasicSetting* other_setting, RequestType request, | 627 | Settings::BasicSetting* other_setting, RequestType request, |
| 607 | const QString& string) const { | 628 | const QString& suffix) const { |
| 608 | return BuildWidget(setting, apply_funcs, request, true, 1.0f, other_setting, string); | 629 | return BuildWidget(setting, apply_funcs, request, true, 1.0f, other_setting, suffix); |
| 609 | } | 630 | } |
| 610 | 631 | ||
| 611 | const ComboboxTranslationMap& Builder::ComboboxTranslations() const { | 632 | const ComboboxTranslationMap& Builder::ComboboxTranslations() const { |
diff --git a/src/yuzu/configuration/shared_widget.h b/src/yuzu/configuration/shared_widget.h index e8c281b81..b3f9efd78 100644 --- a/src/yuzu/configuration/shared_widget.h +++ b/src/yuzu/configuration/shared_widget.h | |||
| @@ -58,14 +58,14 @@ public: | |||
| 58 | * @param managed Set true if the caller will set up component data and handling | 58 | * @param managed Set true if the caller will set up component data and handling |
| 59 | * @param multiplier Value to multiply the slider feedback label | 59 | * @param multiplier Value to multiply the slider feedback label |
| 60 | * @param other_setting Second setting to modify, to replace the label with a checkbox | 60 | * @param other_setting Second setting to modify, to replace the label with a checkbox |
| 61 | * @param string Set to specify formats for Slider feedback labels or SpinBox | 61 | * @param suffix Set to specify formats for Slider feedback labels or SpinBox |
| 62 | */ | 62 | */ |
| 63 | explicit Widget(Settings::BasicSetting* setting, const TranslationMap& translations, | 63 | explicit Widget(Settings::BasicSetting* setting, const TranslationMap& translations, |
| 64 | const ComboboxTranslationMap& combobox_translations, QWidget* parent, | 64 | const ComboboxTranslationMap& combobox_translations, QWidget* parent, |
| 65 | bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_, | 65 | bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_, |
| 66 | RequestType request = RequestType::Default, bool managed = true, | 66 | RequestType request = RequestType::Default, bool managed = true, |
| 67 | float multiplier = 1.0f, Settings::BasicSetting* other_setting = nullptr, | 67 | float multiplier = 1.0f, Settings::BasicSetting* other_setting = nullptr, |
| 68 | const QString& string = QStringLiteral("")); | 68 | const QString& suffix = QStringLiteral("")); |
| 69 | virtual ~Widget(); | 69 | virtual ~Widget(); |
| 70 | 70 | ||
| 71 | /** | 71 | /** |
| @@ -95,7 +95,7 @@ public: | |||
| 95 | private: | 95 | private: |
| 96 | void SetupComponent(const QString& label, std::function<void()>& load_func, bool managed, | 96 | void SetupComponent(const QString& label, std::function<void()>& load_func, bool managed, |
| 97 | RequestType request, float multiplier, | 97 | RequestType request, float multiplier, |
| 98 | Settings::BasicSetting* other_setting, const QString& string); | 98 | Settings::BasicSetting* other_setting, const QString& suffix); |
| 99 | 99 | ||
| 100 | QLabel* CreateLabel(const QString& text); | 100 | QLabel* CreateLabel(const QString& text); |
| 101 | QWidget* CreateCheckBox(Settings::BasicSetting* bool_setting, const QString& label, | 101 | QWidget* CreateCheckBox(Settings::BasicSetting* bool_setting, const QString& label, |
| @@ -111,7 +111,7 @@ private: | |||
| 111 | bool managed = true); | 111 | bool managed = true); |
| 112 | QWidget* CreateHexEdit(std::function<std::string()>& serializer, | 112 | QWidget* CreateHexEdit(std::function<std::string()>& serializer, |
| 113 | std::function<void()>& restore_func, const std::function<void()>& touch); | 113 | std::function<void()>& restore_func, const std::function<void()>& touch); |
| 114 | QWidget* CreateSlider(bool reversed, float multiplier, const QString& format, | 114 | QWidget* CreateSlider(bool reversed, float multiplier, const QString& suffix, |
| 115 | std::function<std::string()>& serializer, | 115 | std::function<std::string()>& serializer, |
| 116 | std::function<void()>& restore_func, const std::function<void()>& touch); | 116 | std::function<void()>& restore_func, const std::function<void()>& touch); |
| 117 | QWidget* CreateDateTimeEdit(bool disabled, bool restrict, | 117 | QWidget* CreateDateTimeEdit(bool disabled, bool restrict, |
| @@ -140,13 +140,13 @@ public: | |||
| 140 | std::forward_list<std::function<void(bool)>>& apply_funcs, | 140 | std::forward_list<std::function<void(bool)>>& apply_funcs, |
| 141 | RequestType request = RequestType::Default, bool managed = true, | 141 | RequestType request = RequestType::Default, bool managed = true, |
| 142 | float multiplier = 1.0f, Settings::BasicSetting* other_setting = nullptr, | 142 | float multiplier = 1.0f, Settings::BasicSetting* other_setting = nullptr, |
| 143 | const QString& string = QStringLiteral("")) const; | 143 | const QString& suffix = QStringLiteral("")) const; |
| 144 | 144 | ||
| 145 | Widget* BuildWidget(Settings::BasicSetting* setting, | 145 | Widget* BuildWidget(Settings::BasicSetting* setting, |
| 146 | std::forward_list<std::function<void(bool)>>& apply_funcs, | 146 | std::forward_list<std::function<void(bool)>>& apply_funcs, |
| 147 | Settings::BasicSetting* other_setting, | 147 | Settings::BasicSetting* other_setting, |
| 148 | RequestType request = RequestType::Default, | 148 | RequestType request = RequestType::Default, |
| 149 | const QString& string = QStringLiteral("")) const; | 149 | const QString& suffix = QStringLiteral("")) const; |
| 150 | 150 | ||
| 151 | const ComboboxTranslationMap& ComboboxTranslations() const; | 151 | const ComboboxTranslationMap& ComboboxTranslations() const; |
| 152 | 152 | ||