summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-11-12 16:48:50 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2000-11-12 16:48:50 +0100
commit5e272f90653736e6bc115660fa39cbe6d2ab0403 (patch)
tree1a284a0af49e93b8cdec62792c865fbe4cfd36df /menu.c
parent5b65773ec836a6086374657098bbcc55e74abd60 (diff)
downloadvdr-5e272f90653736e6bc115660fa39cbe6d2ab0403.tar.gz
vdr-5e272f90653736e6bc115660fa39cbe6d2ab0403.tar.bz2
The 'Schedule' button now shows the schedule of the current channel in the 'Now/Next' menu
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/menu.c b/menu.c
index 92e715e2..08350ea3 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.47 2000/11/12 13:03:35 kls Exp $
+ * $Id: menu.c 1.48 2000/11/12 16:46:19 kls Exp $
*/
#include "menu.h"
@@ -1160,11 +1160,15 @@ class cMenuWhatsOn : public cOsdMenu {
private:
eOSState Record(void);
eOSState Switch(void);
+ static const cEventInfo *scheduleEventInfo;
public:
cMenuWhatsOn(const cSchedules *Schedules, bool Now);
+ static const cEventInfo *ScheduleEventInfo(void);
virtual eOSState ProcessKey(eKeys Key);
};
+const cEventInfo *cMenuWhatsOn::scheduleEventInfo = NULL;
+
static int CompareEventChannel(const void *p1, const void *p2)
{
return (int)( (*(const cEventInfo **)p1)->GetChannelNumber() - (*(const cEventInfo **)p2)->GetChannelNumber());
@@ -1200,6 +1204,13 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now)
SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Schedule"), tr("Switch"));
}
+const cEventInfo *cMenuWhatsOn::ScheduleEventInfo(void)
+{
+ const cEventInfo *ei = scheduleEventInfo;
+ scheduleEventInfo = NULL;
+ return ei;
+}
+
eOSState cMenuWhatsOn::Switch(void)
{
cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current());
@@ -1239,7 +1250,12 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key)
if (state == osUnknown) {
switch (Key) {
case kRed: return Record();
- case kYellow: return osBack;
+ case kYellow: {
+ cMenuWhatsOnItem *mi = (cMenuWhatsOnItem *)Get(Current());
+ if (mi)
+ scheduleEventInfo = mi->eventInfo;
+ }
+ return osBack;
case kBlue: return Switch();
case kOk: if (Count())
return AddSubMenu(new cMenuEvent(((cMenuWhatsOnItem *)Get(Current()))->eventInfo, true));
@@ -1274,7 +1290,7 @@ private:
const cSchedules *schedules;
bool now, next;
eOSState Record(void);
- void PrepareSchedule(void);
+ void PrepareSchedule(cChannel *Channel);
void PrepareWhatsOnNext(bool On);
public:
cMenuSchedule(void);
@@ -1287,10 +1303,8 @@ cMenuSchedule::cMenuSchedule(void)
now = next = false;
cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel());
if (channel) {
- char *buffer = NULL;
- asprintf(&buffer, tr("Schedule - %s"), channel->name);
- SetTitle(buffer, false);
- PrepareSchedule();
+ schedules = cDvbApi::PrimaryDvbApi->Schedules(&threadLock);
+ PrepareSchedule(channel);
SetHelp(tr("Record"), tr("Now"), tr("Next"));
}
}
@@ -1300,11 +1314,14 @@ static int CompareEventTime(const void *p1, const void *p2)
return (int)((*(cEventInfo **)p1)->GetTime() - (*(cEventInfo **)p2)->GetTime());
}
-void cMenuSchedule::PrepareSchedule(void)
+void cMenuSchedule::PrepareSchedule(cChannel *Channel)
{
- schedules = cDvbApi::PrimaryDvbApi->Schedules(&threadLock);
+ Clear();
+ char *buffer = NULL;
+ asprintf(&buffer, tr("Schedule - %s"), Channel->name);
+ SetTitle(buffer, false);
if (schedules) {
- const cSchedule *Schedule = schedules->GetSchedule();
+ const cSchedule *Schedule = Channel->pnr ? schedules->GetSchedule(Channel->pnr) : schedules->GetSchedule();
int num = Schedule->NumEvents();
const cEventInfo **pArray = (const cEventInfo **)malloc(num * sizeof(cEventInfo *));
if (pArray) {
@@ -1366,8 +1383,17 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
default: break;
}
}
- else if (!HasSubMenu())
+ else if (!HasSubMenu()) {
now = next = false;
+ const cEventInfo *ei = cMenuWhatsOn::ScheduleEventInfo();
+ if (ei) {
+ cChannel *channel = Channels.GetByServiceID(ei->GetServiceID());
+ if (channel) {
+ PrepareSchedule(channel);
+ Display();
+ }
+ }
+ }
return state;
}