diff options
author | louis <louis.braun@gmx.de> | 2013-10-27 16:17:24 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-10-27 16:17:24 +0100 |
commit | 3cdbc204e283f45bfd71ea6adacd3693e83c1255 (patch) | |
tree | 344faf3a7d1240bf825b7a5c698d7e0f460354fb | |
parent | eec77c1ec540282b30891aeede497045b97070b6 (diff) | |
download | skin-nopacity-3cdbc204e283f45bfd71ea6adacd3693e83c1255.tar.gz skin-nopacity-3cdbc204e283f45bfd71ea6adacd3693e83c1255.tar.bz2 |
Fixed a bug in theme specific configs
-rw-r--r-- | config.c | 28 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | setup.c | 3 |
3 files changed, 20 insertions, 12 deletions
@@ -341,24 +341,28 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) { std::map<std::string, int>::iterator hit = conf.find(name); if (hit == conf.end()) return false; - //check if theme already in map - std::map<std::string, std::map<std::string, int> >::iterator hit2 = themeConfigSetup.find(theme); - if (hit2 != themeConfigSetup.end()) { - std::map<std::string, int> existingValues = (std::map<std::string, int>)hit2->second; - existingValues.insert(std::pair<std::string, int>(name, atoi(Value))); - themeConfigSetup.erase(theme); - themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(theme, existingValues)); - } else { - std::map<std::string, int> themeConf; - themeConf.insert(std::pair<std::string, int>(name, atoi(Value))); - themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(theme, themeConf)); - } + SetThemeConfigSetupValue(theme, name, atoi(Value)); } else { return false; } return true; } +void cNopacityConfig::SetThemeConfigSetupValue(std::string themeName, std::string key, int value) { + //check if theme already in map + std::map<std::string, std::map<std::string, int> >::iterator hit = themeConfigSetup.find(themeName); + if (hit != themeConfigSetup.end()) { + std::map<std::string, int> existingValues = (std::map<std::string, int>)hit->second; + existingValues.insert(std::pair<std::string, int>(key, value)); + themeConfigSetup.erase(themeName); + themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(themeName, existingValues)); + } else { + std::map<std::string, int> themeConf; + themeConf.insert(std::pair<std::string, int>(key, value)); + themeConfigSetup.insert(std::pair<std::string, std::map<std::string, int> >(themeName, themeConf)); + } +} + void cNopacityConfig::DumpConfig(void) { esyslog("nopacity: current config -----------------"); for(std::map<std::string, int>::const_iterator it = conf.begin(); it != conf.end(); it++) { @@ -23,6 +23,7 @@ class cNopacityConfig { std::map<std::string, int>::const_iterator GetStart(void) { return conf.begin(); }; std::map<std::string, int>::const_iterator GetEnd(void) { return conf.end(); }; bool SetupParse(const char *Name, const char *Value); + void SetThemeConfigSetupValue(std::string themeName, std::string key, int value); void SetLogoPath(cString path); void SetIconPath(cString path); void SetEpgImagePath(cString path); @@ -84,7 +84,10 @@ void cNopacitySetup::Store(void) { int value = (int)it->second; int origValue = config.GetValue(name); if (value != origValue) { + //Save changed value in setup.conf SetupStore(*cString::sprintf("%s.%s", themeName, name.c_str()), value); + //Save changed value also in cConfig::themeConfigSetup + tmpConf.SetThemeConfigSetupValue(themeName, name, value); } } config = tmpConf; |