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

Removed cSchedule::GetEventNumber() and cSchedule::NumEvents()

This commit is contained in:
Klaus Schmidinger 2004-03-14 13:27:57 +01:00
parent 510a205c31
commit 07dc53331e
4 changed files with 18 additions and 21 deletions

View File

@ -2739,3 +2739,5 @@ Video Disk Recorder Revision History
- Fixed detecting the running status in case an empty EPG event is broadcast (thanks - Fixed detecting the running status in case an empty EPG event is broadcast (thanks
to Michael Pennewiß for pointing this out). to Michael Pennewiß for pointing this out).
- Improved performance when paging through very long menu lists. - Improved performance when paging through very long menu lists.
- Removed cSchedule::GetEventNumber() and cSchedule::NumEvents(). There is now
cSchedule::Events() that returns the list of events directly.

5
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* *
* $Id: epg.h 1.14 2004/03/13 13:39:13 kls Exp $ * $Id: epg.h 1.15 2004/03/14 13:25:39 kls Exp $
*/ */
#ifndef __EPG_H #ifndef __EPG_H
@ -90,12 +90,11 @@ public:
void Cleanup(time_t Time); void Cleanup(time_t Time);
void Cleanup(void); void Cleanup(void);
cEvent *AddEvent(cEvent *Event); cEvent *AddEvent(cEvent *Event);
const cList<cEvent> *Events(void) const { return &events; }
const cEvent *GetPresentEvent(bool CheckRunningStatus = false) const; const cEvent *GetPresentEvent(bool CheckRunningStatus = false) const;
const cEvent *GetFollowingEvent(bool CheckRunningStatus = false) const; const cEvent *GetFollowingEvent(bool CheckRunningStatus = false) const;
const cEvent *GetEvent(u_int16_t EventID, time_t StartTime = 0) const; const cEvent *GetEvent(u_int16_t EventID, time_t StartTime = 0) const;
const cEvent *GetEventAround(time_t Time) const; const cEvent *GetEventAround(time_t Time) const;
const cEvent *GetEventNumber(int n) const { return events.Get(n); }
int NumEvents(void) const { return events.Count(); }
void Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const; void Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const;
static bool Read(FILE *f, cSchedules *Schedules); static bool Read(FILE *f, cSchedules *Schedules);
}; };

6
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 1.296 2004/03/14 10:31:13 kls Exp $ * $Id: menu.c 1.297 2004/03/14 13:24:02 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1380,10 +1380,8 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID()); const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID());
if (Schedule) { if (Schedule) {
const cEvent *PresentEvent = Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel()); const cEvent *PresentEvent = Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel());
int num = Schedule->NumEvents();
time_t now = time(NULL) - Setup.EPGLinger * 60; time_t now = time(NULL) - Setup.EPGLinger * 60;
for (int a = 0; a < num; a++) { for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) {
const cEvent *Event = Schedule->GetEventNumber(a);
if (Event->EndTime() > now || Event == PresentEvent) if (Event->EndTime() > now || Event == PresentEvent)
Add(new cMenuScheduleItem(Event), Event == PresentEvent); Add(new cMenuScheduleItem(Event), Event == PresentEvent);
} }

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 1.11 2004/03/06 11:22:57 kls Exp $ * $Id: timers.c 1.12 2004/03/14 13:27:57 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -506,7 +506,7 @@ cTimer *cTimers::GetNextActiveTimer(void)
void cTimers::SetEvents(void) void cTimers::SetEvents(void)
{ {
cSchedulesLock SchedulesLock; cSchedulesLock SchedulesLock(false, 100);
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
if (Schedules) { if (Schedules) {
for (cTimer *ti = First(); ti; ti = Next(ti)) { for (cTimer *ti = First(); ti; ti = Next(ti)) {
@ -514,19 +514,17 @@ void cTimers::SetEvents(void)
const cEvent *Event = NULL; const cEvent *Event = NULL;
if (Schedule) { if (Schedule) {
//XXX what if the Schedule doesn't have any VPS??? //XXX what if the Schedule doesn't have any VPS???
const cEvent *e;
int Match = tmNone; int Match = tmNone;
int i = 0; for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
while ((e = Schedule->GetEventNumber(i++)) != NULL) { int m = ti->Matches(e);
int m = ti->Matches(e); if (m > Match) {
if (m > Match) { Match = m;
Match = m; Event = e;
Event = e; if (Match == tmFull)
if (Match == tmFull) break;
break; //XXX what if there's another event with the same VPS time???
//XXX what if there's another event with the same VPS time??? }
} }
}
} }
ti->SetEvent(Event); ti->SetEvent(Event);
} }