FRQ: VDR core support for online help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

today many TV equipment offers online help, even my remote does ;)
VDR currently only gives help by manuals or WIKI, but this is far away every time you need it, i.e. if you whatch TV. So I was wondering if it would be interesting to add online help for VDR with the following requirements:

- a dedicated key should give help in any situations (-> kHelp)
- help may be available per OSD item, or - if not present - per OSD menu
  (e.g. some setup values could give an extra explanation)
- help may be available for all player controls
  (e.g. I'll never keep in mind the keys for the dvd-plugin ;) )
- the implementation should also work for plugins

What do you (especially Klaus) think about an online help?

I've added a quick and dirty patch, that adds the basics for an online help. With the patch the implemenation of an online help works like this:

To add help to an OSD item, simply replace for example

Add(new cMenuEditItem(tr("an osd item"), &data.value));

with

cOsdItem* item = new cMenuEditItem(tr("an osd item"), &data.value);
Add(item);
item->SetOnlineHelp(tr("Help for item"));

To add help for an OSD menu add the following line to the contructor:

SetOnlineHelp(tr("Help for this menu"));

The same for an object derived from cControl.

Whenever the user presses the 'Help' key he gets a simple text menu with the online help.

I've already added online help to epgsearch's setup previously, but I think it would be better if there was core support in VDR for this and a common implementation.

The patch really needs some refinement (especially the part in vdr.c), but it should only serve as a starting point for a discussion.

BR,

Christian




diff -Nru --exclude PLUGINS vdr-1.5.6/keys.c vdr-1.5.6-patched/keys.c
--- vdr-1.5.6/keys.c	2006-10-14 12:18:05.000000000 +0200
+++ vdr-1.5.6-patched/keys.c	2007-08-12 11:23:05.000000000 +0200
@@ -64,6 +64,7 @@
                     { kUser7,         "User7"      },
                     { kUser8,         "User8"      },
                     { kUser9,         "User9"      },
+                    { kHelp,          "Help"       },
                     { kNone,          ""           },
                     { k_Setup,        "_Setup"     },
                     { kNone,          NULL         },
diff -Nru --exclude PLUGINS vdr-1.5.6/keys.h vdr-1.5.6-patched/keys.h
--- vdr-1.5.6/keys.h	2007-02-25 11:49:35.000000000 +0100
+++ vdr-1.5.6-patched/keys.h	2007-08-12 11:05:50.000000000 +0200
@@ -50,6 +50,7 @@
              kSetup,
              kCommands,
              kUser1, kUser2, kUser3, kUser4, kUser5, kUser6, kUser7, kUser8, kUser9,
+	     kHelp,
              kNone,
              kKbd,
              // The following codes are used internally:
diff -Nru --exclude PLUGINS vdr-1.5.6/osdbase.c vdr-1.5.6-patched/osdbase.c
--- vdr-1.5.6/osdbase.c	2007-06-09 12:07:46.000000000 +0200
+++ vdr-1.5.6-patched/osdbase.c	2007-08-12 13:38:00.000000000 +0200
@@ -13,6 +13,7 @@
 #include "i18n.h"
 #include "remote.h"
 #include "status.h"
+#include "menu.h"
 
 // --- cOsdItem --------------------------------------------------------------
 
@@ -22,6 +23,7 @@
   state = State;
   selectable = true;
   fresh = true;
+  help = NULL;
 }
 
 cOsdItem::cOsdItem(const char *Text, eOSState State, bool Selectable)
@@ -30,12 +32,14 @@
   state = State;
   selectable = Selectable;
   fresh = true;
+  help = NULL;
   SetText(Text);
 }
 
 cOsdItem::~cOsdItem()
 {
   free(text);
+  free(help);
 }
 
 void cOsdItem::SetText(const char *Text, bool Copy)
@@ -54,6 +58,12 @@
   fresh = Fresh;
 }
 
+void cOsdItem::SetOnlineHelp(const char *Help, bool Copy)
+{
+  free(help);
+  help = Copy ? strdup(Help) : (char *)Help; // help assumes ownership!
+}
+
 eOSState cOsdItem::ProcessKey(eKeys Key)
 {
   return Key == kOk ? state : osUnknown;
@@ -67,6 +77,12 @@
      ((cOsdMenu *)this)->Display();
 }
 
+void cOsdObject::SetOnlineHelp(const char *Help, bool Copy)
+{
+  free(help);
+  help = Copy ? strdup(Help) : (char *)Help; // help assumes ownership!
+}
+
 // --- cOsdMenu --------------------------------------------------------------
 
 cSkinDisplayMenu *cOsdMenu::displayMenu = NULL;
@@ -447,6 +463,18 @@
      }
 }
 
