diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2008-02-16 15:04:49 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2008-02-16 15:04:49 +0100 |
commit | 6140c49f146455f01897097e0393225382ec1885 (patch) | |
tree | d6a3312bfbc62bfa50a9729d19fa06188ed69931 | |
parent | 6b35173789c2d97fc6b9dadb780a22316f82c7fb (diff) | |
download | vdr-6140c49f146455f01897097e0393225382ec1885.tar.gz vdr-6140c49f146455f01897097e0393225382ec1885.tar.bz2 |
Added cStatus::TimerChange()
-rw-r--r-- | CONTRIBUTORS | 4 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | status.c | 8 | ||||
-rw-r--r-- | status.h | 13 | ||||
-rw-r--r-- | timers.c | 24 | ||||
-rw-r--r-- | timers.h | 9 |
6 files changed, 53 insertions, 7 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 55c5b272..7af31b22 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2294,3 +2294,7 @@ Hans-Werner Hilse <hilse@web.de> Mikko Matilainen <mikkom@iki.fi> for reporting a possible crash if the Info key is pressed after deleting the currently replayed recording + +Benedikt Elser <elser@in.tum.de> + for a patch that was used to add cStatus::TimerChange() to inform plugins about + changes to the list of timers @@ -5633,3 +5633,5 @@ Video Disk Recorder Revision History which would not add any free space to the video directory. - Implemented the cStatus, cDevice and cPlayer functions for setting subtitle tracks in plugins (thanks to Petri Hintukainen). +- Added cStatus::TimerChange() to inform plugins about changes to the list of timers + (based on a patch from Benedikt Elser). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.c 1.9 2008/02/16 13:50:15 kls Exp $ + * $Id: status.c 1.10 2008/02/16 14:46:31 kls Exp $ */ #include "status.h" @@ -23,6 +23,12 @@ cStatus::~cStatus() statusMonitors.Del(this, false); } +void cStatus::MsgTimerChange(const cTimer *Timer, eTimerChange Change) +{ + for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) + sm->TimerChange(Timer, Change); +} + void cStatus::MsgChannelSwitch(const cDevice *Device, int ChannelNumber) { for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.h 1.11 2008/02/16 13:50:15 kls Exp $ + * $Id: status.h 1.12 2008/02/16 15:00:33 kls Exp $ */ #ifndef __STATUS_H @@ -15,11 +15,21 @@ #include "player.h" #include "tools.h" +enum eTimerChange { tcMod, tcAdd, tcDel }; + +class cTimer; + class cStatus : public cListObject { private: static cList<cStatus> statusMonitors; protected: // These functions can be implemented by derived classes to receive status information: + virtual void TimerChange(const cTimer *Timer, eTimerChange Change) {} + // Indicates a change in the timer settings. + // If Change is tcAdd or tcDel, Timer points to the timer that has + // been added or will be deleted, respectively. In case of tcMod, + // Timer is NULL; this indicates that some timer has been changed. + // Note that tcAdd and tcDel are always also followed by a tcMod. virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber) {} // Indicates a channel switch on the given DVB device. // If ChannelNumber is 0, this is before the channel is being switched, @@ -74,6 +84,7 @@ public: cStatus(void); virtual ~cStatus(); // These functions are called whenever the related status information changes: + static void MsgTimerChange(const cTimer *Timer, eTimerChange Change); static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber); static void MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On); static void MsgReplaying(const cControl *Control, const char *Name, const char *FileName, bool On); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 1.72 2008/02/15 15:36:59 kls Exp $ + * $Id: timers.c 1.73 2008/02/16 14:47:40 kls Exp $ */ #include "timers.h" @@ -15,6 +15,7 @@ #include "libsi/si.h" #include "recording.h" #include "remote.h" +#include "status.h" #define VFAT_MAX_FILENAME 40 // same as MAX_SUBTITLE_LENGTH in recording.c @@ -136,7 +137,7 @@ int cTimer::Compare(const cListObject &ListObject) const return r; } -cString cTimer::ToText(bool UseChannelID) +cString cTimer::ToText(bool UseChannelID) const { strreplace(file, ':', '|'); cString buffer = cString::sprintf("%u:%s:%s:%04d:%04d:%d:%d:%s:%s\n", flags, UseChannelID ? *Channel()->GetChannelID().ToString() : *itoa(Channel()->Number()), *PrintDay(day, weekdays, true), start, stop, priority, lifetime, file, aux ? aux : ""); @@ -696,9 +697,28 @@ cTimer *cTimers::GetNextActiveTimer(void) void cTimers::SetModified(void) { + cStatus::MsgTimerChange(NULL, tcMod); state++; } +void cTimers::Add(cTimer *Timer, cTimer *After) +{ + cConfig<cTimer>::Add(Timer, After); + cStatus::MsgTimerChange(Timer, tcAdd); +} + +void cTimers::Ins(cTimer *Timer, cTimer *Before) +{ + cConfig<cTimer>::Ins(Timer, Before); + cStatus::MsgTimerChange(Timer, tcAdd); +} + +void cTimers::Del(cTimer *Timer, bool DeleteObject) +{ + cStatus::MsgTimerChange(Timer, tcDel); + cConfig<cTimer>::Del(Timer, DeleteObject); +} + bool cTimers::Modified(int &State) { bool Result = state != State; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.h 1.30 2007/06/03 13:24:58 kls Exp $ + * $Id: timers.h 1.31 2008/02/16 14:33:23 kls Exp $ */ #ifndef __TIMERS_H @@ -38,7 +38,7 @@ private: int stop; int priority; int lifetime; - char file[MaxFileName]; + mutable char file[MaxFileName]; char *aux; const cEvent *event; public: @@ -62,7 +62,7 @@ public: const char *File(void) const { return file; } time_t FirstDay(void) const { return weekdays ? day : 0; } const char *Aux(void) const { return aux; } - cString ToText(bool UseChannelID = false); + cString ToText(bool UseChannelID = false) const; cString ToDescr(void) const; const cEvent *Event(void) const { return event; } bool Parse(const char *s); @@ -119,6 +119,9 @@ public: ///< Upon return the internal state will be stored in State. void SetEvents(void); void DeleteExpired(void); + void Add(cTimer *Timer, cTimer *After = NULL); + void Ins(cTimer *Timer, cTimer *Before = NULL); + void Del(cTimer *Timer, bool DeleteObject = true); }; extern cTimers Timers; |