diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-01 15:02:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 15:02:06 -0500 |
commit | c3c676b7d69c35c37462fb0edd04d714e9a1f4e3 (patch) | |
tree | 4301881852e57113f602f01f166462cbda25f262 /src/frontend_common/config.h | |
parent | aa9ff2ffc2d9c3c1b7d6f4f6a7170acda7e17e9c (diff) | |
parent | aa4d15594f7bfd1c1aeb5d9ba40a59ff689e25e7 (diff) |
Merge pull request #12518 from t895/theme-settings
android: Migrate remaining settings to ini
Diffstat (limited to 'src/frontend_common/config.h')
-rw-r--r-- | src/frontend_common/config.h | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/frontend_common/config.h b/src/frontend_common/config.h index b3812af17..0c4d505b8 100644 --- a/src/frontend_common/config.h +++ b/src/frontend_common/config.h @@ -154,11 +154,20 @@ protected: * @param use_global Specifies if the custom or global config should be in use, for custom * configs */ - template <typename Type = int> - void WriteSetting(const std::string& key, const Type& value, - const std::optional<Type>& default_value = std::nullopt, - const std::optional<bool>& use_global = std::nullopt); - void WriteSettingInternal(const std::string& key, const std::string& value); + void WriteBooleanSetting(const std::string& key, const bool& value, + const std::optional<bool>& default_value = std::nullopt, + const std::optional<bool>& use_global = std::nullopt); + template <typename T> + std::enable_if_t<std::is_integral_v<T>> WriteIntegerSetting( + const std::string& key, const T& value, + const std::optional<T>& default_value = std::nullopt, + const std::optional<bool>& use_global = std::nullopt); + void WriteDoubleSetting(const std::string& key, const double& value, + const std::optional<double>& default_value = std::nullopt, + const std::optional<bool>& use_global = std::nullopt); + void WriteStringSetting(const std::string& key, const std::string& value, + const std::optional<std::string>& default_value = std::nullopt, + const std::optional<bool>& use_global = std::nullopt); void ReadCategory(Settings::Category category); void WriteCategory(Settings::Category category); @@ -175,8 +184,10 @@ protected: return value_ ? "true" : "false"; } else if constexpr (std::is_same_v<T, u64>) { return std::to_string(static_cast<u64>(value_)); - } else { + } else if constexpr (std::is_same_v<T, s64>) { return std::to_string(static_cast<s64>(value_)); + } else { + return std::to_string(value_); } } @@ -197,9 +208,13 @@ protected: const bool global; private: - inline static std::array<char, 19> special_characters = {'!', '#', '$', '%', '^', '&', '*', - '|', ';', '\'', '\"', ',', '<', '.', - '>', '?', '`', '~', '='}; + void WritePreparedSetting(const std::string& key, const std::string& adjusted_value, + const std::optional<std::string>& adjusted_default_value, + const std::optional<bool>& use_global); + void WriteString(const std::string& key, const std::string& value); + + inline static std::array<char, 18> special_characters = { + '!', '#', '$', '%', '^', '&', '*', '|', ';', '\'', '\"', ',', '<', '>', '?', '`', '~', '='}; struct ConfigArray { std::string name; |