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

Timers are now linked to EPG events even if they are inactive

This commit is contained in:
Klaus Schmidinger 2017-06-25 10:03:19 +02:00
parent 139a93156b
commit ce5e23f209
4 changed files with 32 additions and 11 deletions

11
HISTORY
View File

@ -9130,7 +9130,7 @@ Video Disk Recorder Revision History
before including tools.h in case some plugin needs to use the STL and gets error before including tools.h in case some plugin needs to use the STL and gets error
messages regarding one of the template functions defined in tools.h. messages regarding one of the template functions defined in tools.h.
2017-06-23: Version 2.3.8 2017-06-25: Version 2.3.8
- Updated links in the INSTALL file (thanks to Chris Mayo). - Updated links in the INSTALL file (thanks to Chris Mayo).
- Fixed detecting whether a CAM replies to queries, which didn't work on some systems - Fixed detecting whether a CAM replies to queries, which didn't work on some systems
@ -9143,3 +9143,12 @@ Video Disk Recorder Revision History
- Now skipping a leading '/' in AddDirectory(), to avoid double slashes (reported by - Now skipping a leading '/' in AddDirectory(), to avoid double slashes (reported by
Chris Mayo). Chris Mayo).
- Fixed drawing very long menu titles in the LCARS skin (reported by Matthias Senzel). - Fixed drawing very long menu titles in the LCARS skin (reported by Matthias Senzel).
- Timers are now linked to EPG events even if they are inactive. By default Events that
are linked to inactive timers are marked with 'I' and 'i', depending on whether the
timer would record the entire Event or only part of it.
The function cSkinDisplayMenu::SetItemEvent() now has an additional parameter named
TimerActive, which indicates whether the timer that would record this event (if any)
is active. A plugin may react on this when displaying a menu line for an event.
The old version of cSkinDisplayMenu::SetItemEvent() (without the TimerActive parameter)
is still there for backwards compatibility. It may be removed in a future version,
so plugin authors should switch to the new one.

