mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
Fix display of recording sign in display channel
The display of the instant timer has been corrected in the display channel so that all events contained in the timer that have a tmFull or tmPartial flag are marked with the recording symbol.
This commit is contained in:
parent
9b63e8327f
commit
b977e3582a
@ -112,6 +112,8 @@ const char *cVeDcChannelGroup::GetChannelSep(const cChannel *c, bool prev) {
|
||||
******************************************************************/
|
||||
cVeDcEpgInfo::cVeDcEpgInfo(void) {
|
||||
globalTimers = NULL;
|
||||
current = NULL;
|
||||
next = NULL;
|
||||
}
|
||||
|
||||
cVeDcEpgInfo::~cVeDcEpgInfo(void) {
|
||||
@ -141,33 +143,36 @@ void cVeDcEpgInfo::SetTokenContainer(void) {
|
||||
InheritTokenContainer();
|
||||
}
|
||||
|
||||
void cVeDcEpgInfo::Set(const cEvent *p, const cEvent *f) {
|
||||
bool cVeDcEpgInfo::Parse(bool force) {
|
||||
if (!cViewElement::Parse(force))
|
||||
return false;
|
||||
tokenContainer->Clear();
|
||||
if (p) {
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currenttitle, p->Title());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currentsubtitle, p->ShortText());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currentstart, *p->GetTimeString());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currentstop, *p->GetEndTimeString());
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentduration, p->Duration() / 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentdurationhours, p->Duration() / 3600);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentdurationminutes, (p->Duration() / 60) % 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentelapsed, (int)round((time(NULL) - p->StartTime())/60));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentremaining, (int)round((p->EndTime() - time(NULL))/60));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentrecording, EventHasTimer(p));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::hasVPS, (bool)p->Vps());
|
||||
if (current) {
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currenttitle, current->Title());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currentsubtitle, current->ShortText());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currentstart, *current->GetTimeString());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::currentstop, *current->GetEndTimeString());
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentduration, current->Duration() / 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentdurationhours, current->Duration() / 3600);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentdurationminutes, (current->Duration() / 60) % 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentelapsed, (int)round((time(NULL) - current->StartTime())/60));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentremaining, (int)round((current->EndTime() - time(NULL))/60));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::currentrecording, EventHasTimer(current));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::hasVPS, (bool)current->Vps());
|
||||
}
|
||||
if (f) {
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nexttitle, f->Title());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nextsubtitle, f->ShortText());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nextstart, *f->GetTimeString());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nextstop, *f->GetEndTimeString());
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextduration, f->Duration() / 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextdurationhours, f->Duration() / 3600);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextdurationminutes, (f->Duration() / 60) % 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextrecording, EventHasTimer(f));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::hasVPS, (bool)f->Vps());
|
||||
if (next) {
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nexttitle, next->Title());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nextsubtitle, next->ShortText());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nextstart, *next->GetTimeString());
|
||||
tokenContainer->AddStringToken((int)eDCEpgInfoST::nextstop, *next->GetEndTimeString());
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextduration, next->Duration() / 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextdurationhours, next->Duration() / 3600);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextdurationminutes, (next->Duration() / 60) % 60);
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::nextrecording, EventHasTimer(next));
|
||||
tokenContainer->AddIntToken((int)eDCEpgInfoIT::hasVPS, (bool)next->Vps());
|
||||
}
|
||||
SetDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
void cVeDcEpgInfo::Close(void) {
|
||||
@ -177,14 +182,33 @@ void cVeDcEpgInfo::Close(void) {
|
||||
|
||||
bool cVeDcEpgInfo::EventHasTimer(const cEvent *e) {
|
||||
if (!e) return false;
|
||||
bool hasTimer = e->HasTimer();
|
||||
eTimerMatch TimerMatch = tmNone;
|
||||
const cTimers *timers;
|
||||
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
|
||||
{
|
||||
LOCK_TIMERS_READ;
|
||||
timers = Timers;
|
||||
}
|
||||
#else
|
||||
timers = &Timers;
|
||||
#endif
|
||||
const cTimer *Timer = timers->GetMatch(e, &TimerMatch);
|
||||
if (Timer && Timer->HasFlags(tfActive)) {
|
||||
if (TimerMatch == tmFull)
|
||||
return true;
|
||||
if (TimerMatch == tmPartial) {
|
||||
const char *fileName = Timer->File();
|
||||
if (fileName && *fileName == '@')
|
||||
return true;
|
||||
}
|
||||
}
|
||||
bool hasTimer = false;
|
||||
for (int i = 0; i < globalTimers->Size() && !hasTimer; i++)
|
||||
if (const cTimer *Timer = globalTimers->At(i))
|
||||
if (Timer->Channel() && (Timer->Channel()->GetChannelID() == e->ChannelID()))
|
||||
if (const cEvent *timerEvent = Timer->Event())
|
||||
if (e->EventID() == timerEvent->EventID())
|
||||
hasTimer = true;
|
||||
|
||||
return hasTimer;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@ public:
|
||||
******************************************************************/
|
||||
class cVeDcEpgInfo : public cViewElement {
|
||||
private:
|
||||
const cEvent *current;
|
||||
const cEvent *next;
|
||||
cGlobalTimers *globalTimers;
|
||||
bool EventHasTimer(const cEvent *e);
|
||||
public:
|
||||
@ -41,8 +43,9 @@ public:
|
||||
virtual ~cVeDcEpgInfo(void);
|
||||
void SetGlobalTimers(cGlobalTimers *globalTimers) { this->globalTimers = globalTimers; };
|
||||
void SetTokenContainer(void);
|
||||
void Set(const cEvent *p, const cEvent *f);
|
||||
void Set(const cEvent *p, const cEvent *f) { this->current = p; this->next = f; };
|
||||
void Close(void);
|
||||
bool Parse(bool forced = false);
|
||||
};
|
||||
/******************************************************************
|
||||
* cVeDcProgressBar
|
||||
|
Loading…
Reference in New Issue
Block a user