summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-10-03 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-10-03 18:00:00 +0200
commit88d8d634089bae65bdfea8238a847b7883058072 (patch)
tree8d6143bb63258e7c8b918d664f69a5870d1e8983 /menu.c
parentc16bbf7422f37108580e559ca849e5aafbdac672 (diff)
downloadvdr-patch-lnbsharing-88d8d634089bae65bdfea8238a847b7883058072.tar.gz
vdr-patch-lnbsharing-88d8d634089bae65bdfea8238a847b7883058072.tar.bz2
Version 1.3.34vdr-1.3.34
- Fixed a leftover 'summary.vdr' in vdr.5 (thanks to Peter Bieringer for reporting this one). - Fixed opening recording folders in case the last replayed recording no longer exists (reported by Udo Richter). - Fixed an unjustified "Error while accessing recording!" after deleting a recording from a subfolder. - Fixed handling the '.update' file in case the video directory is not at the default location (reported by Jon Burgess). - Fixed a crash in cConfig::Load() when compiling on the PPC (thanks to Sascha Volkenandt). - Fixed the FATALERRNO macro to check for a non-zero errno value (reported by Marco Schlüßler). - Added a check against MAXOSDAREAS in cOsd::CanHandleAreas() (reported by Udo Richter). - Fixed setting current menu item if the first one is non-selectable. - cOsdItem::cOsdItem() now has a 'Selectable' parameter. - Improved displaying 'sub-title' and 'bottom text' in the CAM menu. - Added status message "Resetting CAM..." for an immediate feedback when the CAM reset has been triggered. - The CAM menu now automatically updates itself in case of a progress display (as used, for instance, when updating the firmware via satellite). - Now skipping some funny characters sent by some CAMs at the beginning of strings. - The CAM menu is now completely closed when pressing the Menu key while inside a sub menu. - Reduced MAX_CONNECT_RETRIES in ci.c to 2 (waiting too long made the whole thing appear hanging). - Added status message "Opening CAM menu..." for an immediate feedback when the CAM menu has been requested. - Speeded up initial opening of the CAM menu. - Fixed handling of menus with no selectable items. - The character 0x8A in CAM menu strings is now mapped to a real newline. - The 'sub-title' and 'bottom text' in the CAM menu can now consist of several lines. - Improved the CAM enquiry menu.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c95
1 files changed, 75 insertions, 20 deletions
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;