aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenen92 <enen92@users.noreply.github.com>2018-12-11 11:26:46 +0000
committerGitHub <noreply@github.com>2018-12-11 11:26:46 +0000
commit41dde44755f0574540c8cb706d04d80e9db05309 (patch)
treec1150242bc7564825ed664b012381dc2fd8626de
parent10edcdb03d5f821e1a8239c5bf67d756bce0d808 (diff)
parent3ead79cb650a51da3080d273cea701578cb23827 (diff)
Merge pull request #15015 from enen92/reusesettings
[settings] Fix regression (setting reuse)
-rw-r--r--xbmc/addons/settings/AddonSettings.cpp21
-rw-r--r--xbmc/addons/settings/AddonSettings.h4
2 files changed, 14 insertions, 11 deletions
diff --git a/xbmc/addons/settings/AddonSettings.cpp b/xbmc/addons/settings/AddonSettings.cpp
index caaa117912..20c3b611f9 100644
--- a/xbmc/addons/settings/AddonSettings.cpp
+++ b/xbmc/addons/settings/AddonSettings.cpp
@@ -430,11 +430,10 @@ bool CAddonSettings::ParseSettingVersion(const CXBMCTinyXML& doc, uint32_t& vers
return true;
}
-std::shared_ptr<CSettingGroup> CAddonSettings::ParseOldSettingElement(const TiXmlElement* categoryElement, std::shared_ptr<CSettingCategory> category, std::set<std::string>& actionSettings)
+std::shared_ptr<CSettingGroup> CAddonSettings::ParseOldSettingElement(const TiXmlElement* categoryElement, std::shared_ptr<CSettingCategory> category, std::set<std::string>& actionSettings, std::set<std::string>& settingIds)
{
// build a vector of settings from the same category
std::vector<std::shared_ptr<const CSetting>> categorySettings;
- std::set<std::string> settingIds;
// prepare for settings with enable/visible conditions
struct SettingWithConditions {
@@ -593,9 +592,11 @@ std::shared_ptr<CSettingGroup> CAddonSettings::ParseOldSettingElement(const TiXm
// turn the setting into a reference setting
setting = std::make_shared<CSettingReference>(settingId, GetSettingsManager());
}
-
- // add the setting's identifier to the list of all identifiers
- settingIds.insert(setting->GetId());
+ else
+ {
+ // add the setting's identifier to the list of all identifiers
+ settingIds.insert(setting->GetId());
+ }
// add the setting to the list of settings from the same category
categorySettings.push_back(setting);
@@ -646,7 +647,7 @@ std::shared_ptr<CSettingGroup> CAddonSettings::ParseOldSettingElement(const TiXm
return group;
}
-std::shared_ptr<CSettingCategory> CAddonSettings::ParseOldCategoryElement(uint32_t &categoryId, const TiXmlElement * categoryElement, std::set<std::string> &actionSettings)
+std::shared_ptr<CSettingCategory> CAddonSettings::ParseOldCategoryElement(uint32_t &categoryId, const TiXmlElement * categoryElement, std::set<std::string> &actionSettings, std::set<std::string> &settingIds)
{
// create the category
auto category = std::make_shared<CSettingCategory>(StringUtils::Format("category%u", categoryId), GetSettingsManager());
@@ -658,7 +659,7 @@ std::shared_ptr<CSettingCategory> CAddonSettings::ParseOldCategoryElement(uint32
category->SetLabel(categoryLabel);
// prepare a setting group
- auto group = ParseOldSettingElement(categoryElement, category, actionSettings);
+ auto group = ParseOldSettingElement(categoryElement, category, actionSettings, settingIds);
// add the group to the category
category->AddGroup(group);
@@ -680,14 +681,16 @@ bool CAddonSettings::InitializeFromOldSettingDefinitions(const CXBMCTinyXML& doc
uint32_t categoryId = 0;
std::set<std::string> actionSettings;
+ // Settings id set
+ std::set<std::string> settingIds;
// Special case for no category settings
- section->AddCategory(ParseOldCategoryElement(categoryId, root, actionSettings));
+ section->AddCategory(ParseOldCategoryElement(categoryId, root, actionSettings, settingIds));
const TiXmlElement *categoryElement = root->FirstChildElement("category");
while (categoryElement != nullptr)
{
- section->AddCategory(ParseOldCategoryElement(categoryId, categoryElement, actionSettings));
+ section->AddCategory(ParseOldCategoryElement(categoryId, categoryElement, actionSettings, settingIds));
// look for the next category
categoryElement = categoryElement->NextSiblingElement("category");
diff --git a/xbmc/addons/settings/AddonSettings.h b/xbmc/addons/settings/AddonSettings.h
index d4f52b82e8..fbf546a85a 100644
--- a/xbmc/addons/settings/AddonSettings.h
+++ b/xbmc/addons/settings/AddonSettings.h
@@ -74,9 +74,9 @@ namespace ADDON
bool ParseSettingVersion(const CXBMCTinyXML& doc, uint32_t& version) const;
- std::shared_ptr<CSettingGroup> ParseOldSettingElement(const TiXmlElement *categoryElement, std::shared_ptr<CSettingCategory> category, std::set<std::string>& actionSettings);
+ std::shared_ptr<CSettingGroup> ParseOldSettingElement(const TiXmlElement *categoryElement, std::shared_ptr<CSettingCategory> category, std::set<std::string>& actionSettings, std::set<std::string>& settingIds);
- std::shared_ptr<CSettingCategory> ParseOldCategoryElement(uint32_t &categoryId, const TiXmlElement * categoryElement, std::set<std::string> &actionSettings);
+ std::shared_ptr<CSettingCategory> ParseOldCategoryElement(uint32_t &categoryId, const TiXmlElement * categoryElement, std::set<std::string> &actionSettings, std::set<std::string>& settingIds);
bool InitializeFromOldSettingDefinitions(const CXBMCTinyXML& doc);
std::shared_ptr<CSetting> InitializeFromOldSettingAction(std::string settingId, const TiXmlElement *settingElement, const std::string& defaultValue);