summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-07-27 23:57:22 +0000
committersvntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-07-27 23:57:22 +0000
commit9ea196bed5d4c395a8eda28320809abbfff4113a (patch)
tree8666e60fedefc0b0588d7a2746ac4335f3c1da0d
parentef588ca5054e352cbff3b2de159dabed945ac573 (diff)
downloadvdr-plugin-menuorg-9ea196bed5d4c395a8eda28320809abbfff4113a.tar.gz
vdr-plugin-menuorg-9ea196bed5d4c395a8eda28320809abbfff4113a.tar.bz2
tab cleanup
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5661 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
-rw-r--r--src/menunode.h2
-rw-r--r--src/submenuprovider.cc17
-rw-r--r--src/submenuprovider.h16
-rw-r--r--src/xmlmenu.cpp113
-rw-r--r--src/xmlmenu.h20
5 files changed, 83 insertions, 85 deletions
diff --git a/src/menunode.h b/src/menunode.h
index 73dbb4c..66286a1 100644
--- a/src/menunode.h
+++ b/src/menunode.h
@@ -13,7 +13,7 @@ class MenuNode
private:
MenuNode* _parent;
MenuNodeList _childs;
-
+
protected:
void SetParent(MenuNode* parent);
diff --git a/src/submenuprovider.cc b/src/submenuprovider.cc
index 19e4834..872927c 100644
--- a/src/submenuprovider.cc
+++ b/src/submenuprovider.cc
@@ -6,9 +6,9 @@
SubMenuProvider::SubMenuProvider()
{
- //CreateTestMenus();
- _oXmlMenu.loadXmlMenu();
- _currentMenu = &_oXmlMenu._rootMenuNode;
+ //CreateTestMenus();
+ _oXmlMenu.loadXmlMenu();
+ _currentMenu = &_oXmlMenu._rootMenuNode;
}
/*
void SubMenuProvider::CreateTestMenus()
@@ -38,7 +38,7 @@ void SubMenuProvider::CreateTestMenus()
MainMenuItemsList* SubMenuProvider::MainMenuItems()
{
ResetMainMenuItemsList();
-
+
for (MenuNodeList::iterator i = _currentMenu->Childs().begin();
i != _currentMenu->Childs().end(); i++)
{
@@ -57,19 +57,18 @@ void SubMenuProvider::ResetMainMenuItemsList()
delete *i;
}
_currentMainMenuItems.clear();
-
}
void SubMenuProvider::EnterSubMenu(cOsdItem* item)
{
for(unsigned int itemIndex=0; itemIndex < _currentMainMenuItems.size(); itemIndex++)
{
- MainMenuItem* menuItem = _currentMainMenuItems.at(itemIndex);
- if (menuItem->IsCustomMenuItem() && (menuItem->CustomMenuItem() == item))
- {
+ MainMenuItem* menuItem = _currentMainMenuItems.at(itemIndex);
+ if (menuItem->IsCustomMenuItem() && (menuItem->CustomMenuItem() == item))
+ {
_currentMenu = _currentMenu->Childs().at(itemIndex);
break;
- }
+ }
}
}
diff --git a/src/submenuprovider.h b/src/submenuprovider.h
index 7f3ac68..bb5c055 100644
--- a/src/submenuprovider.h
+++ b/src/submenuprovider.h
@@ -10,20 +10,20 @@ using namespace SubMenuPatch;
class SubMenuProvider: public ISubMenuProvider
{
private:
- XmlMenu _oXmlMenu;
- //MenuNode _rootMenuNode;
+ XmlMenu _oXmlMenu;
+ //MenuNode _rootMenuNode;
MenuNode* _currentMenu;
MainMenuItemsList _currentMainMenuItems;
public:
- SubMenuProvider();
- virtual MainMenuItemsList* MainMenuItems();
- virtual void EnterSubMenu(cOsdItem* item);
- virtual bool LeaveSubMenu();
+ SubMenuProvider();
+ virtual MainMenuItemsList* MainMenuItems();
+ virtual void EnterSubMenu(cOsdItem* item);
+ virtual bool LeaveSubMenu();
private:
- void ResetMainMenuItemsList();
- void CreateTestMenus();
+ void ResetMainMenuItemsList();
+ void CreateTestMenus();
};
#endif
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;
}
diff --git a/src/xmlmenu.h b/src/xmlmenu.h
index 4cac005..4c7dbb1 100644
--- a/src/xmlmenu.h
+++ b/src/xmlmenu.h
@@ -8,17 +8,17 @@ using namespace xmlpp;
class XmlMenu
{
- private:
- //void createMenu(); // create the Menu Node
- void ParseElement(const Element* a_node, MenuNode* menuNode);
- eOSState geteOSState(std::string name); // gets the eOSState for the given string
- bool FindPluginByName(std::string name, const char** mainMenuEntry, int& pluginIndex); // gets the plugin for the given string
- MenuNode* _subMenu[30]; // holds the submenus
- int MenuCount;
+ private:
+ //void createMenu(); // create the Menu Node
+ void ParseElement(const Element* a_node, MenuNode* menuNode);
+ eOSState geteOSState(std::string name); // gets the eOSState for the given string
+ bool FindPluginByName(std::string name, const char** mainMenuEntry, int& pluginIndex); // gets the plugin for the given string
+ MenuNode* _subMenu[30]; // holds the submenus
+ int MenuCount;
- public:
- MenuNode _rootMenuNode; // hold the Menue Nodes
- void loadXmlMenu(); // load the xmlfile
+ public:
+ MenuNode _rootMenuNode; // hold the Menue Nodes
+ void loadXmlMenu(); // load the xmlfile
};
#endif