r4331 - in vdr/vdr/trunk/debian: . patches

Tobias Grimm tiber-guest at alioth.debian.org
Sat Mar 10 21:15:11 CET 2007


Author: tiber-guest
Date: 2007-03-10 20:15:10 +0000 (Sat, 10 Mar 2007)
New Revision: 4331

Added:
   vdr/vdr/trunk/debian/patches/opt-42-x_MainMenuHooks.dpatch
Modified:
   vdr/vdr/trunk/debian/changelog
   vdr/vdr/trunk/debian/patches/00list
   vdr/vdr/trunk/debian/patches/patchtest
Log:
* NOR RELEASED YET
* Added opt-42-x_MainMenuHooks.dpatch (required by remoteosd plugin)

Modified: vdr/vdr/trunk/debian/changelog
===================================================================
--- vdr/vdr/trunk/debian/changelog	2007-03-10 19:46:10 UTC (rev 4330)
+++ vdr/vdr/trunk/debian/changelog	2007-03-10 20:15:10 UTC (rev 4331)
@@ -1,3 +1,10 @@
+vdr (1.4.6-2) UNRELEASED; urgency=low
+
+  * NOR RELEASED YET
+  * Added opt-42-x_MainMenuHooks.dpatch (required by remoteosd plugin)
+
+ -- Tobias Grimm <tg at e-tobi.net>  Sat, 10 Mar 2007 20:59:30 +0100
+
 vdr (1.4.6-1) experimental; urgency=low
 
   [ Tobias Grimm ]

Modified: vdr/vdr/trunk/debian/patches/00list
===================================================================
--- vdr/vdr/trunk/debian/patches/00list	2007-03-10 19:46:10 UTC (rev 4330)
+++ vdr/vdr/trunk/debian/patches/00list	2007-03-10 20:15:10 UTC (rev 4331)
@@ -46,6 +46,9 @@
 # Patch to show an info, if it is possible to record an event in the timer-info.
 # opt-41-x_timer-info
 
+# Patch to allow plugins to replace the VDR mainmenus
+# opt-42-x_MainMenuHooks
+
 # Patch to allow extrecmenu to replace the recordings menu with it's own version.
 # opt-42-x_extrecmenu
 

