diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2002-10-13 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2002-10-13 18:00:00 +0200 |
commit | cd7ccd64fd51b77b8b75b6e85ef6891b1917aa59 (patch) | |
tree | 7de627368728c02bdf195a3cbca5418175638434 /menu.c | |
parent | 313e33539cd22fd571fc9a0f9f841173e9faebc4 (diff) | |
download | vdr-patch-lnbsharing-cd7ccd64fd51b77b8b75b6e85ef6891b1917aa59.tar.gz vdr-patch-lnbsharing-cd7ccd64fd51b77b8b75b6e85ef6891b1917aa59.tar.bz2 |
Version 1.1.13vdr-1.1.13
- Added cDevice::DeviceNumber() to get the number of a device, not counting any
gaps that might be in the index count.
- Fixed fetching the current/next information to handle cases where the duration
of an event is set wrongly and would last beyond the start time of the next
event.
- Adapted type names to the new HEAD version of the driver (which the previous
NEWSTRUCT branch has been merged into). Note that to use this driver version
you still need to add NEWSTRUCT=1 to the make call when building VDR. You
need a HEAD version of the LinuxDVB driver dated 2002-10-11 or later to compile
VDR with NEWSTRUCT=1.
- Fixed radio channels in channels.conf.cable (thanks to Robert Schiele and Uwe
Scheffler).
- Fixed switching the video format in the Setup/DVB menu (thanks to Uwe Scheffler
for reporting this one).
- Reactivated full handling of second audio PID (even in 'Transfer Mode').
- Fixed a crash when closing down with remote control plugins (thanks to Oliver
Endriss helping to debug this one).
- Commands in the file 'commands.conf' can now have a '?' at the end of their
title, which will result in a confirmation prompt before executing the
command.
- Changed a few leftover 'new char[...]' to MALLOC(char, ...).
- If a command executed from the "Commands" menu doesn't return any output, the
OSD will now be closed automatically.
- The SVDRP command PUTE now triggers an immediate write of the 'epg.data' file
(suggested by Gerhard Steiner).
- The new configuration file 'reccmds.conf' can be used to define commands that
shall be executed from the "Recordings" menu; see MANUAL and 'man vdr(5)' for
details (suggested by Gerhard Steiner).
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 178 |
1 files changed, 114 insertions, 64 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.212 2002/10/06 14:08:44 kls Exp $ + * $Id: menu.c 1.217 2002/10/13 12:10:54 kls Exp $ */ #include "menu.h" @@ -1431,6 +1431,77 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key) return state; } +// --- cMenuCommands --------------------------------------------------------- + +class cMenuCommands : public cOsdMenu { +private: + cCommands *commands; + char *parameters; + eOSState Execute(void); +public: + cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); + virtual ~cMenuCommands(); + virtual eOSState ProcessKey(eKeys Key); + }; + +cMenuCommands::cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters) +:cOsdMenu(Title) +{ + SetHasHotkeys(); + commands = Commands; + parameters = Parameters ? strdup(Parameters) : NULL; + int i = 0; + cCommand *command; + + while ((command = commands->Get(i)) != NULL) { + Add(new cOsdItem(hk(command->Title()))); + i++; + } +} + +cMenuCommands::~cMenuCommands() +{ + free(parameters); +} + +eOSState cMenuCommands::Execute(void) +{ + cCommand *command = commands->Get(Current()); + if (command) { + char *buffer = NULL; + bool confirmed = true; + if (command->Confirm()) { + asprintf(&buffer, "%s?", command->Title()); + confirmed = Interface->Confirm(buffer); + free(buffer); + } + if (confirmed) { + asprintf(&buffer, "%s...", command->Title()); + Interface->Status(buffer); + Interface->Flush(); + free(buffer); + const char *Result = command->Execute(parameters); + if (Result) + return AddSubMenu(new cMenuText(command->Title(), Result, fontFix)); + return osEnd; + } + } + return osContinue; +} + +eOSState cMenuCommands::ProcessKey(eKeys Key) +{ + eOSState state = cOsdMenu::ProcessKey(Key); + + if (state == osUnknown) { + switch (Key) { + case kOk: return Execute(); + default: break; + } + } + return state; +} + // --- cMenuRecordingItem ---------------------------------------------------- class cMenuRecordingItem : public cOsdItem { @@ -1545,7 +1616,7 @@ void cMenuRecordings::SetHelpKeys(void) case 0: SetHelp(NULL); break; case 1: SetHelp(tr("Open")); break; case 2: - case 3: SetHelp(tr("Play"), tr("Rewind"), tr("Delete"), NewHelpKeys == 3 ? tr("Summary") : NULL); + case 3: SetHelp(RecordingCommands.Count() ? tr("Commands") : tr("Play"), tr("Rewind"), tr("Delete"), NewHelpKeys == 3 ? tr("Summary") : NULL); } helpKeys = NewHelpKeys; } @@ -1595,6 +1666,8 @@ eOSState cMenuRecordings::Play(void) eOSState cMenuRecordings::Rewind(void) { + if (HasSubMenu() || Count() == 0) + return osContinue; cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()); if (ri && !ri->IsDirectory()) { cDevice::PrimaryDevice()->StopReplay(); // must do this first to be able to rewind the currently replayed recording @@ -1607,6 +1680,8 @@ eOSState cMenuRecordings::Rewind(void) eOSState cMenuRecordings::Delete(void) { + if (HasSubMenu() || Count() == 0) + return osContinue; cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()); if (ri && !ri->IsDirectory()) { if (Interface->Confirm(tr("Delete recording?"))) { @@ -1654,6 +1729,27 @@ eOSState cMenuRecordings::Summary(void) return osContinue; } +eOSState cMenuRecordings::Commands(eKeys Key) +{ + if (HasSubMenu() || Count() == 0) + return osContinue; + cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()); + if (ri && !ri->IsDirectory()) { + cRecording *recording = GetRecording(ri); + if (recording) { + char *parameter = NULL; + asprintf(¶meter, "'%s'", recording->FileName()); + cMenuCommands *menu; + eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Recording commands"), &RecordingCommands, parameter)); + free(parameter); + if (Key != kNone) + state = menu->ProcessKey(Key); + return state; + } + } + return osContinue; +} + eOSState cMenuRecordings::ProcessKey(eKeys Key) { bool HadSubMenu = HasSubMenu(); @@ -1661,11 +1757,12 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key) if (state == osUnknown) { switch (Key) { - case kOk: - case kRed: return Play(); + case kOk: return Play(); + case kRed: return (helpKeys > 1 && RecordingCommands.Count()) ? Commands() : Play(); case kGreen: return Rewind(); case kYellow: return Delete(); case kBlue: return Summary(); + case k1...k9: return Commands(Key); default: break; } } @@ -1776,13 +1873,14 @@ cMenuSetupDVB::cMenuSetupDVB(void) eOSState cMenuSetupDVB::ProcessKey(eKeys Key) { int oldPrimaryDVB = Setup.PrimaryDVB; + bool oldVideoFormat = Setup.VideoFormat; eOSState state = cMenuSetupBase::ProcessKey(Key); if (state == osBack && Key == kOk) { - if (Setup.PrimaryDVB != oldPrimaryDVB) { + if (Setup.PrimaryDVB != oldPrimaryDVB) state = osSwitchDvb; + if (Setup.VideoFormat != oldVideoFormat) cDevice::PrimaryDevice()->SetVideoFormat(Setup.VideoFormat); - } } return state; } @@ -2050,58 +2148,6 @@ eOSState cMenuSetup::ProcessKey(eKeys Key) return state; } -// --- cMenuCommands --------------------------------------------------------- - -class cMenuCommands : public cOsdMenu { -private: - eOSState Execute(void); -public: - cMenuCommands(void); - virtual eOSState ProcessKey(eKeys Key); - }; - -cMenuCommands::cMenuCommands(void) -:cOsdMenu(tr("Commands")) -{ - SetHasHotkeys(); - int i = 0; - cCommand *command; - - while ((command = Commands.Get(i)) != NULL) { - Add(new cOsdItem(hk(command->Title()))); - i++; - } -} - -eOSState cMenuCommands::Execute(void) -{ - cCommand *command = Commands.Get(Current()); - if (command) { - char *buffer = NULL; - asprintf(&buffer, "%s...", command->Title()); - Interface->Status(buffer); - Interface->Flush(); - free(buffer); - const char *Result = command->Execute(); - if (Result) - return AddSubMenu(new cMenuText(command->Title(), Result, fontFix)); - } - return osContinue; -} - -eOSState cMenuCommands::ProcessKey(eKeys Key) -{ - eOSState state = cOsdMenu::ProcessKey(Key); - - if (state == osUnknown) { - switch (Key) { - case kOk: return Execute(); - default: break; - } - } - return state; -} - // --- cMenuPluginItem ------------------------------------------------------- class cMenuPluginItem : public cOsdItem { @@ -2211,7 +2257,7 @@ void cMenuMain::Set(void) // Color buttons: - SetHelp(tr("Record"), /*XXX+ cDevice::PrimaryDevice()->CanToggleAudioTrack() ? tr("Language") :XXX*/ NULL, NULL, replaying ? tr("Button$Stop") : cReplayControl::LastReplayed() ? tr("Resume") : NULL); + SetHelp(tr("Record"), cDevice::PrimaryDevice()->NumAudioTracks() > 1 ? tr("Language") : NULL, NULL, replaying ? tr("Button$Stop") : cReplayControl::LastReplayed() ? tr("Resume") : NULL); Display(); lastActivity = time(NULL); } @@ -2227,7 +2273,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key) case osTimers: return AddSubMenu(new cMenuTimers); case osRecordings: return AddSubMenu(new cMenuRecordings); case osSetup: return AddSubMenu(new cMenuSetup); - case osCommands: return AddSubMenu(new cMenuCommands); + case osCommands: return AddSubMenu(new cMenuCommands(tr("Commands"), &Commands)); case osStopRecord: if (Interface->Confirm(tr("Stop recording?"))) { cOsdItem *item = Get(Current()); if (item) { @@ -2263,13 +2309,17 @@ eOSState cMenuMain::ProcessKey(eKeys Key) state = osRecord; break; case kGreen: if (!HasSubMenu()) { - /*XXX+ - if (cDevice::PrimaryDevice()->CanToggleAudioTrack()) { + int CurrentAudioTrack = -1; + const char **AudioTracks = cDevice::PrimaryDevice()->GetAudioTracks(&CurrentAudioTrack); + if (AudioTracks) { + const char **at = &AudioTracks[CurrentAudioTrack]; + if (!*++at) + at = AudioTracks; Interface->Clear(); - cDevice::PrimaryDevice()->ToggleAudioTrack(); + cDevice::PrimaryDevice()->SetAudioTrack(at - AudioTracks); + //XXX Interface->Info(*at); state = osEnd; } - XXX*/ } break; case kBlue: if (!HasSubMenu()) |