summaryrefslogtreecommitdiff
path: root/src/gui/theme.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-18 19:02:04 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-18 19:02:04 +0300
commitc7ad8d093591214a32cacc79fa25d8e118493093 (patch)
tree2be3eacaa43c6941862b15ca099eeba8cd292fa5 /src/gui/theme.cpp
parent2b4110a217110dfe9919fa3cc70e41c6920ac597 (diff)
downloadmanaverse-c7ad8d093591214a32cacc79fa25d8e118493093.tar.gz
manaverse-c7ad8d093591214a32cacc79fa25d8e118493093.tar.bz2
manaverse-c7ad8d093591214a32cacc79fa25d8e118493093.tar.xz
manaverse-c7ad8d093591214a32cacc79fa25d8e118493093.zip
Add button in themes to show additional theme info.
Diffstat (limited to 'src/gui/theme.cpp')
-rw-r--r--src/gui/theme.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 4abf76eb6..9ecac247c 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -1031,3 +1031,35 @@ ImageSet *Theme::getImageSetFromThemeXml(const std::string &name,
}
return nullptr;
}
+
+ThemeInfo *Theme::loadInfo(const std::string &themeName)
+{
+ std::string path;
+ if (themeName.empty())
+ path = "graphics/gui/info.xml";
+ else
+ path = defaultThemePath + themeName + "/info.xml";
+ logger->log("loading: " + path);
+ XML::Document doc(path);
+ const XmlNodePtr rootNode = doc.rootNode();
+
+ if (!rootNode || !xmlNameEqual(rootNode, "info"))
+ return nullptr;
+
+ ThemeInfo *info = new ThemeInfo();
+
+ for_each_xml_child_node(infoNode, rootNode)
+ {
+ if (xmlNameEqual(infoNode, "name"))
+ {
+ info->name = reinterpret_cast<const char*>(
+ xmlNodeGetContent(infoNode));
+ }
+ else if (xmlNameEqual(infoNode, "copyright"))
+ {
+ info->copyright = reinterpret_cast<const char*>(
+ xmlNodeGetContent(infoNode));
+ }
+ }
+ return info;
+}