vdr  1.7.31
menu.h
Go to the documentation of this file.
1 /*
2  * menu.h: The actual menu implementations
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: menu.h 2.12 2012/09/07 08:48:34 kls Exp $
8  */
9 
10 #ifndef __MENU_H
11 #define __MENU_H
12 
13 #include "ci.h"
14 #include "device.h"
15 #include "epg.h"
16 #include "osdbase.h"
17 #include "dvbplayer.h"
18 #include "menuitems.h"
19 #include "recorder.h"
20 #include "skins.h"
21 
22 class cMenuText : public cOsdMenu {
23 private:
24  char *text;
25  eDvbFont font;
26 public:
27  cMenuText(const char *Title, const char *Text, eDvbFont Font = fontOsd);
28  virtual ~cMenuText();
29  void SetText(const char *Text);
30  virtual void Display(void);
31  virtual eOSState ProcessKey(eKeys Key);
32  };
33 
34 class cMenuFolder : public cOsdMenu {
35 private:
38  cString dir;
40  bool editing;
41  void SetHelpKeys(void);
42  void Set(const char *CurrentFolder = NULL);
43  void DescendPath(const char *Path);
44  eOSState SetFolder(void);
45  eOSState Select(void);
46  eOSState New(void);
47  eOSState Delete(void);
48  eOSState Edit(void);
49  cMenuFolder(const char *Title, cList<cNestedItem> *List, cNestedItemList *NestedItemList, const char *Dir, const char *Path = NULL);
50 public:
51  cMenuFolder(const char *Title, cNestedItemList *NestedItemList, const char *Path = NULL);
52  cString GetFolder(void);
53  virtual eOSState ProcessKey(eKeys Key);
54  };
55 
56 class cMenuCommands : public cOsdMenu {
57 private:
60  cString title;
62  bool confirm;
63  char *result;
64  bool Parse(const char *s);
65  eOSState Execute(void);
66 public:
67  cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters = NULL);
68  virtual ~cMenuCommands();
69  virtual eOSState ProcessKey(eKeys Key);
70  };
71 
72 class cMenuEditTimer : public cOsdMenu {
73 private:
74  cTimer *timer;
75  cTimer data;
76  int channel;
77  bool addIfConfirmed;
81  eOSState SetFolder(void);
82  void SetFirstDayItem(void);
83  void SetHelpKeys(void);
84 public:
85  cMenuEditTimer(cTimer *Timer, bool New = false);
86  virtual ~cMenuEditTimer();
87  virtual eOSState ProcessKey(eKeys Key);
88  };
89 
90 class cMenuEvent : public cOsdMenu {
91 private:
92  const cEvent *event;
93 public:
94  cMenuEvent(const cEvent *Event, bool CanSwitch = false, bool Buttons = false);
95  virtual void Display(void);
96  virtual eOSState ProcessKey(eKeys Key);
97  };
98 
99 class cMenuMain : public cOsdMenu {
100 private:
101  bool replaying;
107  static cOsdObject *pluginOsdObject;
108  void Set(void);
109  bool Update(bool Force = false);
110 public:
111  cMenuMain(eOSState State = osUnknown);
112  virtual eOSState ProcessKey(eKeys Key);
113  static cOsdObject *PluginOsdObject(void);
114  };
115 
116 class cDisplayChannel : public cOsdObject {
117 private:
119  int group;
120  bool withInfo;
122  int number;
123  bool timeout;
124  cChannel *channel;
125  const cEvent *lastPresent;
126  const cEvent *lastFollowing;
128  void DisplayChannel(void);
129  void DisplayInfo(void);
130  void Refresh(void);
131  cChannel *NextAvailableChannel(cChannel *Channel, int Direction);
132 public:
133  cDisplayChannel(int Number, bool Switched);
134  cDisplayChannel(eKeys FirstKey);
135  virtual ~cDisplayChannel();
136  virtual eOSState ProcessKey(eKeys Key);
137  static bool IsOpen(void) { return currentDisplayChannel != NULL; }
138  };
139 
140 class cDisplayVolume : public cOsdObject {
141 private:
145  virtual void Show(void);
146  cDisplayVolume(void);
147 public:
148  virtual ~cDisplayVolume();
149  static cDisplayVolume *Create(void);
150  static void Process(eKeys Key);
152  };
153 
154 class cDisplayTracks : public cOsdObject {
155 private:
159  char *descriptions[ttMaxTrackTypes + 1]; // list is NULL terminated
162  virtual void Show(void);
163  cDisplayTracks(void);
164 public:
165  virtual ~cDisplayTracks();
166  static bool IsOpen(void) { return currentDisplayTracks != NULL; }
167  static cDisplayTracks *Create(void);
168  static void Process(eKeys Key);
170  };
171 
172 class cDisplaySubtitleTracks : public cOsdObject {
173 private:
177  char *descriptions[ttMaxTrackTypes + 1]; // list is NULL terminated
178  int numTracks, track;
180  virtual void Show(void);
182 public:
183  virtual ~cDisplaySubtitleTracks();
184  static bool IsOpen(void) { return currentDisplayTracks != NULL; }
185  static cDisplaySubtitleTracks *Create(void);
186  static void Process(eKeys Key);
188  };
189 
190 cOsdObject *CamControl(void);
191 bool CamMenuActive(void);
192 
193 class cMenuRecordingItem;
194 
195 class cMenuRecordings : public cOsdMenu {
196 private:
197  char *base;
198  int level;
199  int recordingsState;
200  int helpKeys;
201  void SetHelpKeys(void);
202  void Set(bool Refresh = false);
203  bool Open(bool OpenSubMenus = false);
204  eOSState Play(void);
205  eOSState Rewind(void);
206  eOSState Delete(void);
207  eOSState Info(void);
208  eOSState Sort(void);
209  eOSState Commands(eKeys Key = kNone);
210  eOSState Edit(void);
211 protected:
212  cString DirectoryName(void);
214 public:
215  cMenuRecordings(const char *Base = NULL, int Level = 0, bool OpenSubMenus = false);
217  virtual eOSState ProcessKey(eKeys Key);
218  };
219 
220 class cRecordControl {
221 private:
222  cDevice *device;
223  cTimer *timer;
225  const cEvent *event;
227  char *fileName;
228  bool GetEvent(void);
229 public:
230  cRecordControl(cDevice *Device, cTimer *Timer = NULL, bool Pause = false);
231  virtual ~cRecordControl();
232  bool Process(time_t t);
233  cDevice *Device(void) { return device; }
234  void Stop(bool ExecuteUserCommand = true);
235  const char *InstantId(void) { return instantId; }
236  const char *FileName(void) { return fileName; }
237  cTimer *Timer(void) { return timer; }
238  };
239 
240 class cRecordControls {
241 private:
242  static cRecordControl *RecordControls[];
243  static int state;
244 public:
245  static bool Start(cTimer *Timer = NULL, bool Pause = false);
246  static void Stop(const char *InstantId);
247  static bool PauseLiveVideo(void);
248  static const char *GetInstantId(const char *LastInstantId);
249  static cRecordControl *GetRecordControl(const char *FileName);
250  static cRecordControl *GetRecordControl(const cTimer *Timer);
253  static void Process(time_t t);
254  static void ChannelDataModified(cChannel *Channel);
255  static bool Active(void);
256  static void Shutdown(void);
257  static void ChangeState(void) { state++; }
258  static bool StateChanged(int &State);
259  };
260 
261 class cReplayControl : public cDvbPlayerControl {
262 private:
264  cMarks marks;
265  bool marksModified;
267  int lastCurrent, lastTotal;
268  bool lastPlay, lastForward;
269  int lastSpeed;
270  int lastSkipSeconds;
273  time_t timeoutShow;
276  void TimeSearchDisplay(void);
277  void TimeSearchProcess(eKeys Key);
278  void TimeSearch(void);
279  void ShowTimed(int Seconds = 0);
281  static cString fileName;
282  void ShowMode(void);
283  bool ShowProgress(bool Initial);
284  void MarkToggle(void);
285  void MarkJump(bool Forward);
286  void MarkMove(bool Forward);
287  void EditCut(void);
288  void EditTest(void);
289 public:
290  cReplayControl(bool PauseLive = false);
291  virtual ~cReplayControl();
292  void Stop(void);
293  virtual cOsdObject *GetInfo(void);
294  virtual const cRecording *GetRecording(void);
295  virtual eOSState ProcessKey(eKeys Key);
296  virtual void Show(void);
297  virtual void Hide(void);
298  bool Visible(void) { return visible; }
299  static void SetRecording(const char *FileName);
300  static const char *NowReplaying(void);
301  static const char *LastReplayed(void);
302  static void ClearLastReplayed(const char *FileName);
303  };
304 
305 #endif //__MENU_H