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
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).
- 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
Chris Mayo).
- 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
* 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"
@ -1477,6 +1477,7 @@ public:
const cChannel *channel;
bool withDate;
eTimerMatch timerMatch;
bool timerActive;
cMenuScheduleItem(const cTimers *Timers, const cEvent *Event, const cChannel *Channel = NULL, bool WithDate = false);
static void SetSortMode(eScheduleSortMode SortMode) { sortMode = SortMode; }
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;
withDate = WithDate;
timerMatch = tmNone;
timerActive = false;
Update(Timers, true);
}
@ -1508,15 +1510,17 @@ int cMenuScheduleItem::Compare(const cListObject &ListObject) const
return r;
}
static const char *TimerMatchChars = " tT";
static const char *TimerMatchChars = " tT iI";
bool cMenuScheduleItem::Update(const cTimers *Timers, bool Force)
{
eTimerMatch OldTimerMatch = timerMatch;
Timers->GetMatch(event, &timerMatch);
if (Force || timerMatch != OldTimerMatch) {
bool OldTimerActive = timerActive;
const cTimer *Timer = Timers->GetMatch(event, &timerMatch);
timerActive = Timer && Timer->HasFlags(tfActive);
if (Force || timerMatch != OldTimerMatch || timerActive != OldTimerActive) {
cString buffer;
char t = TimerMatchChars[timerMatch];
char t = TimerMatchChars[timerMatch + (timerActive ? 0 : 3)];
char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' ';
char r = event->SeenWithin(30) && event->IsRunning() ? '*' : ' ';
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)
{
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);
}

12
skins.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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
@ -233,16 +233,24 @@ public:
///< 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 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.
///< 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.
///< 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).
///< 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.
///< The default implementation does nothing and returns false, which results in
///< 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; }
///< 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

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@ -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,
// it gets an additional 100 added, and a VPS event that is actually running
// gets 200 added to the FULLMATCH.
if (HasFlags(tfActive) && channel->GetChannelID() == Event->ChannelID()) {
if (channel->GetChannelID() == Event->ChannelID()) {
bool UseVps = HasFlags(tfVps) && Event->Vps();
Matches(UseVps ? Event->Vps() : Event->StartTime(), true);
int overlap = 0;