The Setup/CICAM menu now only contains the devices that actually have a CI and dynamically detects the number of slots a CI provides

This commit is contained in:
Klaus Schmidinger 2005-08-26 12:49:26 +02:00
parent 60d77a9171
commit ed807972ac
3 changed files with 52 additions and 62 deletions

View File

@ -3717,6 +3717,8 @@ Video Disk Recorder Revision History
functions to avoid problems on platforms that don't provide these (thanks to functions to avoid problems on platforms that don't provide these (thanks to
David Woodhouse for his help). David Woodhouse for his help).
2005-08-21: Version 1.3.31 2005-08-26: Version 1.3.31
- Added missing German OSD texts for 'Audio language'. - Added missing German OSD texts for 'Audio language'.
- The Setup/CICAM menu now only contains the devices that actually have a CI and
dynamically detects the number of slots a CI provides.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: config.h 1.224 2005/08/20 10:29:35 kls Exp $ * $Id: config.h 1.225 2005/08/26 12:28:40 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -20,8 +20,8 @@
#include "i18n.h" #include "i18n.h"
#include "tools.h" #include "tools.h"
#define VDRVERSION "1.3.30" #define VDRVERSION "1.3.31"
#define VDRVERSNUM 10330 // Version * 10000 + Major * 100 + Minor #define VDRVERSNUM 10331 // Version * 10000 + Major * 100 + Minor
#define MAXPRIORITY 99 #define MAXPRIORITY 99
#define MAXLIFETIME 99 #define MAXLIFETIME 99

104
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 1.355 2005/08/14 15:14:29 kls Exp $ * $Id: menu.c 1.356 2005/08/26 12:49:26 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -2122,11 +2122,28 @@ eOSState cMenuSetupLNB::ProcessKey(eKeys Key)
// --- cMenuSetupCICAM ------------------------------------------------------- // --- cMenuSetupCICAM -------------------------------------------------------
class cMenuSetupCICAMItem : public cOsdItem {
private:
cCiHandler *ciHandler;
int slot;
public:
cMenuSetupCICAMItem(int Device, cCiHandler *CiHandler, int Slot);
cCiHandler *CiHandler(void) { return ciHandler; }
int Slot(void) { return slot; }
};
cMenuSetupCICAMItem::cMenuSetupCICAMItem(int Device, cCiHandler *CiHandler, int Slot)
{
ciHandler = CiHandler;
slot = Slot;
char buffer[32];
const char *CamName = CiHandler->GetCamName(slot);
snprintf(buffer, sizeof(buffer), "%s%d %d\t%s", tr("Setup.CICAM$CICAM DVB"), Device + 1, slot + 1, CamName ? CamName : "-");
SetText(buffer);
}
class cMenuSetupCICAM : public cMenuSetupBase { class cMenuSetupCICAM : public cMenuSetupBase {
private: private:
int helpKeys;
void SetHelpKeys(void);
cCiHandler *GetCurrentCiHandler(int *Slot = NULL);
eOSState Menu(void); eOSState Menu(void);
eOSState Reset(void); eOSState Reset(void);
public: public:
@ -2136,66 +2153,43 @@ public:
cMenuSetupCICAM::cMenuSetupCICAM(void) cMenuSetupCICAM::cMenuSetupCICAM(void)
{ {
helpKeys = -1;
SetSection(tr("CICAM")); SetSection(tr("CICAM"));
for (int d = 0; d < cDevice::NumDevices(); d++) { for (int d = 0; d < cDevice::NumDevices(); d++) {
cDevice *Device = cDevice::GetDevice(d); cDevice *Device = cDevice::GetDevice(d);
cCiHandler *CiHandler = Device->CiHandler(); if (Device) {
for (int Slot = 0; Slot < 2; Slot++) { cCiHandler *CiHandler = Device->CiHandler();
char buffer[32]; if (CiHandler) {
int CardIndex = Device->CardIndex(); for (int Slot = 0; Slot < CiHandler->NumSlots(); Slot++)
const char *CamName = CiHandler ? CiHandler->GetCamName(Slot) : NULL; Add(new cMenuSetupCICAMItem(Device->CardIndex(), CiHandler, Slot));
if (!CamName) }
CamName = "-"; }
snprintf(buffer, sizeof(buffer), "%s%d %d\t%s", tr("Setup.CICAM$CICAM DVB"), CardIndex + 1, Slot + 1, CamName);
Add(new cOsdItem(buffer));
}
} }
SetHelpKeys(); SetHelp(tr("Menu"), tr("Reset"));
}
cCiHandler *cMenuSetupCICAM::GetCurrentCiHandler(int *Slot)
{
cDevice *Device = cDevice::GetDevice(Current() / 2);
if (Slot)
*Slot = 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) eOSState cMenuSetupCICAM::Menu(void)
{ {
int Slot = 0; cMenuSetupCICAMItem *item = (cMenuSetupCICAMItem *)Get(Current());
cCiHandler *CiHandler = GetCurrentCiHandler(&Slot); if (item) {
if (CiHandler && CiHandler->EnterMenu(Slot)) if (item->CiHandler()->EnterMenu(item->Slot()))
return osEnd; // the CAM menu will be executed explicitly from the main loop return osEnd; // the CAM menu will be executed explicitly from the main loop
else else
Skins.Message(mtError, tr("Can't open CAM menu!")); Skins.Message(mtError, tr("Can't open CAM menu!"));
}
return osContinue; return osContinue;
} }
eOSState cMenuSetupCICAM::Reset(void) eOSState cMenuSetupCICAM::Reset(void)
{ {
int Slot = 0; cMenuSetupCICAMItem *item = (cMenuSetupCICAMItem *)Get(Current());
cCiHandler *CiHandler = GetCurrentCiHandler(&Slot); if (item) {
if (CiHandler && CiHandler->Reset(Slot)) { if (item->CiHandler()->Reset(item->Slot())) {
Skins.Message(mtInfo, tr("CAM has been reset")); Skins.Message(mtInfo, tr("CAM has been reset"));
return osEnd; return osEnd;
}
else
Skins.Message(mtError, tr("Can't reset CAM!"));
} }
else
Skins.Message(mtError, tr("Can't reset CAM!"));
return osContinue; return osContinue;
} }
@ -2205,17 +2199,11 @@ eOSState cMenuSetupCICAM::ProcessKey(eKeys Key)
if (state == osUnknown) { if (state == osUnknown) {
switch (Key) { switch (Key) {
case kRed: if (helpKeys == 1) case kRed: return Menu();
return Menu(); case kGreen: return Reset();
break;
case kGreen: if (helpKeys == 1)
return Reset();
break;
default: break; default: break;
} }
} }
if (Key != kNone)
SetHelpKeys();
return state; return state;
} }