16
menu.c
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: menu.c 4.39 2017/06/21 09:19:59 kls Exp $ * $Id: menu.c 4.40 2017/06/25 10:02:09 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1477,6 +1477,7 @@ public:
const cChannel *channel; const cChannel *channel;
bool withDate; bool withDate;
eTimerMatch timerMatch; eTimerMatch timerMatch;
bool timerActive;
cMenuScheduleItem(const cTimers *Timers, const cEvent *Event, const cChannel *Channel = NULL, bool WithDate = false); cMenuScheduleItem(const cTimers *Timers, const cEvent *Event, const cChannel *Channel = NULL, bool WithDate = false);
static void SetSortMode(eScheduleSortMode SortMode) { sortMode = SortMode; } static void SetSortMode(eScheduleSortMode SortMode) { sortMode = SortMode; }
static void IncSortMode(void) { sortMode = eScheduleSortMode((sortMode == ssmAllAll) ? ssmAllThis : sortMode + 1); } static void IncSortMode(void) { sortMode = eScheduleSortMode((sortMode == ssmAllAll) ? ssmAllThis : sortMode + 1); }
@ -1494,6 +1495,7 @@ cMenuScheduleItem::cMenuScheduleItem(const cTimers *Timers, const cEvent *Event,
channel = Channel; channel = Channel;
withDate = WithDate; withDate = WithDate;
timerMatch = tmNone; timerMatch = tmNone;
timerActive = false;
Update(Timers, true); Update(Timers, true);
} }
@ -1508,15 +1510,17 @@ int cMenuScheduleItem::Compare(const cListObject &ListObject) const
return r; return r;
} }
static const char *TimerMatchChars = " tT"; static const char *TimerMatchChars = " tT iI";
bool cMenuScheduleItem::Update(const cTimers *Timers, bool Force) bool cMenuScheduleItem::Update(const cTimers *Timers, bool Force)
{ {
eTimerMatch OldTimerMatch = timerMatch; eTimerMatch OldTimerMatch = timerMatch;
Timers->GetMatch(event, &timerMatch); bool OldTimerActive = timerActive;
if (Force || timerMatch != OldTimerMatch) { const cTimer *Timer = Timers->GetMatch(event, &timerMatch);
timerActive = Timer && Timer->HasFlags(tfActive);
if (Force || timerMatch != OldTimerMatch || timerActive != OldTimerActive) {
cString buffer; cString buffer;
char t = TimerMatchChars[timerMatch]; char t = TimerMatchChars[timerMatch + (timerActive ? 0 : 3)];
char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' '; char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' ';
char r = event->SeenWithin(30) && event->IsRunning() ? '*' : ' '; char r = event->SeenWithin(30) && event->IsRunning() ? '*' : ' ';
const char *csn = channel ? channel->ShortName(true) : NULL; const char *csn = channel ? channel->ShortName(true) : NULL;
@ -1535,7 +1539,7 @@ bool cMenuScheduleItem::Update(const cTimers *Timers, bool Force)
void cMenuScheduleItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable) void cMenuScheduleItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable)
{ {
if (!DisplayMenu->SetItemEvent(event, Index, Current, Selectable, channel, withDate, timerMatch)) if (!DisplayMenu->SetItemEvent(event, Index, Current, Selectable, channel, withDate, timerMatch, timerActive))
DisplayMenu->SetItem(Text(), Index, Current, Selectable); DisplayMenu->SetItem(Text(), Index, Current, Selectable);
} }

12
skins.h
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: skins.h 4.3 2017/06/23 09:08:40 kls Exp $ * $Id: skins.h 4.4 2017/06/25 10:02:09 kls Exp $
*/ */
#ifndef __SKINS_H #ifndef __SKINS_H
@ -233,16 +233,24 @@ public:
///< this function will be first called for the old current item ///< this function will be first called for the old current item
///< with Current set to false, and then for the new current item ///< with Current set to false, and then for the new current item
///< with Current set to true. ///< with Current set to true.
virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch) { return false; } virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch, bool TimerActive) { return false; }
///< Sets the item at the given Index to Event. See SetItem() for more information. ///< Sets the item at the given Index to Event. See SetItem() for more information.
///< If a derived skin class implements this function, it can display an Event item ///< If a derived skin class implements this function, it can display an Event item
///< in a more elaborate way than just a simple line of text. ///< in a more elaborate way than just a simple line of text.
///< If Channel is not NULL, the channel's name and/or number shall be displayed. ///< If Channel is not NULL, the channel's name and/or number shall be displayed.
///< If WithDate is true, the date of the Event shall be displayed (in addition to the time). ///< If WithDate is true, the date of the Event shall be displayed (in addition to the time).
///< TimerMatch tells how much of this event will be recorded by a timer. ///< TimerMatch tells how much of this event will be recorded by a timer.
///< TimerActive tells whether the timer that will record this event is active.
///< If the skin displays the Event item in its own way, it shall return true. ///< If the skin displays the Event item in its own way, it shall return true.
///< The default implementation does nothing and returns false, which results in ///< The default implementation does nothing and returns false, which results in
///< a call to SetItem() with a proper text. ///< a call to SetItem() with a proper text.
#define DEPRECATED_SKIN_SETITEMEVENT
#ifdef DEPRECATED_SKIN_SETITEMEVENT
virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch) { return SetItemEvent(Event, Index, Current, Selectable, Channel, WithDate, TimerMatch, true); }
///< This function is here for comaptibility with older plugins and may be removed
///< in a future version. Use the above version of SetItemEvent() with the TimerActive
///< parameter instead.
#endif
virtual bool SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) { return false; } virtual bool SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) { return false; }
///< Sets the item at the given Index to Timer. See SetItem() for more information. ///< Sets the item at the given Index to Timer. See SetItem() for more information.
///< If a derived skin class implements this function, it can display a Timer item ///< If a derived skin class implements this function, it can display a Timer item

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 4.10 2017/05/26 15:43:38 kls Exp $ * $Id: timers.c 4.11 2017/06/25 10:02:09 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -476,7 +476,7 @@ eTimerMatch cTimer::Matches(const cEvent *Event, int *Overlap) const
// To make sure a VPS timer can be distinguished from a plain 100% overlap, // To make sure a VPS timer can be distinguished from a plain 100% overlap,
// it gets an additional 100 added, and a VPS event that is actually running // it gets an additional 100 added, and a VPS event that is actually running
// gets 200 added to the FULLMATCH. // gets 200 added to the FULLMATCH.
if (HasFlags(tfActive) && channel->GetChannelID() == Event->ChannelID()) { if (channel->GetChannelID() == Event->ChannelID()) {
bool UseVps = HasFlags(tfVps) && Event->Vps(); bool UseVps = HasFlags(tfVps) && Event->Vps();
Matches(UseVps ? Event->Vps() : Event->StartTime(), true); Matches(UseVps ? Event->Vps() : Event->StartTime(), true);
int overlap = 0; int overlap = 0;