summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-01-08 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-01-08 18:00:00 +0100
commitda948a50d2318fd9c818a4b969b74555ce577b1e (patch)
treeeee052c6d2f2fb2ddc8a9f56d77fab030b245ec6 /menu.c
parent8c63e0fd967a7ac037872ca5af378dc92f0410fa (diff)
downloadvdr-patch-lnbsharing-da948a50d2318fd9c818a4b969b74555ce577b1e.tar.gz
vdr-patch-lnbsharing-da948a50d2318fd9c818a4b969b74555ce577b1e.tar.bz2
Version 1.3.38vdr-1.3.38
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels (was broken in version 1.3.37). - Improved TS/PES conversion to better handle lost TS packets (thanks to Reinhard Nissl). - Limited the frequency of log messages from the cRepackers. - Now using the gettid() syscall to get a thread's pid, so that we get a useful value on NPTL systems (suggested by Johannes Stezenbach). - Fixed the RCU remote control handling to avoid problems with NPTL (thanks to Andreas Share for reporting a lockup with the RCU on NPTL systems). - When displaying the amount of free disk space, the space consumed by recordings that have been "deleted" but not yet actually "removed" is now taken into account (suggested by Christian Vogt). - Now avoiding unnecessary disk access when checking if there are deleted recordings that need to be removed (reported by Carsten Koch). - Fixed handling the DELETEDLIFETIME when removing deleted recordings. Now a deleted recording is retained at least DELETEDLIFETIME seconds before actually removing it. The value of DELETEDLIFETIME has been changed to 300. So after (possibly inadvertently) deleting a recording, there will be at least 5 minutes in which it can be recovered (unless a new recording immediately requires the disk space). The count starts again at 0 every time VDR is started. - Fixed a possible crash when displaying the "Low disk space!" message from a background thread (thanks to Christof Steininger). - Fixed handling OSD areas that have invalid sizes (thanks to Marco Schlüßler). - Added a mutex to AssertFreeDiskSpace() to make sure calls from foreground and background threads won't interfere. - The main menu now dynamically updates its contents in case an instant recording or replay stops, etc. - The version number of EPG events is now also stored in the epg.data file (thanks to Kendy Kutzner). - EPG events that are no longer in the currently broadcasted data stream are now automatically deleted. - 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 "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. - Removing deleted recordings is now done in a separate thread. - Dropped the unused "stop recording on primary interface" stuff. - Converting a grabbed image to JPEG is now done with the new function RgbToJpeg() (see tools.h). - The SVDRP command GRAB now determines the image type (JPEG or PNM) from the extension (".jpg", ".jpeg" or ".pnm") of the given file name. The explicit 'jpeg' or 'pnm' parameter is still accepted for backward compatibility, but has no meaning any more. - The function cDevice::GrabImage() no longer writes the grabbed image to a file, but rather returns a pointer to the image in memory. The wrapper function cDevice::GrabImageFile() can be used to write the grabbed image directly to a file. Plugins that used the old version of cDevice::GrabImage() need to be adapted to the new interface. - The new class cBase64Encoder (see tools.h) can be used to encode data in base64 (thanks to Bob Withers for publishing his Base64 class). - The SVDRP command GRAB now writes the image data to the SVDRP connection (encoded in base64) if the given file name consists of only the file extension (".jpg", ".jpeg" or ".pnm"), or if only "-" is given as file name (based on a suggestion from Darren Salt). A simple way of viewing a grabbed image on a remote host is: svdrpsend.pl -d <hostname> 'grab -' | sed -n -e 's/^216-//p' -e '1ibegin-base64 644 -' -e '$a====' | uudecode | display - - The new command line option '-g' must be given if the SVDRP command GRAB shall be allowed to write image files to disk. The parameter to this option must be the full path name of an existing directory, without any "..", double '/' or symlinks. By default, or if "-g- is given, grabbing to files is not allowed any more because of potential security risks. - Modified the way the SVDRP command GRAB writes the grabbed image to a file to avoid a security hole (CAN-2005-0071, reported by Javier Fernández-Sanguino Peña): + The file handle is now opened in a way that it won't follow symbolic links (suggested by Darren Salt). + The given file name is now canonicalized, so that it won't contain any ".." or symlinks (suggested by Darren Salt). + Grabbing to files is limited to the directory given in the the command line option '-g'. By default grabbing to files is not allowed any more. - Updated the Greek OSD texts (thanks to Dimitrios Dimitrakos). - Changed all "illegal" to "invalid" in error messages (there's nothing "illegal" in VDR ;-). - When started as user 'root' VDR now switches to a lesser privileged user id, keeping the capability to set the system time (based on a patch from Ludwig Nussel). By default the user id 'vdr' is used, which can be changed through the new command line option '-u'. Note that for security reasons VDR will no longer run as user 'root' (unless you explicitly start it with '-u root', but this is not recommended!). The 'runvdr' script has been changed to use the '-u' option. - Changed the API of the functions cStatus::Recording() and cStatus::Replaying(), so that they can provide the full file name of the recording. Plugins that use these (or the related cStatus::Msg...() functions) need to be adapted (suggested by Andreas Brugger). - The DVB devices now retune (and, if applicable, resend the DiSEqC data) if the lock is lost (based on a patch from Reinhard Nissl). - Fixed handling multi byte key sequences in cKbdRemote (based on a patch from Jürgen Schneider). - Removed unused variables in skinclassic.c and skinsttng.c (thanks to Marco Schlüßler). - Made the static cControl functions thread safe (thanks to Patrick Fischer). - Fixed initializing pthread_mutexattr_t and pthread_rwlockattr_t to avoid warnings with g++ 4.1.0 (thanks to Ville Skyttä). - Fixed incrementing the 'state' variables in the repacker classes in remux.c to avoid warnings with g++ 4.1.0 (reported by Ville Skyttä). - The Makefile now reports a summary of failed plugins (thanks to Udo Richter). - The cTimer constructor can now take an optional cChannel (suggested by Patrick Fischer). - Fixed setting the main thread id if VDR is running as a daemon. - Fixed handling TS packets in cTS2PES (thanks to Reinhard Nissl). - Added cTimer::SetPriority() to set a timer's priority (suggested by Kendy Kutzner). - Added cMenuEditStrItem::InEditMode() (suggested by Christian Wieninger). - Now using FE_READ_STATUS to read the current frontend status (suggested by Holger Wächtler). - The "Menu" key now behaves consistently. If there is anything on the OSD, it is closed when the "Menu" key is pressed, and if there is nothing on the OSD, the "Menu" key opens the main menu (suggested by Luca Olivetti). - The new option "Setup/OSD/Timeout requested channel info" can be used to turn off the automatic timeout of the channel display in case it was invoked by a press of the "Ok" key (suggested by Thiemo Gehrke). - A message is now given when an instant recording is started (suggested by Helmut Auer). Actually the code was already there, just commented out - don't remember why it wasn't active... - Removed an obsolete "Summary" text from i18n.c and preceded all key definition texts with "Key$" to avoid duplicates (reported by Lucian Muresan). - Preceded all button texts with "Button$". - Removed obsolete "Eject", "Language" and "scanning recordings..." texts. - Added missing #include "thread.h" to dvbspu.c (reported by Gavin Hamill). - Disabled the use of "fadvise" in cUnbufferedFile because there have been several reports that it causes more problems than it solves (suggested by Petri Hintukainen). If you want to use "fadvise", you can activate the line //#define USE_FADVISE in tools.c. - Removed unused 'offset' member from cOsdItem. - In the "Channels" menu the numeric keys now position the cursor to the channel with the given number (see MANUAL, section "Remote Control Keys", note (3) for details). - The "Mark/Move" function in the "Channels" menu now also works in the non-numeric sort modes. - The default cOsdObject::Show() now automatically calls cOsdMenu::Display() if this is a menu. - The new "Info" key brings up information on the currently viewed programme or recording. For a live programme this is the same as "Schedule/Ok", i.e. the description of the current EPG event. For a recording this is the same as shown by the "Info" button in the "Recordings" menu. Plugins that implement players can overwrite their cControl::GetInfo() function to show their own info (see PLUGINS.html for details). Pressing the "Info" key again while the info is displayed will close the OSD. In order to assign this new key to an existing remote control setup, the remote.conf file needs to be deleted and VDR has to be restarted to go through the process of learning the remote control keys. - Any cReceivers still attached to a cDevice when that device switches to a different transponder are now automatically detached (suggested by Patrick Fischer). - The "flags" of a timer are now handled as an unsigned integer value. In order to do this, the interface of cMenuEditBitItem also had to be changed. - In string entry fields (like, e.g., the file name of a recording) the characters can now be entered by pressing the numeric keys, the same way as on a telephone keypad (based on the "Easy Input" patch from Marcel Schaeben). - Fixed the "Day" field of the "Edit timer" menu when pressing '0' to switch from "single shot" to "weekly", followed by the "Right" key (reported by Andreas Böttger). - The file 'ca.conf' is obsolete and has been removed. - Revised all descriptions regarding CICAM. - Adapted c(Dvb)Device::ProvidesCa() to the dynamic CA handling. - Added a mutex to synchronize cDevice::PlayPesPacket() and SetCurrentAudioTrack() (thanks to Reinhard Nissl). - Added a SleepMs() in cRecorder::Action() to avoid a busy loop (thanks to Ingo Schneider). - Cleaned up some trailing white space.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c460
1 files changed, 317 insertions, 143 deletions
diff --git a/menu.c b/menu.c
index 0bb7598..e21f230 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.376 2005/11/05 17:29:22 kls Exp $
+ * $Id: menu.c 1.390 2006/01/08 11:39:57 kls Exp $
*/
#include "menu.h"
@@ -31,6 +31,7 @@
#define MAXWAIT4EPGINFO 3 // seconds
#define MODETIMEOUT 3 // seconds
+#define DISKSPACECHEK 5 // seconds between disk space checks in the main menu
#define MAXRECORDCONTROLS (MAXDEVICES * MAXRECEIVERS)
#define MAXINSTANTRECTIME (24 * 60 - 1) // 23:59 hours
@@ -41,28 +42,25 @@
// --- cMenuEditCaItem -------------------------------------------------------
class cMenuEditCaItem : public cMenuEditIntItem {
-private:
- const cCaDefinition *ca;
- bool allowCardNr;
protected:
virtual void Set(void);
public:
- cMenuEditCaItem(const char *Name, int *Value, bool AllowCardNr = false);
+ cMenuEditCaItem(const char *Name, int *Value);
eOSState ProcessKey(eKeys Key);
};
-cMenuEditCaItem::cMenuEditCaItem(const char *Name, int *Value, bool AllowCardNr)
+cMenuEditCaItem::cMenuEditCaItem(const char *Name, int *Value)
:cMenuEditIntItem(Name, Value, 0)
{
- ca = CaDefinitions.Get(*Value);
- allowCardNr = AllowCardNr;
Set();
}
void cMenuEditCaItem::Set(void)
{
- if (ca)
- SetValue(ca->Description());
+ if (*value == CA_FTA)
+ SetValue(tr("Free To Air"));
+ else if (*value >= CA_ENCRYPTED_MIN)
+ SetValue(tr("encrypted"));
else
cMenuEditIntItem::Set();
}
@@ -72,18 +70,8 @@ eOSState cMenuEditCaItem::ProcessKey(eKeys Key)
eOSState state = cMenuEditItem::ProcessKey(Key);
if (state == osUnknown) {
- if (NORMALKEY(Key) == kLeft) { // TODO might want to increase the delta if repeated quickly?
- if (ca && ca->Prev()) {
- ca = (cCaDefinition *)ca->Prev();
- *value = ca->Number();
- }
- }
- else if (NORMALKEY(Key) == kRight) {
- if (ca && ca->Next() && (allowCardNr || ((cCaDefinition *)ca->Next())->Number() > MAXDEVICES)) {
- ca = (cCaDefinition *)ca->Next();
- *value = ca->Number();
- }
- }
+ if (NORMALKEY(Key) == kLeft && *value >= CA_ENCRYPTED_MIN)
+ *value = CA_FTA;
else
return cMenuEditIntItem::ProcessKey(Key);
Set();
@@ -265,7 +253,7 @@ void cMenuEditChannel::Setup(void)
Add(new cMenuEditIntItem( tr("Dpid1"), &data.dpids[0], 0, 0x1FFF));
Add(new cMenuEditIntItem( tr("Dpid2"), &data.dpids[1], 0, 0x1FFF));
Add(new cMenuEditIntItem( tr("Tpid"), &data.tpid, 0, 0x1FFF));
- Add(new cMenuEditCaItem( tr("CA"), &data.caids[0], true));//XXX
+ Add(new cMenuEditCaItem( tr("CA"), &data.caids[0]));
Add(new cMenuEditIntItem( tr("Sid"), &data.sid, 1, 0xFFFF));
/* XXX not yet used
Add(new cMenuEditIntItem( tr("Nid"), &data.nid, 0));
@@ -380,12 +368,17 @@ void cMenuChannelItem::Set(void)
// --- cMenuChannels ---------------------------------------------------------
+#define CHANNELNUMBERTIMEOUT 1000 //ms
+
class cMenuChannels : public cOsdMenu {
private:
+ int number;
+ cTimeMs numberTimer;
void Setup(void);
cChannel *GetChannel(int Index);
void Propagate(void);
protected:
+ eOSState Number(eKeys Key);
eOSState Switch(void);
eOSState Edit(void);
eOSState New(void);
@@ -400,6 +393,7 @@ public:
cMenuChannels::cMenuChannels(void)
:cOsdMenu(tr("Channels"), CHNUMWIDTH)
{
+ number = 0;
Setup();
Channels.IncBeingEdited();
}
@@ -427,7 +421,7 @@ void cMenuChannels::Setup(void)
if (cMenuChannelItem::SortMode() != cMenuChannelItem::csmNumber)
Sort();
SetCurrent(currentItem);
- SetHelp(tr("Edit"), tr("New"), tr("Delete"), cMenuChannelItem::SortMode() == cMenuChannelItem::csmNumber ? tr("Mark") : NULL);
+ SetHelp(tr("Button$Edit"), tr("Button$New"), tr("Button$Delete"), tr("Button$Mark"));
Display();
}
@@ -446,6 +440,30 @@ void cMenuChannels::Propagate(void)
Channels.SetModified(true);
}
+eOSState cMenuChannels::Number(eKeys Key)
+{
+ if (HasSubMenu())
+ return osContinue;
+ if (numberTimer.TimedOut())
+ number = 0;
+ if (!number && Key == k0) {
+ cMenuChannelItem::IncSortMode();
+ Setup();
+ }
+ else {
+ number = number * 10 + Key - k0;
+ for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next()) {
+ if (!ci->Channel()->GroupSep() && ci->Channel()->Number() == number) {
+ SetCurrent(ci);
+ Display();
+ break;
+ }
+ }
+ numberTimer.Set(CHANNELNUMBERTIMEOUT);
+ }
+ return osContinue;
+}
+
eOSState cMenuChannels::Switch(void)
{
if (HasSubMenu())
@@ -530,14 +548,13 @@ eOSState cMenuChannels::ProcessKey(eKeys Key)
default:
if (state == osUnknown) {
switch (Key) {
- case k0: cMenuChannelItem::IncSortMode();
- Setup();
- break;
+ case k0 ... k9:
+ return Number(Key);
case kOk: return Switch();
case kRed: return Edit();
case kGreen: return New();
case kYellow: return Delete();
- case kBlue: if (!HasSubMenu() && cMenuChannelItem::SortMode() == cMenuChannelItem::csmNumber)
+ case kBlue: if (!HasSubMenu())
Mark();
break;
default: break;
@@ -771,7 +788,7 @@ cMenuTimers::cMenuTimers(void)
Add(new cMenuTimerItem(timer));
if (Setup.SortTimers)
Sort();
- SetHelp(tr("Edit"), tr("New"), tr("Delete"), Setup.SortTimers ? tr("On/Off") : tr("Mark"));
+ SetHelp(tr("Button$Edit"), tr("Button$New"), tr("Button$Delete"), Setup.SortTimers ? tr("Button$On/Off") : tr("Button$Mark"));
Timers.IncBeingEdited();
}
@@ -897,7 +914,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("Button$Record"), NULL, NULL, CanSwitch ? tr("Button$Switch") : NULL);
}
}
}
@@ -939,36 +958,59 @@ eOSState cMenuEvent::ProcessKey(eKeys Key)
return state;
}
-// --- cMenuWhatsOnItem ------------------------------------------------------
+// --- cMenuScheduleItem -----------------------------------------------------
-class cMenuWhatsOnItem : public cOsdItem {
+class cMenuScheduleItem : public cOsdItem {
public:
const cEvent *event;
const cChannel *channel;
- cMenuWhatsOnItem(const cEvent *Event, cChannel *Channel);
+ int timerMatch;
+ cMenuScheduleItem(const cEvent *Event, cChannel *Channel = NULL);
+ bool Update(bool Force = false);
};
-cMenuWhatsOnItem::cMenuWhatsOnItem(const cEvent *Event, cChannel *Channel)
+cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event, cChannel *Channel)
{
event = Event;
channel = Channel;
- char *buffer = NULL;
- int TimerMatch;
- char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' ';
- char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' ';
- char r = event->IsRunning() ? '*' : ' ';
- asprintf(&buffer, "%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), 6, channel->ShortName(true), *event->GetTimeString(), t, v, r, event->Title());
- SetText(buffer, false);
+ timerMatch = tmNone;
+ Update(true);
+}
+
+static char *TimerMatchChars = " tT";
+
+bool cMenuScheduleItem::Update(bool Force)
+{
+ bool result = false;
+ int OldTimerMatch = timerMatch;
+ Timers.GetMatch(event, &timerMatch);
+ if (Force || timerMatch != OldTimerMatch) {
+ char *buffer = NULL;
+ char t = TimerMatchChars[timerMatch];
+ char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' ';
+ char r = event->IsRunning() ? '*' : ' ';
+ if (channel)
+ asprintf(&buffer, "%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), 6, channel->ShortName(true), *event->GetTimeString(), t, v, r, event->Title());
+ else
+ asprintf(&buffer, "%.*s\t%s\t%c%c%c\t%s", 6, *event->GetDateString(), *event->GetTimeString(), t, v, r, event->Title());
+ SetText(buffer, false);
+ result = true;
+ }
+ return result;
}
// --- cMenuWhatsOn ----------------------------------------------------------
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; }
@@ -983,18 +1025,47 @@ 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());
if (Schedule) {
const cEvent *Event = Now ? Schedule->GetPresentEvent() : Schedule->GetFollowingEvent();
if (Event)
- Add(new cMenuWhatsOnItem(Event, Channel), Channel->Number() == CurrentChannelNr);
+ Add(new cMenuScheduleItem(Event, Channel), Channel->Number() == CurrentChannelNr);
}
}
}
currentChannel = CurrentChannelNr;
- SetHelp(Count() ? tr("Record") : NULL, Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch"));
+ SetHelpKeys();
+}
+
+bool cMenuWhatsOn::Update(void)
+{
+ bool result = false;
+ for (cOsdItem *item = First(); item; item = Next(item)) {
+ if (((cMenuScheduleItem *)item)->Update())
+ result = true;
+ }
+ 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("Button$Record"), tr("Timer") };
+ SetHelp(Red[NewHelpKeys], now ? tr("Button$Next") : tr("Button$Now"), tr("Button$Schedule"), tr("Button$Switch"));
+ helpKeys = NewHelpKeys;
+ }
}
const cEvent *cMenuWhatsOn::ScheduleEvent(void)
@@ -1006,7 +1077,7 @@ const cEvent *cMenuWhatsOn::ScheduleEvent(void)
eOSState cMenuWhatsOn::Switch(void)
{
- cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current());
+ cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current());
if (item) {
cChannel *channel = Channels.GetByChannelID(item->event->ChannelID(), true);
if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true))
@@ -1018,21 +1089,39 @@ eOSState cMenuWhatsOn::Switch(void)
eOSState cMenuWhatsOn::Record(void)
{
- cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current());
+ cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current());
if (item) {
+ if (item->timerMatch == tmFull) {
+ int tm = tmNone;
+ cTimer *timer = Timers.GetMatch(item->event, &tm);
+ if (timer)
+ return AddSubMenu(new cMenuEditTimer(timer));
+ }
cTimer *timer = new cTimer(item->event);
cTimer *t = Timers.GetTimer(timer);
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;
}
eOSState cMenuWhatsOn::ProcessKey(eKeys Key)
{
+ bool HadSubMenu = HasSubMenu();
eOSState state = cOsdMenu::ProcessKey(Key);
if (state == osUnknown) {
@@ -1042,7 +1131,7 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key)
case kYellow: state = osBack;
// continue with kGreen
case kGreen: {
- cMenuWhatsOnItem *mi = (cMenuWhatsOnItem *)Get(Current());
+ cMenuScheduleItem *mi = (cMenuScheduleItem *)Get(Current());
if (mi) {
scheduleEvent = mi->event;
currentChannel = mi->channel->Number();
@@ -1051,34 +1140,20 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key)
break;
case kBlue: return Switch();
case kOk: if (Count())
- return AddSubMenu(new cMenuEvent(((cMenuWhatsOnItem *)Get(Current()))->event, true));
+ return AddSubMenu(new cMenuEvent(((cMenuScheduleItem *)Get(Current()))->event, true));
break;
default: break;
}
}
+ else if (!HasSubMenu()) {
+ if (HadSubMenu && Update())
+ Display();
+ if (Key != kNone)
+ SetHelpKeys();
+ }
return state;
}
-// --- cMenuScheduleItem -----------------------------------------------------
-
-class cMenuScheduleItem : public cOsdItem {
-public:
- const cEvent *event;
- cMenuScheduleItem(const cEvent *Event);
-};
-
-cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event)
-{
- event = Event;
- char *buffer = NULL;
- int TimerMatch;
- char t = Timers.GetMatch(Event, &TimerMatch) ? (TimerMatch == tmFull) ? 'T' : 't' : ' ';
- char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' ';
- char r = event->IsRunning() ? '*' : ' ';
- asprintf(&buffer, "%.*s\t%s\t%c%c%c\t%s", 6, *event->GetDateString(), *event->GetTimeString(), t, v, r, event->Title());
- SetText(buffer, false);
-}
-
// --- cMenuSchedule ---------------------------------------------------------
class cMenuSchedule : public cOsdMenu {
@@ -1087,9 +1162,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();
@@ -1101,12 +1179,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();
}
}
@@ -1135,17 +1214,61 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
}
}
+bool cMenuSchedule::Update(void)
+{
+ bool result = false;
+ for (cOsdItem *item = First(); item; item = Next(item)) {
+ if (((cMenuScheduleItem *)item)->Update())
+ result = true;
+ }
+ 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("Button$Record"), tr("Timer") };
+ SetHelp(Red[NewHelpKeys], tr("Button$Now"), tr("Button$Next"));
+ helpKeys = NewHelpKeys;
+ }
+}
+
eOSState cMenuSchedule::Record(void)
{
cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current());
if (item) {
+ if (item->timerMatch == tmFull) {
+ int tm = tmNone;
+ cTimer *timer = Timers.GetMatch(item->event, &tm);
+ if (timer)
+ return AddSubMenu(new cMenuEditTimer(timer));
+ }
cTimer *timer = new cTimer(item->event);
cTimer *t = Timers.GetTimer(timer);
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;
}
@@ -1162,6 +1285,7 @@ eOSState cMenuSchedule::Switch(void)
eOSState cMenuSchedule::ProcessKey(eKeys Key)
{
+ bool HadSubMenu = HasSubMenu();
eOSState state = cOsdMenu::ProcessKey(Key);
if (state == osUnknown) {
@@ -1204,11 +1328,15 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
PrepareSchedule(channel);
if (channel->Number() != cDevice::CurrentChannel()) {
otherChannel = channel->Number();
- SetHelp(Count() ? tr("Record") : NULL, tr("Now"), tr("Next"), tr("Switch"));
+ SetHelp(Count() ? tr("Button$Record") : NULL, tr("Button$Now"), tr("Button$Next"), tr("Button$Switch"));
}
Display();
}
}
+ else if (HadSubMenu && Update())
+ Display();
+ if (Key != kNone)
+ SetHelpKeys();
}
return state;
}
@@ -1461,7 +1589,7 @@ cMenuRecording::cMenuRecording(const cRecording *Recording)
{
recording = Recording;
if (recording)
- SetHelp(tr("Play"), tr("Rewind"));
+ SetHelp(tr("Button$Play"), tr("Button$Rewind"));
}
void cMenuRecording::Display(void)
@@ -1586,9 +1714,9 @@ void cMenuRecordings::SetHelpKeys(void)
if (NewHelpKeys != helpKeys) {
switch (NewHelpKeys) {
case 0: SetHelp(NULL); break;
- case 1: SetHelp(tr("Open")); break;
+ case 1: SetHelp(tr("Button$Open")); break;
case 2:
- case 3: SetHelp(RecordingCommands.Count() ? tr("Commands") : tr("Play"), tr("Rewind"), tr("Delete"), NewHelpKeys == 3 ? tr("Info") : NULL);
+ case 3: SetHelp(RecordingCommands.Count() ? tr("Commands") : tr("Button$Play"), tr("Button$Rewind"), tr("Button$Delete"), NewHelpKeys == 3 ? tr("Info") : NULL);
}
helpKeys = NewHelpKeys;
}
@@ -1876,6 +2004,7 @@ void cMenuSetupOSD::Set(void)
Add(new cMenuEditBoolItem(tr("Setup.OSD$Channel info position"), &data.ChannelInfoPos, tr("bottom"), tr("top")));
Add(new cMenuEditIntItem( tr("Setup.OSD$Channel info time (s)"), &data.ChannelInfoTime, 1, 60));
Add(new cMenuEditBoolItem(tr("Setup.OSD$Info on channel switch"), &data.ShowInfoOnChSwitch));
+ Add(new cMenuEditBoolItem(tr("Setup.OSD$Timeout requested channel info"), &data.TimeoutRequChInfo));
Add(new cMenuEditBoolItem(tr("Setup.OSD$Scroll pages"), &data.MenuScrollPage));
Add(new cMenuEditBoolItem(tr("Setup.OSD$Scroll wraps"), &data.MenuScrollWrap));
Add(new cMenuEditBoolItem(tr("Setup.OSD$Sort timers"), &data.SortTimers));
@@ -1918,7 +2047,7 @@ eOSState cMenuSetupOSD::ProcessKey(eKeys Key)
themeIndex = d ? themes.GetThemeIndex(d) : 0;
free(d);
}
-
+
Set();
Setup.OSDLanguage = OriginalOSDLanguage;
}
@@ -1943,7 +2072,7 @@ cMenuSetupEPG::cMenuSetupEPG(void)
;
originalNumLanguages = numLanguages;
SetSection(tr("EPG"));
- SetHelp(tr("Scan"));
+ SetHelp(tr("Button$Scan"));
Setup();
}
@@ -2196,7 +2325,7 @@ cMenuSetupCICAM::cMenuSetupCICAM(void)
}
}
}
- SetHelp(tr("Menu"), tr("Reset"));
+ SetHelp(tr("Button$Menu"), tr("Button$Reset"));
}
eOSState cMenuSetupCICAM::Menu(void)
@@ -2469,14 +2598,19 @@ cMenuPluginItem::cMenuPluginItem(const char *Name, int Index)
// --- cMenuMain -------------------------------------------------------------
#define STOP_RECORDING tr(" Stop recording ")
-#define ON_PRIMARY_INTERFACE tr("on primary interface")
cOsdObject *cMenuMain::pluginOsdObject = NULL;
-cMenuMain::cMenuMain(bool Replaying, eOSState State)
+cMenuMain::cMenuMain(eOSState State)
:cOsdMenu("")
{
- replaying = Replaying;
+ lastDiskSpaceCheck = 0;
+ lastFreeMB = 0;
+ replaying = false;
+ stopReplayItem = NULL;
+ cancelEditingItem = NULL;
+ stopRecordingItem = NULL;
+ recordControlsState = 0;
Set();
// Initial submenus:
@@ -2502,23 +2636,9 @@ cOsdObject *cMenuMain::PluginOsdObject(void)
void cMenuMain::Set(void)
{
Clear();
- //XXX //SetTitle("VDR"); // this is done below, including disk usage
+ SetTitle("VDR");
SetHasHotkeys();
- // Title with disk usage:
-
-#define MB_PER_MINUTE 25.75 // this is just an estimate!
-
- char buffer[40];
- int FreeMB;
- int Percent = VideoDiskSpace(&FreeMB);
- int Minutes = int(double(FreeMB) / MB_PER_MINUTE);
- int Hours = Minutes / 60;
- Minutes %= 60;
- snprintf(buffer, sizeof(buffer), "%s - %s %d%% - %2d:%02d %s", tr("VDR"), tr("Disk"), Percent, Hours, Minutes, tr("free"));
- //XXX -> skin function!!!
- SetTitle(buffer);
-
// Basic menu items:
Add(new cOsdItem(hk(tr("Schedule")), osSchedule));
@@ -2545,37 +2665,82 @@ void cMenuMain::Set(void)
if (Commands.Count())
Add(new cOsdItem(hk(tr("Commands")), osCommands));
- // Replay control:
+ Update(true);
- if (replaying)
- Add(new cOsdItem(tr(" Stop replaying"), osStopReplay));
+ Display();
+}
- // Record control:
+#define MB_PER_MINUTE 25.75 // this is just an estimate!
- if (cRecordControls::StopPrimary()) {
- char *buffer = NULL;
- asprintf(&buffer, "%s%s", STOP_RECORDING, ON_PRIMARY_INTERFACE);
- Add(new cOsdItem(buffer, osStopRecord));
- free(buffer);
- }
+bool cMenuMain::Update(bool Force)
+{
+ bool result = false;
- const char *s = NULL;
- while ((s = cRecordControls::GetInstantId(s)) != NULL) {
- char *buffer = NULL;
- asprintf(&buffer, "%s%s", STOP_RECORDING, s);
- Add(new cOsdItem(buffer, osStopRecord));
- free(buffer);
+ // Title with disk usage:
+ if (Force || time(NULL) - lastDiskSpaceCheck > DISKSPACECHEK) {
+ int FreeMB;
+ int Percent = VideoDiskSpace(&FreeMB);
+ if (Force || FreeMB != lastFreeMB) {
+ int Minutes = int(double(FreeMB) / MB_PER_MINUTE);
+ int Hours = Minutes / 60;
+ Minutes %= 60;
+ char buffer[40];
+ snprintf(buffer, sizeof(buffer), "%s - %s %d%% - %2d:%02d %s", tr("VDR"), tr("Disk"), Percent, Hours, Minutes, tr("free"));
+ //XXX -> skin function!!!
+ SetTitle(buffer);
+ result = true;
+ }
+ lastDiskSpaceCheck = time(NULL);
+ }
+
+ bool NewReplaying = cControl::Control() != NULL;
+ if (Force || NewReplaying != replaying) {
+ replaying = NewReplaying;
+ // Replay control:
+ if (replaying && !stopReplayItem)
+ Add(stopReplayItem = new cOsdItem(tr(" Stop replaying"), osStopReplay));
+ else if (stopReplayItem && !replaying) {
+ Del(stopReplayItem->Index());
+ stopReplayItem = NULL;
}
+ // Color buttons:
+ SetHelp(!replaying ? tr("Button$Record") : NULL, tr("Button$Audio"), replaying ? NULL : tr("Button$Pause"), replaying ? tr("Button$Stop") : cReplayControl::LastReplayed() ? tr("Button$Resume") : NULL);
+ result = true;
+ }
// Editing control:
+ bool CutterActive = cCutter::Active();
+ if (CutterActive && !cancelEditingItem) {
+ Add(cancelEditingItem = new cOsdItem(tr(" Cancel editing"), osCancelEdit));
+ result = true;
+ }
+ else if (cancelEditingItem && !CutterActive) {
+ Del(cancelEditingItem->Index());
+ cancelEditingItem = NULL;
+ result = true;
+ }
- if (cCutter::Active())
- Add(new cOsdItem(tr(" Cancel editing"), osCancelEdit));
-
- // Color buttons:
+ // Record control:
+ if (cRecordControls::StateChanged(recordControlsState)) {
+ while (stopRecordingItem) {
+ cOsdItem *it = Next(stopRecordingItem);
+ Del(stopRecordingItem->Index());
+ stopRecordingItem = it;
+ }
+ const char *s = NULL;
+ while ((s = cRecordControls::GetInstantId(s)) != NULL) {
+ char *buffer = NULL;
+ asprintf(&buffer, "%s%s", STOP_RECORDING, s);
+ cOsdItem *item = new cOsdItem(osStopRecord);
+ item->SetText(buffer, false);
+ Add(item);
+ if (!stopRecordingItem)
+ stopRecordingItem = item;
+ }
+ result = true;
+ }
- SetHelp(!replaying ? tr("Record") : NULL, tr("Audio"), replaying ? NULL : tr("Pause"), replaying ? tr("Button$Stop") : cReplayControl::LastReplayed() ? tr("Resume") : NULL);
- Display();
+ return result;
}
eOSState cMenuMain::ProcessKey(eKeys Key)
@@ -2595,11 +2760,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
case osStopRecord: if (Interface->Confirm(tr("Stop recording?"))) {
cOsdItem *item = Get(Current());
if (item) {
- const char *s = item->Text() + strlen(STOP_RECORDING);
- if (strcmp(s, ON_PRIMARY_INTERFACE) == 0)
- cRecordControls::StopPrimary(true);
- else
- cRecordControls::Stop(item->Text() + strlen(STOP_RECORDING));
+ cRecordControls::Stop(item->Text() + strlen(STOP_RECORDING));
return osEnd;
}
}
@@ -2647,6 +2808,8 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
default: break;
}
}
+ if (!HasSubMenu() && Update(HadSubMenu))
+ Display();
if (Key != kNone) {
if (Setup.OSDLanguage != osdLanguage) {
Set();
@@ -2710,6 +2873,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched)
withInfo = !Switched || Setup.ShowInfoOnChSwitch;
displayChannel = Skins.Current()->DisplayChannel(withInfo);
number = 0;
+ timeout = Switched || Setup.TimeoutRequChInfo;
channel = Channels.GetByNumber(Number);
lastPresent = lastFollowing = NULL;
if (channel) {
@@ -2893,7 +3057,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
return osEnd;
}
};
- if (lastTime.Elapsed() < (uint64)(Setup.ChannelInfoTime * 1000)) {
+ if (!timeout || lastTime.Elapsed() < (uint64)(Setup.ChannelInfoTime * 1000)) {
if (!number && group < 0 && channel && channel->Number() != cDevice::CurrentChannel())
Refresh(); // makes sure a channel switch through the SVDRP CHAN command is displayed
DisplayInfo();
@@ -2996,7 +3160,7 @@ cDisplayTracks::cDisplayTracks(void)
}
}
timeout.Set(TRACKTIMEOUT);
- displayTracks = Skins.Current()->DisplayTracks(tr("Audio"), numTracks, descriptions);
+ displayTracks = Skins.Current()->DisplayTracks(tr("Button$Audio"), numTracks, descriptions);
Show();
}
@@ -3147,7 +3311,7 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer, bool Pause)
recorder = new cRecorder(fileName, ch->Ca(), timer->Priority(), ch->Vpid(), ch->Apids(), ch->Dpids(), ch->Spids());
if (device->AttachReceiver(recorder)) {
Recording.WriteInfo();
- cStatus::MsgRecording(device, Recording.Name());
+ cStatus::MsgRecording(device, Recording.Name(), Recording.FileName(), true);
if (!Timer && !cReplayControl::LastReplayed()) // an instant recording, maybe from cRecordControls::PauseLiveVideo()
cReplayControl::SetRecording(fileName, Recording.Name());
Recordings.AddByName(fileName);
@@ -3206,7 +3370,7 @@ void cRecordControl::Stop(void)
DELETENULL(recorder);
timer->SetRecording(false);
timer = NULL;
- cStatus::MsgRecording(device, NULL);
+ cStatus::MsgRecording(device, NULL, fileName, false);
cRecordingUserCommand::InvokeCommand(RUC_AFTERRECORDING, fileName);
}
}
@@ -3222,9 +3386,11 @@ bool cRecordControl::Process(time_t t)
// --- cRecordControls -------------------------------------------------------
cRecordControl *cRecordControls::RecordControls[MAXRECORDCONTROLS] = { NULL };
+int cRecordControls::state = 0;
bool cRecordControls::Start(cTimer *Timer, bool Pause)
{
+ ChangeState();
int ch = Timer ? Timer->Channel()->Number() : cDevice::CurrentChannel();
cChannel *channel = Channels.GetByNumber(ch);
@@ -3262,6 +3428,7 @@ bool cRecordControls::Start(cTimer *Timer, bool Pause)
void cRecordControls::Stop(const char *InstantId)
{
+ ChangeState();
for (int i = 0; i < MAXRECORDCONTROLS; i++) {
if (RecordControls[i]) {
const char *id = RecordControls[i]->InstantId();
@@ -3281,6 +3448,7 @@ void cRecordControls::Stop(const char *InstantId)
void cRecordControls::Stop(cDevice *Device)
{
+ ChangeState();
for (int i = 0; i < MAXRECORDCONTROLS; i++) {
if (RecordControls[i]) {
if (RecordControls[i]->Device() == Device) {
@@ -3291,20 +3459,6 @@ void cRecordControls::Stop(cDevice *Device)
}
}
-bool cRecordControls::StopPrimary(bool DoIt)
-{
- if (cDevice::PrimaryDevice()->Receiving()) {
- //XXX+ disabled for the moment - might become obsolete with DVB_DRIVER_VERSION >= 2002090101
- cDevice *device = NULL;//XXX cDevice::GetDevice(cDevice::PrimaryDevice()->Ca(), 0);
- if (device) {
- if (DoIt)
- Stop(cDevice::PrimaryDevice());
- return true;
- }
- }
- return false;
-}
-
bool cRecordControls::PauseLiveVideo(void)
{
Skins.Message(mtStatus, tr("Pausing live video..."));
@@ -3349,8 +3503,10 @@ void cRecordControls::Process(time_t t)
{
for (int i = 0; i < MAXRECORDCONTROLS; i++) {
if (RecordControls[i]) {
- if (!RecordControls[i]->Process(t))
+ if (!RecordControls[i]->Process(t)) {
DELETENULL(RecordControls[i]);
+ ChangeState();
+ }
}
}
}
@@ -3365,6 +3521,7 @@ void cRecordControls::ChannelDataModified(cChannel *Channel)
RecordControls[i]->Stop();
// This will restart the recording, maybe even from a different
// device in case conditional access has changed.
+ ChangeState();
}
}
}
@@ -3384,6 +3541,15 @@ void cRecordControls::Shutdown(void)
{
for (int i = 0; i < MAXRECORDCONTROLS; i++)
DELETENULL(RecordControls[i]);
+ ChangeState();
+}
+
+bool cRecordControls::StateChanged(int &State)
+{
+ int NewState = state;
+ bool Result = State != NewState;
+ State = state;
+ return Result;
}
// --- cReplayControl --------------------------------------------------------
@@ -3403,13 +3569,13 @@ cReplayControl::cReplayControl(void)
timeSearchActive = false;
marks.Load(fileName);
cRecording Recording(fileName);
- cStatus::MsgReplaying(this, Recording.Name());
+ cStatus::MsgReplaying(this, Recording.Name(), Recording.FileName(), true);
}
cReplayControl::~cReplayControl()
{
Hide();
- cStatus::MsgReplaying(this, NULL);
+ cStatus::MsgReplaying(this, NULL, fileName, false);
Stop();
}
@@ -3698,6 +3864,14 @@ void cReplayControl::EditTest(void)
}
}
+cOsdObject *cReplayControl::GetInfo(void)
+{
+ cRecording *Recording = Recordings.GetByName(cReplayControl::LastReplayed());
+ if (Recording)
+ return new cMenuRecording(Recording);
+ return NULL;
+}
+
eOSState cReplayControl::ProcessKey(eKeys Key)
{
if (!Active())