|
SASC-NG
DVBSoftCAM
|
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 1.87 2007/01/05 10:40:54 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 cMenuEditTimer : public cOsdMenu { 00035 private: 00036 cTimer *timer; 00037 cTimer data; 00038 int channel; 00039 bool addIfConfirmed; 00040 cMenuEditDateItem *firstday; 00041 void SetFirstDayItem(void); 00042 public: 00043 cMenuEditTimer(cTimer *Timer, bool New = false); 00044 virtual ~cMenuEditTimer(); 00045 virtual eOSState ProcessKey(eKeys Key); 00046 }; 00047 00048 class cMenuEvent : public cOsdMenu { 00049 private: 00050 const cEvent *event; 00051 public: 00052 cMenuEvent(const cEvent *Event, bool CanSwitch = false, bool Buttons = false); 00053 virtual void Display(void); 00054 virtual eOSState ProcessKey(eKeys Key); 00055 }; 00056 00057 class cMenuMain : public cOsdMenu { 00058 private: 00059 time_t lastDiskSpaceCheck; 00060 int lastFreeMB; 00061 bool replaying; 00062 cOsdItem *stopReplayItem; 00063 cOsdItem *cancelEditingItem; 00064 cOsdItem *stopRecordingItem; 00065 int recordControlsState; 00066 static cOsdObject *pluginOsdObject; 00067 void Set(void); 00068 bool Update(bool Force = false); 00069 public: 00070 cMenuMain(eOSState State = osUnknown); 00071 virtual eOSState ProcessKey(eKeys Key); 00072 static cOsdObject *PluginOsdObject(void); 00073 }; 00074 00075 class cDisplayChannel : public cOsdObject { 00076 private: 00077 cSkinDisplayChannel *displayChannel; 00078 int group; 00079 bool withInfo; 00080 cTimeMs lastTime; 00081 int number; 00082 bool timeout; 00083 cChannel *channel; 00084 const cEvent *lastPresent; 00085 const cEvent *lastFollowing; 00086 static cDisplayChannel *currentDisplayChannel; 00087 void DisplayChannel(void); 00088 void DisplayInfo(void); 00089 void Refresh(void); 00090 cChannel *NextAvailableChannel(cChannel *Channel, int Direction); 00091 public: 00092 cDisplayChannel(int Number, bool Switched); 00093 cDisplayChannel(eKeys FirstKey); 00094 virtual ~cDisplayChannel(); 00095 virtual eOSState ProcessKey(eKeys Key); 00096 static bool IsOpen(void) { return currentDisplayChannel != NULL; } 00097 }; 00098 00099 class cDisplayVolume : public cOsdObject { 00100 private: 00101 cSkinDisplayVolume *displayVolume; 00102 cTimeMs timeout; 00103 static cDisplayVolume *currentDisplayVolume; 00104 virtual void Show(void); 00105 cDisplayVolume(void); 00106 public: 00107 virtual ~cDisplayVolume(); 00108 static cDisplayVolume *Create(void); 00109 static void Process(eKeys Key); 00110 eOSState ProcessKey(eKeys Key); 00111 }; 00112 00113 class cDisplayTracks : public cOsdObject { 00114 private: 00115 cSkinDisplayTracks *displayTracks; 00116 cTimeMs timeout; 00117 eTrackType types[ttMaxTrackTypes]; 00118 char *descriptions[ttMaxTrackTypes]; 00119 int numTracks, track, audioChannel; 00120 static cDisplayTracks *currentDisplayTracks; 00121 virtual void Show(void); 00122 cDisplayTracks(void); 00123 public: 00124 virtual ~cDisplayTracks(); 00125 static bool IsOpen(void) { return currentDisplayTracks != NULL; } 00126 static cDisplayTracks *Create(void); 00127 static void Process(eKeys Key); 00128 eOSState ProcessKey(eKeys Key); 00129 }; 00130 00131 cOsdObject *CamControl(void); 00132 00133 class cMenuRecordingItem; 00134 00135 class cMenuRecordings : public cOsdMenu { 00136 private: 00137 char *base; 00138 int level; 00139 int recordingsState; 00140 int helpKeys; 00141 void SetHelpKeys(void); 00142 void Set(bool Refresh = false); 00143 bool Open(bool OpenSubMenus = false); 00144 eOSState Play(void); 00145 eOSState Rewind(void); 00146 eOSState Delete(void); 00147 eOSState Info(void); 00148 eOSState Commands(eKeys Key = kNone); 00149 protected: 00150 cRecording *GetRecording(cMenuRecordingItem *Item); 00151 public: 00152 cMenuRecordings(const char *Base = NULL, int Level = 0, bool OpenSubMenus = false); 00153 ~cMenuRecordings(); 00154 virtual eOSState ProcessKey(eKeys Key); 00155 }; 00156 00157 class cRecordControl { 00158 private: 00159 cDevice *device; 00160 cTimer *timer; 00161 //cRecorder *recorder; 00162 const cEvent *event; 00163 char *instantId; 00164 char *fileName; 00165 bool GetEvent(void); 00166 public: 00167 cRecordControl(cDevice *Device, cTimer *Timer = NULL, bool Pause = false); 00168 virtual ~cRecordControl(); 00169 bool Process(time_t t); 00170 cDevice *Device(void) { return device; } 00171 void Stop(void); 00172 const char *InstantId(void) { return instantId; } 00173 const char *FileName(void) { return fileName; } 00174 cTimer *Timer(void) { return timer; } 00175 }; 00176 00177 class cRecordControls { 00178 private: 00179 static cRecordControl *RecordControls[]; 00180 static int state; 00181 public: 00182 static bool Start(cTimer *Timer = NULL, bool Pause = false); 00183 static void Stop(const char *InstantId); 00184 static bool PauseLiveVideo(void); 00185 static const char *GetInstantId(const char *LastInstantId); 00186 static cRecordControl *GetRecordControl(const char *FileName); 00187 static void Process(time_t t); 00188 static void ChannelDataModified(cChannel *Channel); 00189 static bool Active(void); 00190 static void Shutdown(void); 00191 static void ChangeState(void) { state++; } 00192 static bool StateChanged(int &State); 00193 }; 00194 00195 #if 0 00196 class cReplayControl : public cDvbPlayerControl { 00197 private: 00198 cSkinDisplayReplay *displayReplay; 00199 cMarks marks; 00200 bool visible, modeOnly, shown, displayFrames; 00201 int lastCurrent, lastTotal; 00202 bool lastPlay, lastForward; 00203 int lastSpeed; 00204 time_t timeoutShow; 00205 bool timeSearchActive, timeSearchHide; 00206 int timeSearchTime, timeSearchPos; 00207 void TimeSearchDisplay(void); 00208 void TimeSearchProcess(eKeys Key); 00209 void TimeSearch(void); 00210 void ShowTimed(int Seconds = 0); 00211 static cReplayControl *currentReplayControl; 00212 static char *fileName; 00213 static char *title; 00214 void ShowMode(void); 00215 bool ShowProgress(bool Initial); 00216 void MarkToggle(void); 00217 void MarkJump(bool Forward); 00218 void MarkMove(bool Forward); 00219 void EditCut(void); 00220 void EditTest(void); 00221 public: 00222 cReplayControl(void); 00223 virtual ~cReplayControl(); 00224 virtual cOsdObject *GetInfo(void); 00225 virtual eOSState ProcessKey(eKeys Key); 00226 virtual void Show(void); 00227 virtual void Hide(void); 00228 bool Visible(void) { return visible; } 00229 static void SetRecording(const char *FileName, const char *Title); 00230 static const char *NowReplaying(void); 00231 static const char *LastReplayed(void); 00232 static void ClearLastReplayed(const char *FileName); 00233 }; 00234 #endif 00235 #endif //__MENU_H