mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Made the volume, mute and power keys work when a menu is active, too
This commit is contained in:
parent
34e6eaad58
commit
0ed710a843
@ -139,3 +139,6 @@ Rolf Hakenes <hakenes@hippomi.de>
|
|||||||
Andreas Vitting <Andreas@huji.de>
|
Andreas Vitting <Andreas@huji.de>
|
||||||
for providing code that closes all unused file descriptors in the child
|
for providing code that closes all unused file descriptors in the child
|
||||||
process of a pipe (used in cPipe)
|
process of a pipe (used in cPipe)
|
||||||
|
|
||||||
|
Matthias Weingart <matthias@pentax.boerde.de>
|
||||||
|
for fixing handling of the volume, mute and power keys when menus are active
|
||||||
|
2
HISTORY
2
HISTORY
@ -784,3 +784,5 @@ Video Disk Recorder Revision History
|
|||||||
- Writing the current time (as seen by VDR) into the log file when starting
|
- Writing the current time (as seen by VDR) into the log file when starting
|
||||||
a timer recording (this may help debugging cases where timers don't start
|
a timer recording (this may help debugging cases where timers don't start
|
||||||
at the expected time).
|
at the expected time).
|
||||||
|
- Made the volume, mute and power keys work when a menu is active, too (thanks
|
||||||
|
to Matthias Weingart).
|
||||||
|
205
vdr.c
205
vdr.c
@ -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.78 2001/09/23 10:59:29 kls Exp $
|
* $Id: vdr.c 1.79 2001/09/23 14:33:39 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
@ -367,106 +367,111 @@ int main(int argc, char *argv[])
|
|||||||
EITScanner.Activity();
|
EITScanner.Activity();
|
||||||
LastActivity = time(NULL);
|
LastActivity = time(NULL);
|
||||||
}
|
}
|
||||||
if (*Interact && key != kPower) {
|
// Keys that must work independent of any interactive mode:
|
||||||
switch ((*Interact)->ProcessKey(key)) {
|
switch (key) {
|
||||||
case osMenu: DELETENULL(Menu);
|
// Volume Control:
|
||||||
Menu = new cMenuMain(ReplayControl);
|
case kVolUp|k_Repeat:
|
||||||
break;
|
case kVolUp:
|
||||||
case osRecord: DELETENULL(Menu);
|
case kVolDn|k_Repeat:
|
||||||
if (!cRecordControls::Start())
|
case kVolDn:
|
||||||
Interface->Error(tr("No free DVB device to record!"));
|
cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
|
||||||
break;
|
break;
|
||||||
case osRecordings:
|
case kMute:
|
||||||
DELETENULL(Menu);
|
cDvbApi::PrimaryDvbApi->ToggleMute();
|
||||||
DELETENULL(ReplayControl);
|
break;
|
||||||
Menu = new cMenuRecordings;
|
// Power off:
|
||||||
break;
|
case kPower: isyslog(LOG_INFO, "Power button pressed");
|
||||||
case osReplay: DELETENULL(Menu);
|
DELETENULL(*Interact);
|
||||||
DELETENULL(ReplayControl);
|
if (!Shutdown) {
|
||||||
ReplayControl = new cReplayControl;
|
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
|
||||||
break;
|
|
||||||
#ifdef DVDSUPPORT
|
|
||||||
case osDVD: DELETENULL(Menu);
|
|
||||||
DELETENULL(ReplayControl);
|
|
||||||
Menu = new cMenuDVD;
|
|
||||||
break;
|
|
||||||
#endif //DVDSUPPORT
|
|
||||||
case osStopReplay:
|
|
||||||
DELETENULL(*Interact);
|
|
||||||
DELETENULL(ReplayControl);
|
|
||||||
break;
|
|
||||||
case osSwitchDvb:
|
|
||||||
DELETENULL(*Interact);
|
|
||||||
Interface->Info(tr("Switching primary DVB..."));
|
|
||||||
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
|
|
||||||
break;
|
|
||||||
case osBack:
|
|
||||||
case osEnd: DELETENULL(*Interact);
|
|
||||||
break;
|
|
||||||
default: ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
switch (key) {
|
|
||||||
// Toggle channels:
|
|
||||||
case k0: {
|
|
||||||
int CurrentChannel = cDvbApi::CurrentChannel();
|
|
||||||
Channels.SwitchTo(PreviousChannel);
|
|
||||||
PreviousChannel = CurrentChannel;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Direct Channel Select:
|
|
||||||
case k1 ... k9:
|
|
||||||
Menu = new cDisplayChannel(key);
|
|
||||||
break;
|
|
||||||
// Left/Right rotates trough channel groups:
|
|
||||||
case kLeft|k_Repeat:
|
|
||||||
case kLeft:
|
|
||||||
case kRight|k_Repeat:
|
|
||||||
case kRight:
|
|
||||||
Menu = new cDisplayChannel(NORMALKEY(key));
|
|
||||||
break;
|
|
||||||
// Up/Down Channel Select:
|
|
||||||
case kUp|k_Repeat:
|
|
||||||
case kUp:
|
|
||||||
case kDown|k_Repeat:
|
|
||||||
case kDown: {
|
|
||||||
int n = cDvbApi::CurrentChannel() + (NORMALKEY(key) == kUp ? 1 : -1);
|
|
||||||
cChannel *channel = Channels.GetByNumber(n);
|
|
||||||
if (channel)
|
|
||||||
channel->Switch();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Menu Control:
|
|
||||||
case kMenu: Menu = new cMenuMain(ReplayControl); break;
|
|
||||||
// Viewing Control:
|
|
||||||
case kOk: LastChannel = -1; break; // forces channel display
|
|
||||||
// Volume Control:
|
|
||||||
case kVolUp|k_Repeat:
|
|
||||||
case kVolUp:
|
|
||||||
case kVolDn|k_Repeat:
|
|
||||||
case kVolDn:
|
|
||||||
cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
|
|
||||||
break;
|
|
||||||
case kMute:
|
|
||||||
cDvbApi::PrimaryDvbApi->ToggleMute();
|
|
||||||
break;
|
|
||||||
// Power off:
|
|
||||||
case kPower: isyslog(LOG_INFO, "Power button pressed");
|
|
||||||
DELETENULL(*Interact);
|
|
||||||
if (!Shutdown) {
|
|
||||||
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (cRecordControls::Active()) {
|
|
||||||
if (Interface->Confirm(tr("Recording - shut down anyway?")))
|
|
||||||
ForceShutdown = true;
|
|
||||||
}
|
|
||||||
LastActivity = 1; // not 0, see below!
|
|
||||||
break;
|
break;
|
||||||
default: break;
|
}
|
||||||
}
|
if (cRecordControls::Active()) {
|
||||||
}
|
if (Interface->Confirm(tr("Recording - shut down anyway?")))
|
||||||
|
ForceShutdown = true;
|
||||||
|
}
|
||||||
|
LastActivity = 1; // not 0, see below!
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (*Interact) {
|
||||||
|
switch ((*Interact)->ProcessKey(key)) {
|
||||||
|
case osMenu: DELETENULL(Menu);
|
||||||
|
Menu = new cMenuMain(ReplayControl);
|
||||||
|
break;
|
||||||
|
case osRecord: DELETENULL(Menu);
|
||||||
|
if (!cRecordControls::Start())
|
||||||
|
Interface->Error(tr("No free DVB device to record!"));
|
||||||
|
break;
|
||||||
|
case osRecordings:
|
||||||
|
DELETENULL(Menu);
|
||||||
|
DELETENULL(ReplayControl);
|
||||||
|
Menu = new cMenuRecordings;
|
||||||
|
break;
|
||||||
|
case osReplay: DELETENULL(Menu);
|
||||||
|
DELETENULL(ReplayControl);
|
||||||
|
ReplayControl = new cReplayControl;
|
||||||
|
break;
|
||||||
|
#ifdef DVDSUPPORT
|
||||||
|
case osDVD: DELETENULL(Menu);
|
||||||
|
DELETENULL(ReplayControl);
|
||||||
|
Menu = new cMenuDVD;
|
||||||
|
break;
|
||||||
|
#endif //DVDSUPPORT
|
||||||
|
case osStopReplay:
|
||||||
|
DELETENULL(*Interact);
|
||||||
|
DELETENULL(ReplayControl);
|
||||||
|
break;
|
||||||
|
case osSwitchDvb:
|
||||||
|
DELETENULL(*Interact);
|
||||||
|
Interface->Info(tr("Switching primary DVB..."));
|
||||||
|
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
|
||||||
|
break;
|
||||||
|
case osBack:
|
||||||
|
case osEnd: DELETENULL(*Interact);
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Key functions in "normal" viewing mode:
|
||||||
|
switch (key) {
|
||||||
|
// Toggle channels:
|
||||||
|
case k0: {
|
||||||
|
int CurrentChannel = cDvbApi::CurrentChannel();
|
||||||
|
Channels.SwitchTo(PreviousChannel);
|
||||||
|
PreviousChannel = CurrentChannel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Direct Channel Select:
|
||||||
|
case k1 ... k9:
|
||||||
|
Menu = new cDisplayChannel(key);
|
||||||
|
break;
|
||||||
|
// Left/Right rotates trough channel groups:
|
||||||
|
case kLeft|k_Repeat:
|
||||||
|
case kLeft:
|
||||||
|
case kRight|k_Repeat:
|
||||||
|
case kRight:
|
||||||
|
Menu = new cDisplayChannel(NORMALKEY(key));
|
||||||
|
break;
|
||||||
|
// Up/Down Channel Select:
|
||||||
|
case kUp|k_Repeat:
|
||||||
|
case kUp:
|
||||||
|
case kDown|k_Repeat:
|
||||||
|
case kDown: {
|
||||||
|
int n = cDvbApi::CurrentChannel() + (NORMALKEY(key) == kUp ? 1 : -1);
|
||||||
|
cChannel *channel = Channels.GetByNumber(n);
|
||||||
|
if (channel)
|
||||||
|
channel->Switch();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Menu Control:
|
||||||
|
case kMenu: Menu = new cMenuMain(ReplayControl); break;
|
||||||
|
// Viewing Control:
|
||||||
|
case kOk: LastChannel = -1; break; // forces channel display
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!Menu) {
|
if (!Menu) {
|
||||||
EITScanner.Process();
|
EITScanner.Process();
|
||||||
cVideoCutter::Active();
|
cVideoCutter::Active();
|
||||||
|
Loading…
Reference in New Issue
Block a user