Fixed 'confirm' dialog

This commit is contained in:
Klaus Schmidinger 2000-09-19 17:48:42 +02:00
parent 3219452195
commit 0d85a30e61
6 changed files with 42 additions and 31 deletions

View File

@ -168,7 +168,7 @@ Video Disk Recorder Revision History
entered so far together with the name of that channel are displayed on the
OSD (suggested by Martin Hammerschmid).
2000-09-17: Version 0.64
2000-09-19: Version 0.64
- NOTE: If you are using DVB driver version 0.7 you need to load the dvb.o
module with option outstream=0, so your insmod statement should read
@ -200,3 +200,4 @@ Video Disk Recorder Revision History
now silently removed.
- Fixed a buffer overflow in EIT parsing.
- Added a security warning regarding SVDRP to the INSTALL file.
- Fixed 'confirm' dialog.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.c 1.18 2000/09/18 17:22:09 kls Exp $
* $Id: interface.c 1.19 2000/09/19 17:41:23 kls Exp $
*/
#include "interface.h"
@ -29,11 +29,19 @@ cInterface::cInterface(void)
open = 0;
cols[0] = 0;
keyFromWait = kNone;
SVDRP = NULL;
}
void cInterface::Init(void)
void cInterface::Init(int SVDRPport)
{
RcIo.SetCode(Keys.code, Keys.address);
if (SVDRPport)
SVDRP = new cSVDRP(SVDRPport);
}
void cInterface::Cleanup(void)
{
delete SVDRP;
}
void cInterface::Open(int NumCols, int NumLines)
@ -61,6 +69,8 @@ unsigned int cInterface::GetCh(bool Wait)
eKeys cInterface::GetKey(bool Wait)
{
if (SVDRP)
SVDRP->Process();
eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh(Wait));
keyFromWait = kNone;
return Key;
@ -74,6 +84,7 @@ void cInterface::PutKey(eKeys Key)
eKeys cInterface::Wait(int Seconds, bool KeepChar)
{
eKeys Key = kNone;
RcIo.Flush(500);
if (cFile::AnyFileReady(-1, Seconds * 1000))
Key = GetKey();
if (KeepChar)
@ -223,7 +234,7 @@ void cInterface::QueryKeys(void)
Keys.address = Address;
WriteText(1, 5, "RC code detected!");
WriteText(1, 6, "Do not press any key...");
RcIo.Flush(3);
RcIo.Flush(3000);
ClearEol(0, 5);
ClearEol(0, 6);
break;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.h 1.12 2000/09/17 09:19:43 kls Exp $
* $Id: interface.h 1.13 2000/09/18 22:29:31 kls Exp $
*/
#ifndef __INTERFACE_H
@ -12,6 +12,7 @@
#include "config.h"
#include "dvbapi.h"
#include "svdrp.h"
class cInterface {
public:
@ -20,13 +21,15 @@ private:
int open;
int cols[MaxCols];
eKeys keyFromWait;
cSVDRP *SVDRP;
unsigned int GetCh(bool Wait = true);
void QueryKeys(void);
void HelpButton(int Index, const char *Text, eDvbColor FgColor, eDvbColor BgColor);
eKeys Wait(int Seconds = 1, bool KeepChar = false);
public:
cInterface(void);
void Init(void);
void Init(int SVDRPport = 0);
void Cleanup(void);
void Open(int NumCols = MenuColumns, int NumLines = MenuLines);
void Close(void);
eKeys GetKey(bool Wait = true);

View File

@ -6,7 +6,7 @@
*
* Ported to LIRC by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
*
* $Id: remote.c 1.12 2000/09/16 16:42:30 kls Exp $
* $Id: remote.c 1.13 2000/09/19 17:40:52 kls Exp $
*/
#include "remote.h"
@ -56,15 +56,15 @@ cRcIoKBD::~cRcIoKBD()
{
}
void cRcIoKBD::Flush(int WaitSeconds)
void cRcIoKBD::Flush(int WaitMs)
{
time_t t0 = time(NULL);
int t0 = time_ms();
timeout(10);
for (;;) {
while (getch() > 0)
t0 = time(NULL);
if (time(NULL) - t0 >= WaitSeconds)
t0 = time_ms();
if (time_ms() - t0 >= WaitMs)
break;
}
}
@ -172,14 +172,14 @@ bool cRcIoRCU::SetMode(unsigned char Mode)
return SendCommand(mode);
}
void cRcIoRCU::Flush(int WaitSeconds)
void cRcIoRCU::Flush(int WaitMs)
{
time_t t0 = time(NULL);
int t0 = time_ms();
for (;;) {
while (ReceiveByte(false) >= 0)
t0 = time(NULL);
if (time(NULL) - t0 >= WaitSeconds)
t0 = time_ms();
if (time_ms() - t0 >= WaitMs)
break;
}
}
@ -381,17 +381,17 @@ const char *cRcIoLIRC::ReceiveString(void)
return NULL;
}
void cRcIoLIRC::Flush(int WaitSeconds)
void cRcIoLIRC::Flush(int WaitMs)
{
char buf[LIRC_BUFFER_SIZE];
time_t t0 = time(NULL);
int t0 = time_ms();
for (;;) {
while (InputAvailable(false)) {
read(f, buf, sizeof(buf));
t0 = time(NULL);
t0 = time_ms();
}
if (time(NULL) - t0 >= WaitSeconds)
if (time_ms() - t0 >= WaitMs)
break;
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remote.h 1.8 2000/09/16 14:01:14 kls Exp $
* $Id: remote.h 1.9 2000/09/19 17:39:36 kls Exp $
*/
#ifndef __REMOTE_H
@ -29,7 +29,7 @@ public:
virtual void SetPoints(unsigned char Dp, bool On) {}
virtual bool String(char *s) { return true; }
virtual bool DetectCode(unsigned char *Code, unsigned short *Address) { return true; }
virtual void Flush(int WaitSeconds = 0) {}
virtual void Flush(int WaitMs = 0) {}
virtual bool InputAvailable(bool Wait = false) = 0;
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL) = 0;
};
@ -42,7 +42,7 @@ private:
public:
cRcIoKBD(void);
virtual ~cRcIoKBD();
virtual void Flush(int WaitSeconds = 0);
virtual void Flush(int WaitMs = 0);
virtual bool InputAvailable(bool Wait = false);
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
};
@ -69,7 +69,7 @@ public:
virtual void SetPoints(unsigned char Dp, bool On);
virtual bool String(char *s);
virtual bool DetectCode(unsigned char *Code, unsigned short *Address);
virtual void Flush(int WaitSeconds = 0);
virtual void Flush(int WaitMs = 0);
virtual bool InputAvailable(bool Wait = false);
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
};
@ -85,7 +85,7 @@ private:
public:
cRcIoLIRC(char *DeviceName);
virtual ~cRcIoLIRC();
virtual void Flush(int WaitSeconds = 0);
virtual void Flush(int WaitMs = 0);
virtual bool InputAvailable(bool Wait = false);
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
};