+eOSState cOsdMenu::Help(void)
+{
+  const char* Help = OnlineHelp();
+  cOsdItem *item = Get(current);
+  if (item && item->OnlineHelp())
+    Help = item->OnlineHelp();
+  if (Help)
+    return AddSubMenu(new cMenuText(tr("Help"), Help));
+  else
+    return osUnknown;
+}
+
 eOSState cOsdMenu::HotKey(eKeys Key)
 {
   for (cOsdItem *item = First(); item; item = Next(item)) {
@@ -517,6 +545,7 @@
                    marked = -1;
                    break;
                    }
+    case kHelp: return Help();
                 // else run into default
     default: if (marked < 0)
                 return osUnknown;
diff -Nru --exclude PLUGINS vdr-1.5.6/osdbase.h vdr-1.5.6-patched/osdbase.h
--- vdr-1.5.6/osdbase.h	2007-06-09 13:49:00.000000000 +0200
+++ vdr-1.5.6-patched/osdbase.h	2007-08-12 14:00:43.000000000 +0200
@@ -51,6 +51,7 @@
   char *text;
   eOSState state;
   bool selectable;
+  char *help;
 protected:
   bool fresh;
 public:
@@ -61,7 +62,9 @@
   void SetText(const char *Text, bool Copy = true);
   void SetSelectable(bool Selectable);
   void SetFresh(bool Fresh);
+  void SetOnlineHelp(const char *Help, bool Copy = true);
   const char *Text(void) { return text; }
+  const char *OnlineHelp(void) { return help; }
   virtual void Set(void) {}
   virtual eOSState ProcessKey(eKeys Key);
   };
@@ -71,15 +74,18 @@
 private:
   bool isMenu;
   bool needsFastResponse;
+  char *help;
 protected:
   void SetNeedsFastResponse(bool NeedsFastResponse) { needsFastResponse = NeedsFastResponse; }
 public:
-  cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; }
-  virtual ~cOsdObject() {}
+  cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; help = NULL; }
+  virtual ~cOsdObject() { free(help); }
   virtual bool NeedsFastResponse(void) { return needsFastResponse; }
   bool IsMenu(void) { return isMenu; }
   virtual void Show(void);
   virtual eOSState ProcessKey(eKeys Key) { return osUnknown; }
+  virtual void SetOnlineHelp(const char *Help, bool Copy = true);
+  const char *OnlineHelp(void) { return help; }
   };
 
 class cOsdMenu : public cOsdObject, public cList<cOsdItem> {
@@ -120,6 +126,7 @@
   void SetTitle(const char *Title);
   void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
   virtual void Del(int Index);
+  virtual eOSState Help(void);
 public:
   cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
   virtual ~cOsdMenu();
diff -Nru --exclude PLUGINS vdr-1.5.6/player.c vdr-1.5.6-patched/player.c
--- vdr-1.5.6/player.c	2007-07-20 17:25:24.000000000 +0200
+++ vdr-1.5.6-patched/player.c	2007-08-12 13:49:24.000000000 +0200
@@ -9,6 +9,7 @@
 
 #include "player.h"
 #include "i18n.h"
+#include "menu.h"
 
 // --- cPlayer ---------------------------------------------------------------
 
@@ -94,3 +95,12 @@
   control = NULL;
   delete c;
 }
+
+cOsdObject *cControl::Help(void)
+{
+  const char* Help = OnlineHelp();
+  if (Help)
+    return new cMenuText(tr("Help"), Help);
+  else
+    return NULL;
+}
diff -Nru --exclude PLUGINS vdr-1.5.6/player.h vdr-1.5.6-patched/player.h
--- vdr-1.5.6/player.h	2006-01-06 12:29:27.000000000 +0100
+++ vdr-1.5.6-patched/player.h	2007-08-12 13:48:50.000000000 +0200
@@ -78,6 +78,7 @@
   static void Attach(void);
   static void Shutdown(void);
   static cControl *Control(void);
+  virtual cOsdObject *Help(void);
   };
 
 #endif //__PLAYER_H
diff -Nru --exclude PLUGINS vdr-1.5.6/vdr.c vdr-1.5.6-patched/vdr.c
--- vdr-1.5.6/vdr.c	2007-07-22 13:40:01.000000000 +0200
+++ vdr-1.5.6-patched/vdr.c	2007-08-12 13:54:35.000000000 +0200
@@ -923,8 +923,18 @@
                      cRemote::Put(kSchedule, true);
                      }
                   }
-               }
+	  }
+               break;
+          // Help:
+          case kHelp: 
+                  if (cControl::Control()) {
+                     cControl::Control()->Hide();
+                     Menu = cControl::Control()->Help();
+                     if (Menu)
+                        Menu->Show();
+                     }	  
                break;
+	       
           // Direct main menu functions:
           #define DirectMainFunction(function)\
             DELETE_MENU;\
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux