diff options
Diffstat (limited to 'src/frontend_common/config.h')
| -rw-r--r-- | src/frontend_common/config.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/frontend_common/config.h b/src/frontend_common/config.h index 0c4d505b8..4ecb97044 100644 --- a/src/frontend_common/config.h +++ b/src/frontend_common/config.h | |||
| @@ -51,7 +51,6 @@ protected: | |||
| 51 | [[nodiscard]] bool IsCustomConfig() const; | 51 | [[nodiscard]] bool IsCustomConfig() const; |
| 52 | 52 | ||
| 53 | void Reload(); | 53 | void Reload(); |
| 54 | void Save(); | ||
| 55 | 54 | ||
| 56 | /** | 55 | /** |
| 57 | * Derived config classes must implement this so they can reload all platform-specific | 56 | * Derived config classes must implement this so they can reload all platform-specific |
| @@ -77,6 +76,9 @@ protected: | |||
| 77 | void ReadCoreValues(); | 76 | void ReadCoreValues(); |
| 78 | void ReadDataStorageValues(); | 77 | void ReadDataStorageValues(); |
| 79 | void ReadDebuggingValues(); | 78 | void ReadDebuggingValues(); |
| 79 | #ifdef __unix__ | ||
| 80 | void ReadLinuxValues(); | ||
| 81 | #endif | ||
| 80 | void ReadServiceValues(); | 82 | void ReadServiceValues(); |
| 81 | void ReadDisabledAddOnValues(); | 83 | void ReadDisabledAddOnValues(); |
| 82 | void ReadMiscellaneousValues(); | 84 | void ReadMiscellaneousValues(); |
| @@ -108,6 +110,9 @@ protected: | |||
| 108 | void SaveCoreValues(); | 110 | void SaveCoreValues(); |
| 109 | void SaveDataStorageValues(); | 111 | void SaveDataStorageValues(); |
| 110 | void SaveDebuggingValues(); | 112 | void SaveDebuggingValues(); |
| 113 | #ifdef __unix__ | ||
| 114 | void SaveLinuxValues(); | ||
| 115 | #endif | ||
| 111 | void SaveNetworkValues(); | 116 | void SaveNetworkValues(); |
| 112 | void SaveDisabledAddOnValues(); | 117 | void SaveDisabledAddOnValues(); |
| 113 | void SaveMiscellaneousValues(); | 118 | void SaveMiscellaneousValues(); |
| @@ -157,17 +162,23 @@ protected: | |||
| 157 | void WriteBooleanSetting(const std::string& key, const bool& value, | 162 | void WriteBooleanSetting(const std::string& key, const bool& value, |
| 158 | const std::optional<bool>& default_value = std::nullopt, | 163 | const std::optional<bool>& default_value = std::nullopt, |
| 159 | const std::optional<bool>& use_global = std::nullopt); | 164 | const std::optional<bool>& use_global = std::nullopt); |
| 160 | template <typename T> | ||
| 161 | std::enable_if_t<std::is_integral_v<T>> WriteIntegerSetting( | ||
| 162 | const std::string& key, const T& value, | ||
| 163 | const std::optional<T>& default_value = std::nullopt, | ||
| 164 | const std::optional<bool>& use_global = std::nullopt); | ||
| 165 | void WriteDoubleSetting(const std::string& key, const double& value, | 165 | void WriteDoubleSetting(const std::string& key, const double& value, |
| 166 | const std::optional<double>& default_value = std::nullopt, | 166 | const std::optional<double>& default_value = std::nullopt, |
| 167 | const std::optional<bool>& use_global = std::nullopt); | 167 | const std::optional<bool>& use_global = std::nullopt); |
| 168 | void WriteStringSetting(const std::string& key, const std::string& value, | 168 | void WriteStringSetting(const std::string& key, const std::string& value, |
| 169 | const std::optional<std::string>& default_value = std::nullopt, | 169 | const std::optional<std::string>& default_value = std::nullopt, |
| 170 | const std::optional<bool>& use_global = std::nullopt); | 170 | const std::optional<bool>& use_global = std::nullopt); |
| 171 | template <typename T> | ||
| 172 | std::enable_if_t<std::is_integral_v<T>> WriteIntegerSetting( | ||
| 173 | const std::string& key, const T& value, | ||
| 174 | const std::optional<T>& default_value = std::nullopt, | ||
| 175 | const std::optional<bool>& use_global = std::nullopt) { | ||
| 176 | std::optional<std::string> string_default = std::nullopt; | ||
| 177 | if (default_value.has_value()) { | ||
| 178 | string_default = std::make_optional(ToString(default_value.value())); | ||
| 179 | } | ||
| 180 | WritePreparedSetting(key, AdjustOutputString(ToString(value)), string_default, use_global); | ||
| 181 | } | ||
| 171 | 182 | ||
| 172 | void ReadCategory(Settings::Category category); | 183 | void ReadCategory(Settings::Category category); |
| 173 | void WriteCategory(Settings::Category category); | 184 | void WriteCategory(Settings::Category category); |