vdr  1.7.27
menu.h
Go to the documentation of this file.
00001 /*
00002  * menu.h: The actual menu implementations
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: menu.h 2.5 2012/03/08 13:11:40 kls Exp $
00008  */
00009 
00010 #ifndef __MENU_H
00011 #define __MENU_H
00012 
00013 #include "ci.h"
00014 #include "device.h"
00015 #include "epg.h"
00016 #include "osdbase.h"
00017 #include "dvbplayer.h"
00018 #include "menuitems.h"
00019 #include "recorder.h"
00020 #include "skins.h"
00021 
00022 class cMenuText : public cOsdMenu {
00023 private:
00024   char *text;
00025   eDvbFont font;
00026 public:
00027   cMenuText(const char *Title, const char *Text, eDvbFont Font = fontOsd);
00028   virtual ~cMenuText();
00029   void SetText(const char *Text);
00030   virtual void Display(void);
00031   virtual eOSState ProcessKey(eKeys Key);
00032   };
00033 
00034 class cMenuFolder : public cOsdMenu {
00035 private:
00036   cNestedItemList *nestedItemList;
00037   cList<cNestedItem> *list;
00038   cString dir;
00039   cOsdItem *firstFolder;
00040   bool editing;
00041   void SetHelpKeys(void);
00042   void Set(const char *CurrentFolder = NULL);
00043   void DescendPath(const char *Path);
00044   eOSState SetFolder(void);
00045   eOSState Select(void);
00046   eOSState New(void);
00047   eOSState Delete(void);
00048   eOSState Edit(void);
00049   cMenuFolder(const char *Title, cList<cNestedItem> *List, cNestedItemList *NestedItemList, const char *Dir, const char *Path = NULL);
00050 public:
00051   cMenuFolder(const char *Title, cNestedItemList *NestedItemList, const char *Path = NULL);
00052   cString GetFolder(void);
00053   virtual eOSState ProcessKey(eKeys Key);
00054   };
00055 
00056 class cMenuCommands : public cOsdMenu {
00057 private:
00058   cList<cNestedItem> *commands;
00059   cString parameters;
00060   cString title;
00061   cString command;
00062   bool confirm;
00063   char *result;
00064   bool Parse(const char *s);
00065   eOSState Execute(void);
00066 public:
00067   cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters = NULL);
00068   virtual ~cMenuCommands();
00069   virtual eOSState ProcessKey(eKeys Key);
00070   };
00071 
00072 class cMenuEditTimer : public cOsdMenu {
00073 private:
00074   cTimer *timer;
00075   cTimer data;
00076   int channel;
00077   bool addIfConfirmed;
00078   cMenuEditStrItem *file;
00079   cMenuEditDateItem *day;
00080   cMenuEditDateItem *firstday;
00081   eOSState SetFolder(void);
00082   void SetFirstDayItem(void);
00083   void SetHelpKeys(void);
00084 public:
00085   cMenuEditTimer(cTimer *Timer, bool New = false);
00086   virtual ~cMenuEditTimer();
00087   virtual eOSState ProcessKey(eKeys Key);
00088   };
00089 
00090 class cMenuEvent : public cOsdMenu {
00091 private:
00092   const cEvent *event;
00093 public:
00094   cMenuEvent(const cEvent *Event, bool CanSwitch = false, bool Buttons = false);
00095   virtual void Display(void);
00096   virtual eOSState ProcessKey(eKeys Key);
00097   };
00098 
00099 class cMenuMain : public cOsdMenu {
00100 private:
00101   bool replaying;
00102   cOsdItem *stopReplayItem;
00103   cOsdItem *cancelEditingItem;
00104   cOsdItem *cancelFileTransferItem;
00105   cOsdItem *stopRecordingItem;
00106   int recordControlsState;
00107   static cOsdObject *pluginOsdObject;
00108   void Set(void);
00109   bool Update(bool Force = false);
00110 public:
00111   cMenuMain(eOSState State = osUnknown);
00112   virtual eOSState ProcessKey(eKeys Key);
00113   static cOsdObject *PluginOsdObject(void);
00114   };
00115 
00116 class cDisplayChannel : public cOsdObject {
00117 private:
00118   cSkinDisplayChannel *displayChannel;
00119   int group;
00120   bool withInfo;
00121   cTimeMs lastTime;
00122   int number;
00123   bool timeout;
00124   cChannel *channel;
00125   const cEvent *lastPresent;
00126   const cEvent *lastFollowing;
00127   static cDisplayChannel *currentDisplayChannel;
00128   void DisplayChannel(void);
00129   void DisplayInfo(void);
00130   void Refresh(void);
00131   cChannel *NextAvailableChannel(cChannel *Channel, int Direction);
00132 public:
00133   cDisplayChannel(int Number, bool Switched);
00134   cDisplayChannel(eKeys FirstKey);
00135   virtual ~cDisplayChannel();
00136   virtual eOSState ProcessKey(eKeys Key);
00137   static bool IsOpen(void) { return currentDisplayChannel != NULL; }
00138   };
00139 
00140 class cDisplayVolume : public cOsdObject {
00141 private:
00142   cSkinDisplayVolume *displayVolume;
00143   cTimeMs timeout;
00144   static cDisplayVolume *currentDisplayVolume;
00145   virtual void Show(void);
00146   cDisplayVolume(void);
00147 public:
00148   virtual ~cDisplayVolume();
00149   static cDisplayVolume *Create(void);
00150   static void Process(eKeys Key);
00151   eOSState ProcessKey(eKeys Key);
00152   };
00153 
00154 class cDisplayTracks : public cOsdObject {
00155 private:
00156   cSkinDisplayTracks *displayTracks;
00157   cTimeMs timeout;
00158   eTrackType types[ttMaxTrackTypes];
00159   char *descriptions[ttMaxTrackTypes + 1]; // list is NULL terminated
00160   int numTracks, track, audioChannel;
00161   static cDisplayTracks *currentDisplayTracks;
00162   virtual void Show(void);
00163   cDisplayTracks(void);
00164 public:
00165   virtual ~cDisplayTracks();
00166   static bool IsOpen(void) { return currentDisplayTracks != NULL; }
00167   static cDisplayTracks *Create(void);
00168   static void Process(eKeys Key);
00169   eOSState ProcessKey(eKeys Key);
00170   };
00171 
00172 class cDisplaySubtitleTracks : public cOsdObject {
00173 private:
00174   cSkinDisplayTracks *displayTracks;
00175   cTimeMs timeout;
00176   eTrackType types[ttMaxTrackTypes];
00177   char *descriptions[ttMaxTrackTypes + 1]; // list is NULL terminated
00178   int numTracks, track;
00179   static cDisplaySubtitleTracks *currentDisplayTracks;
00180   virtual void Show(void);
00181   cDisplaySubtitleTracks(void);
00182 public:
00183   virtual ~cDisplaySubtitleTracks();
00184   static bool IsOpen(void) { return currentDisplayTracks != NULL; }
00185   static cDisplaySubtitleTracks *Create(void);
00186   static void Process(eKeys Key);
00187   eOSState ProcessKey(eKeys Key);
00188   };
00189 
00190 cOsdObject *CamControl(void);
00191 
00192 class cMenuRecordingItem;
00193 
00194 class cMenuRecordings : public cOsdMenu {
00195 private:
00196   char *base;
00197   int level;
00198   int recordingsState;
00199   int helpKeys;
00200   bool SetFreeDiskDisplay(bool Force = false);
00201   void SetHelpKeys(void);
00202   void Set(bool Refresh = false);
00203   bool Open(bool OpenSubMenus = false);
00204   eOSState Play(void);
00205   eOSState Rewind(void);
00206   eOSState Delete(void);
00207   eOSState Info(void);
00208   eOSState Commands(eKeys Key = kNone);
00209   eOSState Edit(void);
00210 protected:
00211   cRecording *GetRecording(cMenuRecordingItem *Item);
00212 public:
00213   cMenuRecordings(const char *Base = NULL, int Level = 0, bool OpenSubMenus = false);
00214   ~cMenuRecordings();
00215   virtual eOSState ProcessKey(eKeys Key);
00216   };
00217 
00218 class cRecordControl {
00219 private:
00220   cDevice *device;
00221   cTimer *timer;
00222   cRecorder *recorder;
00223   const cEvent *event;
00224   cString instantId;
00225   char *fileName;
00226   bool GetEvent(void);
00227 public:
00228   cRecordControl(cDevice *Device, cTimer *Timer = NULL, bool Pause = false);
00229   virtual ~cRecordControl();
00230   bool Process(time_t t);
00231   cDevice *Device(void) { return device; }
00232   void Stop(bool ExecuteUserCommand = true);
00233   const char *InstantId(void) { return instantId; }
00234   const char *FileName(void) { return fileName; }
00235   cTimer *Timer(void) { return timer; }
00236   };
00237 
00238 class cRecordControls {
00239 private:
00240   static cRecordControl *RecordControls[];
00241   static int state;
00242 public:
00243   static bool Start(cTimer *Timer = NULL, bool Pause = false);
00244   static void Stop(const char *InstantId);
00245   static bool PauseLiveVideo(void);
00246   static const char *GetInstantId(const char *LastInstantId);
00247   static cRecordControl *GetRecordControl(const char *FileName);
00248   static void Process(time_t t);
00249   static void ChannelDataModified(cChannel *Channel);
00250   static bool Active(void);
00251   static void Shutdown(void);
00252   static void ChangeState(void) { state++; }
00253   static bool StateChanged(int &State);
00254   };
00255 
00256 class cReplayControl : public cDvbPlayerControl {
00257 private:
00258   cSkinDisplayReplay *displayReplay;
00259   cMarks marks;
00260   bool visible, modeOnly, shown, displayFrames;
00261   int lastCurrent, lastTotal;
00262   bool lastPlay, lastForward;
00263   int lastSpeed;
00264   int lastSkipSeconds;
00265   eKeys lastSkipKey;
00266   cTimeMs lastSkipTimeout;
00267   time_t timeoutShow;
00268   bool timeSearchActive, timeSearchHide;
00269   int timeSearchTime, timeSearchPos;
00270   void TimeSearchDisplay(void);
00271   void TimeSearchProcess(eKeys Key);
00272   void TimeSearch(void);
00273   void ShowTimed(int Seconds = 0);
00274   static cReplayControl *currentReplayControl;
00275   static char *fileName;
00276   static char *title;
00277   void ShowMode(void);
00278   bool ShowProgress(bool Initial);
00279   void MarkToggle(void);
00280   void MarkJump(bool Forward);
00281   void MarkMove(bool Forward);
00282   void EditCut(void);
00283   void EditTest(void);
00284 public:
00285   cReplayControl(bool PauseLive = false);
00286   virtual ~cReplayControl();
00287   void Stop(void);
00288   virtual cOsdObject *GetInfo(void);
00289   virtual eOSState ProcessKey(eKeys Key);
00290   virtual void Show(void);
00291   virtual void Hide(void);
00292   bool Visible(void) { return visible; }
00293   static void SetRecording(const char *FileName, const char *Title);
00294   static const char *NowReplaying(void);
00295   static const char *LastReplayed(void);
00296   static void ClearLastReplayed(const char *FileName);
00297   };
00298 
00299 #endif //__MENU_H