Added: vdr/vdr/trunk/debian/patches/opt-42-x_MainMenuHooks.dpatch
===================================================================
--- vdr/vdr/trunk/debian/patches/opt-42-x_MainMenuHooks.dpatch	2007-03-10 19:46:10 UTC (rev 4330)
+++ vdr/vdr/trunk/debian/patches/opt-42-x_MainMenuHooks.dpatch	2007-03-10 20:15:10 UTC (rev 4331)
@@ -0,0 +1,163 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## opt-42-x_MainMenuHooks.dpatch by Frank Schmirler <vdrdev at schmirler.de>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: This patch allows plugins to replace the VDR mainmenus "Schedule",
+## DP: "Channels", "Timers" and "Recordings" by a different implementation.
+
+ at DPATCH@
+This is a "patch" for the Video Disk Recorder (VDR).
+
+* Authors:
+Tobias Grimm <vdr at e-tobi.net>
+Martin Prochnow <nordlicht at martins-kabuff.de>  
+Frank Schmirler <vdrdev at schmirler.de>
+Christian Wieninger <cwieninger at gmx.de>
+
+* Description:
+This patch allows plugins to replace the VDR mainmenus "Schedule",
+"Channels", "Timers" and "Recordings" by a different implementation.
+
+The patch is based on a suggestion of Christian Wieninger back in 2006
+(http://www.linuxtv.org/pipermail/vdr/2006-March/008234.html). It is
+meant to be an interim solution for VDR 1.4 until (maybe) VDR 1.5
+introduces an official API for this purpose.
+
+* Installation
+Change into the VDR source directory, then issue
+  patch -p1 < path/to/MainMenuHooks-v1_0.patch
+and recompile.
+
+* Notes for plugin authors
+The following code sample shows the required plugin code for replacing
+the original Schedule menu:
+
+bool cMyPlugin::Service(const char *Id, void *Data)
+{
+  cOsdMenu **menu = (cOsdMenu**) Data;
+  if (MySetup.replaceSchedule &&
+            strcmp(Id, "MainMenuHooksPatch-v1.0::osSchedule") == 0) {
+    if (menu)
+      *menu = (cOsdMenu*) MainMenuAction();
+    return true;
+  }
+  return false;
+}
+
+A plugin can replace more than one menu at a time. Simply replace the
+call to MainMenuAction() in the sample above by appropriate code.
+
+Note that a plugin *should* offer a setup option which allows the user
+to enable or disable the replacement. "Disabled" would be a reasonable
+default setting. By testing for define MAINMENUHOOKSVERSNUM, a plugin
+can leave the setup option out at compiletime.
+
+In case there is an internal problem when trying to open the replacement
+menu, it is safe to return true even though Data is NULL. However an
+OSD message should indicate the problem to the user.
+
+Feel free to ship this patch along with your plugin. However if you
+think you need to modify the patch, we'd encourage you to contact the
+authors first or at least use a service id which differs in more than
+just the version number.
+
+--- vdr-1.4.5/menu.c.orig	2007-02-07 08:23:49.000000000 +0100
++++ vdr-1.4.5/menu.c	2007-02-20 11:05:34.000000000 +0100
+@@ -2792,15 +2792,30 @@
+ 
+   // Initial submenus:
+ 
++  cOsdMenu *menu = NULL;
+   switch (State) {
+-    case osSchedule:   AddSubMenu(new cMenuSchedule); break;
+-    case osChannels:   AddSubMenu(new cMenuChannels); break;
+-    case osTimers:     AddSubMenu(new cMenuTimers); break;
+-    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 osSchedule:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osSchedule", &menu))
++            menu = new cMenuSchedule;
++        break;
++    case osChannels:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osChannels", &menu))
++            menu = new cMenuChannels;
++        break;
++    case osTimers:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osTimers", &menu))
++            menu = new cMenuTimers;
++        break;
++    case osRecordings:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osRecordings", &menu))
++            menu = new cMenuRecordings(NULL, 0, true);
++        break;
++    case osSetup:      menu = new cMenuSetup; break;
++    case osCommands:   menu = new cMenuCommands(tr("Commands"), &Commands); break;
+     default: break;
+     }
++  if (menu)
++      AddSubMenu(menu);
+ }
+ 
+ cOsdObject *cMenuMain::PluginOsdObject(void)
+@@ -2927,13 +2942,34 @@
+   eOSState state = cOsdMenu::ProcessKey(Key);
+   HadSubMenu |= HasSubMenu();
+ 
++  cOsdMenu *menu = NULL;
+   switch (state) {
+-    case osSchedule:   return AddSubMenu(new cMenuSchedule);
+-    case osChannels:   return AddSubMenu(new cMenuChannels);
+-    case osTimers:     return AddSubMenu(new cMenuTimers);
+-    case osRecordings: return AddSubMenu(new cMenuRecordings);
+-    case osSetup:      return AddSubMenu(new cMenuSetup);
+-    case osCommands:   return AddSubMenu(new cMenuCommands(tr("Commands"), &Commands));
++    case osSchedule:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osSchedule", &menu))
++            menu = new cMenuSchedule;
++        else
++            state = osContinue;
++        break;
++    case osChannels:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osChannels", &menu))
++            menu = new cMenuChannels;
++        else
++            state = osContinue;
++        break;
++    case osTimers:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osTimers", &menu))
++            menu = new cMenuTimers;
++        else
++            state = osContinue;
++        break;
++    case osRecordings:
++        if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osRecordings", &menu))
++            menu = new cMenuRecordings;
++        else
++            state = osContinue;
++        break;
++    case osSetup:      menu = new cMenuSetup; break;
++    case osCommands:   menu = new cMenuCommands(tr("Commands"), &Commands); break;
+     case osStopRecord: if (Interface->Confirm(tr("Stop recording?"))) {
+                           cOsdItem *item = Get(Current());
+                           if (item) {
+@@ -2985,6 +3021,8 @@
+                default:      break;
+                }
+     }
++  if (menu)
++      return AddSubMenu(menu);
+   if (!HasSubMenu() && Update(HadSubMenu))
+      Display();
+   if (Key != kNone) {
+--- vdr-1.4.5/config.h.orig	2007-02-20 11:55:40.000000000 +0100
++++ vdr-1.4.5/config.h	2007-02-20 11:56:43.000000000 +0100
+@@ -35,6 +35,8 @@
+ // plugins to work with newer versions of the core VDR as long as no
+ // VDR header files have changed.
+ 
++#define MAINMENUHOOKSVERSNUM 1.0
++
+ #define MAXPRIORITY 99
+ #define MAXLIFETIME 99
+ 

Modified: vdr/vdr/trunk/debian/patches/patchtest
===================================================================
--- vdr/vdr/trunk/debian/patches/patchtest	2007-03-10 19:46:10 UTC (rev 4330)
+++ vdr/vdr/trunk/debian/patches/patchtest	2007-03-10 20:15:10 UTC (rev 4331)
@@ -26,6 +26,7 @@
     opt-39_noepg \
     opt-40_wareagle-icons \
     opt-41-x_timer-info \
+    opt-42-x_MainMenuHooks \
     opt-42-x_extrecmenu \
     opt-43-x_epgsearch \
     opt-44_rotor \




More information about the pkg-vdr-dvb-changes mailing list