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

Modified red button handling in the "Schedule" menu

This commit is contained in:
Klaus Schmidinger 2005-12-27 15:06:26 +01:00
parent 1314d03411
commit 0795050f6d
3 changed files with 92 additions and 13 deletions

View File

@ -3998,7 +3998,11 @@ Video Disk Recorder Revision History
- Removed an invalid access to Event->schedule in cSchedule::DelEvent(). - Removed an invalid access to Event->schedule in cSchedule::DelEvent().
- Modified cSchedule::Cleanup() (events are always sorted by time). - Modified cSchedule::Cleanup() (events are always sorted by time).
- Schedules are now cleaned up once every hour (not only at 05:00). - Schedules are now cleaned up once every hour (not only at 05:00).
- The "Schedules" and "What's on now/next?" menus are now updated if a timer - The "Schedule" and "What's on now/next?" menus are now updated if a timer
is set or modified. is set or modified.
- cTimer no longer has its own 'schedule' member, it rather uses that of the - cTimer no longer has its own 'schedule' member, it rather uses that of the
event it has been set to. event it has been set to.
- The "Red" button in the "Schedule", "What's on now/next?" and "Event" menus
now immediately creates a timer for the selected event and marks it with 'T'.
If the event is already marked with 'T', the "Red" button opens the "Edit
timer" menu for that timer.

11
MANUAL
View File

@ -141,14 +141,17 @@ Version 1.2
"Schedule" menu of the current channel in the list. "Schedule" menu of the current channel in the list.
The "Red" button allows you to instantly program a timer to record the The "Red" button allows you to instantly program a timer to record the
selected programme. You will get into the "Edit Timer" menu in which selected programme. After pressing this button, the current event will
everything has already been filled in, and you can make any modifications be marked with 'T', and the function of the "Red" button will change from
"Record" to "Timer". Pressing "Red" on an event marked with 'T' will open
the "Edit timer" menu for this timer, where you can make any modifications
you may want to apply. Note that the Start and Stop time are offset by the you may want to apply. Note that the Start and Stop time are offset by the
MarginStart and MarginStop parameters (see Setup) in order to make sure the MarginStart and MarginStop parameters (see Setup) in order to make sure the
entire programme is recorded in case it doesn't exactly adhere to its entire programme is recorded in case it doesn't exactly adhere to its
published start/stop times. Of course, no guarantee can be given that the published start/stop times. Of course, no guarantee can be given that the
default margin values will be sufficient, so in case this recording is default margin values will be sufficient, so in case this recording is
really important you may want to add an extra margin ;-) really important you may want to add an extra margin ;-). VPS recordings
will use the exact Start (or VPS) and Stop times as given in the event.
The "Blue" button can be pressed to switch to the channel with the selected The "Blue" button can be pressed to switch to the channel with the selected
programme. programme.
@ -373,7 +376,7 @@ Version 1.2
* Programming the Timer * Programming the Timer
Use the "Timer" menu to maintain your list of timer controlled recordings. Use the "Timer" menu to maintain your list of timer controlled recordings.
The parameters in the "Edit Timer" menu have the following meanings: The parameters in the "Edit timer" menu have the following meanings:
Active: Defines whether the timer will be processed (set it to 'no' to Active: Defines whether the timer will be processed (set it to 'no' to
temporarily disable a timer). temporarily disable a timer).

