mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
- Added some missing braces in remux.c (thanks to Wayne Keer for reporting this one). - Removed unused MAINMENUENTRY from svdrpdemo.c (thanks to Udo Richter for reporting this one). - Fixed appending sequence end code in cDvbPlayer::Goto() (thanks to Reinhard Nissl). - Fixed syncing in cRepacker (thanks to Reinhard Nissl). - Now always using stream id 0xE0 for the video stream, to avoid problems with post processing tools that choke on different ids (suggested by Reinhard Nissl). - Updated the Estonian OSD texts (thanks to Arthur Konovalov). - Fixed cDvbPlayer::SkipFrames() to properly handle radio recordings (thanks to Reinhard Nissl). - Updated the Swedish OSD texts (thanks to Tomas Prybil). - Updated the Slovenian OSD texts (thanks to Matjaz Thaler). - Updated the Danish OSD texts (thanks to Mogens Elneff). - Made LIRC command parsing more robust (thanks to Ville Skyttä). - Introduced a separate 'plugins-install' target in the Makefile (thanks to Daniel Thompson). - Re-introduced the code that waits for a tuner lock in VDR/device.c, since apparently some users actually need it. It's not active by default, you'll have to define the WAIT_FOR_TUNER_LOCK macro in that file if you need it (suggested by Malcolm Caldwell). - Adjusted the Makefile to the dvb-kernel driver on kernel 2.6 and up (thanks to Lauri Tischler). - Repeat keys are now ignored when waiting for a keypress to cancel an operation (thanks to Marko Mäkelä). - The main menu function of a plugin can now be activated through a key macro of the form "@plugin" even if that plugin doesn't have a main menu entry (using part of a patch by Hardy Flor, which originally implemented calling plugins from SVDRP). - The menu timeout handling is now done centrally in the main program loop. - Added missing help for the 'help' keyword in the SVDRP command PLUG. - The main menu function of a plugin can now be called programmatically through the static function cRemote::CallPlugin(). - The SVDRP command PLUG now has a new option 'main' which can be used to initiate a call to the main menu function of a plugin (using part of a patch by Hardy Flor). - The new command line option '--vfat' can be used to make VDR encode special characters in recording file names, even if it wasn't compiled with VFAT=1 (suggested by Peter Bieringer). The compile time option VFAT still exists and creates a VDR that always behaves as if it were called with '--vfat'. - Replaced the ':' delimiter between hour and minute in recording file names with a '.' under Linux, too. Existing recordings with ':' as delimiter will still work. - Implemented the SVDRP command MOVC (thanks to Andreas Brachold). - Added support for multiple audio language codes in ISO639LanguageDescriptors to 'libsi' (thanks to Marcel Wiesweg). - Changed the audio PID language codes to hold up to two 3 letter codes, separated by '+', to store separate languages broadcast in two channel audio mode. - If the preferred audio language is broadcast on a PID that has two different languages in the two stereo channels, the audio channel is now properly set when switching to such a channel (thanks to Mogens Elneff for his help in testing this). - Fixed some typos in MANUAL (thanks to Ville Skyttä). - Fixed the default value for "Setup/EPG bugfix level" (thanks to Ville Skyttä for reporting this one). - Fixed defining timers that only differ in the day of week (thanks to Patrick Rother for reporting this one). - Fixed converting summary.vdr files that would result in a very long 'short text' (thanks to Carsten Koch). - Implemented a hash for the channels to reduce the system load in the EIT scanning thread (based on a patch by Georg Acher).
202 lines
6.9 KiB
C
202 lines
6.9 KiB
C
/*
|
|
* interface.c: Abstract user interface layer
|
|
*
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
* how to reach the author.
|
|
*
|
|
* $Id: interface.c 1.69 2005/09/03 09:07:23 kls Exp $
|
|
*/
|
|
|
|
#include "interface.h"
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include "i18n.h"
|
|
#include "status.h"
|
|
|
|
cInterface *Interface = NULL;
|
|
|
|
cInterface::cInterface(int SVDRPport)
|
|
{
|
|
interrupted = false;
|
|
SVDRP = NULL;
|
|
if (SVDRPport)
|
|
SVDRP = new cSVDRP(SVDRPport);
|
|
}
|
|
|
|
cInterface::~cInterface()
|
|
{
|
|
delete SVDRP;
|
|
}
|
|
|
|
eKeys cInterface::GetKey(bool Wait)
|
|
{
|
|
if (!cRemote::HasKeys())
|
|
Skins.Flush();
|
|
if (SVDRP) {
|
|
if (SVDRP->Process())
|
|
Wait = false;
|
|
if (!Skins.IsOpen()) {
|
|
char *message = SVDRP->GetMessage();
|
|
if (message) {
|
|
Skins.Message(mtInfo, message);
|
|
free(message);
|
|
}
|
|
}
|
|
}
|
|
return cRemote::Get(Wait ? 1000 : 10);
|
|
}
|
|
|
|
eKeys cInterface::Wait(int Seconds, bool KeepChar)
|
|
{
|
|
if (Seconds == 0)
|
|
Seconds = Setup.OSDMessageTime;
|
|
Skins.Flush();
|
|
eKeys Key = kNone;
|
|
time_t timeout = time(NULL) + Seconds;
|
|
for (;;) {
|
|
Key = GetKey();
|
|
if (ISRAWKEY(Key) || time(NULL) > timeout || interrupted)
|
|
break;
|
|
}
|
|
if (KeepChar && ISRAWKEY(Key))
|
|
cRemote::Put(Key);
|
|
interrupted = false;
|
|
return Key;
|
|
}
|
|
|
|
bool cInterface::Confirm(const char *s, int Seconds, bool WaitForTimeout)
|
|
{
|
|
isyslog("confirm: %s", s);
|
|
eKeys k = Skins.Message(mtWarning, s, Seconds);
|
|
bool result = WaitForTimeout ? k == kNone : k == kOk;
|
|
isyslog("%sconfirmed", result ? "" : "not ");
|
|
return result;
|
|
}
|
|
|
|
bool cInterface::QueryKeys(cRemote *Remote, cSkinDisplayMenu *DisplayMenu)
|
|
{
|
|
DisplayMenu->SetItem(tr("Phase 1: Detecting RC code type"), 2, false, false);
|
|
DisplayMenu->SetItem(tr("Press any key on the RC unit"), 4, false, false);
|
|
DisplayMenu->Flush();
|
|
if (Remote->Initialize()) {
|
|
DisplayMenu->SetItem(tr("RC code detected!"), 4, false, false);
|
|
DisplayMenu->SetItem(tr("Do not press any key..."), 5, false, false);
|
|
DisplayMenu->Flush();
|
|
sleep(3);
|
|
DisplayMenu->SetItem("", 4, false, false);
|
|
DisplayMenu->SetItem("", 5, false, false);
|
|
|
|
DisplayMenu->SetItem(tr("Phase 2: Learning specific key codes"), 2, false, false);
|
|
eKeys NewKey = kUp;
|
|
while (NewKey != kNone) {
|
|
char *Prompt;
|
|
asprintf(&Prompt, tr("Press key for '%s'"), tr(cKey::ToString(NewKey)));
|
|
DisplayMenu->SetItem(Prompt, 4, false, false);
|
|
free(Prompt);
|
|
cRemote::Clear();
|
|
DisplayMenu->Flush();
|
|
for (eKeys k = NewKey; k == NewKey; ) {
|
|
char *NewCode = NULL;
|
|
eKeys Key = cRemote::Get(100, &NewCode);
|
|
switch (Key) {
|
|
case kUp: if (NewKey > kUp) {
|
|
NewKey = eKeys(NewKey - 1);
|
|
cKey *last = Keys.Last();
|
|
if (last && last->Key() == NewKey)
|
|
Keys.Del(last);
|
|
}
|
|
break;
|
|
case kDown: DisplayMenu->SetItem(tr("Press 'Up' to confirm"), 4, false, false);
|
|
DisplayMenu->SetItem(tr("Press 'Down' to continue"), 5, false, false);
|
|
DisplayMenu->SetItem("", 6, false, false);
|
|
DisplayMenu->SetItem("", 7, false, false);
|
|
DisplayMenu->SetItem("", 8, false, false);
|
|
DisplayMenu->Flush();
|
|
for (;;) {
|
|
Key = cRemote::Get(100);
|
|
if (Key == kUp) {
|
|
DisplayMenu->Clear();
|
|
return true;
|
|
}
|
|
else if (Key == kDown) {
|
|
DisplayMenu->SetItem("", 5, false, false);
|
|
k = kNone; // breaks the outer for() loop
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case kMenu: NewKey = eKeys(NewKey + 1);
|
|
break;
|
|
case kNone: if (NewCode) {
|
|
dsyslog("new %s code: %s = %s", Remote->Name(), NewCode, cKey::ToString(NewKey));
|
|
Keys.Add(new cKey(Remote->Name(), NewCode, NewKey));
|
|
NewKey = eKeys(NewKey + 1);
|
|
free(NewCode);
|
|
}
|
|
break;
|
|
default: break;
|
|
}
|
|
}
|
|
if (NewKey > kUp)
|
|
DisplayMenu->SetItem(tr("(press 'Up' to go back)"), 6, false, false);
|
|
else
|
|
DisplayMenu->SetItem("", 6, false, false);
|
|
if (NewKey > kDown)
|
|
DisplayMenu->SetItem(tr("(press 'Down' to end key definition)"), 7, false, false);
|
|
else
|
|
DisplayMenu->SetItem("", 7, false, false);
|
|
if (NewKey > kMenu)
|
|
DisplayMenu->SetItem(tr("(press 'Menu' to skip this key)"), 8, false, false);
|
|
else
|
|
DisplayMenu->SetItem("", 8, false, false);
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void cInterface::LearnKeys(void)
|
|
{
|
|
for (cRemote *Remote = Remotes.First(); Remote; Remote = Remotes.Next(Remote)) {
|
|
if (!Remote->Ready()) {
|
|
esyslog("ERROR: remote control %s not ready!", Remote->Name());
|
|
continue;
|
|
}
|
|
bool known = Keys.KnowsRemote(Remote->Name());
|
|
dsyslog("remote control %s - %s", Remote->Name(), known ? "keys known" : "learning keys");
|
|
if (!known) {
|
|
cSkinDisplayMenu *DisplayMenu = Skins.Current()->DisplayMenu();
|
|
char Headline[256];
|
|
snprintf(Headline, sizeof(Headline), tr("Learning Remote Control Keys"));
|
|
cRemote::Clear();
|
|
DisplayMenu->SetTitle(Headline);
|
|
DisplayMenu->SetItem(Remote->Name(), 0, false, false);
|
|
cRemote::SetLearning(Remote);
|
|
bool rc = QueryKeys(Remote, DisplayMenu);
|
|
cRemote::SetLearning(NULL);
|
|
DisplayMenu->Clear();
|
|
if (!rc) {
|
|
delete DisplayMenu;
|
|
continue;
|
|
}
|
|
DisplayMenu->SetItem(Remote->Name(), 0, false, false);
|
|
DisplayMenu->SetItem(tr("Phase 3: Saving key codes"), 2, false, false);
|
|
DisplayMenu->SetItem(tr("Press 'Up' to save, 'Down' to cancel"), 4, false, false);
|
|
for (;;) {
|
|
eKeys key = GetKey();
|
|
if (key == kUp) {
|
|
Keys.Save();
|
|
delete DisplayMenu;
|
|
break;
|
|
}
|
|
else if (key == kDown) {
|
|
Keys.Load();
|
|
delete DisplayMenu;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|