1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00
vdr/menu.h

335 lines
9.4 KiB
C
Raw Permalink Normal View History

2000-02-19 13:36:48 +01:00
/*
* menu.h: The actual menu implementations
*
2000-04-24 09:46:05 +02:00
* See the main source file 'vdr.c' for copyright information and
2000-02-19 13:36:48 +01:00
* how to reach the author.
*
2015-09-14 13:23:06 +02:00
* $Id: menu.h 4.4 2015/09/13 14:17:56 kls Exp $
2000-02-19 13:36:48 +01:00
*/
2002-04-13 15:31:41 +02:00
#ifndef __MENU_H
#define __MENU_H
2000-02-19 13:36:48 +01:00
#include "ci.h"
#include "device.h"
#include "epg.h"
2004-05-16 10:35:36 +02:00
#include "osdbase.h"
#include "dvbplayer.h"
#include "menuitems.h"
#include "recorder.h"
2004-05-16 10:35:36 +02:00
#include "skins.h"
2000-02-19 13:36:48 +01:00
class cMenuText : public cOsdMenu {
private:
2004-05-23 09:54:06 +02:00
char *text;
2006-02-17 15:45:25 +01:00
eDvbFont font;
public:
cMenuText(const char *Title, const char *Text, eDvbFont Font = fontOsd);
2004-05-23 09:54:06 +02:00
virtual ~cMenuText();
void SetText(const char *Text);
virtual void Display(void);
virtual eOSState ProcessKey(eKeys Key);
};
class cMenuFolder : public cOsdMenu {
private:
cNestedItemList *nestedItemList;
cList<cNestedItem> *list;
cString dir;
cOsdItem *firstFolder;
bool editing;
int helpKeys;
void SetHelpKeys(void);
void Set(const char *CurrentFolder = NULL);
void DescendPath(const char *Path);
eOSState SetFolder(void);
eOSState Select(bool Open);
eOSState New(void);
eOSState Delete(void);
eOSState Edit(void);
cMenuFolder(const char *Title, cList<cNestedItem> *List, cNestedItemList *NestedItemList, const char *Dir, const char *Path = NULL);
public:
cMenuFolder(const char *Title, cNestedItemList *NestedItemList, const char *Path = NULL);
cString GetFolder(void);
virtual eOSState ProcessKey(eKeys Key);
};
class cMenuCommands : public cOsdMenu {
private:
cList<cNestedItem> *commands;
cString parameters;
cString title;
cString command;
bool confirm;
char *result;
bool Parse(const char *s);
eOSState Execute(void);
public:
cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters = NULL);
virtual ~cMenuCommands();
virtual eOSState ProcessKey(eKeys Key);
};
class cMenuEditTimer : public cOsdMenu {
private:
static const cTimer *addedTimer;
cTimer *timer;
cTimer data;
int channel;
bool addIfConfirmed;
cStringList svdrpServerNames;
char remote[HOST_NAME_MAX];
cMenuEditStrItem *file;
cMenuEditDateItem *day;
cMenuEditDateItem *firstday;
eOSState SetFolder(void);
void SetFirstDayItem(void);
void SetHelpKeys(void);
public:
cMenuEditTimer(cTimer *Timer, bool New = false);
virtual ~cMenuEditTimer();
virtual eOSState ProcessKey(eKeys Key);
static const cTimer *AddedTimer(void);
};
class cMenuEvent : public cOsdMenu {
private:
const cEvent *event;
public:
cMenuEvent(const cTimers *Timers, const cChannels *Channels, const cEvent *Event, bool CanSwitch = false, bool Buttons = false);
virtual void Display(void);
virtual eOSState ProcessKey(eKeys Key);
};
2000-02-19 13:36:48 +01:00
class cMenuMain : public cOsdMenu {
2000-05-01 16:29:46 +02:00
private:
bool replaying;
cOsdItem *stopReplayItem;
cOsdItem *cancelEditingItem;
cOsdItem *stopRecordingItem;
int recordControlsState;
2002-11-24 10:45:39 +01:00
static cOsdObject *pluginOsdObject;
void Set(void);
bool Update(bool Force = false);
2000-02-19 13:36:48 +01:00
public:
cMenuMain(eOSState State = osUnknown, bool OpenSubMenus = false);
virtual eOSState ProcessKey(eKeys Key);
2002-11-24 10:45:39 +01:00
static cOsdObject *PluginOsdObject(void);
2000-02-19 13:36:48 +01:00
};
2001-08-03 14:18:08 +02:00
class cDisplayChannel : public cOsdObject {
private:
2004-05-16 10:35:36 +02:00
cSkinDisplayChannel *displayChannel;
int group;
bool withInfo;
cTimeMs lastTime;
2002-09-29 13:40:45 +02:00
int number;
bool timeout;
2015-01-15 11:33:58 +01:00
int osdState;
const cPositioner *positioner;
const cChannel *channel;
2004-05-16 10:35:36 +02:00
const cEvent *lastPresent;
const cEvent *lastFollowing;
static cDisplayChannel *currentDisplayChannel;
void DisplayChannel(void);
void DisplayInfo(void);
2002-10-27 14:32:06 +01:00
void Refresh(void);
const cChannel *NextAvailableChannel(const cChannel *Channel, int Direction);
public:
cDisplayChannel(int Number, bool Switched);
cDisplayChannel(eKeys FirstKey);
virtual ~cDisplayChannel();
virtual eOSState ProcessKey(eKeys Key);
static bool IsOpen(void) { return currentDisplayChannel != NULL; }
};
class cDisplayVolume : public cOsdObject {
2002-03-09 17:11:49 +01:00
private:
2004-05-16 10:35:36 +02:00
cSkinDisplayVolume *displayVolume;
cTimeMs timeout;
2004-05-16 10:35:36 +02:00
static cDisplayVolume *currentDisplayVolume;
virtual void Show(void);
2002-03-09 17:11:49 +01:00
cDisplayVolume(void);
public:
virtual ~cDisplayVolume();
static cDisplayVolume *Create(void);
static void Process(eKeys Key);
eOSState ProcessKey(eKeys Key);
};
2005-01-02 15:11:44 +01:00
class cDisplayTracks : public cOsdObject {
private:
cSkinDisplayTracks *displayTracks;
cTimeMs timeout;
eTrackType types[ttMaxTrackTypes];
char *descriptions[ttMaxTrackTypes + 1]; // list is NULL terminated
2005-01-09 12:08:34 +01:00
int numTracks, track, audioChannel;
2005-01-02 15:11:44 +01:00
static cDisplayTracks *currentDisplayTracks;
virtual void Show(void);
cDisplayTracks(void);
public:
virtual ~cDisplayTracks();
2005-01-06 14:36:40 +01:00
static bool IsOpen(void) { return currentDisplayTracks != NULL; }
2005-01-02 15:11:44 +01:00
static cDisplayTracks *Create(void);
2007-10-12 14:52:30 +02:00
static void Process(eKeys Key);
eOSState ProcessKey(eKeys Key);
};
class cDisplaySubtitleTracks : public cOsdObject {
private:
cSkinDisplayTracks *displayTracks;
cTimeMs timeout;
eTrackType types[ttMaxTrackTypes];
char *descriptions[ttMaxTrackTypes + 1]; // list is NULL terminated
int numTracks, track;
static cDisplaySubtitleTracks *currentDisplayTracks;
virtual void Show(void);
cDisplaySubtitleTracks(void);
public:
virtual ~cDisplaySubtitleTracks();
static bool IsOpen(void) { return currentDisplayTracks != NULL; }
static cDisplaySubtitleTracks *Create(void);
2005-01-02 15:11:44 +01:00
static void Process(eKeys Key);
eOSState ProcessKey(eKeys Key);
};
cOsdObject *CamControl(void);
bool CamMenuActive(void);
class cRecordingFilter {
public:
virtual ~cRecordingFilter(void) {};
virtual bool Filter(const cRecording *Recording) const = 0;
///< Returns true if the given Recording shall be displayed in the Recordings menu.
};
class cMenuRecordingItem;
class cMenuRecordings : public cOsdMenu {
private:
char *base;
int level;
cStateKey recordingsStateKey;
int helpKeys;
const cRecordingFilter *filter;
static cString path;
static cString fileName;
void SetHelpKeys(void);
void Set(bool Refresh = false);
bool Open(bool OpenSubMenus = false);
eOSState Play(void);
eOSState Rewind(void);
eOSState Delete(void);
eOSState Info(void);
2012-06-09 14:32:29 +02:00
eOSState Sort(void);
2002-10-13 12:14:49 +02:00
eOSState Commands(eKeys Key = kNone);
protected:
2012-06-09 14:32:29 +02:00
cString DirectoryName(void);
public:
cMenuRecordings(const char *Base = NULL, int Level = 0, bool OpenSubMenus = false, const cRecordingFilter *Filter = NULL);
~cMenuRecordings();
virtual eOSState ProcessKey(eKeys Key);
static void SetPath(const char *Path);
static void SetRecording(const char *FileName);
};
2000-05-01 16:29:46 +02:00
class cRecordControl {
2000-04-30 10:22:13 +02:00
private:
cDevice *device;
2000-04-30 10:22:13 +02:00
cTimer *timer;
cRecorder *recorder;
const cEvent *event;
cString instantId;
char *fileName;
bool GetEvent(void);
2000-04-30 10:22:13 +02:00
public:
cRecordControl(cDevice *Device, cTimers *Timers, cTimer *Timer = NULL, bool Pause = false);
2000-04-30 10:22:13 +02:00
virtual ~cRecordControl();
bool Process(time_t t);
cDevice *Device(void) { return device; }
void Stop(bool ExecuteUserCommand = true);
2000-05-01 16:29:46 +02:00
const char *InstantId(void) { return instantId; }
const char *FileName(void) { return fileName; }
cTimer *Timer(void) { return timer; }
2000-05-01 16:29:46 +02:00
};
class cRecordControls {
private:
static cRecordControl *RecordControls[];
static int state;
2000-05-01 16:29:46 +02:00
public:
static bool Start(cTimers *Timers, cTimer *Timer, bool Pause = false);
static bool Start(bool Pause = false);
2000-05-01 16:29:46 +02:00
static void Stop(const char *InstantId);
static void Stop(cTimer *Timer);
2003-04-21 14:57:13 +02:00
static bool PauseLiveVideo(void);
2000-05-01 16:29:46 +02:00
static const char *GetInstantId(const char *LastInstantId);
static cRecordControl *GetRecordControl(const char *FileName);
static cRecordControl *GetRecordControl(const cTimer *Timer);
///< Returns the cRecordControl for the given Timer.
///< If there is no cRecordControl for Timer, NULL is returned.
static bool Process(cTimers *Timers, time_t t);
static void ChannelDataModified(const cChannel *Channel);
static bool Active(void);
static void Shutdown(void);
static void ChangeState(void) { state++; }
static bool StateChanged(int &State);
2000-04-30 10:22:13 +02:00
};
class cAdaptiveSkipper {
private:
int *initialValue;
int currentValue;
double framesPerSecond;
eKeys lastKey;
cTimeMs timeout;
public:
cAdaptiveSkipper(void);
void Initialize(int *InitialValue, double FramesPerSecond);
int GetValue(eKeys Key);
};
class cReplayControl : public cDvbPlayerControl {
2000-04-24 15:32:11 +02:00
private:
2004-05-16 10:35:36 +02:00
cSkinDisplayReplay *displayReplay;
cAdaptiveSkipper adaptiveSkipper;
2000-12-28 12:57:16 +01:00
cMarks marks;
bool marksModified;
2001-09-14 14:06:43 +02:00
bool visible, modeOnly, shown, displayFrames;
int lastCurrent, lastTotal;
2004-05-16 10:35:36 +02:00
bool lastPlay, lastForward;
int lastSpeed;
time_t timeoutShow;
bool timeSearchActive, timeSearchHide;
int timeSearchTime, timeSearchPos;
void TimeSearchDisplay(void);
void TimeSearchProcess(eKeys Key);
void TimeSearch(void);
void ShowTimed(int Seconds = 0);
static cReplayControl *currentReplayControl;
static cString fileName;
void ShowMode(void);
2000-12-09 11:13:00 +01:00
bool ShowProgress(bool Initial);
2000-12-28 12:57:16 +01:00
void MarkToggle(void);
void MarkJump(bool Forward);
void MarkMove(int Frames, bool MarkRequired);
2000-12-28 12:57:16 +01:00
void EditCut(void);
void EditTest(void);
2000-04-23 15:38:16 +02:00
public:
cReplayControl(bool PauseLive = false);
virtual ~cReplayControl();
void Stop(void);
2006-01-06 12:53:28 +01:00
virtual cOsdObject *GetInfo(void);
virtual const cRecording *GetRecording(void);
virtual eOSState ProcessKey(eKeys Key);
virtual void Show(void);
virtual void Hide(void);
bool Visible(void) { return visible; }
static void SetRecording(const char *FileName);
static const char *NowReplaying(void);
static const char *LastReplayed(void);
static void ClearLastReplayed(const char *FileName);
2000-04-23 15:38:16 +02:00
};
2002-04-13 15:31:41 +02:00
#endif //__MENU_H