10
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.33 2000/09/17 14:15:24 kls Exp $
* $Id: vdr.c 1.34 2000/09/18 22:29:56 kls Exp $
*/
#include <getopt.h>
@ -34,7 +34,6 @@
#include "interface.h"
#include "menu.h"
#include "recording.h"
#include "svdrp.h"
#include "tools.h"
#include "videodir.h"
@ -176,7 +175,7 @@ int main(int argc, char *argv[])
if (!Keys.Load(AddDirectory(ConfigDirectory, KEYS_CONF)))
Interface.LearnKeys();
#endif
Interface.Init();
Interface.Init(SVDRPport);
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
@ -191,7 +190,6 @@ int main(int argc, char *argv[])
// Main program loop:
cSVDRP *SVDRP = SVDRPport ? new cSVDRP(SVDRPport) : NULL;
cOsdBase *Menu = NULL;
cReplayControl *ReplayControl = NULL;
int LastChannel = -1;
@ -281,13 +279,11 @@ int main(int argc, char *argv[])
default: break;
}
}
if (SVDRP)
SVDRP->Process();//TODO lock menu vs. SVDRP?
}
isyslog(LOG_INFO, "caught signal %d", Interrupted);
delete Menu;
delete ReplayControl;
delete SVDRP;
Interface.Cleanup();
cDvbApi::Cleanup();
isyslog(LOG_INFO, "exiting");
if (SysLogLevel > 0)