diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-18 19:02:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-18 19:02:04 +0300 |
commit | c7ad8d093591214a32cacc79fa25d8e118493093 (patch) | |
tree | 2be3eacaa43c6941862b15ca099eeba8cd292fa5 /src/gui/theme.cpp | |
parent | 2b4110a217110dfe9919fa3cc70e41c6920ac597 (diff) | |
download | manaverse-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.cpp | 32 |
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; +} |