mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added cStatus::TimerChange()
This commit is contained in:
parent
6b35173789
commit
6140c49f14
@ -2294,3 +2294,7 @@ Hans-Werner Hilse <hilse@web.de>
|
|||||||
Mikko Matilainen <mikkom@iki.fi>
|
Mikko Matilainen <mikkom@iki.fi>
|
||||||
for reporting a possible crash if the Info key is pressed after deleting the
|
for reporting a possible crash if the Info key is pressed after deleting the
|
||||||
currently replayed recording
|
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
|
||||||
|
2
HISTORY
2
HISTORY
@ -5633,3 +5633,5 @@ Video Disk Recorder Revision History
|
|||||||
which would not add any free space to the video directory.
|
which would not add any free space to the video directory.
|
||||||
- Implemented the cStatus, cDevice and cPlayer functions for setting subtitle tracks
|
- Implemented the cStatus, cDevice and cPlayer functions for setting subtitle tracks
|
||||||
in plugins (thanks to Petri Hintukainen).
|
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).
|
||||||
|
8
status.c
8
status.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "status.h"
|
||||||
@ -23,6 +23,12 @@ cStatus::~cStatus()
|
|||||||
statusMonitors.Del(this, false);
|
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)
|
void cStatus::MsgChannelSwitch(const cDevice *Device, int ChannelNumber)
|
||||||
{
|
{
|
||||||
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
|
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
|
||||||
|
13
status.h
13
status.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __STATUS_H
|
||||||
@ -15,11 +15,21 @@
|
|||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
|
enum eTimerChange { tcMod, tcAdd, tcDel };
|
||||||
|
|
||||||
|
class cTimer;
|
||||||
|
|
||||||
class cStatus : public cListObject {
|
class cStatus : public cListObject {
|
||||||
private:
|
private:
|
||||||
static cList<cStatus> statusMonitors;
|
static cList<cStatus> statusMonitors;
|
||||||
protected:
|
protected:
|
||||||
// These functions can be implemented by derived classes to receive status information:
|
// 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) {}
|
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber) {}
|
||||||
// Indicates a channel switch on the given DVB device.
|
// Indicates a channel switch on the given DVB device.
|
||||||
// If ChannelNumber is 0, this is before the channel is being switched,
|
// If ChannelNumber is 0, this is before the channel is being switched,
|
||||||
@ -74,6 +84,7 @@ public:
|
|||||||
cStatus(void);
|
cStatus(void);
|
||||||
virtual ~cStatus();
|
virtual ~cStatus();
|
||||||
// These functions are called whenever the related status information changes:
|
// 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 MsgChannelSwitch(const cDevice *Device, int ChannelNumber);
|
||||||
static void MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On);
|
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);
|
static void MsgReplaying(const cControl *Control, const char *Name, const char *FileName, bool On);
|
||||||
|
24
timers.c
24
timers.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "timers.h"
|
||||||
@ -15,6 +15,7 @@
|
|||||||
#include "libsi/si.h"
|
#include "libsi/si.h"
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
#include "remote.h"
|
#include "remote.h"
|
||||||
|
#include "status.h"
|
||||||
|
|
||||||
#define VFAT_MAX_FILENAME 40 // same as MAX_SUBTITLE_LENGTH in recording.c
|
#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;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cTimer::ToText(bool UseChannelID)
|
cString cTimer::ToText(bool UseChannelID) const
|
||||||
{
|
{
|
||||||
strreplace(file, ':', '|');
|
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 : "");
|
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)
|
void cTimers::SetModified(void)
|
||||||
{
|
{
|
||||||
|
cStatus::MsgTimerChange(NULL, tcMod);
|
||||||
state++;
|
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 cTimers::Modified(int &State)
|
||||||
{
|
{
|
||||||
bool Result = state != State;
|
bool Result = state != State;
|
||||||
|
9
timers.h
9
timers.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __TIMERS_H
|
||||||
@ -38,7 +38,7 @@ private:
|
|||||||
int stop;
|
int stop;
|
||||||
int priority;
|
int priority;
|
||||||
int lifetime;
|
int lifetime;
|
||||||
char file[MaxFileName];
|
mutable char file[MaxFileName];
|
||||||
char *aux;
|
char *aux;
|
||||||
const cEvent *event;
|
const cEvent *event;
|
||||||
public:
|
public:
|
||||||
@ -62,7 +62,7 @@ public:
|
|||||||
const char *File(void) const { return file; }
|
const char *File(void) const { return file; }
|
||||||
time_t FirstDay(void) const { return weekdays ? day : 0; }
|
time_t FirstDay(void) const { return weekdays ? day : 0; }
|
||||||
const char *Aux(void) const { return aux; }
|
const char *Aux(void) const { return aux; }
|
||||||
cString ToText(bool UseChannelID = false);
|
cString ToText(bool UseChannelID = false) const;
|
||||||
cString ToDescr(void) const;
|
cString ToDescr(void) const;
|
||||||
const cEvent *Event(void) const { return event; }
|
const cEvent *Event(void) const { return event; }
|
||||||
bool Parse(const char *s);
|
bool Parse(const char *s);
|
||||||
@ -119,6 +119,9 @@ public:
|
|||||||
///< Upon return the internal state will be stored in State.
|
///< Upon return the internal state will be stored in State.
|
||||||
void SetEvents(void);
|
void SetEvents(void);
|
||||||
void DeleteExpired(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;
|
extern cTimers Timers;
|
||||||
|
Loading…
Reference in New Issue
Block a user