1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

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 entered so far together with the name of that channel are displayed on the
OSD (suggested by Martin Hammerschmid). 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 - 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 module with option outstream=0, so your insmod statement should read
@ -200,3 +200,4 @@ Video Disk Recorder Revision History
now silently removed. now silently removed.
- Fixed a buffer overflow in EIT parsing. - Fixed a buffer overflow in EIT parsing.
- Added a security warning regarding SVDRP to the INSTALL file. - 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "interface.h"
@ -29,11 +29,19 @@ cInterface::cInterface(void)
open = 0; open = 0;
cols[0] = 0; cols[0] = 0;
keyFromWait = kNone; keyFromWait = kNone;
SVDRP = NULL;
} }
void cInterface::Init(void) void cInterface::Init(int SVDRPport)
{ {
RcIo.SetCode(Keys.code, Keys.address); 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) void cInterface::Open(int NumCols, int NumLines)
@ -61,6 +69,8 @@ unsigned int cInterface::GetCh(bool Wait)
eKeys cInterface::GetKey(bool Wait) eKeys cInterface::GetKey(bool Wait)
{ {
if (SVDRP)
SVDRP->Process();
eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh(Wait)); eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh(Wait));
keyFromWait = kNone; keyFromWait = kNone;
return Key; return Key;
@ -74,6 +84,7 @@ void cInterface::PutKey(eKeys Key)
eKeys cInterface::Wait(int Seconds, bool KeepChar) eKeys cInterface::Wait(int Seconds, bool KeepChar)
{ {
eKeys Key = kNone; eKeys Key = kNone;
RcIo.Flush(500);
if (cFile::AnyFileReady(-1, Seconds * 1000)) if (cFile::AnyFileReady(-1, Seconds * 1000))
Key = GetKey(); Key = GetKey();
if (KeepChar) if (KeepChar)
@ -223,7 +234,7 @@ void cInterface::QueryKeys(void)
Keys.address = Address; Keys.address = Address;
WriteText(1, 5, "RC code detected!"); WriteText(1, 5, "RC code detected!");
WriteText(1, 6, "Do not press any key..."); WriteText(1, 6, "Do not press any key...");
RcIo.Flush(3); RcIo.Flush(3000);
ClearEol(0, 5); ClearEol(0, 5);
ClearEol(0, 6); ClearEol(0, 6);
break; break;

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: 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 #ifndef __INTERFACE_H
@ -12,6 +12,7 @@
#include "config.h" #include "config.h"
#include "dvbapi.h" #include "dvbapi.h"
#include "svdrp.h"
class cInterface { class cInterface {
public: public:
@ -20,13 +21,15 @@ private:
int open; int open;
int cols[MaxCols]; int cols[MaxCols];
eKeys keyFromWait; eKeys keyFromWait;
cSVDRP *SVDRP;
unsigned int GetCh(bool Wait = true); unsigned int GetCh(bool Wait = true);
void QueryKeys(void); void QueryKeys(void);
void HelpButton(int Index, const char *Text, eDvbColor FgColor, eDvbColor BgColor); void HelpButton(int Index, const char *Text, eDvbColor FgColor, eDvbColor BgColor);
eKeys Wait(int Seconds = 1, bool KeepChar = false); eKeys Wait(int Seconds = 1, bool KeepChar = false);
public: public:
cInterface(void); cInterface(void);
void Init(void); void Init(int SVDRPport = 0);
void Cleanup(void);
void Open(int NumCols = MenuColumns, int NumLines = MenuLines); void Open(int NumCols = MenuColumns, int NumLines = MenuLines);
void Close(void); void Close(void);
eKeys GetKey(bool Wait = true); eKeys GetKey(bool Wait = true);

View File

@ -6,7 +6,7 @@
* *
* Ported to LIRC by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16. * 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" #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); timeout(10);
for (;;) { for (;;) {
while (getch() > 0) while (getch() > 0)
t0 = time(NULL); t0 = time_ms();
if (time(NULL) - t0 >= WaitSeconds) if (time_ms() - t0 >= WaitMs)
break; break;
} }
} }
@ -172,14 +172,14 @@ bool cRcIoRCU::SetMode(unsigned char Mode)
return SendCommand(mode); return SendCommand(mode);
} }
void cRcIoRCU::Flush(int WaitSeconds) void cRcIoRCU::Flush(int WaitMs)
{ {
time_t t0 = time(NULL); int t0 = time_ms();
for (;;) { for (;;) {
while (ReceiveByte(false) >= 0) while (ReceiveByte(false) >= 0)
t0 = time(NULL); t0 = time_ms();
if (time(NULL) - t0 >= WaitSeconds) if (time_ms() - t0 >= WaitMs)
break; break;
} }
} }
@ -381,17 +381,17 @@ const char *cRcIoLIRC::ReceiveString(void)
return NULL; return NULL;
} }
void cRcIoLIRC::Flush(int WaitSeconds) void cRcIoLIRC::Flush(int WaitMs)
{ {
char buf[LIRC_BUFFER_SIZE]; char buf[LIRC_BUFFER_SIZE];
time_t t0 = time(NULL); int t0 = time_ms();
for (;;) { for (;;) {
while (InputAvailable(false)) { while (InputAvailable(false)) {
read(f, buf, sizeof(buf)); read(f, buf, sizeof(buf));
t0 = time(NULL); t0 = time_ms();
} }
if (time(NULL) - t0 >= WaitSeconds) if (time_ms() - t0 >= WaitMs)
break; break;
} }
} }

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: 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 #ifndef __REMOTE_H
@ -29,7 +29,7 @@ public:
virtual void SetPoints(unsigned char Dp, bool On) {} virtual void SetPoints(unsigned char Dp, bool On) {}
virtual bool String(char *s) { return true; } virtual bool String(char *s) { return true; }
virtual bool DetectCode(unsigned char *Code, unsigned short *Address) { 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 InputAvailable(bool Wait = false) = 0;
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL) = 0; virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL) = 0;
}; };
@ -42,7 +42,7 @@ private:
public: public:
cRcIoKBD(void); cRcIoKBD(void);
virtual ~cRcIoKBD(); virtual ~cRcIoKBD();
virtual void Flush(int WaitSeconds = 0); virtual void Flush(int WaitMs = 0);
virtual bool InputAvailable(bool Wait = false); virtual bool InputAvailable(bool Wait = false);
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL); virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
}; };
@ -69,7 +69,7 @@ public:
virtual void SetPoints(unsigned char Dp, bool On); virtual void SetPoints(unsigned char Dp, bool On);
virtual bool String(char *s); virtual bool String(char *s);
virtual bool DetectCode(unsigned char *Code, unsigned short *Address); 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 InputAvailable(bool Wait = false);
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL); virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL);
}; };
@ -85,7 +85,7 @@ private:
public: public:
cRcIoLIRC(char *DeviceName); cRcIoLIRC(char *DeviceName);
virtual ~cRcIoLIRC(); virtual ~cRcIoLIRC();
virtual void Flush(int WaitSeconds = 0); virtual void Flush(int WaitMs = 0);
virtual bool InputAvailable(bool Wait = false); virtual bool InputAvailable(bool Wait = false);
virtual bool GetCommand(unsigned int *Command, unsigned short *Address = NULL); 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 * 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> #include <getopt.h>
@ -34,7 +34,6 @@
#include "interface.h" #include "interface.h"
#include "menu.h" #include "menu.h"
#include "recording.h" #include "recording.h"
#include "svdrp.h"
#include "tools.h" #include "tools.h"
#include "videodir.h" #include "videodir.h"
@ -176,7 +175,7 @@ int main(int argc, char *argv[])
if (!Keys.Load(AddDirectory(ConfigDirectory, KEYS_CONF))) if (!Keys.Load(AddDirectory(ConfigDirectory, KEYS_CONF)))
Interface.LearnKeys(); Interface.LearnKeys();
#endif #endif
Interface.Init(); Interface.Init(SVDRPport);
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
@ -191,7 +190,6 @@ int main(int argc, char *argv[])
// Main program loop: // Main program loop:
cSVDRP *SVDRP = SVDRPport ? new cSVDRP(SVDRPport) : NULL;
cOsdBase *Menu = NULL; cOsdBase *Menu = NULL;
cReplayControl *ReplayControl = NULL; cReplayControl *ReplayControl = NULL;
int LastChannel = -1; int LastChannel = -1;
@ -281,13 +279,11 @@ int main(int argc, char *argv[])
default: break; default: break;
} }
} }
if (SVDRP)
SVDRP->Process();//TODO lock menu vs. SVDRP?
} }
isyslog(LOG_INFO, "caught signal %d", Interrupted); isyslog(LOG_INFO, "caught signal %d", Interrupted);
delete Menu; delete Menu;
delete ReplayControl; delete ReplayControl;
delete SVDRP; Interface.Cleanup();
cDvbApi::Cleanup(); cDvbApi::Cleanup();
isyslog(LOG_INFO, "exiting"); isyslog(LOG_INFO, "exiting");
if (SysLogLevel > 0) if (SysLogLevel > 0)