From 88d8d634089bae65bdfea8238a847b7883058072 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 3 Oct 2005 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.34=20-=20Fixed=20a=20leftover=20'summary.?= =?UTF-8?q?vdr'=20in=20vdr.5=20(thanks=20to=20Peter=20Bieringer=20for=20re?= =?UTF-8?q?porting=20=20=20this=20one).=20-=20Fixed=20opening=20recording?= =?UTF-8?q?=20folders=20in=20case=20the=20last=20replayed=20recording=20no?= =?UTF-8?q?=20longer=20=20=20exists=20(reported=20by=20Udo=20Richter).=20-?= =?UTF-8?q?=20Fixed=20an=20unjustified=20"Error=20while=20accessing=20reco?= =?UTF-8?q?rding!"=20after=20deleting=20a=20recording=20=20=20from=20a=20s?= =?UTF-8?q?ubfolder.=20-=20Fixed=20handling=20the=20'.update'=20file=20in?= =?UTF-8?q?=20case=20the=20video=20directory=20is=20not=20at=20the=20defau?= =?UTF-8?q?lt=20=20=20location=20(reported=20by=20Jon=20Burgess).=20-=20Fi?= =?UTF-8?q?xed=20a=20crash=20in=20cConfig::Load()=20when=20compiling=20on?= =?UTF-8?q?=20the=20PPC=20(thanks=20to=20Sascha=20=20=20Volkenandt).=20-?= =?UTF-8?q?=20Fixed=20the=20FATALERRNO=20macro=20to=20check=20for=20a=20no?= =?UTF-8?q?n-zero=20errno=20value=20(reported=20by=20Marco=20=20=20Schl?= =?UTF-8?q?=C3=BC=C3=9Fler).=20-=20Added=20a=20check=20against=20MAXOSDARE?= =?UTF-8?q?AS=20in=20cOsd::CanHandleAreas()=20(reported=20by=20Udo=20=20?= =?UTF-8?q?=20Richter).=20-=20Fixed=20setting=20current=20menu=20item=20if?= =?UTF-8?q?=20the=20first=20one=20is=20non-selectable.=20-=20cOsdItem::cOs?= =?UTF-8?q?dItem()=20now=20has=20a=20'Selectable'=20parameter.=20-=20Impro?= =?UTF-8?q?ved=20displaying=20'sub-title'=20and=20'bottom=20text'=20in=20t?= =?UTF-8?q?he=20CAM=20menu.=20-=20Added=20status=20message=20"Resetting=20?= =?UTF-8?q?CAM..."=20for=20an=20immediate=20feedback=20when=20the=20CAM=20?= =?UTF-8?q?=20=20reset=20has=20been=20triggered.=20-=20The=20CAM=20menu=20?= =?UTF-8?q?now=20automatically=20updates=20itself=20in=20case=20of=20a=20p?= =?UTF-8?q?rogress=20display=20(as=20=20=20used,=20for=20instance,=20when?= =?UTF-8?q?=20updating=20the=20firmware=20via=20satellite).=20-=20Now=20sk?= =?UTF-8?q?ipping=20some=20funny=20characters=20sent=20by=20some=20CAMs=20?= =?UTF-8?q?at=20the=20beginning=20of=20strings.=20-=20The=20CAM=20menu=20i?= =?UTF-8?q?s=20now=20completely=20closed=20when=20pressing=20the=20Menu=20?= =?UTF-8?q?key=20while=20inside=20=20=20a=20sub=20menu.=20-=20Reduced=20MA?= =?UTF-8?q?X=5FCONNECT=5FRETRIES=20in=20ci.c=20to=202=20(waiting=20too=20l?= =?UTF-8?q?ong=20made=20the=20whole=20thing=20=20=20appear=20hanging).=20-?= =?UTF-8?q?=20Added=20status=20message=20"Opening=20CAM=20menu..."=20for?= =?UTF-8?q?=20an=20immediate=20feedback=20when=20the=20CAM=20=20=20menu=20?= =?UTF-8?q?has=20been=20requested.=20-=20Speeded=20up=20initial=20opening?= =?UTF-8?q?=20of=20the=20CAM=20menu.=20-=20Fixed=20handling=20of=20menus?= =?UTF-8?q?=20with=20no=20selectable=20items.=20-=20The=20character=200x8A?= =?UTF-8?q?=20in=20CAM=20menu=20strings=20is=20now=20mapped=20to=20a=20rea?= =?UTF-8?q?l=20newline.=20-=20The=20'sub-title'=20and=20'bottom=20text'=20?= =?UTF-8?q?in=20the=20CAM=20menu=20can=20now=20consist=20of=20several=20li?= =?UTF-8?q?nes.=20-=20Improved=20the=20CAM=20enquiry=20menu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menu.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 20 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index a28c8a8..19079be 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.362 2005/09/25 13:37:21 kls Exp $ + * $Id: menu.c 1.374 2005/10/03 12:53:51 kls Exp $ */ #include "menu.h" @@ -34,6 +34,7 @@ #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 CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1) @@ -1287,33 +1288,59 @@ eOSState cMenuCommands::ProcessKey(eKeys Key) cMenuCam::cMenuCam(cCiMenu *CiMenu) :cOsdMenu("") { + dsyslog("CAM: Menu ------------------"); ciMenu = CiMenu; selected = false; + offset = 0; 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())); + SetTitle(*ciMenu->TitleText() ? ciMenu->TitleText() : "CAM"); + dsyslog("CAM: '%s'", ciMenu->TitleText()); + if (*ciMenu->SubTitleText()) { + dsyslog("CAM: '%s'", ciMenu->SubTitleText()); + AddMultiLineItem(ciMenu->SubTitleText()); + offset = Count(); + } + for (int i = 0; i < ciMenu->NumEntries(); i++) { + Add(new cOsdItem(hk(ciMenu->Entry(i)), osUnknown, ciMenu->Selectable())); + dsyslog("CAM: '%s'", ciMenu->Entry(i)); + } + if (*ciMenu->BottomText()) { + AddMultiLineItem(ciMenu->BottomText()); + dsyslog("CAM: '%s'", ciMenu->BottomText()); + } Display(); - dsyslog("CAM: Menu - %s", ciMenu->TitleText()); } cMenuCam::~cMenuCam() { if (!selected) - ciMenu->Cancel(); + ciMenu->Abort(); delete ciMenu; } +void cMenuCam::AddMultiLineItem(const char *s) +{ + while (s && *s) { + const char *p = strchr(s, '\n'); + int l = p ? p - s : strlen(s); + cOsdItem *item = new cOsdItem; + item->SetSelectable(false); + item->SetText(strndup(s, l), false); + Add(item); + s = p ? p + 1 : p; + } +} + eOSState cMenuCam::Select(void) { if (ciMenu->Selectable()) { - ciMenu->Select(Current()); - selected = true; + ciMenu->Select(Current() - offset); + dsyslog("CAM: select %d", Current() - offset); } + else + ciMenu->Cancel(); + selected = true; return osEnd; } @@ -1327,36 +1354,51 @@ eOSState cMenuCam::ProcessKey(eKeys Key) default: break; } } + else if (state == osBack) { + ciMenu->Cancel(); + selected = true; + return osEnd; + } + if (ciMenu->HasUpdate()) { + selected = true; + return osEnd; + } return state; } // --- cMenuCamEnquiry ------------------------------------------------------- -//XXX this is just quick and dirty - make this a separate display object cMenuCamEnquiry::cMenuCamEnquiry(cCiEnquiry *CiEnquiry) -:cOsdMenu("", 10) +:cOsdMenu("", 1) { ciEnquiry = CiEnquiry; int Length = ciEnquiry->ExpectedLength(); input = MALLOC(char, Length + 1); *input = 0; replied = false; - SetTitle(ciEnquiry->Text() ? ciEnquiry->Text() : "CAM"); - Add(new cMenuEditNumItem("Input", input, Length, ciEnquiry->Blind())); + SetTitle("CAM"); + Add(new cOsdItem(ciEnquiry->Text(), osUnknown, false)); + Add(new cOsdItem("", osUnknown, false)); + Add(new cMenuEditNumItem("", input, Length, ciEnquiry->Blind())); Display(); } cMenuCamEnquiry::~cMenuCamEnquiry() { if (!replied) - ciEnquiry->Cancel(); + ciEnquiry->Abort(); free(input); delete ciEnquiry; } eOSState cMenuCamEnquiry::Reply(void) { - //XXX check length??? + if (ciEnquiry->ExpectedLength() < 0xFF && int(strlen(input)) != ciEnquiry->ExpectedLength()) { + char buffer[64]; + snprintf(buffer, sizeof(buffer), tr("Please enter %d digits!"), ciEnquiry->ExpectedLength()); + Skins.Message(mtError, buffer); + return osContinue; + } ciEnquiry->Reply(input); replied = true; return osEnd; @@ -1372,6 +1414,11 @@ eOSState cMenuCamEnquiry::ProcessKey(eKeys Key) default: break; } } + else if (state == osBack) { + ciEnquiry->Cancel(); + replied = true; + return osEnd; + } return state; } @@ -1513,6 +1560,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) SetCurrent(First()); else if (OpenSubMenus && cReplayControl::LastReplayed() && Open(true)) return; + Display(); SetHelpKeys(); } @@ -1556,7 +1604,7 @@ void cMenuRecordings::Set(bool Refresh) if (Refresh) { cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()); if (ri) { - cRecording *Recording = GetRecording(ri); + cRecording *Recording = Recordings.GetByName(ri->FileName()); if (Recording) CurrentRecording = Recording->FileName(); } @@ -1583,7 +1631,8 @@ void cMenuRecordings::Set(bool Refresh) } } free(LastItemText); - Display(); + if (Refresh) + Display(); } cRecording *cMenuRecordings::GetRecording(cMenuRecordingItem *Item) @@ -2155,8 +2204,13 @@ eOSState cMenuSetupCICAM::Menu(void) { cMenuSetupCICAMItem *item = (cMenuSetupCICAMItem *)Get(Current()); if (item) { - if (item->CiHandler()->EnterMenu(item->Slot())) + if (item->CiHandler()->EnterMenu(item->Slot())) { + Skins.Message(mtWarning, tr("Opening CAM menu...")); + time_t t = time(NULL); + while (time(NULL) - t < MAXWAITFORCAMMENU && !item->CiHandler()->HasUserIO()) + item->CiHandler()->Process(); return osEnd; // the CAM menu will be executed explicitly from the main loop + } else Skins.Message(mtError, tr("Can't open CAM menu!")); } @@ -2167,6 +2221,7 @@ eOSState cMenuSetupCICAM::Reset(void) { cMenuSetupCICAMItem *item = (cMenuSetupCICAMItem *)Get(Current()); if (item) { + Skins.Message(mtWarning, tr("Resetting CAM...")); if (item->CiHandler()->Reset(item->Slot())) { Skins.Message(mtInfo, tr("CAM has been reset")); return osEnd; -- cgit v1.2.3