summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorGravatar lat9nq2023-05-08 17:33:10 -0400
committerGravatar lat9nq2023-07-21 10:56:07 -0400
commitd35577d3ed0bfc56ddf85a2e8b163d9d02bec809 (patch)
tree54ab3ccf2ac728a75993c9931a39d4739206e25a /src/common
parentconfiguration: Use buttons instead of highlights (diff)
downloadyuzu-d35577d3ed0bfc56ddf85a2e8b163d9d02bec809.tar.gz
yuzu-d35577d3ed0bfc56ddf85a2e8b163d9d02bec809.tar.xz
yuzu-d35577d3ed0bfc56ddf85a2e8b163d9d02bec809.zip
configuration: Implement slider
Diffstat (limited to 'src/common')
-rw-r--r--src/common/settings.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/settings.h b/src/common/settings.h
index 2879237cc..4ca8299b3 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -200,6 +200,8 @@ public:
200 virtual bool RuntimeModfiable() const = 0; 200 virtual bool RuntimeModfiable() const = 0;
201 virtual void SetGlobal(bool global) {} 201 virtual void SetGlobal(bool global) {}
202 virtual constexpr u32 Id() const = 0; 202 virtual constexpr u32 Id() const = 0;
203 virtual std::string MinVal() const = 0;
204 virtual std::string MaxVal() const = 0;
203 virtual bool UsingGlobal() const { 205 virtual bool UsingGlobal() const {
204 return false; 206 return false;
205 } 207 }
@@ -336,7 +338,7 @@ protected:
336 if constexpr (std::is_same<Type, std::string>()) { 338 if constexpr (std::is_same<Type, std::string>()) {
337 return value_; 339 return value_;
338 } else if constexpr (std::is_same<Type, std::optional<u32>>()) { 340 } else if constexpr (std::is_same<Type, std::optional<u32>>()) {
339 return value_.has_value() ? std::to_string(*value_) : "0"; 341 return value_.has_value() ? std::to_string(*value_) : "none";
340 } else if constexpr (std::is_same<Type, bool>()) { 342 } else if constexpr (std::is_same<Type, bool>()) {
341 return value_ ? "true" : "false"; 343 return value_ ? "true" : "false";
342 } else { 344 } else {
@@ -401,7 +403,7 @@ public:
401 if constexpr (std::is_same<Type, std::string>()) { 403 if constexpr (std::is_same<Type, std::string>()) {
402 this->SetValue(input); 404 this->SetValue(input);
403 } else if constexpr (std::is_same<Type, std::optional<u32>>()) { 405 } else if constexpr (std::is_same<Type, std::optional<u32>>()) {
404 this->SetValue(static_cast<u32>(std::stoll(input))); 406 this->SetValue(static_cast<u32>(std::stoul(input)));
405 } else if constexpr (std::is_same<Type, bool>()) { 407 } else if constexpr (std::is_same<Type, bool>()) {
406 this->SetValue(input == "true"); 408 this->SetValue(input == "true");
407 } else { 409 } else {
@@ -435,6 +437,13 @@ public:
435 return id; 437 return id;
436 } 438 }
437 439
440 virtual std::string MinVal() const override {
441 return this->ToString(minimum);
442 }
443 virtual std::string MaxVal() const override {
444 return this->ToString(maximum);
445 }
446
438protected: 447protected:
439 Type value{}; ///< The setting 448 Type value{}; ///< The setting
440 const Type default_value{}; ///< The default value 449 const Type default_value{}; ///< The default value