From 98738ae8c7841da4851251684319ad8eab0fcfc7 Mon Sep 17 00:00:00 2001 From: svntcreutz Date: Fri, 27 Jul 2007 01:11:51 +0000 Subject: - more fixes (also bugs left) git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5648 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f --- src/xmlmenu.cpp | 27 ++++++++++++++++++--------- src/xmlmenu.h | 4 ++-- 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/xmlmenu.cpp b/src/xmlmenu.cpp index 45d7900..1a66981 100644 --- a/src/xmlmenu.cpp +++ b/src/xmlmenu.cpp @@ -2,6 +2,7 @@ #include #include "menunode.h" #include "vdrmenuitem.h" +#include "submenuitem.h" #include "pluginmenuitem.h" #include "xmlmenu.h" #include @@ -82,9 +83,9 @@ void XmlMenu::parseNode(const Node* a_node, unsigned int Parent, MenuNode *paren const Attribute* attribute = *iter; //cout << Parent << "-" << MainMenuIndex << "-" << myMenuNr << "-SystemItem=" << attribute->get_value() << endl; if (parentNode == NULL) - newparentNode =_rootMenuNode.AddChild(new VdrMenuItem(tr(attribute->get_value()), geteOSState(attribute->get_value()))); + newparentNode =_rootMenuNode.AddChild(new VdrMenuItem(tr((const char*) attribute->get_value()), geteOSState(attribute->get_value()))); else - newparentNode = parentNode->AddChild(new VdrMenuItem(tr(attribute->get_value()), geteOSState(attribute->get_value()))); + newparentNode = parentNode->AddChild(new VdrMenuItem(tr((const char*) attribute->get_value()), geteOSState(attribute->get_value()))); } } } @@ -98,9 +99,9 @@ void XmlMenu::parseNode(const Node* a_node, unsigned int Parent, MenuNode *paren const Attribute* attribute = *iter; //cout << Parent << "-" << MainMenuIndex << "-" << myMenuNr << "-MenuItem=" << attribute->get_value() << endl; if (parentNode == NULL) - newparentNode =_rootMenuNode.AddChild(new SubMenuItem(attribute->get_value())); + newparentNode =_rootMenuNode.AddChild(new SubMenuItem((const char*) attribute->get_value())); else - newparentNode = parentNode->AddChild(new SubMenuItem(attribute->get_value())); + newparentNode = parentNode->AddChild(new SubMenuItem((const char*) attribute->get_value())); } } } @@ -121,7 +122,8 @@ void XmlMenu::parseNode(const Node* a_node, unsigned int Parent, MenuNode *paren else newparentNode = parentNode->AddChild(new PluginMenuItem(myPlugin.item, myPlugin.index)); } - } + } + //subMenu2->AddChild(new PluginMenuItem(item, i)); } } } @@ -167,7 +169,7 @@ enum eOSState { osUnknown, osUser10, }; */ -eOSState XmlMenu::geteOSState(Glib::ustring* name) +eOSState XmlMenu::geteOSState(const Glib::ustring& name) { if(name == "Continue") { @@ -233,17 +235,24 @@ eOSState XmlMenu::geteOSState(Glib::ustring* name) return osContinue; } -int XmlMenu::getPluginIndex(Glib::ustring* name) +PluginItemAndIndex XmlMenu::getPlugin(const Glib::ustring& name) { + PluginItemAndIndex returnVar; +/* + returnVar.item = NULL; + returnVar.index = NULL; +*/ int i=0; while (cPlugin *p = cPluginManager::GetPlugin(i)) { if (const char *item = p->MainMenuEntry()) { - if (p.Name == name) + if (name == (const Glib::ustring) p->Name()) + returnVar.item = item; + returnVar.index = i; break; } i++; } - return i; + return returnVar; } diff --git a/src/xmlmenu.h b/src/xmlmenu.h index b24baf0..89db4cd 100644 --- a/src/xmlmenu.h +++ b/src/xmlmenu.h @@ -18,8 +18,8 @@ class XmlMenu private: //void createMenu(); // create the Menu Node void parseNode(const Node* a_node, unsigned int Parent, MenuNode *parentNode); - eOSState geteOSState(Glib::ustring* name); // gets the eOSState for the given string - PluginItemAndIndex getPlugin(Glib::ustring* name); // gets the plugin for the given string + eOSState geteOSState(const Glib::ustring& name); // gets the eOSState for the given string + PluginItemAndIndex getPlugin(const Glib::ustring& name); // gets the plugin for the given string public: MenuNode _rootMenuNode; // hold the Menue Node XmlMenu (void); -- cgit v1.2.3