86
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.379 2005/12/27 11:23:30 kls Exp $ * $Id: menu.c 1.380 2005/12/27 14:54:47 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -898,7 +898,9 @@ cMenuEvent::cMenuEvent(const cEvent *Event, bool CanSwitch)
cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true); cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true);
if (channel) { if (channel) {
SetTitle(channel->Name()); SetTitle(channel->Name());
SetHelp(tr("Record"), NULL, NULL, CanSwitch ? tr("Switch") : NULL); int TimerMatch = tmNone;
Timers.GetMatch(event, &TimerMatch);
SetHelp(TimerMatch == tmFull ? tr("Timer") : tr("Record"), NULL, NULL, CanSwitch ? tr("Switch") : NULL);
} }
} }
} }
@ -985,11 +987,14 @@ bool cMenuScheduleItem::Update(bool Force)
class cMenuWhatsOn : public cOsdMenu { class cMenuWhatsOn : public cOsdMenu {
private: private:
bool now;
int helpKeys;
eOSState Record(void); eOSState Record(void);
eOSState Switch(void); eOSState Switch(void);
static int currentChannel; static int currentChannel;
static const cEvent *scheduleEvent; static const cEvent *scheduleEvent;
bool Update(void); bool Update(void);
void SetHelpKeys(void);
public: public:
cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr); cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr);
static int CurrentChannel(void) { return currentChannel; } static int CurrentChannel(void) { return currentChannel; }
@ -1004,6 +1009,8 @@ const cEvent *cMenuWhatsOn::scheduleEvent = NULL;
cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr) cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr)
:cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, 7, 6, 4) :cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, 7, 6, 4)
{ {
now = Now;
helpKeys = -1;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) { for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep()) { if (!Channel->GroupSep()) {
const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID()); const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID());
@ -1015,7 +1022,7 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha
} }
} }
currentChannel = CurrentChannelNr; currentChannel = CurrentChannelNr;
SetHelp(Count() ? tr("Record") : NULL, Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch")); SetHelpKeys();
} }
bool cMenuWhatsOn::Update(void) bool cMenuWhatsOn::Update(void)
@ -1028,6 +1035,23 @@ bool cMenuWhatsOn::Update(void)
return result; return result;
} }
void cMenuWhatsOn::SetHelpKeys(void)
{
cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current());
int NewHelpKeys = 0;
if (item) {
if (item->timerMatch == tmFull)
NewHelpKeys = 2;
else
NewHelpKeys = 1;
}
if (NewHelpKeys != helpKeys) {
const char *Red[] = { NULL, tr("Record"), tr("Timer") };
SetHelp(Red[NewHelpKeys], now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch"));
helpKeys = NewHelpKeys;
}
}
const cEvent *cMenuWhatsOn::ScheduleEvent(void) const cEvent *cMenuWhatsOn::ScheduleEvent(void)
{ {
const cEvent *ei = scheduleEvent; const cEvent *ei = scheduleEvent;
@ -1056,8 +1080,19 @@ eOSState cMenuWhatsOn::Record(void)
if (t) { if (t) {
delete timer; delete timer;
timer = t; timer = t;
return AddSubMenu(new cMenuEditTimer(timer));
}
else {
Timers.Add(timer);
timer->Matches();
Timers.SetModified();
isyslog("timer %s added (active)", *timer->ToDescr());
if (HasSubMenu())
CloseSubMenu();
if (Update())
Display();
SetHelpKeys();
} }
return AddSubMenu(new cMenuEditTimer(timer, !t));
} }
return osContinue; return osContinue;
} }
@ -1088,8 +1123,12 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key)
default: break; default: break;
} }
} }
else if (HadSubMenu && !HasSubMenu() && Update()) else if (!HasSubMenu()) {
if (HadSubMenu && Update())
Display(); Display();
if (Key != kNone)
SetHelpKeys();
}
return state; return state;
} }
@ -1101,10 +1140,12 @@ private:
const cSchedules *schedules; const cSchedules *schedules;
bool now, next; bool now, next;
int otherChannel; int otherChannel;
int helpKeys;
eOSState Record(void); eOSState Record(void);
eOSState Switch(void); eOSState Switch(void);
void PrepareSchedule(cChannel *Channel); void PrepareSchedule(cChannel *Channel);
bool Update(void); bool Update(void);
void SetHelpKeys(void);
public: public:
cMenuSchedule(void); cMenuSchedule(void);
virtual ~cMenuSchedule(); virtual ~cMenuSchedule();
@ -1116,12 +1157,13 @@ cMenuSchedule::cMenuSchedule(void)
{ {
now = next = false; now = next = false;
otherChannel = 0; otherChannel = 0;
helpKeys = -1;
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (channel) { if (channel) {
cMenuWhatsOn::SetCurrentChannel(channel->Number()); cMenuWhatsOn::SetCurrentChannel(channel->Number());
schedules = cSchedules::Schedules(schedulesLock); schedules = cSchedules::Schedules(schedulesLock);
PrepareSchedule(channel); PrepareSchedule(channel);
SetHelp(Count() ? tr("Record") : NULL, tr("Now"), tr("Next")); SetHelpKeys();
} }
} }
@ -1160,6 +1202,23 @@ bool cMenuSchedule::Update(void)
return result; return result;
} }
void cMenuSchedule::SetHelpKeys(void)
{
cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current());
int NewHelpKeys = 0;
if (item) {
if (item->timerMatch == tmFull)
NewHelpKeys = 2;
else
NewHelpKeys = 1;
}
if (NewHelpKeys != helpKeys) {
const char *Red[] = { NULL, tr("Record"), tr("Timer") };
SetHelp(Red[NewHelpKeys], tr("Now"), tr("Next"));
helpKeys = NewHelpKeys;
}
}
eOSState cMenuSchedule::Record(void) eOSState cMenuSchedule::Record(void)
{ {
cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current()); cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current());
@ -1169,8 +1228,19 @@ eOSState cMenuSchedule::Record(void)
if (t) { if (t) {
delete timer; delete timer;
timer = t; timer = t;
return AddSubMenu(new cMenuEditTimer(timer));
}
else {
Timers.Add(timer);
timer->Matches();
Timers.SetModified();
isyslog("timer %s added (active)", *timer->ToDescr());
if (HasSubMenu())
CloseSubMenu();
if (Update())
Display();
SetHelpKeys();
} }
return AddSubMenu(new cMenuEditTimer(timer, !t));
} }
return osContinue; return osContinue;
} }
@ -1237,6 +1307,8 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
} }
else if (HadSubMenu && Update()) else if (HadSubMenu && Update())
Display(); Display();
if (Key != kNone)
SetHelpKeys();
} }
return state; return state;
} }