From 700b88bc4db79b94fb6bc4f457f72d870cab9520 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 6 Jan 2006 12:53:28 +0100 Subject: Implemented the "Info" key --- HISTORY | 9 +++++++++ MANUAL | 1 + PLUGINS.html | 39 ++++++++++++++++++++++----------------- i18n.c | 23 ++++++++++++++++++++++- keymacros.conf | 1 + keys.c | 3 ++- keys.h | 3 ++- menu.c | 10 +++++++++- menu.h | 3 ++- player.c | 7 ++++++- player.h | 3 ++- vdr.c | 54 +++++++++++++++++++++++++++++++++++++++--------------- 12 files changed, 117 insertions(+), 39 deletions(-) diff --git a/HISTORY b/HISTORY index 35c383b2..ec7f4db3 100644 --- a/HISTORY +++ b/HISTORY @@ -4104,3 +4104,12 @@ Video Disk Recorder Revision History sort modes. - The default cOsdObject::Show() now automatically calls cOsdMenu::Display() if this is a menu. +- The new "Info" key brings up information on the currently viewed programme + or recording. For a live programme this is the same as "Schedule/Ok", i.e. the + description of the current EPG event. For a recording this is the same as shown + by the "Info" button in the "Recordings" menu. Plugins that implement players + can overwrite their cControl::GetInfo() function to show their own info (see + PLUGINS.html for details). Pressing the "Info" key again while the info is + displayed will close the OSD. In order to assign this new key to an existing + remote control setup, the remote.conf file needs to be deleted and VDR has + to be restarted to go through the process of learning the remote control keys. diff --git a/MANUAL b/MANUAL index ff706396..a823679a 100644 --- a/MANUAL +++ b/MANUAL @@ -33,6 +33,7 @@ Version 1.2 If your remote control provides additional keys, they can be used for the following functions: + Info display information on the currently viewed programme or recording Play resume normal replay Pause pause replay or live video Stop stop replay diff --git a/PLUGINS.html b/PLUGINS.html index bdaf1efb..7564341c 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -14,18 +14,18 @@ Copyright © 2005 Klaus Schmidinger
www.cadsoft.de/vdr

-
  -Important modifications introduced in version 1.3.21 are marked like this. -
-
  +
  Important modifications introduced in version 1.3.30 are marked like this.
-
  +
  Important modifications introduced in version 1.3.31 are marked like this.
-
  +
  Important modifications introduced in version 1.3.37 are marked like this.
+
  +Important modifications introduced in version 1.3.38 are marked like this. +

