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

The new functions cTimer::Start/StopTimeEvent() are now used in the LCARS skin to display the start/stop times of timers in the main menu

This commit is contained in:
Klaus Schmidinger 2021-04-18 14:56:40 +02:00
parent fa8c7c35b5
commit 9de337d2ee
4 changed files with 41 additions and 14 deletions

View File

@ -9641,7 +9641,7 @@ Video Disk Recorder Revision History
- No longer switching devices for pattern timers (thanks to Helmut Binder). - No longer switching devices for pattern timers (thanks to Helmut Binder).
- cTimer::TriggerRespawn() now only acts on local timers. - cTimer::TriggerRespawn() now only acts on local timers.
2021-04-17: 2021-04-18:
- When spawning pattern timers, the new function cTimers::GetTimerForEvent() is now used - When spawning pattern timers, the new function cTimers::GetTimerForEvent() is now used
to check whether a matching event already has a local spawned timer. Reason: creating a timer to check whether a matching event already has a local spawned timer. Reason: creating a timer
@ -9658,3 +9658,5 @@ Video Disk Recorder Revision History
the full margins. the full margins.
- Fixed the timer indicator in the Schedule menu in case an event is already over, but the - Fixed the timer indicator in the Schedule menu in case an event is already over, but the
timer is still recording. timer is still recording.
- The new functions cTimer::Start/StopTimeEvent() are now used in the LCARS skin to display
the start/stop times of timers in the main menu.

View File

@ -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: skinlcars.c 5.1 2020/12/26 15:49:01 kls Exp $ * $Id: skinlcars.c 5.2 2021/04/18 14:56:40 kls Exp $
*/ */
// "Star Trek: The Next Generation"(R) is a registered trademark of Paramount Pictures, // "Star Trek: The Next Generation"(R) is a registered trademark of Paramount Pictures,
@ -1213,14 +1213,15 @@ void cSkinLCARSDisplayMenu::DrawTimer(const cTimer *Timer, int y, bool MultiRec)
osd->DrawRectangle(xs00, y, xs03 - 1, y + lineHeight - 1, ColorBg); osd->DrawRectangle(xs00, y, xs03 - 1, y + lineHeight - 1, ColorBg);
cString Date; cString Date;
if (Timer->Recording()) if (Timer->Recording())
Date = cString::sprintf("-%s", *TimeString(Timer->StopTime())); Date = cString::sprintf("-%s", *TimeString(Timer->StopTimeEvent()));
else { else {
time_t Now = time(NULL); time_t Now = time(NULL);
time_t StartTime = Timer->StartTimeEvent();
cString Today = WeekDayName(Now); cString Today = WeekDayName(Now);
cString Time = TimeString(Timer->StartTime()); cString Time = TimeString(StartTime);
cString Day = WeekDayName(Timer->StartTime()); cString Day = WeekDayName(StartTime);
if (Timer->StartTime() > Now + 6 * SECSINDAY) if (StartTime > Now + 6 * SECSINDAY)
Date = DayDateTime(Timer->StartTime()); Date = DayDateTime(StartTime);
else if (strcmp(Day, Today) != 0) else if (strcmp(Day, Today) != 0)
Date = cString::sprintf("%s %s", *Day, *Time); Date = cString::sprintf("%s %s", *Day, *Time);
else else

View File

@ -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 5.13 2021/04/16 16:26:47 kls Exp $ * $Id: timers.c 5.14 2021/04/18 14:56:40 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -713,6 +713,28 @@ time_t cTimer::StopTime(void) const
return stopTime; return stopTime;
} }
time_t cTimer::StartTimeEvent(void) const
{
if (event) {
if (HasFlags(tfVps) && event->Vps())
return event->StartTime();
else if (HasFlags(tfSpawned))
return event->StartTime() - Setup.MarginStart * 60;
}
return StartTime();
}
time_t cTimer::StopTimeEvent(void) const
{
if (event) {
if (HasFlags(tfVps) && event->Vps())
return event->EndTime();
else if (HasFlags(tfSpawned))
return event->EndTime() + Setup.MarginStop * 60;
}
return StopTime();
}
#define EPGLIMITBEFORE (1 * 3600) // Time in seconds before a timer's start time and #define EPGLIMITBEFORE (1 * 3600) // Time in seconds before a timer's start time and
#define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration. #define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration.

View File

@ -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 5.6 2021/04/13 13:54:00 kls Exp $ * $Id: timers.h 5.7 2021/04/18 14:56:40 kls Exp $
*/ */
#ifndef __TIMERS_H #ifndef __TIMERS_H
@ -32,7 +32,7 @@ class cTimer : public cListObject {
friend class cMenuEditTimer; friend class cMenuEditTimer;
private: private:
int id; int id;
mutable time_t startTime, stopTime; mutable time_t startTime, stopTime; ///< the time_t value calculated from 'day', 'start' and 'stop'
int scheduleStateSet; int scheduleStateSet;
int scheduleStateSpawn; int scheduleStateSpawn;
int scheduleStateAdjust; int scheduleStateAdjust;
@ -42,8 +42,8 @@ private:
const cChannel *channel; const cChannel *channel;
mutable time_t day; ///< midnight of the day this timer shall hit, or of the first day it shall hit in case of a repeating timer mutable time_t day; ///< midnight of the day this timer shall hit, or of the first day it shall hit in case of a repeating timer
int weekdays; ///< bitmask, lowest bits: SSFTWTM (the 'M' is the LSB) int weekdays; ///< bitmask, lowest bits: SSFTWTM (the 'M' is the LSB)
int start; int start; ///< the start and stop time of this timer as given by the user,
int stop; int stop; ///< in the form hhmm, with hh (00..23) and mm (00..59) added as hh*100+mm
int priority; int priority;
int lifetime; int lifetime;
mutable char pattern[NAME_MAX * 2 + 1]; // same size as 'file', to be able to initially fill 'pattern' with 'file' in the 'Edit timer' menu mutable char pattern[NAME_MAX * 2 + 1]; // same size as 'file', to be able to initially fill 'pattern' with 'file' in the 'Edit timer' menu
@ -96,8 +96,10 @@ public:
bool Matches(time_t t = 0, bool Directly = false, int Margin = 0) const; bool Matches(time_t t = 0, bool Directly = false, int Margin = 0) const;
eTimerMatch Matches(const cEvent *Event, int *Overlap = NULL) const; eTimerMatch Matches(const cEvent *Event, int *Overlap = NULL) const;
bool Expired(void) const; bool Expired(void) const;
time_t StartTime(void) const; time_t StartTime(void) const; ///< the start time as given by the user
time_t StopTime(void) const; time_t StopTime(void) const; ///< the stop time as given by the user
time_t StartTimeEvent(void) const; ///< the start/stop times as given by the event (for VPS timers), by event plus margins (for spawned non-VPS timers),
time_t StopTimeEvent(void) const; ///< or by the user (for normal timers)
void SetId(int Id); void SetId(int Id);
cTimer *SpawnPatternTimer(const cEvent *Event, cTimers *Timers); cTimer *SpawnPatternTimer(const cEvent *Event, cTimers *Timers);
bool SpawnPatternTimers(const cSchedules *Schedules, cTimers *Timers); bool SpawnPatternTimers(const cSchedules *Schedules, cTimers *Timers);