diff options
author | svntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f> | 2008-03-22 12:28:00 +0000 |
---|---|---|
committer | svntobi <svntobi@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f> | 2008-03-22 12:28:00 +0000 |
commit | 0c50af128d8171e6e6c9cf5bcaa5d03104278306 (patch) | |
tree | fde6821ed788e9d0deb4a08267d717edde879926 /src | |
parent | feff6c258c109abe5a64f5dd08ad5198c5202e4c (diff) | |
download | vdr-plugin-menuorg-0c50af128d8171e6e6c9cf5bcaa5d03104278306.tar.gz vdr-plugin-menuorg-0c50af128d8171e6e6c9cf5bcaa5d03104278306.tar.bz2 |
removed all the code for configuring the menu via the OSD
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/menuorg/trunk@6963 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
Diffstat (limited to 'src')
-rw-r--r-- | src/CommandItemSetup.cpp | 74 | ||||
-rw-r--r-- | src/CommandItemSetup.h | 47 | ||||
-rw-r--r-- | src/FlatMenuSetup.cpp | 149 | ||||
-rw-r--r-- | src/FlatMenuSetup.h | 48 | ||||
-rw-r--r-- | src/MenuEditMenusFactory.cpp | 83 | ||||
-rw-r--r-- | src/MenuEditMenusFactory.h | 56 | ||||
-rw-r--r-- | src/MenuItemSetup.cpp | 101 | ||||
-rw-r--r-- | src/MenuItemSetup.h | 48 | ||||
-rw-r--r-- | src/MenuOrgPlugin.cpp | 14 | ||||
-rw-r--r-- | src/MenuOrgPlugin.h | 1 | ||||
-rw-r--r-- | src/MenuSetupItemsFactory.cpp | 75 | ||||
-rw-r--r-- | src/MenuSetupItemsFactory.h | 52 | ||||
-rw-r--r-- | src/OsdXmlItem.cpp | 126 | ||||
-rw-r--r-- | src/OsdXmlItem.h | 72 | ||||
-rw-r--r-- | src/PluginItemSetup.cpp | 81 | ||||
-rw-r--r-- | src/PluginItemSetup.h | 50 | ||||
-rw-r--r-- | src/PluginSetup.cpp | 49 | ||||
-rw-r--r-- | src/PluginSetup.h | 2 | ||||
-rw-r--r-- | src/RecursiveMenuSetup.cpp | 186 | ||||
-rw-r--r-- | src/RecursiveMenuSetup.h | 57 | ||||
-rw-r--r-- | src/SeparatorItemSetup.cpp | 62 | ||||
-rw-r--r-- | src/SeparatorItemSetup.h | 45 | ||||
-rw-r--r-- | src/SubMenuItemSetup.cpp | 63 | ||||
-rw-r--r-- | src/SubMenuItemSetup.h | 45 | ||||
-rw-r--r-- | src/SystemItemSetup.cpp | 68 | ||||
-rw-r--r-- | src/SystemItemSetup.h | 46 |
26 files changed, 0 insertions, 1700 deletions
diff --git a/src/CommandItemSetup.cpp b/src/CommandItemSetup.cpp deleted file mode 100644 index 9085b95..0000000 --- a/src/CommandItemSetup.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 "CommandItemSetup.h" - -const char AllowedChars[] = "$ abcdefghijklmnopqrstuvwxyz0123456789-.#~\\^$[]|()*+?{}/:%"; - -CommandItemSetup::CommandItemSetup(CommandMenuNode* node) -:cOsdMenu(tr("Edit Command Menu Item"), 10) -{ - strn0cpy(_newName, node->Text().c_str(), sizeof(_newName)); - strn0cpy(_newCommand, node->Command().c_str(), sizeof(_newCommand)); - _newConfirm = (int) node->ShouldConfirm(); - _node = node; - CreateMenuItems(); -} - -CommandItemSetup::~CommandItemSetup() -{ - // TODO: write back the changes -} - -void CommandItemSetup::CreateMenuItems() -{ - // Add textItem for name attribute - Add(new cMenuEditStrItem(tr("name"), _newName, sizeof(_newName), tr(AllowedChars))); - - // Add textItem for command attribute - Add(new cMenuEditStrItem(tr("command"), _newCommand, sizeof(_newCommand), tr(AllowedChars))); - - // Add boolItem for confirm attribute - Add(new cMenuEditBoolItem(tr("confirm"), &_newConfirm)); -} - -void CommandItemSetup::Store() -{ - _node->Text(_newName); - _node->Command(_newCommand); - _node->ShouldConfirm(_newConfirm); -} - -eOSState CommandItemSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if(state == osUnknown) - { - if(Key == kOk) - { - Store(); - state = osBack; - } - } - return state; -} diff --git a/src/CommandItemSetup.h b/src/CommandItemSetup.h deleted file mode 100644 index e054198..0000000 --- a/src/CommandItemSetup.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 ___COMMANDITEMSETUP_H -#define ___COMMANDITEMSETUP_H - -#include <vdr/menu.h> -#include "CommandMenuNode.h" - -class CommandItemSetup : public cOsdMenu -{ - private: - char _newName[256]; - char _newCommand[256]; - int _newConfirm; - CommandMenuNode* _node; - - public: - CommandItemSetup(CommandMenuNode* node); - ~CommandItemSetup(void); - virtual eOSState ProcessKey(eKeys Key); - - private: - void CreateMenuItems(void); - void Store(void); -}; - -#endif diff --git a/src/FlatMenuSetup.cpp b/src/FlatMenuSetup.cpp deleted file mode 100644 index fdeda81..0000000 --- a/src/FlatMenuSetup.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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 "FlatMenuSetup.h" -#include "MenuConfigurationRepository.h" -#include "MenuItemSetup.h" -#include "OsdXmlItem.h" -#include <vdr/menu.h> -#include <vdr/interface.h> -#include <libxml++/libxml++.h> -#include <iostream> - -using namespace xmlpp; -using namespace std; - -cMenuOrgSetup::cMenuOrgSetup(MenuConfigurationRepository& menuConfiguration, bool flatMenuSetup) -:cOsdMenu(tr("Menu Setup")),_menuConfiguration(menuConfiguration) -{ - _flatMenuSetup = flatMenuSetup; - // todo - //CreateMenuItems(_menuConfiguration.Configuration(), 0); -} - -void cMenuOrgSetup::CreateMenuItems(const Element* menuRoot, int iCount) -{ - int cur=Current(); - - if(iCount == 0) - Clear(); - - Node::NodeList children = menuRoot->get_children(); - for (Node::NodeList::iterator i = children.begin(); i != children.end(); i++) - { - const Element* childElement = dynamic_cast<const Element*>(*i); - - if (childElement) - { - const Attribute* nameAttribute = childElement->get_attribute("name"); - - string type = childElement->get_name(); - string name = nameAttribute->get_value(); - - for (int i=0; i <= iCount ;i++) - name = " " + name; - - if ( type == "menu" && _flatMenuSetup) - { - name = "+" + name; - Add(new cOsdXmlItem(name.c_str(), childElement, osUnknown)); - CreateMenuItems(childElement, iCount+1); - } - else - { - if(iCount > 0) - name = " " + name; - - Add(new cOsdXmlItem(name.c_str(), childElement, osUnknown)); - } - } - } - if(iCount == 0) - { - SetCurrent(Get(cur)); - Display(); - DrawButton(); - } -} - -eOSState cMenuOrgSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if(HasSubMenu()) - { - return state; - } - if(state == osUnknown) - { - switch(Key) - { - case kRed: - DrawButton(); - break; - - case kGreen: - { - cOsdXmlItem *item = (cOsdXmlItem*) Get(Current()); - state = AddSubMenu(new cMenuItemSetup(item)); - } - break; - - case kYellow: - DrawButton(); - break; - - case kBlue: - DrawButton(); - break; - - case kUp: - case kDown: - case kLeft: - DrawButton(); - break; - - case kOk: - if (Interface->Confirm(tr("Apply Changes?"))) - { - // Save it! - } - return osEnd; - break; - - case kBack : - return osBack; - break; - - default: - DrawButton(); - break; - } - } - return state; -} - -void cMenuOrgSetup::DrawButton(void) -{ - SetHelp(tr("Create"),tr("Edit"),tr("Delete"),tr("Move")); - Display(); -} diff --git a/src/FlatMenuSetup.h b/src/FlatMenuSetup.h deleted file mode 100644 index be991f3..0000000 --- a/src/FlatMenuSetup.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 ___MENUSETUP_H -#define ___MENUSETUP_H - -#include <vdr/menu.h> -#include <libxml++/libxml++.h> - -namespace xmlpp { class Element; } - -class MenuConfigurationRepository; - -class cMenuOrgSetup : public cOsdMenu -{ - private: - MenuConfigurationRepository& _menuConfiguration; - bool _flatMenuSetup; - - public: - cMenuOrgSetup(MenuConfigurationRepository& menuConfiguration, bool flatMenuSetup); - virtual eOSState ProcessKey(eKeys Key); - - private: - void DrawButton(void); - void CreateMenuItems(const xmlpp::Element* menuRoot, int iCount); -}; - -#endif diff --git a/src/MenuEditMenusFactory.cpp b/src/MenuEditMenusFactory.cpp deleted file mode 100644 index c82bae8..0000000 --- a/src/MenuEditMenusFactory.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 <vdr/osdbase.h> -#include "MenuEditMenusFactory.h" -#include "RecursiveMenuSetup.h" - -#include "CommandMenuNode.h" -#include "PluginMenuNode.h" -#include "SeparatorMenuNode.h" -#include "SubMenuNode.h" -#include "SystemMenuNode.h" - -#include "CommandItemSetup.h" -#include "PluginItemSetup.h" -#include "SeparatorItemSetup.h" -#include "SubMenuItemSetup.h" -#include "SystemItemSetup.h" - -cOsdMenu* MenuEditMenusFactory::Create(MenuNode& menuNode, bool openSubmenuInsteadOfEditing) -{ - cOsdMenu* menu = NULL; - MenuEditMenusFactory editMenusFactory(menu, openSubmenuInsteadOfEditing); - menuNode.Process(&editMenusFactory); - return menu; -} - -void MenuEditMenusFactory::ProcessSystemMenuNode(SystemMenuNode* node) -{ - _menu = new SystemItemSetup(node); -} - -void MenuEditMenusFactory::ProcessPluginMenuNode(PluginMenuNode* node) -{ - _menu = new PluginItemSetup(node); -} - -void MenuEditMenusFactory::ProcessSubMenuNode(SubMenuNode* node) -{ - if (_openSubmenuInsteadOfEditing) - { - _menu = new RecursiveMenuSetup(NULL, node); - } - else - { - _menu = new SubMenuItemSetup(node); - } -} - -void MenuEditMenusFactory::ProcessCommandMenuNode(CommandMenuNode* node) -{ - _menu = new CommandItemSetup(node); -} - -void MenuEditMenusFactory::ProcessSeparatorMenuNode(SeparatorMenuNode* node) -{ - _menu = new SeparatorItemSetup(node); -} - -MenuEditMenusFactory::MenuEditMenusFactory(cOsdMenu*& menu, bool openSubmenuInsteadOfEditing) - :_menu(menu) -{ - _openSubmenuInsteadOfEditing = openSubmenuInsteadOfEditing; -} diff --git a/src/MenuEditMenusFactory.h b/src/MenuEditMenusFactory.h deleted file mode 100644 index 4188162..0000000 --- a/src/MenuEditMenusFactory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 ___MENUEDITMENUSFACTORY_H_ -#define ___MENUEDITMENUSFACTORY_H_ - -#include "IMenuNodeProcessor.h" - -class SubMenuNode; -class SystemMenuNode; -class PluginMenuNode; -class CommandMenuNode; -class SeparatorMenuNode; -class MenuNode; -class cOsdMenu; - -class MenuEditMenusFactory: IMenuNodeProcessor -{ - private: - cOsdMenu*& _menu; - bool _openSubmenuInsteadOfEditing; - - public: - static cOsdMenu* Create(MenuNode& menuNode, bool openSubmenuInsteadOfEditing); - - // IMenuNodeProcessor - void ProcessSystemMenuNode(SystemMenuNode* node); - void ProcessPluginMenuNode(PluginMenuNode* node); - void ProcessSubMenuNode(SubMenuNode* node); - void ProcessCommandMenuNode(CommandMenuNode* node); - void ProcessSeparatorMenuNode(SeparatorMenuNode* node); - - private: - MenuEditMenusFactory(cOsdMenu*& menu, bool openSubmenuInsteadOfEditing); -}; - -#endif diff --git a/src/MenuItemSetup.cpp b/src/MenuItemSetup.cpp deleted file mode 100644 index 6059a47..0000000 --- a/src/MenuItemSetup.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 <iostream> -#include "MenuItemSetup.h" -#include "OsdXmlItem.h" - -cMenuItemSetup::cMenuItemSetup(cOsdXmlItem* osdXmlItem) -:cOsdMenu(tr("Item Setup")) -{ - itemTypeText[0] = "System"; - itemTypeText[1] = "Plugin"; - itemTypeText[2] = "Submenu"; - itemTypeText[3] = "Command"; - - _osdXmlItem = osdXmlItem; - _newItemType = _osdXmlItem->getItemType(); - //_newName = _osdXmlItem->getNameAttribute().c_str(); - //_newTitle = _osdXmlItem->getTitleAttribute().c_str(); - asprintf(&_newTitle, "%s", _osdXmlItem->getTitleAttribute().c_str()); - //_newCommand = _osdXmlItem->getCommandAttribute().c_str(); - CreateMenuItems(); -} - -cMenuItemSetup::~cMenuItemSetup() -{ - _osdXmlItem->setNameAttribute(_newName); - _osdXmlItem->setTitleAttribute(_newTitle); - _osdXmlItem->setCommandAttribute(_newCommand); - free(_newName); - free(_newTitle); - free(_newCommand); -} - -// TODO: When exit check if the type was menu and now is changed -> bring a warning on the osd that the subitems will be deleted - -void cMenuItemSetup::CreateMenuItems(void) -{ - esyslog("menuorg: _newItemType=%d", _newItemType); - esyslog("menuorg: _newTitle=%s", _newTitle); - - Clear(); - - Add(new cMenuEditStraItem(tr("Item Type"), (int*) &_newItemType, 4, itemTypeText)); - - switch(_newItemType) - { - case 0: - // Add listItem of valid System Items - //Add(new cMenuEditStraItem(tr("available System Items"),)) - // Add textItem for title attribute - Add(new cMenuEditStrItem(tr("title"), _newTitle, 64, NULL)); - break; - - case 1: - // Add listItem of unused plugins or a submenu with the items - //Add(new cMenuEditStraItem(tr("available Plugins Items"),)) - // Add textItem for title attribute - //Add(new cMenuEditStrItem(tr("title"), VAR, 64, NULL)) - break; - - case 2: - // Add textItem for name attribute - //Add(new cMenuEditStrItem(tr("name"), VAR, 64, NULL)) - break; - - case 3: - // Add textItem for name attribute - //Add(new cMenuEditStrItem(tr("name"), VAR, 64, NULL)) - // Add textItem for command attribute - //Add(new cMenuEditStrItem(tr("command"), VAR, 64, NULL)) - // Add boolItem for confirm attribute - //Add(new cMenuEditBoolItem(tr("confirm"), &_confirm)); - break; - } -} - -eOSState cMenuItemSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - return state; -} diff --git a/src/MenuItemSetup.h b/src/MenuItemSetup.h deleted file mode 100644 index b58b33b..0000000 --- a/src/MenuItemSetup.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 ___MENUITEMSETUP_H -#define ___MENUITEMSETUP_H - -#include <vdr/menu.h> -#include "OsdXmlItem.h" - -class cMenuItemSetup : public cOsdMenu -{ - private: - cOsdXmlItem* _osdXmlItem; - cOsdXmlItem::sItemType _newItemType; - const char* itemTypeText[4]; - char* _newName; - char* _newTitle; - char* _newCommand; - - public: - cMenuItemSetup(cOsdXmlItem* osdXmlItem); - ~cMenuItemSetup(void); - virtual eOSState ProcessKey(eKeys Key); - - private: - void CreateMenuItems(void); -}; - -#endif diff --git a/src/MenuOrgPlugin.cpp b/src/MenuOrgPlugin.cpp index c14637f..19e5b6b 100644 --- a/src/MenuOrgPlugin.cpp +++ b/src/MenuOrgPlugin.cpp @@ -30,8 +30,6 @@ #include <getopt.h> #include "version.h" #include "MenuOrgPlugin.h" -#include "FlatMenuSetup.h" -#include "RecursiveMenuSetup.h" #include "MenuConfigurationRepository.h" #include "MainMenuItemsProvider.h" #include "i18n.h" @@ -123,18 +121,6 @@ bool MenuOrgPlugin::Initialize(void) return true; } -cOsdObject *MenuOrgPlugin::MainMenuAction(void) -{ - if (_pluginConfiguration.MenuSetupStyle() == 0) - { - return new RecursiveMenuSetup(_menuConfigurationRepository); - } - else - { - return new cMenuOrgSetup(*_menuConfigurationRepository, _pluginConfiguration.MenuSetupStyle()); - } -} - cMenuSetupPage *MenuOrgPlugin::SetupMenu(void) { return new PluginSetup(_pluginConfiguration, *_menuConfigurationRepository); diff --git a/src/MenuOrgPlugin.h b/src/MenuOrgPlugin.h index 6418e10..faf67cf 100644 --- a/src/MenuOrgPlugin.h +++ b/src/MenuOrgPlugin.h @@ -47,7 +47,6 @@ class MenuOrgPlugin : public cPlugin virtual bool ProcessArgs(int argc, char* argv[]); virtual bool Initialize(void); virtual const char* MainMenuEntry(void); - virtual cOsdObject* MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char* Name, const char* Value); virtual bool Service(const char* Id, void* Data = NULL); diff --git a/src/MenuSetupItemsFactory.cpp b/src/MenuSetupItemsFactory.cpp deleted file mode 100644 index 9b9cd08..0000000 --- a/src/MenuSetupItemsFactory.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 "MenuSetupItemsFactory.h" -#include "SubMenuNode.h" -#include "SystemMenuNode.h" -#include "PluginMenuNode.h" -#include "CommandMenuNode.h" -#include "SeparatorMenuNode.h" -#include <string> -#include <vdr/osdbase.h> - -using namespace std; - -MenuSetupItemsFactory::MenuSetupItemsFactory(cOsdMenu* osdMenu) -{ - _osdMenu = osdMenu; -} - -void MenuSetupItemsFactory::SetupItems(SubMenuNode& rootMenu) -{ - for (MenuNodeList::iterator i = rootMenu.Childs()->begin(); i != rootMenu.Childs()->end(); i++) - { - (*i)->Process(this); - } -} - -void MenuSetupItemsFactory::ProcessSystemMenuNode(SystemMenuNode* node) -{ - string text = "(S) " + node->State().Name(); - _osdMenu->Add(new cOsdItem(text.c_str())); -} - -void MenuSetupItemsFactory::ProcessPluginMenuNode(PluginMenuNode* node) -{ - string text = "(P) " + node->PluginName(); - _osdMenu->Add(new cOsdItem(text.c_str())); -} - -void MenuSetupItemsFactory::ProcessSubMenuNode(SubMenuNode* node) -{ - string text = "(M) " + node->Text(); - _osdMenu->Add(new cOsdItem(text.c_str())); -} - -void MenuSetupItemsFactory::ProcessCommandMenuNode(CommandMenuNode* node) -{ - string text = "(C) " + node->Text(); - _osdMenu->Add(new cOsdItem(text.c_str())); -} - -void MenuSetupItemsFactory::ProcessSeparatorMenuNode(SeparatorMenuNode* node) -{ - string text = (string) "(-) " + node->DisplayText(); - _osdMenu->Add(new cOsdItem(text.c_str())); -} diff --git a/src/MenuSetupItemsFactory.h b/src/MenuSetupItemsFactory.h deleted file mode 100644 index c4f36a8..0000000 --- a/src/MenuSetupItemsFactory.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 ___MENUSETUPITEMSFACTORY_H_ -#define ___MENUSETUPITEMSFACTORY_H_ - -#include "IMenuNodeProcessor.h" - -class SubMenuNode; -class SystemMenuNode; -class PluginMenuNode; -class CommandMenuNode; -class SeparatorMenuNode; -class cOsdMenu; - -class MenuSetupItemsFactory: IMenuNodeProcessor -{ - private: - cOsdMenu* _osdMenu; - - public: - MenuSetupItemsFactory(cOsdMenu* osdMenu); - void SetupItems(SubMenuNode& rootMenu); - - // IMenuNodeProcessor - void ProcessSystemMenuNode(SystemMenuNode* node); - void ProcessPluginMenuNode(PluginMenuNode* node); - void ProcessSubMenuNode(SubMenuNode* node); - void ProcessCommandMenuNode(CommandMenuNode* node); - void ProcessSeparatorMenuNode(SeparatorMenuNode* node); -}; - -#endif diff --git a/src/OsdXmlItem.cpp b/src/OsdXmlItem.cpp deleted file mode 100644 index 1606ec3..0000000 --- a/src/OsdXmlItem.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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 <string> -#include <vdr/menu.h> -#include <libxml++/libxml++.h> -#include "OsdXmlItem.h" - -using namespace std; -using namespace xmlpp; - -cOsdXmlItem::cOsdXmlItem(const char* Text, const xmlpp::Element* xmlElement, eOSState State=osUnknown) -: cOsdItem(Text, State) -{ - _xmlElement = xmlElement; - parseXmlElement(); -} - -void cOsdXmlItem::parseXmlElement(void) -{ - const Attribute* nameAttribute = _xmlElement->get_attribute("name"); - - string type = _xmlElement->get_name(); - string name = nameAttribute->get_value(); - - setNameAttribute(name); - - if (type == "system") - { - setItemType(SYSTEM); - const Attribute* titleAttribute = _xmlElement->get_attribute("title"); - string title = titleAttribute ? (string) titleAttribute->get_value() : ""; - setTitleAttribute(title); - } - else if (type == "plugin") - { - setItemType(PLUGIN); - const Attribute* titleAttribute = _xmlElement->get_attribute("title"); - string title = titleAttribute ? (string) titleAttribute->get_value() : ""; - setTitleAttribute(title); - } - else if ( type == "menu") - { - setItemType(MENU); - } - else if (type == "command") - { - setItemType(COMMAND); - - string execute = _xmlElement->get_attribute("execute")->get_value(); - setCommandAttribute(execute); - - const Attribute* confirmAttribute = _xmlElement->get_attribute("confirm"); - if (confirmAttribute) - setConfirmAttribute(confirmAttribute->get_value()); - } -} - -cOsdXmlItem::sItemType cOsdXmlItem::getItemType(void) -{ - return _ItemType; -} - -string cOsdXmlItem::getNameAttribute(void) -{ - return _nameAttribute; -} - -string cOsdXmlItem::getTitleAttribute(void) -{ - return _titleAttribute; -} - -string cOsdXmlItem::getCommandAttribute(void) -{ - return _commandAttribute; -} - -string cOsdXmlItem::getConfirmAttribute(void) -{ - return _confirmAttribute; -} - -void cOsdXmlItem::setItemType(sItemType type) -{ - _ItemType = type; -} - -void cOsdXmlItem::setNameAttribute(string name) -{ - _nameAttribute = name; -} - -void cOsdXmlItem::setTitleAttribute(string title) -{ - _titleAttribute = title; -} - -void cOsdXmlItem::setCommandAttribute(string command) -{ - _commandAttribute = command; -} - -void cOsdXmlItem::setConfirmAttribute(string confirm) -{ - _confirmAttribute = confirm; -} diff --git a/src/OsdXmlItem.h b/src/OsdXmlItem.h deleted file mode 100644 index 1167f3d..0000000 --- a/src/OsdXmlItem.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 ___OSDXMLITEM_H -#define ___OSDXMLITEM_H - -#include <string> -#include <vdr/menu.h> -#include <libxml++/libxml++.h> - -using namespace std; -namespace xmlpp { class Element; } - -class cOsdXmlItem: public cOsdItem -{ - public: - const xmlpp::Element* _xmlElement; - - enum sItemType - { - SYSTEM = 0, - PLUGIN = 1, - MENU = 2, - COMMAND = 3 - }; - - private: - sItemType _ItemType; - string _nameAttribute; - string _titleAttribute; - string _commandAttribute; - string _confirmAttribute; - - public: - cOsdXmlItem(const char* Text, const xmlpp::Element* xmlElement, eOSState State); - - sItemType getItemType(void); - string getNameAttribute(void); - string getTitleAttribute(void); - string getCommandAttribute(void); - string getConfirmAttribute(void); - - void setItemType(sItemType type); - void setNameAttribute(string name); - void setTitleAttribute(string title); - void setCommandAttribute(string command); - void setConfirmAttribute(string confirm); - - private: - void parseXmlElement(void); // parse the xml element and set the private attributes -}; - -#endif diff --git a/src/PluginItemSetup.cpp b/src/PluginItemSetup.cpp deleted file mode 100644 index 02316c4..0000000 --- a/src/PluginItemSetup.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 <vdr/plugin.h> -#include "PluginItemSetup.h" - -PluginItemSetup::PluginItemSetup(PluginMenuNode* node) -:cOsdMenu(tr("Edit Plugin Menu Item"), 10) -{ - _newPluginIndex = node->PluginIndex(); - strn0cpy(_newTitle, node->CustomTitle().c_str(), sizeof(_newTitle)); - _node = node; - getPlugins(); - CreateMenuItems(); -} - -PluginItemSetup::~PluginItemSetup() -{ - // TODO: write back the changes - //delete[] pluginList; -} - -void PluginItemSetup::CreateMenuItems() -{ - // Add listItem of unused plugins or a submenu with the items - //Add(new cMenuEditStraItem(tr("available Plugins Items"), &_newPluginIndex, pluginList.size(), pluginList)); - //Add(new cMenuEditStraItem(tr("available Plugins Items"), &_newPluginIndex, 0, pluginList)); - // Add textItem for title attribute - Add(new cMenuEditStrItem(tr("title"), _newTitle, sizeof(_newTitle), NULL)); -} - -void PluginItemSetup::getPlugins() -{ - int i=0; - while (cPlugin *currentPlugin = cPluginManager::GetPlugin(i)) - { - //pluginList.push_back(currentPlugin->Name()); - //pluginList[i] = new char* ( (char) currentPlugin->Name()); - i++; - } -} - -void PluginItemSetup::Store() -{ - //_node->Text(_newName); - _node->CustomTitle(_newTitle); -} - -eOSState PluginItemSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if(state == osUnknown) - { - if(Key == kOk) - { - Store(); - state = osBack; - } - } - return state; -} diff --git a/src/PluginItemSetup.h b/src/PluginItemSetup.h deleted file mode 100644 index 8ba8908..0000000 --- a/src/PluginItemSetup.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 ___PLUGINITEMSETUP_H -#define ___PLUGINITEMSETUP_H - -#include <vector> -#include <vdr/menu.h> -#include "PluginMenuNode.h" - -class PluginItemSetup : public cOsdMenu -{ - private: - //std::vector<const char*> pluginList; - char **pluginList; - int _newPluginIndex; - char _newTitle[256]; - PluginMenuNode* _node; - - public: - PluginItemSetup(PluginMenuNode* node); - ~PluginItemSetup(void); - virtual eOSState ProcessKey(eKeys Key); - - private: - void CreateMenuItems(void); - void getPlugins(void); - void Store(void); -}; - -#endif diff --git a/src/PluginSetup.cpp b/src/PluginSetup.cpp index 95cb5bc..e59b987 100644 --- a/src/PluginSetup.cpp +++ b/src/PluginSetup.cpp @@ -24,8 +24,6 @@ #include <vdr/menu.h> #include "MenuOrgPlugin.h" #include "PluginSetup.h" -#include "FlatMenuSetup.h" -#include "RecursiveMenuSetup.h" #include "MenuConfigurationRepository.h" PluginSetup::PluginSetup(PluginConfiguration& pluginConfiguration, MenuConfigurationRepository& menuConfiguration) @@ -44,51 +42,6 @@ void PluginSetup::Store(void) SetupStore(PluginConfiguration::SetupName::HideMainMenuEntry, _pluginConfiguration._hideMainMenuEntry = _newHideMainMenuEntry); - - SetupStore(PluginConfiguration::SetupName::MenuSetupStyle, - _pluginConfiguration._menuSetupStyle = _newMenuSetupStyle); -} - -eOSState PluginSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if (HasSubMenu()) - { - return state; - } - switch(state) - { - case osUser1: - if (_pluginConfiguration.MenuSetupStyle() == 0 ) - { - return AddSubMenu(new RecursiveMenuSetup(&_menuConfiguration)); - } - else - { - return AddSubMenu(new cMenuOrgSetup(_menuConfiguration, _pluginConfiguration._menuSetupStyle)); - } - - case osContinue: - if(NORMALKEY(Key)==kUp || NORMALKEY(Key)==kDown) - { - cOsdItem *item=Get(Current()); - if(item) item->ProcessKey(kNone); - } - break; - - case osUnknown: - if(Key==kOk) - { - Store(); - state=osBack; - } - break; - - default: - break; - } - return state; } void PluginSetup::CreateMenuItems() @@ -96,6 +49,4 @@ void PluginSetup::CreateMenuItems() Add(new cMenuEditBoolItem(tr("Enable custom menu"), &_newCustomMenuActive)); Add(new cMenuEditBoolItem(tr("Include unconfigured plugins"), &_newUnconfiguredPluginsIncluded)); Add(new cMenuEditBoolItem(tr("Hide main menu entry"), &_newHideMainMenuEntry)); - Add(new cMenuEditBoolItem(tr("Menu setup style"), &_newMenuSetupStyle, tr("MenuBased"), tr("Flat"))); - Add(new cOsdItem(tr("Configure menu"), osUser1)); } diff --git a/src/PluginSetup.h b/src/PluginSetup.h index 6b97d94..1394950 100644 --- a/src/PluginSetup.h +++ b/src/PluginSetup.h @@ -34,13 +34,11 @@ class PluginSetup : public cMenuSetupPage int _newCustomMenuActive; int _newUnconfiguredPluginsIncluded; int _newHideMainMenuEntry; - int _newMenuSetupStyle; PluginConfiguration& _pluginConfiguration; MenuConfigurationRepository& _menuConfiguration; public: PluginSetup(PluginConfiguration& pluginConfiguration, MenuConfigurationRepository& menuConfiguration); - virtual eOSState ProcessKey(eKeys Key); protected: virtual void Store(void); diff --git a/src/RecursiveMenuSetup.cpp b/src/RecursiveMenuSetup.cpp deleted file mode 100644 index 2afd2a7..0000000 --- a/src/RecursiveMenuSetup.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * 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 "RecursiveMenuSetup.h" -#include "SubMenuNode.h" -#include "MenuConfigurationRepository.h" -#include "MenuSetupItemsFactory.h" -#include "MenuEditMenusFactory.h" - -RecursiveMenuSetup::RecursiveMenuSetup(MenuConfigurationRepository* menuConfigurationRepository, SubMenuNode* rootMenuNode) - :cOsdMenu(tr("Menu Configuration")), _menuConfigurationRepository(menuConfigurationRepository) -{ - _moving = false; - if (rootMenuNode) - { - _currentRootMenuNode = rootMenuNode; - _menuConfiguration = NULL; - } - else - { - _currentRootMenuNode = _menuConfiguration = menuConfigurationRepository->Load()->Clone(); - } - CreateMenuItems(); - ShowHelp(); -} - -RecursiveMenuSetup::~RecursiveMenuSetup() -{ - delete _menuConfiguration; -} - -void RecursiveMenuSetup::CreateMenuItems() -{ - MenuSetupItemsFactory menuItemSetupFactory(this); - menuItemSetupFactory.SetupItems(*_currentRootMenuNode); -} - -eOSState RecursiveMenuSetup::ProcessKey(eKeys Key) -{ - // Catch keys that should not be processed by the base class - if (_moving) - { - if ((Key == kUp) || (Key == kDown)) - { - return MoveCurrentItem(Key == kUp); - } - if ((Key == kLeft) || (Key == kRight)) - { - return osContinue; - } - } - - // Process keys in base class - eOSState state = cOsdMenu::ProcessKey(Key); - if(HasSubMenu()) - { - return state; - } - - if ((state == osBack) || (state == osEnd)) - { - if (!_currentRootMenuNode->Parent()) - { - _menuConfigurationRepository->Save(*_currentRootMenuNode); - } - } - - // Process unprocessed keys - if ((state == osUnknown) && SelectedItem()) - { - if (_moving) - { - switch(Key) - { - case kOk: - StopMoving(); - return osContinue; - default: - break; - } - } - else - { - switch(Key) - { - case kOk: - return ShowEditMenuForSelectedItem(true); - case kRed: - StartMoving(); - break; - case kBlue: - return ShowEditMenuForSelectedItem(false); - default: - break; - } - } - } - - return state; -} - -void RecursiveMenuSetup::StartMoving() -{ - _moving = true; - SetStatus("Move with Up/Down and confirm with OK"); - SetHelp(NULL); -} - -void RecursiveMenuSetup::StopMoving() -{ - _moving = false; - SetStatus(NULL); - ShowHelp(); -} - -eOSState RecursiveMenuSetup::MoveCurrentItem(bool moveUp) -{ - int oldPos = Current(); - int newPos = Current(); - - MenuNode* node = _currentRootMenuNode->Childs()->at(oldPos); - - if ((oldPos > 0) && moveUp) - { - newPos = oldPos - 1; - } - else if ((oldPos < Count() - 1) && !moveUp) - { - newPos = oldPos + 1; - } - - if (oldPos != newPos) - { - _currentRootMenuNode->Childs()->erase(_currentRootMenuNode->Childs()->begin() + oldPos); - _currentRootMenuNode->Childs()->insert(_currentRootMenuNode->Childs()->begin() + newPos, node); - - Clear(); - CreateMenuItems(); - SetCurrent(Get(newPos)); - Display(); - } - - return osContinue; -} - -void RecursiveMenuSetup::ShowHelp() -{ - SetHelp("Move", "Delete", "New", "Edit"); -} - -eOSState RecursiveMenuSetup::ShowEditMenuForSelectedItem(bool openSubmenuInsteadOfEditing) -{ - cOsdMenu* editMenu = MenuEditMenusFactory::Create(*SelectedItem(), openSubmenuInsteadOfEditing); - if (editMenu) - { - return AddSubMenu(editMenu); - } - else - { - return osContinue; - } -} - -MenuNode* RecursiveMenuSetup::SelectedItem() -{ - return _currentRootMenuNode->Childs()->at(Current()); -} diff --git a/src/RecursiveMenuSetup.h b/src/RecursiveMenuSetup.h deleted file mode 100644 index c41d71f..0000000 --- a/src/RecursiveMenuSetup.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 ___RECURSIVEMENUSETUP_H_ -#define ___RECURSIVEMENUSETUP_H_ - -#include <vdr/menu.h> -#include "IMenuNodeProcessor.h" - -class MenuConfigurationRepository; -class MenuNode; - -class RecursiveMenuSetup: public cOsdMenu -{ - private: - MenuConfigurationRepository* _menuConfigurationRepository; - SubMenuNode* _menuConfiguration; - SubMenuNode* _currentRootMenuNode; - bool _moving; - - public: - RecursiveMenuSetup(MenuConfigurationRepository* menuConfigurationRepository, SubMenuNode* rootMenuNode = NULL); - ~RecursiveMenuSetup(); - - // cOsdMenu - eOSState ProcessKey(eKeys Key); - - private: - void CreateMenuItems(); - void ShowHelp(); - void StartMoving(); - void StopMoving(); - eOSState MoveCurrentItem(bool moveUp); - eOSState ShowEditMenuForSelectedItem(bool openSubmenuInsteadOfEditing); - MenuNode* SelectedItem(); -}; - -#endif diff --git a/src/SeparatorItemSetup.cpp b/src/SeparatorItemSetup.cpp deleted file mode 100644 index 87d1732..0000000 --- a/src/SeparatorItemSetup.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 "SeparatorItemSetup.h" - -SeparatorItemSetup::SeparatorItemSetup(SeparatorMenuNode* node) -:cOsdMenu(tr("Edit Separator Menu Item"), 10) -{ - strn0cpy(_newTitle, node->CustomTitle().c_str(), sizeof(_newTitle)); - _node = node; - CreateMenuItems(); -} - -SeparatorItemSetup::~SeparatorItemSetup() -{ - // TODO: write back the changes -} - -void SeparatorItemSetup::CreateMenuItems() -{ - // Add textItem for title attribute - Add(new cMenuEditStrItem(tr("title"), _newTitle, sizeof(_newTitle), NULL)); -} - -void SeparatorItemSetup::Store() -{ - _node->CustomTitle(_newTitle); -} - -eOSState SeparatorItemSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if(state == osUnknown) - { - if(Key == kOk) - { - Store(); - state = osBack; - } - } - return state; -} diff --git a/src/SeparatorItemSetup.h b/src/SeparatorItemSetup.h deleted file mode 100644 index 3178586..0000000 --- a/src/SeparatorItemSetup.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 ___SEPARATORITEMSETUP_H -#define ___SEPARATORITEMSETUP_H - -#include <vdr/menu.h> -#include "SeparatorMenuNode.h" - -class SeparatorItemSetup : public cOsdMenu -{ - private: - char _newTitle[256]; - SeparatorMenuNode* _node; - - public: - SeparatorItemSetup(SeparatorMenuNode* node); - ~SeparatorItemSetup(void); - virtual eOSState ProcessKey(eKeys Key); - - private: - void CreateMenuItems(void); - void Store(void); -}; - -#endif diff --git a/src/SubMenuItemSetup.cpp b/src/SubMenuItemSetup.cpp deleted file mode 100644 index c64d16a..0000000 --- a/src/SubMenuItemSetup.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 "SubMenuItemSetup.h" - -const char AllowedChars[] = "$ abcdefghijklmnopqrstuvwxyz0123456789-.#~\\^$[]|()*+?{}/:%"; - -SubMenuItemSetup::SubMenuItemSetup(SubMenuNode* node) -:cOsdMenu(tr("Edit Sub Menu Item"), 10) -{ - strn0cpy(_newName, node->Text().c_str(), sizeof(_newName)); - CreateMenuItems(); -} - -SubMenuItemSetup::~SubMenuItemSetup() -{ - // TODO: write back the changes -} - -void SubMenuItemSetup::CreateMenuItems() -{ - // Add textItem for name attribute - Add(new cMenuEditStrItem(tr("name"), _newName, sizeof(_newName), tr(AllowedChars))); -} - -void SubMenuItemSetup::Store() -{ - _node->Text(_newName); -} - -eOSState SubMenuItemSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if(state == osUnknown) - { - if(Key == kOk) - { - Store(); - state = osBack; - } - } - return state; -} diff --git a/src/SubMenuItemSetup.h b/src/SubMenuItemSetup.h deleted file mode 100644 index 27853af..0000000 --- a/src/SubMenuItemSetup.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 ___SUBMENUTEMSETUP_H -#define ___SUBMENUTEMSETUP_H - -#include <vdr/menu.h> -#include "SubMenuNode.h" - -class SubMenuItemSetup : public cOsdMenu -{ - private: - char _newName[256]; - SubMenuNode* _node; - - public: - SubMenuItemSetup(SubMenuNode* node); - ~SubMenuItemSetup(void); - virtual eOSState ProcessKey(eKeys Key); - - private: - void CreateMenuItems(void); - void Store(void); -}; - -#endif diff --git a/src/SystemItemSetup.cpp b/src/SystemItemSetup.cpp deleted file mode 100644 index e56ee86..0000000 --- a/src/SystemItemSetup.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 "SystemItemSetup.h" -#include "VdrState.h" - -SystemItemSetup::SystemItemSetup(SystemMenuNode* node) -:cOsdMenu(tr("Edit System Menu Item"), 10) -{ - strn0cpy(_newName, node->State().Name().c_str(), sizeof(_newName)); - strn0cpy(_newTitle, node->CustomTitle().c_str(), sizeof(_newTitle)); - _node = node; - CreateMenuItems(); -} - -SystemItemSetup::~SystemItemSetup() -{ - // TODO: write back the changes -} - -void SystemItemSetup::CreateMenuItems() -{ - // Add listItem of valid System Items - //Add(new cMenuEditStraItem(tr("available System Items"),)) - - // Add textItem for title attribute - Add(new cMenuEditStrItem(tr("title"), _newTitle, sizeof(_newTitle), NULL)); -} - -void SystemItemSetup::Store() -{ - _node->State(VdrState::ByName(_newName)); - _node->CustomTitle(_newTitle); -} - -eOSState SystemItemSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if(state == osUnknown) - { - if(Key == kOk) - { - Store(); - state = osBack; - } - } - return state; -} diff --git a/src/SystemItemSetup.h b/src/SystemItemSetup.h deleted file mode 100644 index 13c8fbc..0000000 --- a/src/SystemItemSetup.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 ___SYSTEMITEMSETUP_H -#define ___SYSTEMITEMSETUP_H - -#include <vdr/menu.h> -#include "SystemMenuNode.h" - -class SystemItemSetup : public cOsdMenu -{ - private: - char _newName[265]; - char _newTitle[265]; - SystemMenuNode* _node; - - public: - SystemItemSetup(SystemMenuNode* node); - ~SystemItemSetup(void); - virtual eOSState ProcessKey(eKeys Key); - - private: - void CreateMenuItems(void); - void Store(void); -}; - -#endif |