diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | menuorg.dtd | 14 | ||||
-rw-r--r-- | sources.mk | 2 | ||||
-rw-r--r-- | src/childlockservice.h | 2 | ||||
-rw-r--r-- | src/commandmenunode.cpp | 6 | ||||
-rw-r--r-- | src/commandmenunode.h | 8 | ||||
-rw-r--r-- | src/imenunodeprocessor.h | 14 | ||||
-rw-r--r-- | src/linemenunode.cpp | 51 | ||||
-rw-r--r-- | src/linemenunode.h | 45 | ||||
-rw-r--r-- | src/mainmenuitemsprovider.h | 7 | ||||
-rw-r--r-- | src/menuconfiguration.cpp | 14 | ||||
-rw-r--r-- | src/menuconfiguration.h | 1 | ||||
-rw-r--r-- | src/osdlineitem.cpp (renamed from src/lineitem.cpp) | 4 | ||||
-rw-r--r-- | src/osdlineitem.h (renamed from src/lineitem.h) | 8 | ||||
-rw-r--r-- | src/pluginconfiguration.h | 8 | ||||
-rw-r--r-- | src/pluginmenunode.h | 8 | ||||
-rw-r--r-- | src/submenunode.h | 6 | ||||
-rw-r--r-- | src/systemmenunode.cpp | 4 | ||||
-rw-r--r-- | src/systemmenunode.h | 6 |
19 files changed, 165 insertions, 45 deletions
@@ -66,6 +66,7 @@ There are only four kinds of menu items described by the following XML tags: <plugin> : Plug-in menu items <menu> : A sub menu <command> : An external command to be excuted, similar to VDR's commands.conf + <line> : a line item In the menu hierarchy <system>, <plug-in> and <command> are leaf nodes, whereas <menu> is an internal node. <menu> may contain any number of <system>, <plugin>, @@ -124,6 +125,7 @@ e.g.: <plug-in name="solitaire" /> <plug-in name="freecell" /> </menu> + <line /> <menu name="System"> <system name="Setup" /> <system name="Commands" /> diff --git a/menuorg.dtd b/menuorg.dtd index 296b62b..01811ab 100644 --- a/menuorg.dtd +++ b/menuorg.dtd @@ -1,7 +1,7 @@ <-- vdr-menuorg - A plugin for the Linux Video Disk Recorder Copyright (C) 2007 Thomas Creutz, Tobias Grimm - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -11,15 +11,15 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + $Id$ --> -<!ELEMENT menu ((menu | system | plugin | command)+)> +<!ELEMENT menu ((menu | system | plugin | command | line)+)> <!ATTLIST menu name CDATA #REQUIRED > @@ -39,4 +39,8 @@ execute CDATA #REQUIRED confirm (yes|no) #IMPLIED > -<!ELEMENT menus ((menu | system | plugin | command)+)> +<!ELEMENT line EMPTY> +<!ATTLIST line + title CDATA #IMPLIED +> +<!ELEMENT menus ((menu | system | plugin | command | line)+)> @@ -17,3 +17,5 @@ SRCS = \ src/menusetup.cpp \ src/menuitemsetup.cpp \ src/osdxmlitem.cpp \ + src/osdlineitem.cpp \ + src/linemenunode.cpp \ diff --git a/src/childlockservice.h b/src/childlockservice.h index 8c6faa9..f677f72 100644 --- a/src/childlockservice.h +++ b/src/childlockservice.h @@ -45,7 +45,7 @@ class IChildLockService virtual bool IsChannelProtected(const cChannel* Channel) = 0; virtual bool IsRecordingProtected(const cRecording* Recording, const char* Name, const char* Base, bool isDirectory) = 0; virtual bool IsPluginProtected(cPlugin* Plugin) = 0; - + virtual bool IsMenuHidden(const char* MenuName) = 0; virtual bool IsPluginHidden(cPlugin* Plugin) = 0; virtual bool IsRecordingHidden(const cRecording* Recording, const char* Name, const char* Base, bool isDirectory) = 0; diff --git a/src/commandmenunode.cpp b/src/commandmenunode.cpp index b5756ac..1727a67 100644 --- a/src/commandmenunode.cpp +++ b/src/commandmenunode.cpp @@ -90,15 +90,15 @@ void CommandMenuNode::Process(IMenuNodeProcessor* menuNodeProcessor) string CommandMenuNode::Command() { - return _command; + return _command; } bool CommandMenuNode::ShouldConfirm() { - return _confirm; + return _confirm; } string CommandMenuNode::Text() { - return _text; + return _text; } diff --git a/src/commandmenunode.h b/src/commandmenunode.h index c80ea2d..9168e06 100644 --- a/src/commandmenunode.h +++ b/src/commandmenunode.h @@ -30,23 +30,23 @@ class IMenuNodeProcessor; class CommandMenuNode: public MenuNode { - private: + private: std::string _text; std::string _command; bool _confirm; - public: + public: CommandMenuNode(std::string text, std::string _command, bool confirm); std::string Text(); std::string Command(); bool ShouldConfirm(); - + // MenuNode virtual void Process(IMenuNodeProcessor* menuNodeProcessor); bool IsHidden(); cOsdMenu* Execute(); - private: + private: std::string ExecuteCommand(); }; diff --git a/src/imenunodeprocessor.h b/src/imenunodeprocessor.h index 641cc88..5d3657d 100644 --- a/src/imenunodeprocessor.h +++ b/src/imenunodeprocessor.h @@ -27,15 +27,17 @@ class SystemMenuNode; class PluginMenuNode; class SubMenuNode; class CommandMenuNode; +class LineMenuNode; class IMenuNodeProcessor { -public: - virtual ~IMenuNodeProcessor() {}; - virtual void ProcessSystemMenuNode(SystemMenuNode* node) = 0; - virtual void ProcessPluginMenuNode(PluginMenuNode* node) = 0; - virtual void ProcessSubMenuNode(SubMenuNode* node) = 0; - virtual void ProcessCommandMenuNode(CommandMenuNode* node) = 0; + public: + virtual ~IMenuNodeProcessor() {}; + virtual void ProcessSystemMenuNode(SystemMenuNode* node) = 0; + virtual void ProcessPluginMenuNode(PluginMenuNode* node) = 0; + virtual void ProcessSubMenuNode(SubMenuNode* node) = 0; + virtual void ProcessCommandMenuNode(CommandMenuNode* node) = 0; + virtual void ProcessLineMenuNode(LineMenuNode* node) = 0; }; #endif diff --git a/src/linemenunode.cpp b/src/linemenunode.cpp new file mode 100644 index 0000000..89e4590 --- /dev/null +++ b/src/linemenunode.cpp @@ -0,0 +1,51 @@ +/* + * vdr-menuorg - A plugin for the Linux Video Disk Recorder + * Copyright (C) 2007 Thomas Creutz, Tobias Grimm + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + * + */ + +#include "linemenunode.h" +#include "imenunodeprocessor.h" + +using namespace std; + +LineMenuNode::LineMenuNode(std::string text) +{ + _text = text; +} + +void LineMenuNode::Process(IMenuNodeProcessor* menuNodeProcessor) +{ + menuNodeProcessor->ProcessCommandMenuNode(this); +} + +bool LineMenuNode::IsHidden() +{ + return false; +} + +cOsdMenu* LineMenuNode::Execute() +{ + return NULL; +} + +string LineMenuNode::Text() +{ + return _text; +}
\ No newline at end of file diff --git a/src/linemenunode.h b/src/linemenunode.h new file mode 100644 index 0000000..5235dd4 --- /dev/null +++ b/src/linemenunode.h @@ -0,0 +1,45 @@ +/* + * vdr-menuorg - A plugin for the Linux Video Disk Recorder + * Copyright (C) 2007 Thomas Creutz, Tobias Grimm + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + * + */ + +#ifndef ___COMMANDMENUNODE_H +#define ___COMMANDMENUNODE_H + +#include "menunode.h" +#include <string> + +class IMenuNodeProcessor; + +class LineMenuNode: public MenuNode +{ + private: + std::string _text; + + public: + LineMenuNode(std::string text); + std::string Text(); + + // MenuNode + virtual void Process(IMenuNodeProcessor* menuNodeProcessor); + virtual cOsdMenu* Execute(); + virtual bool IsHidden(); +}; +#endif diff --git a/src/mainmenuitemsprovider.h b/src/mainmenuitemsprovider.h index 8d61ac0..fa7e93e 100644 --- a/src/mainmenuitemsprovider.h +++ b/src/mainmenuitemsprovider.h @@ -31,14 +31,14 @@ class MenuConfiguration; class MainMenuItemsProvider: public IMainMenuItemsProvider, public IMenuNodeProcessor { - private: + private: MenuNode* _rootMenu; MenuNode* _currentMenu; MenuItemDefinitions _currentMainMenuItems; MenuConfiguration& _menuConfiguration; IMenuItemDefinition* _createdMenuItemDefinition; - public: + public: MainMenuItemsProvider(MenuConfiguration& menuConfiguration); ~MainMenuItemsProvider(); @@ -54,8 +54,9 @@ class MainMenuItemsProvider: public IMainMenuItemsProvider, public IMenuNodeProc void ProcessPluginMenuNode(PluginMenuNode* node); void ProcessSubMenuNode(SubMenuNode* node); void ProcessCommandMenuNode(CommandMenuNode* node); + void ProcessLineMenuNode(LineMenuNode* node); - private: + private: void ResetMainMenuItemsList(); int IndexOfCustomOsdItem(cOsdItem* item); }; diff --git a/src/menuconfiguration.cpp b/src/menuconfiguration.cpp index 7ba7957..94d95a9 100644 --- a/src/menuconfiguration.cpp +++ b/src/menuconfiguration.cpp @@ -29,6 +29,7 @@ #include "submenunode.h" #include "pluginmenunode.h" #include "commandmenunode.h" +#include "linemenunode.h" using namespace xmlpp; using namespace std; @@ -114,7 +115,7 @@ void MenuConfiguration::CreateMenuTree(const Element* menuRoot, MenuNode* menuNo const Attribute* nameAttribute = childElement->get_attribute("name"); string type = childElement->get_name(); - string name = UnicodeToLocaleOrIso8859(nameAttribute->get_value()); + string name = nameAttribute ? (string) UnicodeToLocaleOrIso8859(nameAttribute->get_value()) : ""; if ( type == "menu") { @@ -140,6 +141,12 @@ void MenuConfiguration::CreateMenuTree(const Element* menuRoot, MenuNode* menuNo bool confirm = confirmAttribute ? (confirmAttribute->get_value() == "yes") : false; AddCommandMenuNode(name, execute, confirm, menuNode); } + else if (type == "line") + { + const Attribute* titleAttribute = childElement->get_attribute("title"); + string title = titleAttribute ? (string) UnicodeToLocaleOrIso8859(titleAttribute->get_value()) : "-----------------------------------"; + AddLineMenuNode(title, menuNode); + } } } } @@ -233,6 +240,11 @@ void MenuConfiguration::AddCommandMenuNode(string name, string command, bool con menu->AddChild(new CommandMenuNode(name, command, confirm)); } +void MenuConfiguration::AddLineMenuNode(string text, MenuNode* menu) +{ + menu->AddChild(new LineMenuNode(text)); +} + string MenuConfiguration::UnicodeToLocaleOrIso8859(Glib::ustring unicodeString) { try diff --git a/src/menuconfiguration.h b/src/menuconfiguration.h index 6ae377b..42359c2 100644 --- a/src/menuconfiguration.h +++ b/src/menuconfiguration.h @@ -56,6 +56,7 @@ class MenuConfiguration void AddPluginMenuNode(std::string pluginName, std::string title, MenuNode* menu); void AddUnconfiguredPlugins(MenuNode* menu); void AddCommandMenuNode(std::string name, std::string command, bool confirm, MenuNode* menu); + void AddLineMenuNode(std::string text, MenuNode* menu); std::string UnicodeToLocaleOrIso8859(Glib::ustring unicodeString); }; diff --git a/src/lineitem.cpp b/src/osdlineitem.cpp index 26180e2..a3e8461 100644 --- a/src/lineitem.cpp +++ b/src/osdlineitem.cpp @@ -20,9 +20,9 @@ * */ -#include "lineitem.h" +#include "osdlineitem.h" -cLineItem::cLineItem(const char *Text) +cOsdLineItem::cOsdLineItem(const char *Text) { SetSelectable(false); SetText(Text); diff --git a/src/lineitem.h b/src/osdlineitem.h index 27936f3..3329ff9 100644 --- a/src/lineitem.h +++ b/src/osdlineitem.h @@ -20,13 +20,13 @@ * */ -#ifndef ___LINEITEM_H -#define ___LINEITEM_H +#ifndef ___OSDLINEITEM_H +#define ___OSDLINEITEM_H -class cLineItem : public cOsdItem +class cOsdLineItem : public cOsdItem { public: - cLineItem(const char *Text); + cOsdLineItem(const char *Text); }; #endif diff --git a/src/pluginconfiguration.h b/src/pluginconfiguration.h index 56aa93f..b90d6b0 100644 --- a/src/pluginconfiguration.h +++ b/src/pluginconfiguration.h @@ -26,7 +26,7 @@ class PluginConfiguration { friend class PluginSetup; - + private: struct SetupName { @@ -36,13 +36,13 @@ class PluginConfiguration static const char* MenuSetupStyle; }; - private: + private: bool _customMenuActive; bool _unconfiguredPluginsIncluded; bool _hideMainMenuEntry; int _menuSetupStyle; - public: + public: PluginConfiguration(); bool SetConfigurationOptionByName(const char* Name, const char* Value); bool CustomMenuActive(); @@ -50,7 +50,7 @@ class PluginConfiguration bool MainMenuEntryHidden(); int MenuSetupStyle(); - private: + private: void SetDefaults(); }; diff --git a/src/pluginmenunode.h b/src/pluginmenunode.h index 592a547..fa89c13 100644 --- a/src/pluginmenunode.h +++ b/src/pluginmenunode.h @@ -31,22 +31,22 @@ class IMenuNodeProcessor; class PluginMenuNode: public MenuNode { - private: + private: cPlugin* _plugin; int _pluginIndex; std::string _title; - public: + public: PluginMenuNode(cPlugin* plugin, int pluginIndex, std::string title = ""); cPlugin* Plugin(); int PluginIndex(); std::string Title(); - + // MenuNode virtual void Process(IMenuNodeProcessor* menuNodeProcessor); bool IsHidden(); - private: + private: bool HasMainMenuEntry(); }; diff --git a/src/submenunode.h b/src/submenunode.h index 646af2b..0c00739 100644 --- a/src/submenunode.h +++ b/src/submenunode.h @@ -30,13 +30,13 @@ class IMenuNodeProcessor; class SubMenuNode: public MenuNode { - private: + private: std::string _text; - public: + public: SubMenuNode(std::string text); std::string Text(); - + // MenuNode virtual void Process(IMenuNodeProcessor* menuNodeProcessor); bool IsHidden(); diff --git a/src/systemmenunode.cpp b/src/systemmenunode.cpp index c095703..4eb080b 100644 --- a/src/systemmenunode.cpp +++ b/src/systemmenunode.cpp @@ -46,10 +46,10 @@ void SystemMenuNode::Process(IMenuNodeProcessor* menuNodeProcessor) eOSState SystemMenuNode::State() { - return _state; + return _state; } string SystemMenuNode::Text() { - return _text; + return _text; } diff --git a/src/systemmenunode.h b/src/systemmenunode.h index 79e8928..8b14f2d 100644 --- a/src/systemmenunode.h +++ b/src/systemmenunode.h @@ -31,13 +31,13 @@ class IMenuNodeProcessor; class SystemMenuNode: public MenuNode { - private: + private: std::string _text; eOSState _state; - public: + public: SystemMenuNode(eOSState state, std::string text); - + std::string Text(); eOSState State(); |