From 3fb145c7811445e05a9b8bcd1c4bd182a48e8159 Mon Sep 17 00:00:00 2001 From: svntobi Date: Sun, 26 Aug 2007 12:42:32 +0000 Subject: some renaming git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/menuorg/trunk@6000 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f --- src/menuorg.cpp | 18 ++++++------ src/menuorg.h | 4 +-- src/menuorgsetup.cpp | 79 ---------------------------------------------------- src/menuorgsetup.h | 39 -------------------------- src/pluginsetup.cpp | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/pluginsetup.h | 51 +++++++++++++++++++++++++++++++++ src/version.h | 2 +- 7 files changed, 141 insertions(+), 130 deletions(-) delete mode 100644 src/menuorgsetup.cpp delete mode 100644 src/menuorgsetup.h create mode 100644 src/pluginsetup.cpp create mode 100644 src/pluginsetup.h (limited to 'src') diff --git a/src/menuorg.cpp b/src/menuorg.cpp index 405e0fc..0b0111d 100644 --- a/src/menuorg.cpp +++ b/src/menuorg.cpp @@ -33,7 +33,7 @@ #include "menuconfiguration.h" #include "mainmenuitemsprovider.h" #include "i18n.h" -#include "menuorgsetup.h" +#include "pluginsetup.h" using namespace std; @@ -42,8 +42,8 @@ MenuOrgPlugin::MenuOrgPlugin(void) // Initialize any member variables here. // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! - _pluginIsActive = 1; - _showLostPlugins = 1; + _customMenuShouldBeActive = true; + _unconfiguredPluginsShouldBeIncluded = true; } MenuOrgPlugin::~MenuOrgPlugin() @@ -132,18 +132,18 @@ cOsdObject *MenuOrgPlugin::MainMenuAction(void) cMenuSetupPage *MenuOrgPlugin::SetupMenu(void) { // Return a setup menu in case the plugin supports one. - return new cMenuOrgPluginSetup(&_pluginIsActive, &_showLostPlugins); + return new PluginSetup(_customMenuShouldBeActive, _unconfiguredPluginsShouldBeIncluded); } bool MenuOrgPlugin::SetupParse(const char *Name, const char *Value) { - if (!strcasecmp(Name, "pluginIsActive")) + if (!strcasecmp(Name, PluginSetup::SetupName::CustomMenuActive)) { - _pluginIsActive = atoi(Value); + _customMenuShouldBeActive = (atoi(Value) != 0); } - else if(!strcasecmp(Name, "showLostPlugins")) + else if(!strcasecmp(Name, PluginSetup::SetupName::UnconfiguredPluginsIncluded)) { - _showLostPlugins = atoi(Value); + _unconfiguredPluginsShouldBeIncluded = (atoi(Value) != 0); } else return false; @@ -153,7 +153,7 @@ bool MenuOrgPlugin::SetupParse(const char *Name, const char *Value) bool MenuOrgPlugin::Service(const char *Id, void *Data) { - if (strcmp(Id, MENU_ITEMS_PROVIDER_SERVICE_ID) == 0 && _pluginIsActive == 1) + if (strcmp(Id, MENU_ITEMS_PROVIDER_SERVICE_ID) == 0 && _customMenuShouldBeActive) { if (_subMenuProvider) { diff --git a/src/menuorg.h b/src/menuorg.h index e5b1e11..8ef4213 100644 --- a/src/menuorg.h +++ b/src/menuorg.h @@ -33,8 +33,8 @@ class MenuOrgPlugin : public cPlugin private: MainMenuItemsProvider* _subMenuProvider; std::string configFile; - int _pluginIsActive; - int _showLostPlugins; + bool _customMenuShouldBeActive; + bool _unconfiguredPluginsShouldBeIncluded; public: MenuOrgPlugin(void); diff --git a/src/menuorgsetup.cpp b/src/menuorgsetup.cpp deleted file mode 100644 index 1628f90..0000000 --- a/src/menuorgsetup.cpp +++ /dev/null @@ -1,79 +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 -#include "menuorg.h" -#include "menuorgsetup.h" -#include "menusetup.h" - -cMenuOrgPluginSetup::cMenuOrgPluginSetup(int* pluginIsActive, int* showLostPlugins) -{ - // store the pointers for writing values back - _pluginIsActive = pluginIsActive; - _showLostPlugins = showLostPlugins; - - // make a temporary copy of the values - _newpluginIsActive = *pluginIsActive; - _newshowLostPlugins = *showLostPlugins; - - // create the setup entrys - Add(new cMenuEditBoolItem(tr("PluginActive"), &_newpluginIsActive)); - Add(new cMenuEditBoolItem(tr("Add lost Plugins to MainMenu"), &_newshowLostPlugins)); - Add(new cOsdItem(tr("Configure Menu"), osUser1)); -} - -void cMenuOrgPluginSetup::Store(void) -{ - SetupStore("pluginIsActive", *_pluginIsActive = _newpluginIsActive); - SetupStore("showLostPlugins", *_showLostPlugins = _newshowLostPlugins); -} - -eOSState cMenuOrgPluginSetup::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - switch(state) - { - case osUser1: - return AddSubMenu(new cMenuSetup); - break; - - 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; -} diff --git a/src/menuorgsetup.h b/src/menuorgsetup.h deleted file mode 100644 index b2fea9b..0000000 --- a/src/menuorgsetup.h +++ /dev/null @@ -1,39 +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 - -class cMenuOrgPluginSetup : public cMenuSetupPage -{ - private: - int _newpluginIsActive; - int _newshowLostPlugins; - int* _pluginIsActive; - int* _showLostPlugins; - - protected: - virtual void Store(void); - - public: - cMenuOrgPluginSetup(int *pluginActive, int *getLostPlugins); - virtual eOSState ProcessKey(eKeys Key); -}; diff --git a/src/pluginsetup.cpp b/src/pluginsetup.cpp new file mode 100644 index 0000000..8069113 --- /dev/null +++ b/src/pluginsetup.cpp @@ -0,0 +1,78 @@ +/* + * 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 +#include "menuorg.h" +#include "pluginsetup.h" +#include "menusetup.h" + +const char* PluginSetup::SetupName::CustomMenuActive = "customMenuActive"; +const char* PluginSetup::SetupName::UnconfiguredPluginsIncluded = "unconfiguredPluginsIncluded"; + +PluginSetup::PluginSetup(bool& customMenuActive, bool& unconfiguredPluginsIncluded) + :_customMenuActive(customMenuActive), _unconfiguredPluginsIncluded(unconfiguredPluginsIncluded) +{ + _newCustomMenuActive = _customMenuActive; + _newUnconfiguredPluginsIncluded = _unconfiguredPluginsIncluded; + + // create the setup entrys + Add(new cMenuEditBoolItem(tr("Enable custom menu"), &_newCustomMenuActive)); + Add(new cMenuEditBoolItem(tr("Include unconfigured Plugins"), &_newUnconfiguredPluginsIncluded)); + Add(new cOsdItem(tr("Configure Menu"), osUser1)); +} + +void PluginSetup::Store(void) +{ + SetupStore(SetupName::CustomMenuActive, _customMenuActive = _newCustomMenuActive); + SetupStore(SetupName::UnconfiguredPluginsIncluded, _unconfiguredPluginsIncluded = _newUnconfiguredPluginsIncluded); +} + +eOSState PluginSetup::ProcessKey(eKeys Key) +{ + eOSState state = cOsdMenu::ProcessKey(Key); + switch(state) + { + case osUser1: + return AddSubMenu(new cMenuSetup); + break; + + 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; +} diff --git a/src/pluginsetup.h b/src/pluginsetup.h new file mode 100644 index 0000000..34a501f --- /dev/null +++ b/src/pluginsetup.h @@ -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$ + * + */ + +#ifndef ___PLUGINSETUP_H +#define ___PLUGINSETUP_H + +#include + +class PluginSetup : public cMenuSetupPage +{ + private: + int _newCustomMenuActive; + int _newUnconfiguredPluginsIncluded; + bool& _customMenuActive; + bool& _unconfiguredPluginsIncluded; + + public: + struct SetupName + { + static const char* CustomMenuActive; + static const char* UnconfiguredPluginsIncluded; + }; + + protected: + virtual void Store(void); + + public: + PluginSetup(bool& customMenuActive, bool& unconfiguredPluginsIncluded); + virtual eOSState ProcessKey(eKeys Key); +}; + +#endif diff --git a/src/version.h b/src/version.h index 8b208f0..4a02c5f 100644 --- a/src/version.h +++ b/src/version.h @@ -23,6 +23,6 @@ #ifndef ___VERSION_H #define ___VERSION_H -static const char VERSION[] = "0.3"; +static const char VERSION[] = "0.4"; #endif -- cgit v1.2.3