summaryrefslogtreecommitdiff
path: root/src/xmlmenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlmenu.cpp')
-rw-r--r--src/xmlmenu.cpp113
1 files changed, 56 insertions, 57 deletions
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<const xmlpp::Element*>(*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;
}