summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-09-10 14:56:18 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-09-10 14:56:18 +0200
commitbec30645904b01f95e789f720f47b769498cb4d2 (patch)
tree21cb9d204688a0675643d2f6e8e9508a08cb7719
parent61c87ad6c76431bdb774e02546e8718a9bb0f602 (diff)
downloadvdr-bec30645904b01f95e789f720f47b769498cb4d2.tar.gz
vdr-bec30645904b01f95e789f720f47b769498cb4d2.tar.bz2
Direct channel select displays digits and name on OSD
-rw-r--r--CONTRIBUTORS5
-rw-r--r--HISTORY4
-rw-r--r--config.c10
-rw-r--r--config.h3
-rw-r--r--menu.c56
-rw-r--r--menu.h13
-rw-r--r--vdr.c38
7 files changed, 94 insertions, 35 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 173afe23..9f6aa1b5 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -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
diff --git a/HISTORY b/HISTORY
index 6e9b5065..6ab0b897 100644
--- a/HISTORY
+++ b/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).
+
diff --git a/config.c b/config.c
index 48ac3e5e..188e8973 100644
--- a/config.c
+++ b/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;
diff --git a/config.h b/config.h
index 0d54ffb9..862e116f 100644
--- a/config.h
+++ b/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> {
diff --git a/menu.c b/menu.c
index 2d201a14..f4aa5d8e 100644
--- a/menu.c
+++ b/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)
diff --git a/menu.h b/menu.h
index 6ba080cb..8b4f82ef 100644
--- a/menu.h
+++ b/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;
diff --git a/vdr.c b/vdr.c
index 5d714e7a..4932bf23 100644
--- a/vdr.c
+++ b/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;