mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Direct channel select displays digits and name on OSD
This commit is contained in:
parent
61c87ad6c7
commit
bec3064590
@ -23,4 +23,7 @@ Robert Schneider <Robert.Schneider@lotus.com>
|
|||||||
for implementing EIT support for displaying the current/next info
|
for implementing EIT support for displaying the current/next info
|
||||||
|
|
||||||
Niels de Carpentier <niels@casema.net>
|
Niels de Carpentier <niels@casema.net>
|
||||||
for adding a workaround for a driver timing problem in cDvbApi::Cmd().
|
for adding a workaround for a driver timing problem in cDvbApi::Cmd()
|
||||||
|
|
||||||
|
Martin Hammerschmid <martin@hammerschmid.com>
|
||||||
|
for suggesting to display the direct channel select input on the OSD
|
||||||
|
4
HISTORY
4
HISTORY
@ -165,3 +165,7 @@ Video Disk Recorder Revision History
|
|||||||
be disabled via the "Setup" menu.
|
be disabled via the "Setup" menu.
|
||||||
- The "current/next" display now only shows those lines that actually contain
|
- The "current/next" display now only shows those lines that actually contain
|
||||||
information.
|
information.
|
||||||
|
- When directly selecting a channel by entering the channel number, the digits
|
||||||
|
entered so far together with the name of that channel are displayed on the
|
||||||
|
OSD (suggested by Martin Hammerschmid).
|
||||||
|
|
||||||
|
10
config.c
10
config.c
@ -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: config.c 1.20 2000/09/10 10:30:15 kls Exp $
|
* $Id: config.c 1.21 2000/09/10 14:32:45 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -560,6 +560,14 @@ const char *cChannels::GetChannelNameByNumber(int Number)
|
|||||||
return channel ? channel->name : NULL;
|
return channel ? channel->name : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eKeys cChannels::ShowChannel(int Number, bool Switched, bool Group)
|
||||||
|
{
|
||||||
|
cChannel *channel = Group ? Get(Number) : GetByNumber(Number);
|
||||||
|
if (channel)
|
||||||
|
return Interface.DisplayChannel(channel->number, channel->name, !Switched || Setup.ShowInfoOnChSwitch);
|
||||||
|
return kNone;
|
||||||
|
}
|
||||||
|
|
||||||
// -- cTimers ----------------------------------------------------------------
|
// -- cTimers ----------------------------------------------------------------
|
||||||
|
|
||||||
cTimers Timers;
|
cTimers Timers;
|
||||||
|
3
config.h
3
config.h
@ -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: config.h 1.17 2000/09/10 10:29:05 kls Exp $
|
* $Id: config.h 1.18 2000/09/10 14:32:05 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
@ -199,6 +199,7 @@ public:
|
|||||||
const char *GetChannelNameByNumber(int Number);
|
const char *GetChannelNameByNumber(int Number);
|
||||||
bool SwitchTo(int Number, cDvbApi *DvbApi = NULL);
|
bool SwitchTo(int Number, cDvbApi *DvbApi = NULL);
|
||||||
int MaxNumber(void) { return maxNumber; }
|
int MaxNumber(void) { return maxNumber; }
|
||||||
|
eKeys ShowChannel(int Number, bool Switched, bool Group = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cTimers : public cConfig<cTimer> {
|
class cTimers : public cConfig<cTimer> {
|
||||||
|
56
menu.c
56
menu.c
@ -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: menu.c 1.24 2000/09/10 10:28:46 kls Exp $
|
* $Id: menu.c 1.25 2000/09/10 14:45:29 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -1163,6 +1163,60 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- cDirectChannelSelect --------------------------------------------------
|
||||||
|
|
||||||
|
#define DIRECTCHANNELTIMEOUT 500 //ms
|
||||||
|
|
||||||
|
cDirectChannelSelect::cDirectChannelSelect(eKeys FirstKey)
|
||||||
|
:cOsdBase(true)
|
||||||
|
{
|
||||||
|
oldNumber = CurrentChannel;
|
||||||
|
number = 0;
|
||||||
|
lastTime = time_ms();
|
||||||
|
Interface.Open(MenuColumns, 1);
|
||||||
|
ProcessKey(FirstKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
cDirectChannelSelect::~cDirectChannelSelect()
|
||||||
|
{
|
||||||
|
if (number < 0)
|
||||||
|
Interface.DisplayChannel(oldNumber);
|
||||||
|
Interface.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
eOSState cDirectChannelSelect::ProcessKey(eKeys Key)
|
||||||
|
{
|
||||||
|
switch (Key) {
|
||||||
|
case k0: case k1: case k2: case k3: case k4: case k5: case k6: case k7: case k8: case k9:
|
||||||
|
if (number >= 0) {
|
||||||
|
number = number * 10 + Key - k0;
|
||||||
|
cChannel *channel = Channels.GetByNumber(number);
|
||||||
|
char *Name = channel ? channel->name : "*** Invalid Channel ***";
|
||||||
|
int BufSize = MenuColumns + 1;
|
||||||
|
char buffer[BufSize];
|
||||||
|
snprintf(buffer, BufSize, "%d %s", number, Name);
|
||||||
|
Interface.DisplayChannel(number);
|
||||||
|
Interface.Clear();
|
||||||
|
Interface.Write(0, 0, buffer);
|
||||||
|
lastTime = time_ms();
|
||||||
|
if (!channel) {
|
||||||
|
number = -1;
|
||||||
|
lastTime += 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kNone:
|
||||||
|
if (time_ms() - lastTime > DIRECTCHANNELTIMEOUT) {
|
||||||
|
if (number > 0 && !Channels.SwitchTo(number))
|
||||||
|
number = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
default: return osEnd;
|
||||||
|
};
|
||||||
|
return osContinue;
|
||||||
|
}
|
||||||
|
|
||||||
// --- cRecordControl --------------------------------------------------------
|
// --- cRecordControl --------------------------------------------------------
|
||||||
|
|
||||||
cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer)
|
cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer)
|
||||||
|
13
menu.h
13
menu.h
@ -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: menu.h 1.9 2000/05/01 15:16:23 kls Exp $
|
* $Id: menu.h 1.10 2000/09/10 14:42:20 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MENU_H
|
#ifndef _MENU_H
|
||||||
@ -23,6 +23,17 @@ public:
|
|||||||
virtual eOSState ProcessKey(eKeys Key);
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class cDirectChannelSelect : public cOsdBase {
|
||||||
|
private:
|
||||||
|
int oldNumber;
|
||||||
|
int number;
|
||||||
|
int lastTime;
|
||||||
|
public:
|
||||||
|
cDirectChannelSelect(eKeys FirstKey);
|
||||||
|
virtual ~cDirectChannelSelect();
|
||||||
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
|
};
|
||||||
|
|
||||||
class cRecordControl {
|
class cRecordControl {
|
||||||
private:
|
private:
|
||||||
cDvbApi *dvbApi;
|
cDvbApi *dvbApi;
|
||||||
|
38
vdr.c
38
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.29 2000/09/10 10:42:32 kls Exp $
|
* $Id: vdr.c 1.30 2000/09/10 14:33:09 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -44,8 +44,6 @@
|
|||||||
#define KEYS_CONF "keys.conf"
|
#define KEYS_CONF "keys.conf"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DIRECTCHANNELTIMEOUT 500 //ms
|
|
||||||
|
|
||||||
static int Interrupted = 0;
|
static int Interrupted = 0;
|
||||||
|
|
||||||
void SignalHandler(int signum)
|
void SignalHandler(int signum)
|
||||||
@ -53,14 +51,6 @@ void SignalHandler(int signum)
|
|||||||
Interrupted = signum;
|
Interrupted = signum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static eKeys ShowChannel(int Number, bool Switched, bool Group = false)
|
|
||||||
{
|
|
||||||
cChannel *channel = Group ? Channels.Get(Number) : Channels.GetByNumber(Number);
|
|
||||||
if (channel)
|
|
||||||
return Interface.DisplayChannel(channel->number, channel->name, !Switched || Setup.ShowInfoOnChSwitch);
|
|
||||||
return kNone;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Command line options:
|
// Command line options:
|
||||||
@ -188,24 +178,17 @@ int main(int argc, char *argv[])
|
|||||||
// Main program loop:
|
// Main program loop:
|
||||||
|
|
||||||
cSVDRP *SVDRP = SVDRPport ? new cSVDRP(SVDRPport) : NULL;
|
cSVDRP *SVDRP = SVDRPport ? new cSVDRP(SVDRPport) : NULL;
|
||||||
cMenuMain *Menu = NULL;
|
cOsdBase *Menu = NULL;
|
||||||
cReplayControl *ReplayControl = NULL;
|
cReplayControl *ReplayControl = NULL;
|
||||||
int dcTime = 0, dcNumber = 0;
|
|
||||||
int LastChannel = -1;
|
int LastChannel = -1;
|
||||||
|
|
||||||
while (!Interrupted) {
|
while (!Interrupted) {
|
||||||
// Channel display:
|
// Channel display:
|
||||||
if (CurrentChannel != LastChannel) {
|
if (CurrentChannel != LastChannel) {
|
||||||
if (!Menu)
|
if (!Menu)
|
||||||
ShowChannel(CurrentChannel, LastChannel > 0);
|
Channels.ShowChannel(CurrentChannel, LastChannel > 0);
|
||||||
LastChannel = CurrentChannel;
|
LastChannel = CurrentChannel;
|
||||||
}
|
}
|
||||||
// Direct Channel Select (action):
|
|
||||||
if (dcNumber && time_ms() - dcTime > DIRECTCHANNELTIMEOUT) {
|
|
||||||
Channels.SwitchTo(dcNumber);
|
|
||||||
dcNumber = 0;
|
|
||||||
LastChannel = -1; // in case an invalid channel number was entered!
|
|
||||||
}
|
|
||||||
// Timers and Recordings:
|
// Timers and Recordings:
|
||||||
if (!Menu) {
|
if (!Menu) {
|
||||||
cTimer *Timer = cTimer::GetMatch();
|
cTimer *Timer = cTimer::GetMatch();
|
||||||
@ -217,7 +200,7 @@ int main(int argc, char *argv[])
|
|||||||
cRecordControls::Process();
|
cRecordControls::Process();
|
||||||
}
|
}
|
||||||
// User Input:
|
// User Input:
|
||||||
cOsdBase **Interact = Menu ? (cOsdBase **)&Menu : (cOsdBase **)&ReplayControl;
|
cOsdBase **Interact = Menu ? &Menu : (cOsdBase **)&ReplayControl;
|
||||||
eKeys key = Interface.GetKey(!*Interact || !(*Interact)->NeedsFastResponse());
|
eKeys key = Interface.GetKey(!*Interact || !(*Interact)->NeedsFastResponse());
|
||||||
if (*Interact) {
|
if (*Interact) {
|
||||||
switch ((*Interact)->ProcessKey(key)) {
|
switch ((*Interact)->ProcessKey(key)) {
|
||||||
@ -249,15 +232,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
// Direct Channel Select (input):
|
// Direct Channel Select:
|
||||||
case k0: case k1: case k2: case k3: case k4: case k5: case k6: case k7: case k8: case k9:
|
case k0: case k1: case k2: case k3: case k4: case k5: case k6: case k7: case k8: case k9:
|
||||||
{
|
if (!Interface.Recording())
|
||||||
if (!Interface.Recording()) {
|
Menu = new cDirectChannelSelect(key);
|
||||||
dcNumber = dcNumber * 10 + key - k0;
|
|
||||||
dcTime = time_ms();
|
|
||||||
Interface.DisplayChannel(dcNumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
// Left/Right rotates trough channel groups:
|
// Left/Right rotates trough channel groups:
|
||||||
case kLeft:
|
case kLeft:
|
||||||
@ -269,7 +247,7 @@ int main(int argc, char *argv[])
|
|||||||
CurrentGroup = Channels.GetPrevGroup(CurrentGroup < 1 ? 1 : CurrentGroup);
|
CurrentGroup = Channels.GetPrevGroup(CurrentGroup < 1 ? 1 : CurrentGroup);
|
||||||
if (CurrentGroup < 0)
|
if (CurrentGroup < 0)
|
||||||
CurrentGroup = SaveGroup;
|
CurrentGroup = SaveGroup;
|
||||||
if (ShowChannel(CurrentGroup, false, true) == kOk)
|
if (Channels.ShowChannel(CurrentGroup, false, true) == kOk)
|
||||||
Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(CurrentGroup))->number);
|
Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(CurrentGroup))->number);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user