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
|
||||
|
||||
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.
|
||||
- The "current/next" display now only shows those lines that actually contain
|
||||
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
|
||||
* 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"
|
||||
@ -560,6 +560,14 @@ const char *cChannels::GetChannelNameByNumber(int Number)
|
||||
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 Timers;
|
||||
|
3
config.h
3
config.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* 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
|
||||
@ -199,6 +199,7 @@ public:
|
||||
const char *GetChannelNameByNumber(int Number);
|
||||
bool SwitchTo(int Number, cDvbApi *DvbApi = NULL);
|
||||
int MaxNumber(void) { return maxNumber; }
|
||||
eKeys ShowChannel(int Number, bool Switched, bool Group = false);
|
||||
};
|
||||
|
||||
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
|
||||
* 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"
|
||||
@ -1163,6 +1163,60 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
|
||||
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(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
|
||||
* 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
|
||||
@ -23,6 +23,17 @@ public:
|
||||
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 {
|
||||
private:
|
||||
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
|
||||
*
|
||||
* $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>
|
||||
@ -44,8 +44,6 @@
|
||||
#define KEYS_CONF "keys.conf"
|
||||
#endif
|
||||
|
||||
#define DIRECTCHANNELTIMEOUT 500 //ms
|
||||
|
||||
static int Interrupted = 0;
|
||||
|
||||
void SignalHandler(int signum)
|
||||
@ -53,14 +51,6 @@ void SignalHandler(int 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[])
|
||||
{
|
||||
// Command line options:
|
||||
@ -188,24 +178,17 @@ int main(int argc, char *argv[])
|
||||
// Main program loop:
|
||||
|
||||
cSVDRP *SVDRP = SVDRPport ? new cSVDRP(SVDRPport) : NULL;
|
||||
cMenuMain *Menu = NULL;
|
||||
cOsdBase *Menu = NULL;
|
||||
cReplayControl *ReplayControl = NULL;
|
||||
int dcTime = 0, dcNumber = 0;
|
||||
int LastChannel = -1;
|
||||
|
||||
while (!Interrupted) {
|
||||
// Channel display:
|
||||
if (CurrentChannel != LastChannel) {
|
||||
if (!Menu)
|
||||
ShowChannel(CurrentChannel, LastChannel > 0);
|
||||
Channels.ShowChannel(CurrentChannel, LastChannel > 0);
|
||||
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:
|
||||
if (!Menu) {
|
||||
cTimer *Timer = cTimer::GetMatch();
|
||||
@ -217,7 +200,7 @@ int main(int argc, char *argv[])
|
||||
cRecordControls::Process();
|
||||
}
|
||||
// User Input:
|
||||
cOsdBase **Interact = Menu ? (cOsdBase **)&Menu : (cOsdBase **)&ReplayControl;
|
||||
cOsdBase **Interact = Menu ? &Menu : (cOsdBase **)&ReplayControl;
|
||||
eKeys key = Interface.GetKey(!*Interact || !(*Interact)->NeedsFastResponse());
|
||||
if (*Interact) {
|
||||
switch ((*Interact)->ProcessKey(key)) {
|
||||
@ -249,15 +232,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else {
|
||||
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:
|
||||
{
|
||||
if (!Interface.Recording()) {
|
||||
dcNumber = dcNumber * 10 + key - k0;
|
||||
dcTime = time_ms();
|
||||
Interface.DisplayChannel(dcNumber);
|
||||
}
|
||||
}
|
||||
if (!Interface.Recording())
|
||||
Menu = new cDirectChannelSelect(key);
|
||||
break;
|
||||
// Left/Right rotates trough channel groups:
|
||||
case kLeft:
|
||||
@ -269,7 +247,7 @@ int main(int argc, char *argv[])
|
||||
CurrentGroup = Channels.GetPrevGroup(CurrentGroup < 1 ? 1 : CurrentGroup);
|
||||
if (CurrentGroup < 0)
|
||||
CurrentGroup = SaveGroup;
|
||||
if (ShowChannel(CurrentGroup, false, true) == kOk)
|
||||
if (Channels.ShowChannel(CurrentGroup, false, true) == kOk)
|
||||
Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(CurrentGroup))->number);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user