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
to Michael Pennewiß for pointing this out).
- 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
* 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
@ -90,12 +90,11 @@ public:
void Cleanup(time_t Time);
void Cleanup(void);
cEvent *AddEvent(cEvent *Event);
const cList<cEvent> *Events(void) const { return &events; }
const cEvent *GetPresentEvent(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 *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;
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
* 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"
@ -1380,10 +1380,8 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID());
if (Schedule) {
const cEvent *PresentEvent = Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel());
int num = Schedule->NumEvents();
time_t now = time(NULL) - Setup.EPGLinger * 60;
for (int a = 0; a < num; a++) {
const cEvent *Event = Schedule->GetEventNumber(a);
for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) {
if (Event->EndTime() > now || 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
* 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"
@ -506,7 +506,7 @@ cTimer *cTimers::GetNextActiveTimer(void)
void cTimers::SetEvents(void)
{
cSchedulesLock SchedulesLock;
cSchedulesLock SchedulesLock(false, 100);
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
if (Schedules) {
for (cTimer *ti = First(); ti; ti = Next(ti)) {
@ -514,19 +514,17 @@ void cTimers::SetEvents(void)
const cEvent *Event = NULL;
if (Schedule) {
//XXX what if the Schedule doesn't have any VPS???
const cEvent *e;
int Match = tmNone;
int i = 0;
while ((e = Schedule->GetEventNumber(i++)) != NULL) {
int m = ti->Matches(e);
if (m > Match) {
Match = m;
Event = e;
if (Match == tmFull)
break;
//XXX what if there's another event with the same VPS time???
}
}
for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
int m = ti->Matches(e);
if (m > Match) {
Match = m;
Event = e;
if (Match == tmFull)
break;
//XXX what if there's another event with the same VPS time???
}
}
}
ti->SetEvent(Event);
}