Implemented actual user input for CAM enquiry menus

This commit is contained in:
Klaus Schmidinger 2003-01-19 14:59:46 +01:00
parent c1dcc3e5a5
commit 413b22dc63
6 changed files with 84 additions and 7 deletions

View File

@ -1917,7 +1917,8 @@ Video Disk Recorder Revision History
EPG data, that string is now limited in length when used in a recording's
file name.
2003-01-12: Version 1.1.22
2003-01-19: Version 1.1.22
- Added 'Hrvatska radiotelevizija' and 'RTV Slovenija' to ca.conf (thanks to
Paul Gohn).
- Implemented actual user input for CAM enquiry menus.

4
MANUAL
View File

@ -23,6 +23,10 @@ Video Disk Recorder User's Manual
Blue - Stop/Resume Mark On/Off(1) - Summary Stop
0..9 Ch select - - - Numeric inp. Exec cmd(2) Editing
In a numerical input field (like the response to a CAM enquiry) the keys 0..9
are used to enter the data, and the Left key can be used to delete the last
entered digit.
If your remote control provides additional keys, they can be used for the
following functions:

12
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.231 2003/01/06 16:13:53 kls Exp $
* $Id: menu.c 1.232 2003/01/19 14:59:46 kls Exp $
*/
#include "menu.h"
@ -1572,11 +1572,15 @@ eOSState cMenuCam::ProcessKey(eKeys Key)
//XXX this is just quick and dirty - make this a separate display object
cMenuCamEnquiry::cMenuCamEnquiry(cCiEnquiry *CiEnquiry)
:cOsdMenu("")
:cOsdMenu("", 10)
{
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()));
Display();
}
@ -1584,12 +1588,14 @@ cMenuCamEnquiry::~cMenuCamEnquiry()
{
if (!replied)
ciEnquiry->Cancel();
free(input);
delete ciEnquiry;
}
eOSState cMenuCamEnquiry::Reply(void)
{
ciEnquiry->Reply("1234");//XXX implement actual user input
//XXX check length???
ciEnquiry->Reply(input);
replied = true;
return osEnd;
}

3
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.52 2003/01/06 10:04:05 kls Exp $
* $Id: menu.h 1.53 2003/01/12 14:54:05 kls Exp $
*/
#ifndef __MENU_H
@ -73,6 +73,7 @@ public:
class cMenuCamEnquiry : public cOsdMenu {
private:
cCiEnquiry *ciEnquiry;
char *input;
bool replied;
eOSState Reply(void);
public:

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.c 1.11 2002/12/15 11:05:19 kls Exp $
* $Id: menuitems.c 1.12 2003/01/18 13:34:40 kls Exp $
*/
#include "menuitems.h"
@ -109,6 +109,60 @@ void cMenuEditBoolItem::Set(void)
SetValue(buf);
}
// --- cMenuEditNumItem ------------------------------------------------------
cMenuEditNumItem::cMenuEditNumItem(const char *Name, char *Value, int Length, bool Blind)
:cMenuEditItem(Name)
{
value = Value;
length = Length;
blind = Blind;
Set();
}
void cMenuEditNumItem::Set(void)
{
if (blind) {
char buf[length + 1];
int i;
for (i = 0; i < length && value[i]; i++)
buf[i] = '*';
buf[i] = 0;
SetValue(buf);
}
else
SetValue(value);
}
eOSState cMenuEditNumItem::ProcessKey(eKeys Key)
{
eOSState state = cMenuEditItem::ProcessKey(Key);
if (state == osUnknown) {
Key = NORMALKEY(Key);
switch (Key) {
case kLeft: {
int l = strlen(value);
if (l > 0)
value[l - 1] = 0;
}
break;
case k0 ... k9: {
int l = strlen(value);
if (l < length) {
value[l] = Key - k0 + '0';
value[l + 1] = 0;
}
}
break;
default: return state;
}
Set();
state = osContinue;
}
return state;
}
// --- cMenuEditChrItem ------------------------------------------------------
cMenuEditChrItem::cMenuEditChrItem(const char *Name, char *Value, const char *Allowed)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.h 1.4 2002/08/15 11:28:26 kls Exp $
* $Id: menuitems.h 1.5 2003/01/12 15:06:23 kls Exp $
*/
#ifndef __MENUITEMS_H
@ -42,6 +42,17 @@ public:
cMenuEditBoolItem(const char *Name, int *Value, const char *FalseString = NULL, const char *TrueString = NULL);
};
class cMenuEditNumItem : public cMenuEditItem {
protected:
char *value;
int length;
bool blind;
virtual void Set(void);
public:
cMenuEditNumItem(const char *Name, char *Value, int Length, bool Blind = false);
virtual eOSState ProcessKey(eKeys Key);
};
class cMenuEditChrItem : public cMenuEditItem {
private:
char *value;