diff --git a/HISTORY b/HISTORY index 5da8e8b5..cdce6852 100644 --- a/HISTORY +++ b/HISTORY @@ -3773,3 +3773,7 @@ Video Disk Recorder Revision History Lauri Tischler). - Repeat keys are now ignored when waiting for a keypress to cancel an operation (thanks to Marko Mäkelä). +- The main menu function of a plugin can now be activated through a key macro of + the form "@plugin" even if that plugin doesn't have a main menu entry (using + part of a patch by Hardy Flor, which originally implemented calling plugins from + SVDRP). diff --git a/keys.c b/keys.c index 8a8a104e..8d1c607d 100644 --- a/keys.c +++ b/keys.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: keys.c 1.7 2004/12/27 11:08:34 kls Exp $ + * $Id: keys.c 1.8 2005/09/03 11:28:34 kls Exp $ */ #include "keys.h" @@ -210,7 +210,6 @@ bool cKeyMacro::Parse(char *s) } macro[n++] = k_Plugin; if (n < MAXKEYSINMACRO) { - macro[n] = kOk; plugin = strdup(p + 1); if (!cPluginManager::GetPlugin(plugin)) { esyslog("ERROR: unknown plugin '%s'", plugin); diff --git a/menu.c b/menu.c index 1e514749..4f939b85 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.357 2005/08/27 09:37:23 kls Exp $ + * $Id: menu.c 1.358 2005/09/03 10:34:46 kls Exp $ */ #include "menu.h" @@ -2402,11 +2402,11 @@ cMenuPluginItem::cMenuPluginItem(const char *Name, int Index) cOsdObject *cMenuMain::pluginOsdObject = NULL; -cMenuMain::cMenuMain(bool Replaying, eOSState State, const char *Plugin) +cMenuMain::cMenuMain(bool Replaying, eOSState State) :cOsdMenu("") { replaying = Replaying; - Set(Plugin); + Set(); // Initial submenus: @@ -2417,7 +2417,6 @@ cMenuMain::cMenuMain(bool Replaying, eOSState State, const char *Plugin) case osRecordings: AddSubMenu(new cMenuRecordings(NULL, 0, true)); break; case osSetup: AddSubMenu(new cMenuSetup); break; case osCommands: AddSubMenu(new cMenuCommands(tr("Commands"), &Commands)); break; - case osPlugin: break; // the actual work is done in Set() default: break; } } @@ -2429,7 +2428,7 @@ cOsdObject *cMenuMain::PluginOsdObject(void) return o; } -void cMenuMain::Set(const char *Plugin) +void cMenuMain::Set(void) { Clear(); //XXX //SetTitle("VDR"); // this is done below, including disk usage @@ -2463,7 +2462,7 @@ void cMenuMain::Set(const char *Plugin) if (p) { const char *item = p->MainMenuEntry(); if (item) - Add(new cMenuPluginItem(hk(item), i), Plugin && strcmp(Plugin, p->Name()) == 0); + Add(new cMenuPluginItem(hk(item), i)); } else break; diff --git a/menu.h b/menu.h index f3278113..5846469b 100644 --- a/menu.h +++ b/menu.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.h 1.71 2005/08/27 09:37:33 kls Exp $ + * $Id: menu.h 1.72 2005/09/03 10:33:17 kls Exp $ */ #ifndef __MENU_H @@ -58,9 +58,9 @@ private: time_t lastActivity; bool replaying; static cOsdObject *pluginOsdObject; - void Set(const char *Plugin = NULL); + void Set(void); public: - cMenuMain(bool Replaying, eOSState State = osUnknown, const char *Plugin = NULL); + cMenuMain(bool Replaying, eOSState State = osUnknown); virtual eOSState ProcessKey(eKeys Key); static cOsdObject *PluginOsdObject(void); }; diff --git a/vdr.c b/vdr.c index c98ee0d6..02347fd6 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.211 2005/08/21 08:47:06 kls Exp $ + * $Id: vdr.c 1.212 2005/09/03 11:26:27 kls Exp $ */ #include @@ -695,7 +695,7 @@ int main(int argc, char *argv[]) Menu = new cMenuMain(cControl::Control()); Temp = NULL; break; - #define DirectMainFunction(function...)\ + #define DirectMainFunction(function)\ DELETENULL(Menu);\ if (cControl::Control())\ cControl::Control()->Hide();\ @@ -709,7 +709,23 @@ int main(int argc, char *argv[]) case kSetup: DirectMainFunction(osSetup); break; case kCommands: DirectMainFunction(osCommands); break; case kUser1 ... kUser9: cRemote::PutMacro(key); key = kNone; break; - case k_Plugin: DirectMainFunction(osPlugin, cRemote::GetPlugin()); break; + case k_Plugin: { + DELETENULL(Menu); + Temp = NULL; + if (cControl::Control()) + cControl::Control()->Hide(); + cPlugin *plugin = cPluginManager::GetPlugin(cRemote::GetPlugin()); + if (plugin) { + Menu = Temp = plugin->MainMenuAction(); + if (Menu) { + Menu->Show(); + if (Menu->IsMenu()) + ((cOsdMenu*)Menu)->Display(); + } + } + key = kNone; // nobody else needs to see these keys + } + break; // Channel up/down: case kChanUp|k_Repeat: case kChanUp: