diff options
Diffstat (limited to 'src/frontend_common')
| -rw-r--r-- | src/frontend_common/config.cpp | 28 | ||||
| -rw-r--r-- | src/frontend_common/config.h | 2 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/frontend_common/config.cpp b/src/frontend_common/config.cpp index d34624d28..2bebfeef9 100644 --- a/src/frontend_common/config.cpp +++ b/src/frontend_common/config.cpp | |||
| @@ -401,6 +401,14 @@ void Config::ReadNetworkValues() { | |||
| 401 | EndGroup(); | 401 | EndGroup(); |
| 402 | } | 402 | } |
| 403 | 403 | ||
| 404 | void Config::ReadLibraryAppletValues() { | ||
| 405 | BeginGroup(Settings::TranslateCategory(Settings::Category::LibraryApplet)); | ||
| 406 | |||
| 407 | ReadCategory(Settings::Category::LibraryApplet); | ||
| 408 | |||
| 409 | EndGroup(); | ||
| 410 | } | ||
| 411 | |||
| 404 | void Config::ReadValues() { | 412 | void Config::ReadValues() { |
| 405 | if (global) { | 413 | if (global) { |
| 406 | ReadDataStorageValues(); | 414 | ReadDataStorageValues(); |
| @@ -410,6 +418,7 @@ void Config::ReadValues() { | |||
| 410 | ReadServiceValues(); | 418 | ReadServiceValues(); |
| 411 | ReadWebServiceValues(); | 419 | ReadWebServiceValues(); |
| 412 | ReadMiscellaneousValues(); | 420 | ReadMiscellaneousValues(); |
| 421 | ReadLibraryAppletValues(); | ||
| 413 | } | 422 | } |
| 414 | ReadControlValues(); | 423 | ReadControlValues(); |
| 415 | ReadCoreValues(); | 424 | ReadCoreValues(); |
| @@ -511,6 +520,7 @@ void Config::SaveValues() { | |||
| 511 | SaveNetworkValues(); | 520 | SaveNetworkValues(); |
| 512 | SaveWebServiceValues(); | 521 | SaveWebServiceValues(); |
| 513 | SaveMiscellaneousValues(); | 522 | SaveMiscellaneousValues(); |
| 523 | SaveLibraryAppletValues(); | ||
| 514 | } else { | 524 | } else { |
| 515 | LOG_DEBUG(Config, "Saving only generic configuration values"); | 525 | LOG_DEBUG(Config, "Saving only generic configuration values"); |
| 516 | } | 526 | } |
| @@ -691,6 +701,14 @@ void Config::SaveWebServiceValues() { | |||
| 691 | EndGroup(); | 701 | EndGroup(); |
| 692 | } | 702 | } |
| 693 | 703 | ||
| 704 | void Config::SaveLibraryAppletValues() { | ||
| 705 | BeginGroup(Settings::TranslateCategory(Settings::Category::LibraryApplet)); | ||
| 706 | |||
| 707 | WriteCategory(Settings::Category::LibraryApplet); | ||
| 708 | |||
| 709 | EndGroup(); | ||
| 710 | } | ||
| 711 | |||
| 694 | bool Config::ReadBooleanSetting(const std::string& key, const std::optional<bool> default_value) { | 712 | bool Config::ReadBooleanSetting(const std::string& key, const std::optional<bool> default_value) { |
| 695 | std::string full_key = GetFullKey(key, false); | 713 | std::string full_key = GetFullKey(key, false); |
| 696 | if (!default_value.has_value()) { | 714 | if (!default_value.has_value()) { |
| @@ -867,15 +885,9 @@ void Config::Reload() { | |||
| 867 | } | 885 | } |
| 868 | 886 | ||
| 869 | void Config::ClearControlPlayerValues() const { | 887 | void Config::ClearControlPlayerValues() const { |
| 870 | // If key is an empty string, all keys in the current group() are removed. | 888 | // Removes the entire [Controls] section |
| 871 | const char* section = Settings::TranslateCategory(Settings::Category::Controls); | 889 | const char* section = Settings::TranslateCategory(Settings::Category::Controls); |
| 872 | CSimpleIniA::TNamesDepend keys; | 890 | config->Delete(section, nullptr, true); |
| 873 | config->GetAllKeys(section, keys); | ||
| 874 | for (const auto& key : keys) { | ||
| 875 | if (std::string(config->GetValue(section, key.pItem)).empty()) { | ||
| 876 | config->Delete(section, key.pItem); | ||
| 877 | } | ||
| 878 | } | ||
| 879 | } | 891 | } |
| 880 | 892 | ||
| 881 | const std::string& Config::GetConfigFilePath() const { | 893 | const std::string& Config::GetConfigFilePath() const { |
diff --git a/src/frontend_common/config.h b/src/frontend_common/config.h index 4ecb97044..8b0599cc3 100644 --- a/src/frontend_common/config.h +++ b/src/frontend_common/config.h | |||
| @@ -88,6 +88,7 @@ protected: | |||
| 88 | void ReadSystemValues(); | 88 | void ReadSystemValues(); |
| 89 | void ReadWebServiceValues(); | 89 | void ReadWebServiceValues(); |
| 90 | void ReadNetworkValues(); | 90 | void ReadNetworkValues(); |
| 91 | void ReadLibraryAppletValues(); | ||
| 91 | 92 | ||
| 92 | // Read platform specific sections | 93 | // Read platform specific sections |
| 93 | virtual void ReadHidbusValues() = 0; | 94 | virtual void ReadHidbusValues() = 0; |
| @@ -121,6 +122,7 @@ protected: | |||
| 121 | void SaveScreenshotValues(); | 122 | void SaveScreenshotValues(); |
| 122 | void SaveSystemValues(); | 123 | void SaveSystemValues(); |
| 123 | void SaveWebServiceValues(); | 124 | void SaveWebServiceValues(); |
| 125 | void SaveLibraryAppletValues(); | ||
| 124 | 126 | ||
| 125 | // Save platform specific sections | 127 | // Save platform specific sections |
| 126 | virtual void SaveHidbusValues() = 0; | 128 | virtual void SaveHidbusValues() = 0; |