diff options
author | louis <louis.braun@gmx.de> | 2015-03-12 17:22:16 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-03-12 17:22:16 +0100 |
commit | 3cc8e78e1bf00e16b49520ac416b74b5fd73c906 (patch) | |
tree | 4425c4eb4b9833d927aae2f65d0f3a99d3792f83 /channeljump.c | |
download | vdr-plugin-tvguideng-3cc8e78e1bf00e16b49520ac416b74b5fd73c906.tar.gz vdr-plugin-tvguideng-3cc8e78e1bf00e16b49520ac416b74b5fd73c906.tar.bz2 |
Version 0.0.10.0.1
Diffstat (limited to 'channeljump.c')
-rw-r--r-- | channeljump.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/channeljump.c b/channeljump.c new file mode 100644 index 0000000..aeb5d40 --- /dev/null +++ b/channeljump.c @@ -0,0 +1,47 @@ +#include <vdr/channels.h>
+#include "channeljump.h"
+
+cChannelJump::cChannelJump(cViewElement *channelJump, int lastValidChannel) {
+ this->channelJump = channelJump;
+ channel = 0;
+ maxChannels = lastValidChannel;
+ startTime = 0;
+ timeout = Setup.ChannelEntryTimeout;
+}
+
+cChannelJump::~cChannelJump(void) {
+ channelJump->Clear();
+ delete channelJump;
+}
+
+void cChannelJump::Draw(void) {
+ channelJump->Clear();
+ channelJump->ClearTokens();
+ string channelString = *BuildChannelString();
+ channelJump->AddStringToken("channel", channelString);
+ channelJump->Display();
+}
+
+void cChannelJump::Set(int key) {
+ startTime = cTimeMs::Now();
+ if (channel == 0) {
+ channel = key;
+ return;
+ }
+ int newChannel = channel * 10 + key;
+ if (newChannel <= maxChannels)
+ channel = newChannel;
+}
+
+cString cChannelJump::BuildChannelString(void) {
+ if (channel*10 <= maxChannels)
+ return cString::sprintf("%d-", channel);
+ else
+ return cString::sprintf("%d", channel);
+}
+
+ bool cChannelJump::TimeOut(void) {
+ if ((cTimeMs::Now() - startTime) > timeout)
+ return true;
+ return false;
+ }
\ No newline at end of file |