summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-09-09 14:57:43 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-09-09 14:57:43 +0200
commitc00d4ea326e61d76d7ab5760a5c06646d6b88ab0 (patch)
tree2462fd5c1759f451d8f1c54cedc10b5b0d74cfd1 /vdr.c
parentd4eb96f725bed149762665ddee275301c9f069a6 (diff)
downloadvdr-c00d4ea326e61d76d7ab5760a5c06646d6b88ab0.tar.gz
vdr-c00d4ea326e61d76d7ab5760a5c06646d6b88ab0.tar.bz2
Implemented 'channel grouping'
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/vdr.c b/vdr.c
index 69eceedb..5e322390 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.27 2000/07/29 19:01:57 kls Exp $
+ * $Id: vdr.c 1.28 2000/09/09 14:18:25 kls Exp $
*/
#include <getopt.h>
@@ -53,6 +53,14 @@ void SignalHandler(int signum)
Interrupted = signum;
}
+static eKeys ShowChannel(int Number, bool Group = false)
+{
+ cChannel *channel = Group ? Channels.Get(Number) : Channels.GetByNumber(Number);
+ if (channel)
+ return Interface.DisplayChannel(channel->number, channel->name);
+ return kNone;
+}
+
int main(int argc, char *argv[])
{
// Command line options:
@@ -166,7 +174,7 @@ int main(int argc, char *argv[])
#endif
Interface.Init();
- cChannel::SwitchTo(CurrentChannel);
+ Channels.SwitchTo(CurrentChannel);
// Signal handlers:
@@ -185,16 +193,13 @@ int main(int argc, char *argv[])
while (!Interrupted) {
// Channel display:
if (CurrentChannel != LastChannel) {
- if (!Menu) {
- cChannel *channel = Channels.Get(CurrentChannel);
- if (channel)
- Interface.DisplayChannel(CurrentChannel + 1, channel->name);
- }
+ if (!Menu)
+ ShowChannel(CurrentChannel);
LastChannel = CurrentChannel;
}
// Direct Channel Select (action):
if (dcNumber && time_ms() - dcTime > DIRECTCHANNELTIMEOUT) {
- cChannel::SwitchTo(dcNumber - 1);
+ Channels.SwitchTo(dcNumber);
dcNumber = 0;
LastChannel = -1; // in case an invalid channel number was entered!
}
@@ -246,11 +251,25 @@ int main(int argc, char *argv[])
}
}
break;
+ // Left/Right rotates trough channel groups:
+ case kLeft:
+ case kRight: if (!Interface.Recording()) {
+ int SaveGroup = CurrentGroup;
+ if (key == kRight)
+ CurrentGroup = Channels.GetNextGroup(CurrentGroup) ;
+ else
+ CurrentGroup = Channels.GetPrevGroup(CurrentGroup < 1 ? 1 : CurrentGroup);
+ if (CurrentGroup < 0)
+ CurrentGroup = SaveGroup;
+ if (ShowChannel(CurrentGroup, true) == kOk)
+ Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(CurrentGroup))->number);
+ }
+ break;
// Up/Down Channel Select:
case kUp:
case kDown: if (!Interface.Recording()) {
int n = CurrentChannel + (key == kUp ? 1 : -1);
- cChannel *channel = Channels.Get(n);
+ cChannel *channel = Channels.GetByNumber(n);
if (channel)
channel->Switch();
}