summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-07-27 00:47:42 +0000
committersvntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-07-27 00:47:42 +0000
commitcc67772793751d5329739ede3da01995a743bca1 (patch)
tree7178c093ee562e4ab50a2f8490b67d9ccec87e28
parentea5503c121b54a050649a992e42a38381a38ff59 (diff)
downloadvdr-plugin-menuorg-cc67772793751d5329739ede3da01995a743bca1.tar.gz
vdr-plugin-menuorg-cc67772793751d5329739ede3da01995a743bca1.tar.bz2
some fixed.. but some bugs left - need to fix befor compile
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5647 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
-rw-r--r--Makefile2
-rw-r--r--sources.mk1
-rw-r--r--src/submenuprovider.cc2
-rw-r--r--src/xmlmenu.cpp42
-rw-r--r--src/xmlmenu.h16
5 files changed, 46 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 491f2e5..e1e0aad 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ VERSION = $(shell grep 'static const char VERSION\[\] =' src/version.h | \
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -O2 -Wall -Woverloaded-virtual
+CXXFLAGS ?= -fPIC -O2 -Wall -Woverloaded-virtual `pkg-config libxml++-2.6 --cflags --libs`
### The directory environment:
diff --git a/sources.mk b/sources.mk
index e304abb..25eaf6e 100644
--- a/sources.mk
+++ b/sources.mk
@@ -6,3 +6,4 @@ SRCS = \
src/submenuitem.cc \
src/submenuprovider.cc \
src/vdrmenuitem.cc \
+ src/xmlmenu.cpp
diff --git a/src/submenuprovider.cc b/src/submenuprovider.cc
index a731b60..19e4834 100644
--- a/src/submenuprovider.cc
+++ b/src/submenuprovider.cc
@@ -8,7 +8,7 @@ SubMenuProvider::SubMenuProvider()
{
//CreateTestMenus();
_oXmlMenu.loadXmlMenu();
- _currentMenu = &_rootMenuNode;
+ _currentMenu = &_oXmlMenu._rootMenuNode;
}
/*
void SubMenuProvider::CreateTestMenus()
diff --git a/src/xmlmenu.cpp b/src/xmlmenu.cpp
index 2bba503..45d7900 100644
--- a/src/xmlmenu.cpp
+++ b/src/xmlmenu.cpp
@@ -1,15 +1,15 @@
#include <libxml++/libxml++.h>
+#include <vdr/plugin.h>
+#include "menunode.h"
+#include "vdrmenuitem.h"
+#include "pluginmenuitem.h"
+#include "xmlmenu.h"
#include <iostream>
//#include <vdr/submenupatch.h>
using namespace xmlpp;
using namespace std;
-XmlMenu::XmlMenu(void)
-{
- //MenuNr = 0;
-}
-
void XmlMenu::loadXmlMenu()
{
// TODO: show how vdr handels the path vars (developer doc)
@@ -28,7 +28,7 @@ void XmlMenu::loadXmlMenu()
{
//Walk the tree:
const Node* pNode = parser.get_document()->get_root_node(); //deleted by DomParser.
- parseNode(pNode,0);
+ parseNode(pNode,0,NULL);
}
}
catch(const std::exception& ex)
@@ -45,6 +45,7 @@ void XmlMenu::parseNode(const Node* a_node, unsigned int Parent, MenuNode *paren
const ContentNode* nodeContent = dynamic_cast<const ContentNode*>(a_node);
const TextNode* nodeText = dynamic_cast<const TextNode*>(a_node);
const CommentNode* nodeComment = dynamic_cast<const CommentNode*>(a_node);
+ MenuNode newparentNode;
/****
MenuNode* subMenu1 =_rootMenuNode.AddChild(new SubMenuItem("Custom menu 1"));
@@ -61,10 +62,11 @@ void XmlMenu::parseNode(const Node* a_node, unsigned int Parent, MenuNode *paren
if(!nodeText && !nodeComment && !nodename.empty()) //Let's not say "name: text".
{
- for(int i=0;i<=Parent;i++)
+ /*
+ for(unsigned int i=0;i<=Parent;i++)
{
printf(" ");
- }
+ }*/
if (nodename == "menus")
{
//cout << Parent << "-" << MainMenuIndex << "-" << myMenuNr << "-ROOT" << endl;
@@ -113,10 +115,11 @@ void XmlMenu::parseNode(const Node* a_node, unsigned int Parent, MenuNode *paren
//cout << Parent << "-" << MainMenuIndex << "-" << myMenuNr << "-PluginItem=" << attribute->get_value() << endl;
if (getPluginIndex(attribute->get_value()) != NULL)
{
+ PluginItemAndIndex myPlugin = getPluginIndex(attribute->get_value());
if (parentNode == NULL)
- newparentNode =_rootMenuNode.AddChild(new PluginMenuItem(item, getPluginIndex(attribute->get_value())));
+ newparentNode =_rootMenuNode.AddChild(new PluginMenuItem(myPlugin.item, myPlugin.index));
else
- newparentNode = parentNode->AddChild(new PluginMenuItem(item, getPluginIndex(attribute->get_value())));
+ newparentNode = parentNode->AddChild(new PluginMenuItem(myPlugin.item, myPlugin.index));
}
}
}
@@ -164,7 +167,7 @@ enum eOSState { osUnknown,
osUser10,
};
*/
-eOSState XmlMenu::geteOSState(char* name)
+eOSState XmlMenu::geteOSState(Glib::ustring* name)
{
if(name == "Continue")
{
@@ -228,4 +231,19 @@ eOSState XmlMenu::geteOSState(char* name)
}
else
return osContinue;
-} \ No newline at end of file
+}
+
+int XmlMenu::getPluginIndex(Glib::ustring* name)
+{
+ int i=0;
+ while (cPlugin *p = cPluginManager::GetPlugin(i))
+ {
+ if (const char *item = p->MainMenuEntry())
+ {
+ if (p.Name == name)
+ break;
+ }
+ i++;
+ }
+ return i;
+}
diff --git a/src/xmlmenu.h b/src/xmlmenu.h
index eb9dd77..b24baf0 100644
--- a/src/xmlmenu.h
+++ b/src/xmlmenu.h
@@ -1,15 +1,25 @@
#ifndef ___XMLMENU_H
#define ___XMLMENU_H
+#include <libxml++/libxml++.h>
+#include <iostream>
#include "menunode.h"
+using namespace xmlpp;
+
+struct PluginItemAndIndex
+{
+ const char* item;
+ int index;
+};
+
class XmlMenu
{
private:
//void createMenu(); // create the Menu Node
- void parseNode(const Node *a_node, unsigned int Parent);
- eOSState geteOSState(char* name); // gets the eOSState for the given string
- int getPluginIndex(char* name); // gets the plugin index for the given string
+ 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
public:
MenuNode _rootMenuNode; // hold the Menue Node
XmlMenu (void);