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().
- Modified cSchedule::Cleanup() (events are always sorted by time).
- 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.
- cTimer no longer has its own 'schedule' member, it rather uses that of the
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.
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
everything has already been filled in, and you can make any modifications
selected programme. After pressing this button, the current event will
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
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
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
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
programme.
@ -373,7 +376,7 @@ Version 1.2
* Programming the Timer
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
temporarily disable a timer).

88
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.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"
@ -898,7 +898,9 @@ cMenuEvent::cMenuEvent(const cEvent *Event, bool CanSwitch)
cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true);
if (channel) {
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 {
private:
bool now;
int helpKeys;
eOSState Record(void);
eOSState Switch(void);
static int currentChannel;
static const cEvent *scheduleEvent;
bool Update(void);
void SetHelpKeys(void);
public:
cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr);
static int CurrentChannel(void) { return currentChannel; }
@ -1004,6 +1009,8 @@ const cEvent *cMenuWhatsOn::scheduleEvent = NULL;
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)
{
now = Now;
helpKeys = -1;
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep()) {
const cSchedule *Schedule = Schedules->GetSchedule(Channel->GetChannelID());
@ -1015,7 +1022,7 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha
}
}
currentChannel = CurrentChannelNr;
SetHelp(Count() ? tr("Record") : NULL, Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch"));
SetHelpKeys();
}
bool cMenuWhatsOn::Update(void)
@ -1028,6 +1035,23 @@ bool cMenuWhatsOn::Update(void)
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 *ei = scheduleEvent;
@ -1056,8 +1080,19 @@ eOSState cMenuWhatsOn::Record(void)
if (t) {
delete timer;
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;
}
@ -1088,8 +1123,12 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key)
default: break;
}
}
else if (HadSubMenu && !HasSubMenu() && Update())
Display();
else if (!HasSubMenu()) {
if (HadSubMenu && Update())
Display();
if (Key != kNone)
SetHelpKeys();
}
return state;
}
@ -1101,10 +1140,12 @@ private:
const cSchedules *schedules;
bool now, next;
int otherChannel;
int helpKeys;
eOSState Record(void);
eOSState Switch(void);
void PrepareSchedule(cChannel *Channel);
bool Update(void);
void SetHelpKeys(void);
public:
cMenuSchedule(void);
virtual ~cMenuSchedule();
@ -1116,12 +1157,13 @@ cMenuSchedule::cMenuSchedule(void)
{
now = next = false;
otherChannel = 0;
helpKeys = -1;
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (channel) {
cMenuWhatsOn::SetCurrentChannel(channel->Number());
schedules = cSchedules::Schedules(schedulesLock);
PrepareSchedule(channel);
SetHelp(Count() ? tr("Record") : NULL, tr("Now"), tr("Next"));
SetHelpKeys();
}
}
@ -1160,6 +1202,23 @@ bool cMenuSchedule::Update(void)
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)
{
cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current());
@ -1169,8 +1228,19 @@ eOSState cMenuSchedule::Record(void)
if (t) {
delete timer;
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;
}
@ -1237,6 +1307,8 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
}
else if (HadSubMenu && Update())
Display();
if (Key != kNone)
SetHelpKeys();
}
return state;
}