summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-08-23 21:14:48 +0000
committersvntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f>2007-08-23 21:14:48 +0000
commit9f2a8d070ede9308e43118259cf5d5965fad95ba (patch)
tree807614d9d9c90c0339f4b49c020ea035a10dbc62
parent5739573b28cfe14dd141645ec5e3d068da78a5e0 (diff)
downloadvdr-plugin-menuorg-9f2a8d070ede9308e43118259cf5d5965fad95ba.tar.gz
vdr-plugin-menuorg-9f2a8d070ede9308e43118259cf5d5965fad95ba.tar.bz2
fixed childlock stuff
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5940 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
-rw-r--r--src/childlock.cpp25
-rw-r--r--src/childlock.h4
-rw-r--r--src/commandmenunode.cpp6
-rw-r--r--src/commandmenunode.h3
-rw-r--r--src/mainmenuitemsprovider.cpp15
-rw-r--r--src/menuconfiguration.cpp11
-rw-r--r--src/menunode.cpp5
-rw-r--r--src/menunode.h1
-rw-r--r--src/pluginmenunode.cpp8
-rw-r--r--src/pluginmenunode.h1
-rw-r--r--src/submenunode.cpp6
-rw-r--r--src/submenunode.h1
-rw-r--r--src/systemmenunode.cpp6
-rw-r--r--src/systemmenunode.h1
14 files changed, 47 insertions, 46 deletions
diff --git a/src/childlock.cpp b/src/childlock.cpp
index 38f6d20..dbd2db2 100644
--- a/src/childlock.cpp
+++ b/src/childlock.cpp
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id:$
+ * $Id$
*
*/
@@ -25,29 +25,6 @@
#include "childlockservice.h"
IChildLockService* ChildLock::_childLockService = NULL;
-bool ChildLock::IsMenuProtected(const char* MenuName)
-{
- if (IChildLockService* childLockService = ChildLockService())
- {
- return childLockService->IsMenuProtected(MenuName);
- }
- else
- {
- return false;
- }
-}
-
-bool ChildLock::IsPluginProtected(cPlugin* Plugin)
-{
- if (IChildLockService* childLockService = ChildLockService())
- {
- return childLockService->IsPluginProtected(Plugin);
- }
- else
- {
- return false;
- }
-}
bool ChildLock::IsMenuHidden(const char* MenuName)
{
diff --git a/src/childlock.h b/src/childlock.h
index d586f73..f129b67 100644
--- a/src/childlock.h
+++ b/src/childlock.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id:$
+ * $Id$
*
*/
@@ -32,8 +32,6 @@ class ChildLock
static IChildLockService* _childLockService;
public:
- static bool IsMenuProtected(const char* MenuName);
- static bool IsPluginProtected(cPlugin* Plugin);
static bool IsMenuHidden(const char* MenuName);
static bool IsPluginHidden(cPlugin* Plugin);
diff --git a/src/commandmenunode.cpp b/src/commandmenunode.cpp
index ff44bef..ed4328e 100644
--- a/src/commandmenunode.cpp
+++ b/src/commandmenunode.cpp
@@ -25,6 +25,7 @@
#include <vdr/interface.h>
#include <vdr/menu.h>
#include "osditemdefinition.h"
+#include "childlock.h"
using namespace std;
@@ -80,3 +81,8 @@ string CommandMenuNode::ExecuteCommand()
}
return result;
}
+
+bool CommandMenuNode::IsHidden()
+{
+ return ChildLock::IsMenuHidden(_text.c_str());
+}
diff --git a/src/commandmenunode.h b/src/commandmenunode.h
index 55906e3..913591c 100644
--- a/src/commandmenunode.h
+++ b/src/commandmenunode.h
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id:$
+ * $Id$
*
*/
@@ -37,6 +37,7 @@ class CommandMenuNode: public MenuNode
CommandMenuNode(std::string text, std::string _command, bool confirm);
IMenuItemDefinition* CreateMenuItemDefinition();
cOsdMenu* Execute();
+ bool IsHidden();
private:
std::string ExecuteCommand();
diff --git a/src/mainmenuitemsprovider.cpp b/src/mainmenuitemsprovider.cpp
index 916034f..6e0bb00 100644
--- a/src/mainmenuitemsprovider.cpp
+++ b/src/mainmenuitemsprovider.cpp
@@ -45,7 +45,10 @@ MenuItemDefinitions* MainMenuItemsProvider::MainMenuItems()
for (MenuNodeList::iterator i = _currentMenu->Childs().begin();
i != _currentMenu->Childs().end(); i++)
{
- _currentMainMenuItems.push_back((*i)->CreateMenuItemDefinition());
+ if (!(*i)->IsHidden())
+ {
+ _currentMainMenuItems.push_back((*i)->CreateMenuItemDefinition());
+ }
}
return &_currentMainMenuItems;
@@ -72,10 +75,7 @@ void MainMenuItemsProvider::EnterSubMenu(cOsdItem* item)
int itemIndex = IndexOfCustomOsdItem(item);
if (itemIndex >= 0)
{
- if (!ChildLock::IsMenuProtected(item->Text()))
- {
- _currentMenu = _currentMenu->Childs().at(itemIndex);
- }
+ _currentMenu = _currentMenu->Childs().at(itemIndex);
}
}
@@ -97,10 +97,7 @@ cOsdMenu* MainMenuItemsProvider::Execute(cOsdItem* item)
int itemIndex = IndexOfCustomOsdItem(item);
if (itemIndex >= 0)
{
- if (!ChildLock::IsMenuProtected(item->Text()))
- {
- return _currentMenu->Childs().at(itemIndex)->Execute();
- }
+ return _currentMenu->Childs().at(itemIndex)->Execute();
}
}
diff --git a/src/menuconfiguration.cpp b/src/menuconfiguration.cpp
index 5a84966..39d2e34 100644
--- a/src/menuconfiguration.cpp
+++ b/src/menuconfiguration.cpp
@@ -29,7 +29,6 @@
#include "submenunode.h"
#include "pluginmenunode.h"
#include "commandmenunode.h"
-#include "childlock.h"
using namespace xmlpp;
using namespace std;
@@ -128,10 +127,7 @@ MenuNode* MenuConfiguration::AddSubMenuNode(string name, MenuNode* menu)
void MenuConfiguration::AddSystemMenuNode(string name, MenuNode* menu)
{
- if (!ChildLock::IsMenuHidden(name.c_str()))
- {
- menu->AddChild(new SystemMenuNode(name, MenuTextToVdrState(name)));
- }
+ menu->AddChild(new SystemMenuNode(name, MenuTextToVdrState(name)));
}
void MenuConfiguration::AddPluginMenuNode(string pluginName, MenuNode* menu)
@@ -217,9 +213,6 @@ void MenuConfiguration::AddPluginMenuNode(cPlugin* plugin, int pluginIndex, Menu
{
if (const char *item = plugin->MainMenuEntry())
{
- if (!ChildLock::IsPluginHidden(plugin))
- {
- menu->AddChild(new PluginMenuNode(item, pluginIndex));
- }
+ menu->AddChild(new PluginMenuNode(item, pluginIndex));
}
}
diff --git a/src/menunode.cpp b/src/menunode.cpp
index 24e4f76..60cdbc2 100644
--- a/src/menunode.cpp
+++ b/src/menunode.cpp
@@ -67,3 +67,8 @@ cOsdMenu* MenuNode::Execute()
{
return NULL;
}
+
+bool MenuNode::IsHidden()
+{
+ return false;
+}
diff --git a/src/menunode.h b/src/menunode.h
index bac509e..eff60d8 100644
--- a/src/menunode.h
+++ b/src/menunode.h
@@ -48,6 +48,7 @@ class MenuNode
MenuNode* AddChild(MenuNode* child);
virtual IMenuItemDefinition* CreateMenuItemDefinition();
virtual cOsdMenu* Execute();
+ virtual bool IsHidden();
};
#endif
diff --git a/src/pluginmenunode.cpp b/src/pluginmenunode.cpp
index 3e8bc5b..6745960 100644
--- a/src/pluginmenunode.cpp
+++ b/src/pluginmenunode.cpp
@@ -22,7 +22,9 @@
#include "pluginmenunode.h"
#include <vdr/mainmenuitemsprovider.h>
+#include <vdr/plugin.h>
#include "pluginitemdefinition.h"
+#include "childlock.h"
PluginMenuNode::PluginMenuNode(const char* pluginMainMenuEntry, int pluginIndex)
{
@@ -34,3 +36,9 @@ IMenuItemDefinition* PluginMenuNode::CreateMenuItemDefinition()
{
return new PluginItemDefinition(_pluginMainMenuEntry, _pluginIndex);
}
+
+bool PluginMenuNode::IsHidden()
+{
+ cPlugin* plugin = cPluginManager::GetPlugin(_pluginIndex);
+ return ChildLock::IsPluginHidden(plugin);
+}
diff --git a/src/pluginmenunode.h b/src/pluginmenunode.h
index cf55e66..cbf3477 100644
--- a/src/pluginmenunode.h
+++ b/src/pluginmenunode.h
@@ -34,6 +34,7 @@ class PluginMenuNode: public MenuNode
public:
PluginMenuNode(const char* pluginMainMenuEntry, int pluginIndex);
IMenuItemDefinition* CreateMenuItemDefinition();
+ bool IsHidden();
};
#endif
diff --git a/src/submenunode.cpp b/src/submenunode.cpp
index 8601041..eb423b8 100644
--- a/src/submenunode.cpp
+++ b/src/submenunode.cpp
@@ -23,6 +23,7 @@
#include "submenunode.h"
#include <vdr/osdbase.h>
#include "osditemdefinition.h"
+#include "childlock.h"
SubMenuNode::SubMenuNode(std::string text)
{
@@ -33,3 +34,8 @@ IMenuItemDefinition* SubMenuNode::CreateMenuItemDefinition()
{
return new OsdItemDefinition(new cOsdItem(_text.c_str(), osUser1));
}
+
+bool SubMenuNode::IsHidden()
+{
+ return ChildLock::IsMenuHidden(_text.c_str());
+}
diff --git a/src/submenunode.h b/src/submenunode.h
index 8cd1e93..2197265 100644
--- a/src/submenunode.h
+++ b/src/submenunode.h
@@ -34,6 +34,7 @@ class SubMenuNode: public MenuNode
public:
SubMenuNode(std::string text);
IMenuItemDefinition* CreateMenuItemDefinition();
+ bool IsHidden();
};
#endif
diff --git a/src/systemmenunode.cpp b/src/systemmenunode.cpp
index f5ca3cc..53ab4db 100644
--- a/src/systemmenunode.cpp
+++ b/src/systemmenunode.cpp
@@ -23,6 +23,7 @@
#include "systemmenunode.h"
#include <vdr/mainmenuitemsprovider.h>
#include "osditemdefinition.h"
+#include "childlock.h"
SystemMenuNode::SystemMenuNode(std::string text, eOSState state)
{
@@ -34,3 +35,8 @@ IMenuItemDefinition* SystemMenuNode::CreateMenuItemDefinition()
{
return new OsdItemDefinition(new cOsdItem(tr(_text.c_str()), _state));
}
+
+bool SystemMenuNode::IsHidden()
+{
+ return ChildLock::IsMenuHidden(_text.c_str());
+}
diff --git a/src/systemmenunode.h b/src/systemmenunode.h
index 09df5d6..bba1dc0 100644
--- a/src/systemmenunode.h
+++ b/src/systemmenunode.h
@@ -36,6 +36,7 @@ class SystemMenuNode: public MenuNode
public:
SystemMenuNode(std::string text, eOSState state);
IMenuItemDefinition* CreateMenuItemDefinition();
+ bool IsHidden();
};
#endif