VDR provides an easy to use plugin interface that allows additional functionality to be added to the program by implementing a dynamically loadable library file. @@ -66,10 +66,10 @@ structures and allows it to hook itself into specific areas to perform special a

  • The Setup menu
  • Configuration files
  • Internationalization -
      +
     
  • Custom services
  • -
      +
     
  • SVDRP commands
  • Loading plugins into VDR @@ -85,9 +85,7 @@ structures and allows it to hook itself into specific areas to perform special a
  • Skins
  • Themes
  • Devices -
     
  • Audio -
  • Remote Control @@ -866,7 +864,7 @@ Texts are first searched for in the Phrases registered for this plugin (i and then in the global VDR texts. So a plugin can make use of texts defined by the core VDR code. -
      +
     

    Custom services

    What can I do for you?

    @@ -937,7 +935,7 @@ any plugin handled the request, or false if no plugin handled the reque

    -
      +
     

    SVDRP commands

    Infinite Diversity in Infinite Combinations

    @@ -1264,6 +1262,9 @@ public: cMyControl(void); virtual ~cMyControl(); virtual void Hide(void); +
      + virtual cOsdObject *GetInfo(void); +
    virtual eOSState ProcessKey(eKeys Key); };

    @@ -1292,8 +1293,14 @@ to make the main program loop shut down the player control. A derived cControl must implement the Hide() function, in which it has to hide itself from the OSD, in case it uses it. Hide() may be called at any time, and it may be called even if the cControl is not visible at the moment. -The reason for this is that the Menu button shall always bring up the main VDR -menu, so any active cControl needs to be hidden when that button is pressed. +

    +
      +The GetInfo() function is called when the user presses the Info button, +and shall return a pointer to a cOsdObject that contains information +about the currently played programme. The caller takes ownership of the returned +pointer and will delete it when it is no longer used. If no information is available, +NULL shall be returned. +

    Finally, to get things going, a plugin that implements a player (and the surrounding infrastructure like displaying a list of playable stuff etc) simply has to call the @@ -1515,7 +1522,7 @@ with the full required resolution. Only if this fails shall it use alternate areas. Drawing areas are always rectangular and may not overlap (but do not need to be adjacent). -
      +
     

    Directly accessing the OSD is only allowed from the foreground thread, which restricts this to a cOsdObject returned from the plugin's MainMenuAction() @@ -1840,9 +1847,7 @@ private: virtual void Action(void); public: cMyAudio(void); -
      virtual void Play(const uchar *Data, int Length, uchar Id); -
    virtual void Mute(bool On); virtual void Clear(void); }; diff --git a/i18n.c b/i18n.c index b65230ab..b6601d8b 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.225 2006/01/04 15:50:19 kls Exp $ + * $Id: i18n.c 1.226 2006/01/05 15:39:56 kls Exp $ * * Translations provided by: * @@ -4631,6 +4631,27 @@ const tI18nPhrase Phrases[] = { "Sinine", "Blε", }, + { "Key$Info", + "Info", + "Info", + "",//TODO + "Info", + "",//TODO + "Info", + "",//TODO + "Tiedot", + "",//TODO + "",//TODO + "Πληροφορίες", + "Info", + "Info", + "",//TODO + "",//TODO + "Έέδή", + "Info", + "Info", + "Info", + }, { "Key$Play", "Wiedergabe", "Predvajaj", diff --git a/keymacros.conf b/keymacros.conf index 42cddc26..4b74542e 100644 --- a/keymacros.conf +++ b/keymacros.conf @@ -9,4 +9,5 @@ Red Recordings Green Schedule +Yellow Info Blue Timers diff --git a/keys.c b/keys.c index 57b4f13e..4215d7be 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.9 2005/09/17 11:27:40 kls Exp $ + * $Id: keys.c 1.10 2006/01/05 15:39:26 kls Exp $ */ #include "keys.h" @@ -32,6 +32,7 @@ static tKey keyTable[] = { // "Up" and "Down" must be the first two keys! { k7, "7" }, { k8, "8" }, { k9, "9" }, + { kInfo, "Info" }, { kPlay, "Play" }, { kPause, "Pause" }, { kStop, "Stop" }, diff --git a/keys.h b/keys.h index 09b2c8be..73e061e3 100644 --- a/keys.h +++ b/keys.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: keys.h 1.6 2004/12/27 11:10:59 kls Exp $ + * $Id: keys.h 1.7 2006/01/05 15:39:06 kls Exp $ */ #ifndef __KEYS_H @@ -26,6 +26,7 @@ enum eKeys { // "Up" and "Down" must be the first two keys! kYellow, kBlue, k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, + kInfo, kPlay, kPause, kStop, diff --git a/menu.c b/menu.c index 9548ba4e..a6996f71 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.386 2006/01/05 14:02:45 kls Exp $ + * $Id: menu.c 1.387 2006/01/06 11:44:25 kls Exp $ */ #include "menu.h" @@ -3877,6 +3877,14 @@ void cReplayControl::EditTest(void) } } +cOsdObject *cReplayControl::GetInfo(void) +{ + cRecording *Recording = Recordings.GetByName(cReplayControl::LastReplayed()); + if (Recording) + return new cMenuRecording(Recording); + return NULL; +} + eOSState cReplayControl::ProcessKey(eKeys Key) { if (!Active()) diff --git a/menu.h b/menu.h index c85654f7..f88a597d 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.80 2006/01/04 13:47:00 kls Exp $ + * $Id: menu.h 1.81 2006/01/06 11:30:38 kls Exp $ */ #ifndef __MENU_H @@ -240,6 +240,7 @@ private: public: cReplayControl(void); virtual ~cReplayControl(); + virtual cOsdObject *GetInfo(void); virtual eOSState ProcessKey(eKeys Key); virtual void Show(void); virtual void Hide(void); diff --git a/player.c b/player.c index 74b19362..f2930207 100644 --- a/player.c +++ b/player.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: player.c 1.10 2006/01/01 14:45:36 kls Exp $ + * $Id: player.c 1.11 2006/01/06 11:30:07 kls Exp $ */ #include "player.h" @@ -55,6 +55,11 @@ cControl::~cControl() control = NULL; } +cOsdObject *cControl::GetInfo(void) +{ + return NULL; +} + cControl *cControl::Control(void) { cMutexLock MutexLock(&mutex); diff --git a/player.h b/player.h index 8134d117..11d16563 100644 --- a/player.h +++ b/player.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: player.h 1.18 2006/01/01 14:43:10 kls Exp $ + * $Id: player.h 1.19 2006/01/06 11:29:27 kls Exp $ */ #ifndef __PLAYER_H @@ -71,6 +71,7 @@ public: cControl(cPlayer *Player, bool Hidden = false); virtual ~cControl(); virtual void Hide(void) = 0; + virtual cOsdObject *GetInfo(void); bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false) { return player->GetIndex(Current, Total, SnapToIFrame); } bool GetReplayMode(bool &Play, bool &Forward, int &Speed) { return player->GetReplayMode(Play, Forward, Speed); } static void Launch(cControl *Control); diff --git a/vdr.c b/vdr.c index 96e775a2..eb88bc3d 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.229 2006/01/05 15:35:06 kls Exp $ + * $Id: vdr.c 1.230 2006/01/06 12:47:16 kls Exp $ */ #include @@ -491,6 +491,7 @@ int main(int argc, char *argv[]) bool ForceShutdown = false; bool UserShutdown = false; bool TimerInVpsMargin = false; + bool IsInfoMenu = false; // Load plugins: @@ -646,6 +647,8 @@ int main(int argc, char *argv[]) // Main program loop: +#define DELETE_MENU ((IsInfoMenu &= (Menu == NULL)), delete Menu, Menu = NULL) + while (!Interrupted) { // Handle emergency exits: if (cThread::EmergencyExit()) { @@ -786,14 +789,35 @@ int main(int argc, char *argv[]) case kMenu: key = kNone; // nobody else needs to see this key if (Menu) - DELETENULL(Menu); + DELETE_MENU; else if (cControl::Control() && cOsd::IsOpen()) cControl::Control()->Hide(); else Menu = new cMenuMain; break; + // Info: + case kInfo: { + bool WasInfoMenu = IsInfoMenu; + DELETE_MENU; + if (!WasInfoMenu) { + IsInfoMenu = true; + if (cControl::Control()) { + cControl::Control()->Hide(); + Menu = cControl::Control()->GetInfo(); + if (Menu) + Menu->Show(); + else + IsInfoMenu = false; + } + else { + cRemote::Put(kOk, true); + cRemote::Put(kSchedule, true); + } + } + } + break; #define DirectMainFunction(function)\ - DELETENULL(Menu);\ + DELETE_MENU;\ if (cControl::Control())\ cControl::Control()->Hide();\ Menu = new cMenuMain(function);\ @@ -806,7 +830,7 @@ int main(int argc, char *argv[]) case kCommands: DirectMainFunction(osCommands); break; case kUser1 ... kUser9: cRemote::PutMacro(key); key = kNone; break; case k_Plugin: { - DELETENULL(Menu); + DELETE_MENU; if (cControl::Control()) cControl::Control()->Hide(); cPlugin *plugin = cPluginManager::GetPlugin(cRemote::GetPlugin()); @@ -851,7 +875,7 @@ int main(int argc, char *argv[]) if (cControl::Control()) cControl::Control()->Hide(); if (!cDisplayTracks::IsOpen()) { - DELETENULL(Menu); + DELETE_MENU; Menu = cDisplayTracks::Create(); } else @@ -861,7 +885,7 @@ int main(int argc, char *argv[]) // Pausing live video: case kPause: if (!cControl::Control()) { - DELETENULL(Menu); + DELETE_MENU; if (!cRecordControls::PauseLiveVideo()) Skins.Message(mtError, tr("No free DVB device to record!")); key = kNone; // nobody else needs to see this key @@ -879,7 +903,7 @@ int main(int argc, char *argv[]) break; // Power off: case kPower: isyslog("Power button pressed"); - DELETENULL(Menu); + DELETE_MENU; if (!Shutdown) { Skins.Message(mtError, tr("Can't shutdown - option '-s' not given!")); break; @@ -909,44 +933,44 @@ int main(int argc, char *argv[]) state = osEnd; } switch (state) { - case osPause: DELETENULL(Menu); + case osPause: DELETE_MENU; cControl::Shutdown(); // just in case if (!cRecordControls::PauseLiveVideo()) Skins.Message(mtError, tr("No free DVB device to record!")); break; - case osRecord: DELETENULL(Menu); + case osRecord: DELETE_MENU; if (cRecordControls::Start()) Skins.Message(mtInfo, tr("Recording started")); else Skins.Message(mtError, tr("No free DVB device to record!")); break; case osRecordings: - DELETENULL(Menu); + DELETE_MENU; cControl::Shutdown(); Menu = new cMenuMain(osRecordings); break; - case osReplay: DELETENULL(Menu); + case osReplay: DELETE_MENU; cControl::Shutdown(); cControl::Launch(new cReplayControl); break; case osStopReplay: - DELETENULL(Menu); + DELETE_MENU; cControl::Shutdown(); break; case osSwitchDvb: - DELETENULL(Menu); + DELETE_MENU; cControl::Shutdown(); Skins.Message(mtInfo, tr("Switching primary DVB...")); cDevice::SetPrimaryDevice(Setup.PrimaryDVB); break; - case osPlugin: DELETENULL(Menu); + case osPlugin: DELETE_MENU; Menu = cMenuMain::PluginOsdObject(); if (Menu) Menu->Show(); break; case osBack: case osEnd: if (Interact == Menu) - DELETENULL(Menu); + DELETE_MENU; else cControl::Shutdown(); break; -- cgit v1.2.3