mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Missing theme files defined using variables now only trigger debug messages instead of errors or warnings.
Also added two DebugSkipMissingThemeFiles and DebugSkipMissingThemeFilesCustomCollections settings.
This commit is contained in:
parent
171ee4ded2
commit
c870664615
|
@ -1335,7 +1335,7 @@ void SystemData::loadTheme()
|
|||
sysData.insert(std::pair<std::string, std::string>("system.theme.collections", "\b"));
|
||||
}
|
||||
|
||||
mTheme->loadFile(sysData, path);
|
||||
mTheme->loadFile(sysData, path, isCustomCollection());
|
||||
}
|
||||
catch (ThemeException& e) {
|
||||
LOG(LogError) << e.what();
|
||||
|
|
|
@ -285,6 +285,8 @@ void Settings::setDefaults()
|
|||
//
|
||||
|
||||
mBoolMap["DebugSkipInputLogging"] = {false, false};
|
||||
mBoolMap["DebugSkipMissingThemeFiles"] = {false, false};
|
||||
mBoolMap["DebugSkipMissingThemeFilesCustomCollections"] = {true, true};
|
||||
mStringMap["OpenGLVersion"] = {"", ""};
|
||||
mStringMap["ROMDirectory"] = {"", ""};
|
||||
mStringMap["UIMode_passkey"] = {"uuddlrlrba", "uuddlrlrba"};
|
||||
|
|
|
@ -393,13 +393,17 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
|
||||
ThemeData::ThemeData()
|
||||
: mLegacyTheme {false}
|
||||
, mCustomCollection {false}
|
||||
{
|
||||
mCurrentThemeSet = mThemeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||
}
|
||||
|
||||
void ThemeData::loadFile(const std::map<std::string, std::string>& sysDataMap,
|
||||
const std::string& path)
|
||||
const std::string& path,
|
||||
const bool customCollection)
|
||||
{
|
||||
mCustomCollection = customCollection;
|
||||
|
||||
mPaths.push_back(path);
|
||||
|
||||
ThemeException error;
|
||||
|
@ -903,8 +907,28 @@ void ThemeData::parseIncludes(const pugi::xml_node& root)
|
|||
for (pugi::xml_node node = root.child("include"); node; node = node.next_sibling("include")) {
|
||||
std::string relPath {resolvePlaceholders(node.text().as_string())};
|
||||
std::string path {Utils::FileSystem::resolveRelativePath(relPath, mPaths.back(), true)};
|
||||
if (!ResourceManager::getInstance().fileExists(path))
|
||||
throw error << " -> \"" << relPath << "\" not found (resolved to \"" << path << "\")";
|
||||
|
||||
if (!ResourceManager::getInstance().fileExists(path)) {
|
||||
// For explicit paths, throw an error if the file couldn't be found, but only
|
||||
// print a debug message if it was set using a variable.
|
||||
if (relPath == node.text().get()) {
|
||||
throw error << " -> \"" << relPath << "\" not found (resolved to \"" << path
|
||||
<< "\")";
|
||||
}
|
||||
else {
|
||||
if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") ||
|
||||
(mCustomCollection && Settings::getInstance()->getBool(
|
||||
"DebugSkipMissingThemeFilesCustomCollections")))) {
|
||||
LOG(LogDebug) << error.message << ": Couldn't find file \"" << node.text().get()
|
||||
<< "\" "
|
||||
<< ((node.text().get() != path) ?
|
||||
"which resolves to \"" + path + "\"" :
|
||||
"");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
error << " -> \"" << relPath << "\"";
|
||||
|
||||
mPaths.push_back(path);
|
||||
|
@ -1312,21 +1336,30 @@ void ThemeData::parseElement(const pugi::xml_node& root,
|
|||
|
||||
if (!ResourceManager::getInstance().fileExists(path)) {
|
||||
std::stringstream ss;
|
||||
// For explicits paths, print a warning if the file couldn't be found, but
|
||||
// For explicit paths, print a warning if the file couldn't be found, but
|
||||
// only print a debug message if it was set using a variable.
|
||||
if (str == node.text().as_string()) {
|
||||
LOG(LogWarning)
|
||||
<< error.message << ": Couldn't find file \"" << node.text().get()
|
||||
<< "\" "
|
||||
<< ((node.text().get() != path) ? "which resolves to \"" + path + "\"" :
|
||||
"");
|
||||
"")
|
||||
<< "(element type \"" << element.type << "\", name \""
|
||||
<< root.attribute("name").as_string() << "\", property \"" << nodeName
|
||||
<< "\")";
|
||||
}
|
||||
else {
|
||||
else if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") ||
|
||||
(mCustomCollection &&
|
||||
Settings::getInstance()->getBool(
|
||||
"DebugSkipMissingThemeFilesCustomCollections")))) {
|
||||
LOG(LogDebug)
|
||||
<< error.message << ": Couldn't find file \"" << node.text().get()
|
||||
<< "\" "
|
||||
<< ((node.text().get() != path) ? "which resolves to \"" + path + "\"" :
|
||||
"");
|
||||
"")
|
||||
<< " (element type \"" << element.type << "\", name \""
|
||||
<< root.attribute("name").as_string() << "\", property \"" << nodeName
|
||||
<< "\")";
|
||||
}
|
||||
}
|
||||
element.properties[nodeName] = path;
|
||||
|
|
|
@ -203,7 +203,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void loadFile(const std::map<std::string, std::string>& sysDataMap, const std::string& path);
|
||||
void loadFile(const std::map<std::string, std::string>& sysDataMap,
|
||||
const std::string& path,
|
||||
const bool customCollection);
|
||||
bool hasView(const std::string& view);
|
||||
ThemeView& getViewElements(std::string view) { return mViews[view]; }
|
||||
|
||||
|
@ -281,6 +283,7 @@ private:
|
|||
std::string mSelectedVariant;
|
||||
std::string mSelectedAspectRatio;
|
||||
bool mLegacyTheme;
|
||||
bool mCustomCollection;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_THEME_DATA_H
|
||||
|
|
Loading…
Reference in a new issue