From c7ad8d093591214a32cacc79fa25d8e118493093 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 18 Oct 2012 19:02:04 +0300 Subject: Add button in themes to show additional theme info. --- src/gui/theme.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/gui/theme.cpp') 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( + xmlNodeGetContent(infoNode)); + } + else if (xmlNameEqual(infoNode, "copyright")) + { + info->copyright = reinterpret_cast( + xmlNodeGetContent(infoNode)); + } + } + return info; +} -- cgit v1.2.3-60-g2f50