diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2006-01-22 18:00:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2006-01-22 18:00:00 +0100 |
commit | 446b0e8e0b94b997293aef2f63220c5f8a68bf0f (patch) | |
tree | b2d3e77137f068f9fc3682197c9e7b91afba5fe1 /menu.c | |
parent | 78e3da813cb4345e57934a9a60f6316f1e257307 (diff) | |
download | vdr-patch-lnbsharing-446b0e8e0b94b997293aef2f63220c5f8a68bf0f.tar.gz vdr-patch-lnbsharing-446b0e8e0b94b997293aef2f63220c5f8a68bf0f.tar.bz2 |
Version 1.3.40vdr-1.3.40
- Fixed a second place where a message should be given when an instant recording
is started (reported by Jesus Bravo Alvarez).
- Modified logging so that even on NPTL systems each line in the log file shows
the individual thread's pid (based on a suggestion from Francois-Xavier Kowalski).
- Fixed a problem with @plugin in keymacros.conf in case the named plugin is not
loaded (reported by Franz Gangkofer).
- Fixed a crash after executing the SVDRP command CLRE, caused by dangling 'schedule'
pointers from cChannel objects (reported by Malte Schröder).
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Improved NULL checking in strreplace().
- Fixed a crash in the Schedule menu with events that have no title (reported by
Rolf Ahrenberg). cEvent::FixEpgBugs() now assigns a "No title" string to events
that have no title.
- Updated the Estonian OSD texts (thanks to Arthur Konovalov).
- Recordings are now only started if there is at least 300MB free disk space
(suggested by Markus Hahn).
- When entering text via the numeric keys, the cursor now automatically advances
(based on a patch from Rolf Ahrenberg).
- Updated the Polish OSD texts and the fontosd-iso8859-2.c file (thanks to Jaroslaw
Swierczynski).
- Disabled the "buffer reserve" in Transfer Mode. Last chance to complain if you
really need it - it will be completely removed in the next version. If you are
experiencing problems with a/v running out of sync, try the latest driver and
firmware (if you are using a full featured DVB card).
- Switching channels with the Up/Down or Channel+/Channel- keys now works a lot
faster when the repeat function kicks in, by not actually switching the
channel every time, but rather only displaying the channel info and doing
the final switch when the key is released.
- The channel display is now updated _before_ the channel is switched.
- Added a missing initialization of 'timeout' in the cDisplayChannel constructor.
- Fixed detecting if there can be any useful further input when entering channel
numbers (thanks to Thomas Bergwinkl).
- Updated the Spanish OSD texts (thanks to Jesus Bravo Alvarez).
- Fixed handling the '0' key for switching between the last two channels (thanks
to Thomas Bergwinkl).
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 181 |
1 files changed, 123 insertions, 58 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.396 2006/01/15 15:02:36 kls Exp $ + * $Id: menu.c 1.403 2006/01/22 16:06:39 kls Exp $ */ #include "menu.h" @@ -36,6 +36,8 @@ #define MAXRECORDCONTROLS (MAXDEVICES * MAXRECEIVERS) #define MAXINSTANTRECTIME (24 * 60 - 1) // 23:59 hours #define MAXWAITFORCAMMENU 4 // seconds to wait for the CAM menu to open +#define MINFREEDISK 300 // minimum free disk space required to start recording +#define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages #define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1) @@ -2996,9 +2998,12 @@ static void SetTrackDescriptions(bool Live) #define DIRECTCHANNELTIMEOUT 1000 //ms +cDisplayChannel *cDisplayChannel::currentDisplayChannel = NULL; + cDisplayChannel::cDisplayChannel(int Number, bool Switched) :cOsdObject(true) { + currentDisplayChannel = this; group = -1; withInfo = !Switched || Setup.ShowInfoOnChSwitch; displayChannel = Skins.Current()->DisplayChannel(withInfo); @@ -3017,12 +3022,15 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched) cDisplayChannel::cDisplayChannel(eKeys FirstKey) :cOsdObject(true) { + currentDisplayChannel = this; group = -1; number = 0; + timeout = true; lastPresent = lastFollowing = NULL; lastTime.Set(); withInfo = Setup.ShowInfoOnChSwitch; displayChannel = Skins.Current()->DisplayChannel(withInfo); + channel = Channels.GetByNumber(cDevice::CurrentChannel()); ProcessKey(FirstKey); } @@ -3030,6 +3038,7 @@ cDisplayChannel::~cDisplayChannel() { delete displayChannel; cStatus::MsgOsdClear(); + currentDisplayChannel = NULL; } void cDisplayChannel::DisplayChannel(void) @@ -3063,14 +3072,27 @@ void cDisplayChannel::DisplayInfo(void) void cDisplayChannel::Refresh(void) { - channel = Channels.GetByNumber(cDevice::CurrentChannel()); DisplayChannel(); displayChannel->SetEvents(NULL, NULL); - lastTime.Set(); +} + +cChannel *cDisplayChannel::NextAvailableChannel(cChannel *Channel, int Direction) +{ + if (Direction) { + while (Channel) { + Channel = Direction > 0 ? Channels.Next(Channel) : Channels.Prev(Channel); + if (Channel && !Channel->GroupSep() && cDevice::GetDevice(Channel, 0)) + return Channel; + } + } + return NULL; } eOSState cDisplayChannel::ProcessKey(eKeys Key) { + cChannel *NewChannel = NULL; + if (Key != kNone) + lastTime.Set(); switch (Key) { case k0: if (number == 0) { @@ -3081,31 +3103,32 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) case k1 ... k9: if (number >= 0) { number = number * 10 + Key - k0; - if (number > 0) { - channel = Channels.GetByNumber(number); - displayChannel->SetEvents(NULL, NULL); - withInfo = false; - DisplayChannel(); - lastTime.Set(); - // Lets see if there can be any useful further input: - int n = channel ? number * 10 : 0; - cChannel *ch = channel; - while (ch && (ch = Channels.Next(ch)) != NULL) { - if (!ch->GroupSep()) { - if (n <= ch->Number() && ch->Number() <= n + 9) { - n = 0; - break; - } - if (ch->Number() > n) - n *= 10; + channel = Channels.GetByNumber(number); + displayChannel->SetEvents(NULL, NULL); + withInfo = false; + DisplayChannel(); + // Lets see if there can be any useful further input: + int n = channel ? number * 10 : 0; + int m = 10; + cChannel *ch = channel; + while (ch && (ch = Channels.Next(ch)) != NULL) { + if (!ch->GroupSep()) { + if (n <= ch->Number() && ch->Number() < n + m) { + n = 0; + break; + } + if (ch->Number() > n) { + n *= 10; + m *= 10; } } - if (n > 0) { - // This channel is the only one that fits the input, so let's take it right away: - displayChannel->Flush(); // makes sure the user sees his last input - Channels.SwitchTo(number); - return osEnd; } + if (n > 0) { + // This channel is the only one that fits the input, so let's take it right away: + displayChannel->Flush(); // makes sure the user sees his last input + NewChannel = channel; + withInfo = true; + number = 0; } } break; @@ -3136,18 +3159,27 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) group = -1; } } - lastTime.Set(); break; case kUp|k_Repeat: case kUp: case kDown|k_Repeat: case kDown: - cDevice::SwitchChannel(NORMALKEY(Key) == kUp ? 1 : -1); - // no break here case kChanUp|k_Repeat: case kChanUp: case kChanDn|k_Repeat: - case kChanDn: + case kChanDn: { + eKeys k = NORMALKEY(Key); + cChannel *ch = NextAvailableChannel(channel, (k == kUp || k == kChanUp) ? 1 : -1); + if (ch) + channel = ch; + } + // no break here + case kUp|k_Release: + case kDown|k_Release: + case kChanUp|k_Release: + case kChanDn|k_Release: + if (!(Key & k_Repeat) && channel) + NewChannel = channel; withInfo = true; group = -1; number = 0; @@ -3155,43 +3187,57 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) break; case kNone: if (number && lastTime.Elapsed() > DIRECTCHANNELTIMEOUT) { - if (Channels.GetByNumber(number)) - Channels.SwitchTo(number); - else { - number = 0; - channel = NULL; - DisplayChannel(); - lastTime.Set(); - return osContinue; - } - return osEnd; + channel = Channels.GetByNumber(number); + if (channel) + NewChannel = channel; + withInfo = true; + number = 0; + Refresh(); + lastTime.Set(); } break; //TODO //XXX case kGreen: return osEventNow; //XXX case kYellow: return osEventNext; - case kOk: if (group >= 0) { - channel = Channels.Get(Channels.GetNextNormal(group)); - if (channel) - Channels.SwitchTo(channel->Number()); - withInfo = true; - group = -1; - Refresh(); - break; - } - else if (number > 0 && channel) - Channels.SwitchTo(number); - return osEnd; - default: if ((Key & (k_Repeat | k_Release)) == 0) { - cRemote::Put(Key); - return osEnd; - } + case kOk: + if (group >= 0) { + channel = Channels.Get(Channels.GetNextNormal(group)); + if (channel) + NewChannel = channel; + withInfo = true; + group = -1; + Refresh(); + } + else if (number > 0) { + channel = Channels.GetByNumber(number); + if (channel) + NewChannel = channel; + withInfo = true; + number = 0; + Refresh(); + } + else + return osEnd; + break; + default: + if ((Key & (k_Repeat | k_Release)) == 0) { + cRemote::Put(Key); + return osEnd; + } }; 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 + if (Key == kNone && !number && group < 0 && !NewChannel && channel && channel->Number() != cDevice::CurrentChannel()) { + // makes sure a channel switch through the SVDRP CHAN command is displayed + channel = Channels.GetByNumber(cDevice::CurrentChannel()); + Refresh(); + lastTime.Set(); + } DisplayInfo(); displayChannel->Flush(); + if (NewChannel) { + Channels.SwitchTo(NewChannel->Number()); + channel = NewChannel; + } return osContinue; } return osEnd; @@ -3520,6 +3566,23 @@ int cRecordControls::state = 0; bool cRecordControls::Start(cTimer *Timer, bool Pause) { + static time_t LastNoDiskSpaceMessage = 0; + int FreeMB = 0; + if (Timer) { + AssertFreeDiskSpace(Timer->Priority(), !Timer->Pending()); + Timer->SetPending(true); + } + VideoDiskSpace(&FreeMB); + if (FreeMB < MINFREEDISK) { + if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) { + isyslog("not enough disk space to start recording%s%s", Timer ? " timer " : "", Timer ? *Timer->ToDescr() : ""); + Skins.Message(mtWarning, tr("Not enough disk space to start recording!")); + LastNoDiskSpaceMessage = time(NULL); + } + return false; + } + LastNoDiskSpaceMessage = 0; + ChangeState(); int ch = Timer ? Timer->Channel()->Number() : cDevice::CurrentChannel(); cChannel *channel = Channels.GetByNumber(ch); @@ -3548,8 +3611,10 @@ bool cRecordControls::Start(cTimer *Timer, bool Pause) } } } - else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) + else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) { isyslog("no free DVB device to record channel %d!", ch); + Skins.Message(mtError, tr("No free DVB device to record!")); + } } else esyslog("ERROR: channel %d not defined!", ch); |