diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2003-01-10 18:00:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2003-01-10 18:00:00 +0100 |
commit | 3e1d34f392792bbcf1bda4884c58ca9cec445d1d (patch) | |
tree | e2c9910b5a7d429784eeda4404ea7429e757a8f3 /menu.c | |
parent | 48fd2b04e9010bb67e19f33e8c7506a976b70e90 (diff) | |
download | vdr-patch-lnbsharing-3e1d34f392792bbcf1bda4884c58ca9cec445d1d.tar.gz vdr-patch-lnbsharing-3e1d34f392792bbcf1bda4884c58ca9cec445d1d.tar.bz2 |
Version 1.1.21vdr-1.1.21
- Fixed the 'channels.conf' entries for "Studio Universal" and "Disney Channel".
- Fixed handling channels in the "Channels" menu in case there are ':@nnn' group
separators without names (thanks to Guy Roussin for reporting this one).
- The SVDRP command CHAN now also accepts channel IDs.
- Increased the timeout until an index file is considerd no longer to be written
(sometimes in time shift with heavy system load the index file was closed too
early by the replay thread).
- Implemented "Link Layer" based CAM support, which hopefully will solve the
problems with CAMs we had in the past. To use this you need the driver version
2002-01-08 or higher (with the new firmware supporting the "Link Layer" protocol).
- Added an EPG bugfix that moves the Subtitle data to the Extended Description in
case the latter is empty and the Subtitle exceeds some useful length.
- Since several channels put very long strings into the Subtitle part of their
EPG data, that string is now limited in length when used in a recording's
file name.
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 202 |
1 files changed, 192 insertions, 10 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.228 2002/12/01 10:31:55 kls Exp $ + * $Id: menu.c 1.231 2003/01/06 16:13:53 kls Exp $ */ #include "menu.h" @@ -645,6 +645,7 @@ private: public: cMenuChannelItem(cChannel *Channel); virtual void Set(void); + cChannel *Channel(void) { return channel; } }; cMenuChannelItem::cMenuChannelItem(cChannel *Channel) @@ -669,6 +670,7 @@ void cMenuChannelItem::Set(void) class cMenuChannels : public cOsdMenu { private: + cChannel *GetChannel(int Index); void Propagate(void); protected: eOSState Switch(void); @@ -691,6 +693,12 @@ cMenuChannels::cMenuChannels(void) SetHelp(tr("Edit"), tr("New"), tr("Delete"), tr("Mark")); } +cChannel *cMenuChannels::GetChannel(int Index) +{ + cMenuChannelItem *p = (cMenuChannelItem *)Get(Index); + return p ? (cChannel *)p->Channel() : NULL; +} + void cMenuChannels::Propagate(void) { Channels.ReNumber(); @@ -703,7 +711,7 @@ void cMenuChannels::Propagate(void) eOSState cMenuChannels::Switch(void) { - cChannel *ch = Channels.Get(Current()); + cChannel *ch = GetChannel(Current()); if (ch) cDevice::PrimaryDevice()->SwitchChannel(ch, true); return osEnd; @@ -713,7 +721,7 @@ eOSState cMenuChannels::Edit(void) { if (HasSubMenu() || Count() == 0) return osContinue; - cChannel *ch = Channels.Get(Current()); + cChannel *ch = GetChannel(Current()); if (ch) return AddSubMenu(new cMenuEditChannel(ch)); return osContinue; @@ -730,7 +738,7 @@ eOSState cMenuChannels::Delete(void) { if (Count() > 0) { int Index = Current(); - cChannel *channel = Channels.Get(Index); + cChannel *channel = GetChannel(Current()); int DeletedChannel = channel->Number(); // Check if there is a timer using this channel: for (cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti)) { @@ -751,12 +759,16 @@ eOSState cMenuChannels::Delete(void) void cMenuChannels::Move(int From, int To) { - int FromNumber = Channels.Get(From)->Number(); - int ToNumber = Channels.Get(To)->Number(); - Channels.Move(From, To); - cOsdMenu::Move(From, To); - Propagate(); - isyslog("channel %d moved to %d", FromNumber, ToNumber); + cChannel *FromChannel = GetChannel(From); + cChannel *ToChannel = GetChannel(To); + if (FromChannel && ToChannel) { + int FromNumber = FromChannel->Number(); + int ToNumber = ToChannel->Number(); + Channels.Move(FromChannel, ToChannel); + cOsdMenu::Move(From, To); + Propagate(); + isyslog("channel %d moved to %d", FromNumber, ToNumber); + } } eOSState cMenuChannels::ProcessKey(eKeys Key) @@ -1509,6 +1521,116 @@ eOSState cMenuCommands::ProcessKey(eKeys Key) return state; } +// --- cMenuCam -------------------------------------------------------------- + +cMenuCam::cMenuCam(cCiMenu *CiMenu) +:cOsdMenu("") +{ + ciMenu = CiMenu; + selected = false; + if (ciMenu->Selectable()) + SetHasHotkeys(); + SetTitle(ciMenu->TitleText() ? ciMenu->TitleText() : "CAM"); + for (int i = 0; i < ciMenu->NumEntries(); i++) + Add(new cOsdItem(hk(ciMenu->Entry(i)))); + //XXX implement a clean way of displaying this: + Add(new cOsdItem(ciMenu->SubTitleText())); + Add(new cOsdItem(ciMenu->BottomText())); + Display(); +} + +cMenuCam::~cMenuCam() +{ + if (!selected) + ciMenu->Cancel(); + delete ciMenu; +} + +eOSState cMenuCam::Select(void) +{ + if (ciMenu->Selectable()) { + ciMenu->Select(Current()); + selected = true; + } + return osEnd; +} + +eOSState cMenuCam::ProcessKey(eKeys Key) +{ + eOSState state = cOsdMenu::ProcessKey(Key); + + if (state == osUnknown) { + switch (Key) { + case kOk: return Select(); + default: break; + } + } + return state; +} + +// --- cMenuCamEnquiry ------------------------------------------------------- + +//XXX this is just quick and dirty - make this a separate display object +cMenuCamEnquiry::cMenuCamEnquiry(cCiEnquiry *CiEnquiry) +:cOsdMenu("") +{ + ciEnquiry = CiEnquiry; + replied = false; + SetTitle(ciEnquiry->Text() ? ciEnquiry->Text() : "CAM"); + Display(); +} + +cMenuCamEnquiry::~cMenuCamEnquiry() +{ + if (!replied) + ciEnquiry->Cancel(); + delete ciEnquiry; +} + +eOSState cMenuCamEnquiry::Reply(void) +{ + ciEnquiry->Reply("1234");//XXX implement actual user input + replied = true; + return osEnd; +} + +eOSState cMenuCamEnquiry::ProcessKey(eKeys Key) +{ + eOSState state = cOsdMenu::ProcessKey(Key); + + if (state == osUnknown) { + switch (Key) { + case kOk: return Reply(); + default: break; + } + } + return state; +} + +// --- CamControl ------------------------------------------------------------ + +cOsdObject *CamControl(void) +{ + for (int d = 0; d < cDevice::NumDevices(); d++) { + cDevice *Device = cDevice::GetDevice(d); + if (Device) { + cCiHandler *CiHandler = Device->CiHandler(); + if (CiHandler) { + CiHandler->Process(); + cCiMenu *CiMenu = CiHandler->GetMenu(); + if (CiMenu) + return new cMenuCam(CiMenu); + else { + cCiEnquiry *CiEnquiry = CiHandler->GetEnquiry(); + if (CiEnquiry) + return new cMenuCamEnquiry(CiEnquiry); + } + } + } + } + return NULL; +} + // --- cMenuRecordingItem ---------------------------------------------------- class cMenuRecordingItem : public cOsdItem { @@ -1938,6 +2060,12 @@ eOSState cMenuSetupLNB::ProcessKey(eKeys Key) // --- cMenuSetupCICAM ------------------------------------------------------- class cMenuSetupCICAM : public cMenuSetupBase { +private: + int helpKeys; + void SetHelpKeys(void); + cCiHandler *GetCurrentCiHandler(void); + eOSState Menu(void); + eOSState Reset(void); public: cMenuSetupCICAM(void); virtual eOSState ProcessKey(eKeys Key); @@ -1945,6 +2073,7 @@ public: cMenuSetupCICAM::cMenuSetupCICAM(void) { + helpKeys = -1; SetSection(tr("CICAM")); for (int d = 0; d < cDevice::NumDevices(); d++) { for (int i = 0; i < 2; i++) { @@ -1953,6 +2082,46 @@ cMenuSetupCICAM::cMenuSetupCICAM(void) Add(new cMenuEditCaItem(buffer, &data.CaCaps[d][i])); } } + SetHelpKeys(); +} + +cCiHandler *cMenuSetupCICAM::GetCurrentCiHandler(void) +{ + cDevice *Device = cDevice::GetDevice(Current() / 2); + return Device ? Device->CiHandler() : NULL; +} + +void cMenuSetupCICAM::SetHelpKeys(void) +{ + int NewHelpKeys = helpKeys; + NewHelpKeys = GetCurrentCiHandler() ? 1 : 0; + if (NewHelpKeys != helpKeys) { + switch (NewHelpKeys) { + case 0: SetHelp(NULL); break; + case 1: SetHelp(tr("Menu"), tr("Reset")); + } + helpKeys = NewHelpKeys; + } +} + +eOSState cMenuSetupCICAM::Menu(void) +{ + cCiHandler *CiHandler = GetCurrentCiHandler(); + if (CiHandler && CiHandler->EnterMenu()) + return osEnd; // the CAM menu will be executed explicitly from the main loop + else + Interface->Error(tr("Can't open CAM menu!")); + return osContinue; +} + +eOSState cMenuSetupCICAM::Reset(void) +{ + cCiHandler *CiHandler = GetCurrentCiHandler(); + if (CiHandler && CiHandler->Reset()) + Interface->Info(tr("CAM has been reset")); + else + Interface->Error(tr("Can't reset CAM!")); + return osContinue; } eOSState cMenuSetupCICAM::ProcessKey(eKeys Key) @@ -1961,6 +2130,19 @@ eOSState cMenuSetupCICAM::ProcessKey(eKeys Key) if (state == osBack && Key == kOk) cDevice::SetCaCaps(); + else if (state == osUnknown) { + switch (Key) { + case kRed: if (helpKeys == 1) + return Menu(); + break; + case kGreen: if (helpKeys == 1) + return Reset(); + break; + default: break; + } + } + if (Key != kNone) + SetHelpKeys(); return state; } |