mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-12-26 23:06:44 +01:00
The new virtual function cSkinDisplayMenu::SetItemEvent(..., const cTimer *Timer) can be used to get full access to the timer (if any) defined for this event
This commit is contained in:
2
HISTORY
2
HISTORY
@@ -10098,3 +10098,5 @@ Video Disk Recorder Revision History
|
|||||||
Plugins may want to do the same, but don't have to.
|
Plugins may want to do the same, but don't have to.
|
||||||
- Renamed cStatus::Osd*2() to cStatus::Osd*().
|
- Renamed cStatus::Osd*2() to cStatus::Osd*().
|
||||||
Plugins that use these recently introduced functions need to remove the '2' from the name.
|
Plugins that use these recently introduced functions need to remove the '2' from the name.
|
||||||
|
- The new virtual function cSkinDisplayMenu::SetItemEvent(..., const cTimer *Timer) can be
|
||||||
|
used to get full access to the timer (if any) defined for this event.
|
||||||
|
|||||||
13
menu.c
13
menu.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: menu.c 5.24 2025/03/02 11:03:35 kls Exp $
|
* $Id: menu.c 5.25 2025/03/03 11:05:23 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@@ -1569,6 +1569,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
const cEvent *event;
|
const cEvent *event;
|
||||||
const cChannel *channel;
|
const cChannel *channel;
|
||||||
|
const cTimer *timer;
|
||||||
bool withDate;
|
bool withDate;
|
||||||
eTimerMatch timerMatch;
|
eTimerMatch timerMatch;
|
||||||
bool timerActive;
|
bool timerActive;
|
||||||
@@ -1587,6 +1588,7 @@ cMenuScheduleItem::cMenuScheduleItem(const cTimers *Timers, const cEvent *Event,
|
|||||||
{
|
{
|
||||||
event = Event;
|
event = Event;
|
||||||
channel = Channel;
|
channel = Channel;
|
||||||
|
timer = NULL;
|
||||||
withDate = WithDate;
|
withDate = WithDate;
|
||||||
timerMatch = tmNone;
|
timerMatch = tmNone;
|
||||||
timerActive = false;
|
timerActive = false;
|
||||||
@@ -1612,10 +1614,10 @@ bool cMenuScheduleItem::Update(const cTimers *Timers, bool Force)
|
|||||||
LOCK_SCHEDULES_READ;
|
LOCK_SCHEDULES_READ;
|
||||||
eTimerMatch OldTimerMatch = timerMatch;
|
eTimerMatch OldTimerMatch = timerMatch;
|
||||||
bool OldTimerActive = timerActive;
|
bool OldTimerActive = timerActive;
|
||||||
const cTimer *Timer = Timers->GetMatch(event, &timerMatch);
|
timer = Timers->GetMatch(event, &timerMatch);
|
||||||
if (event->EndTime() < time(NULL) && !event->IsRunning() && (!Timer || !Timer->Recording()))
|
if (event->EndTime() < time(NULL) && !event->IsRunning() && (!timer || !timer->Recording()))
|
||||||
timerMatch = tmNone;
|
timerMatch = tmNone;
|
||||||
timerActive = Timer && Timer->HasFlags(tfActive);
|
timerActive = timer && timer->HasFlags(tfActive);
|
||||||
if (Force || timerMatch != OldTimerMatch || timerActive != OldTimerActive) {
|
if (Force || timerMatch != OldTimerMatch || timerActive != OldTimerActive) {
|
||||||
cString buffer;
|
cString buffer;
|
||||||
char t = TimerMatchChars[timerMatch + (timerActive ? 0 : 3)];
|
char t = TimerMatchChars[timerMatch + (timerActive ? 0 : 3)];
|
||||||
@@ -1637,9 +1639,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
LOCK_TIMERS_READ;
|
||||||
LOCK_CHANNELS_READ;
|
LOCK_CHANNELS_READ;
|
||||||
LOCK_SCHEDULES_READ;
|
LOCK_SCHEDULES_READ;
|
||||||
if (!DisplayMenu->SetItemEvent(event, Index, Current, Selectable, channel, withDate, timerMatch, timerActive))
|
if (!DisplayMenu->SetItemEvent(event, Index, Current, Selectable, channel, withDate, timerMatch, timer))
|
||||||
DisplayMenu->SetItem(Text(), Index, Current, Selectable);
|
DisplayMenu->SetItem(Text(), Index, Current, Selectable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
skins.h
6
skins.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: skins.h 5.7 2025/03/02 11:03:35 kls Exp $
|
* $Id: skins.h 5.8 2025/03/03 11:05:23 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SKINS_H
|
#ifndef __SKINS_H
|
||||||
@@ -244,6 +244,10 @@ public:
|
|||||||
///< 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.
|
||||||
|
virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch, const cTimer *Timer) {
|
||||||
|
return SetItemEvent(Event, Index, Current, Selectable, Channel, WithDate, TimerMatch, Timer && Timer->HasFlags(tfActive)); }
|
||||||
|
///< Like SetItemEvent(..., bool TimerActive), but with full access to the Timer.
|
||||||
|
///< If Timer is NULL, no timer is defined for this event.
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user