mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-06 07:15:39 +00:00
Added support for overriding variables and to define them inside the variants tags.
This commit is contained in:
parent
7e2818c854
commit
b1a2b3f5ca
|
@ -986,6 +986,7 @@ void ThemeData::parseVariants(const pugi::xml_node& root)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSelectedVariant == viewKey) {
|
if (mSelectedVariant == viewKey) {
|
||||||
|
parseVariables(node);
|
||||||
parseIncludes(node);
|
parseIncludes(node);
|
||||||
parseViews(node);
|
parseViews(node);
|
||||||
}
|
}
|
||||||
|
@ -1040,17 +1041,21 @@ void ThemeData::parseVariables(const pugi::xml_node& root)
|
||||||
ThemeException error;
|
ThemeException error;
|
||||||
error.setFiles(mPaths);
|
error.setFiles(mPaths);
|
||||||
|
|
||||||
pugi::xml_node variables {root.child("variables")};
|
for (pugi::xml_node node = root.child("variables"); node;
|
||||||
|
node = node.next_sibling("variables")) {
|
||||||
|
|
||||||
if (!variables)
|
for (pugi::xml_node_iterator it = node.begin(); it != node.end(); ++it) {
|
||||||
return;
|
const std::string key {it->name()};
|
||||||
|
const std::string val {resolvePlaceholders(it->text().as_string())};
|
||||||
|
|
||||||
for (pugi::xml_node_iterator it = variables.begin(); it != variables.end(); ++it) {
|
if (!val.empty()) {
|
||||||
std::string key {it->name()};
|
// Overriding existing variables is not allowed for legacy themes.
|
||||||
std::string val {resolvePlaceholders(it->text().as_string())};
|
if (!mLegacyTheme && mVariables.find(key) != mVariables.end())
|
||||||
|
mVariables[key] = val;
|
||||||
if (!val.empty())
|
else
|
||||||
mVariables.insert(std::pair<std::string, std::string>(key, val));
|
mVariables.insert(std::pair<std::string, std::string>(key, val));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue