From 9ea196bed5d4c395a8eda28320809abbfff4113a Mon Sep 17 00:00:00 2001 From: svntcreutz Date: Fri, 27 Jul 2007 23:57:22 +0000 Subject: tab cleanup git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5661 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f --- src/xmlmenu.cpp | 113 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 56 insertions(+), 57 deletions(-) (limited to 'src/xmlmenu.cpp') diff --git a/src/xmlmenu.cpp b/src/xmlmenu.cpp index 9640eb4..be24c95 100644 --- a/src/xmlmenu.cpp +++ b/src/xmlmenu.cpp @@ -12,33 +12,33 @@ using namespace std; void XmlMenu::loadXmlMenu() { - // TODO: show how vdr handels the path vars (developer doc) - // and change code for dynamic path vars - const char *File = "/var/lib/vdr/plugins/vdr-menu.xml"; + // TODO: show how vdr handels the path vars (developer doc) + // and change code for dynamic path vars + const char *File = "/var/lib/vdr/plugins/vdr-menu.xml"; - try - { - DomParser parser; + try + { + DomParser parser; - //TODO: patch the xmlfile with the xsd definition for validate the schema - //parser.set_validate(); - parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically. - parser.parse_file(File); - if(parser) - { - //Walk the tree: - MenuCount=0; - const Element* rootElement = parser.get_document()->get_root_node(); //deleted by DomParser. - ParseElement(rootElement, &_rootMenuNode); - } - } - catch(const std::exception& ex) - { - //TODO: print output to syslog (isyslog or dsyslog?) - cout << "Exception caught: " << ex.what() << endl; + //TODO: patch the xmlfile with the xsd definition for validate the schema + //parser.set_validate(); + parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically. + parser.parse_file(File); + if(parser) + { + //Walk the tree: + MenuCount=0; + const Element* rootElement = parser.get_document()->get_root_node(); //deleted by DomParser. + ParseElement(rootElement, &_rootMenuNode); + } + } + catch(const std::exception& ex) + { + //TODO: print output to syslog (isyslog or dsyslog?) + cout << "Exception caught: " << ex.what() << endl; - //TODO: display message on osd - } + //TODO: display message on osd + } } void XmlMenu::ParseElement(const Element* element, MenuNode* menuNode) @@ -47,7 +47,7 @@ void XmlMenu::ParseElement(const Element* element, MenuNode* menuNode) for (Node::NodeList::iterator i = children.begin(); i != children.end(); i++) { const xmlpp::Element* childElement = dynamic_cast(*i); - + if (childElement) { const xmlpp::Attribute* nameAttribute = childElement->get_attribute("name"); @@ -67,7 +67,7 @@ void XmlMenu::ParseElement(const Element* element, MenuNode* menuNode) { const char* pluginMainMenuEntry; int pluginIndex; - + if (FindPluginByName(nameAttribute->get_value(), &pluginMainMenuEntry, pluginIndex)) { menuNode->AddChild(new PluginMenuItem(pluginMainMenuEntry, pluginIndex)); @@ -80,36 +80,35 @@ void XmlMenu::ParseElement(const Element* element, MenuNode* menuNode) eOSState XmlMenu::geteOSState(std::string name) { - if (name == "Schedule") - { - return osSchedule; - } - else if (name == "Channels") - { - return osChannels; - } - else if (name == "Timers") - { - return osTimers; - } - else if (name == "Recordings") - { - return osRecordings; - } - else if (name == "Setup") - { - return osSetup; - } - else if (name == "Commands") - { - return osCommands; - } - else - return osContinue; + if (name == "Schedule") + { + return osSchedule; + } + else if (name == "Channels") + { + return osChannels; + } + else if (name == "Timers") + { + return osTimers; + } + else if (name == "Recordings") + { + return osRecordings; + } + else if (name == "Setup") + { + return osSetup; + } + else if (name == "Commands") + { + return osCommands; + } + else + return osContinue; } -bool XmlMenu::FindPluginByName(std::string name, const char** mainMenuEntry, - int& pluginIndex) +bool XmlMenu::FindPluginByName(std::string name, const char** mainMenuEntry, int& pluginIndex) { int i=0; while (cPlugin *p = cPluginManager::GetPlugin(i)) @@ -117,13 +116,13 @@ bool XmlMenu::FindPluginByName(std::string name, const char** mainMenuEntry, if (name == p->Name()) { if (const char *item = p->MainMenuEntry()) - { + { pluginIndex = i; *mainMenuEntry = item; return true; } - } - i++; + } + i++; } return false; } -- cgit v1.2.3