summaryrefslogtreecommitdiff
path: root/coreengine
diff options
context:
space:
mode:
Diffstat (limited to 'coreengine')
-rw-r--r--coreengine/viewelementsdisplaychannel.c74
-rw-r--r--coreengine/viewelementsdisplaychannel.h5
2 files changed, 53 insertions, 26 deletions
diff --git a/coreengine/viewelementsdisplaychannel.c b/coreengine/viewelementsdisplaychannel.c
index 9a307a7..95d040e 100644
--- a/coreengine/viewelementsdisplaychannel.c
+++ b/coreengine/viewelementsdisplaychannel.c
@@ -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;
}
diff --git a/coreengine/viewelementsdisplaychannel.h b/coreengine/viewelementsdisplaychannel.h
index fbae6d2..eecadaf 100644
--- a/coreengine/viewelementsdisplaychannel.h
+++ b/coreengine/viewelementsdisplaychannel.h
@@ -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