Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Faster channel number input, patch



Jaakko Hyvätti wrote:
> 
>   Hi Klaus and everyone,
> 
>   Inputting channel numbers from remote can be made 1 second faster with
> the following patch.  When typing the numbers, if you only have say 20
> channels, if you type '3' vdr knows there are no channels with more digits
> in channel number and can change channel immediately without waiting for
> 1 second for the next key.
> 
>   There needs to be some tuning on channel display but I suppose someone
> can do it better than me.  Feel free to write more beautiful code too :-)

Very interesting point!

How about this implementation:

--- menu.c      2003/06/07 12:31:57     1.256
+++ menu.c      2003/06/13 14:31:15
@@ -2742,6 +2742,24 @@
                cChannel *channel = Channels.GetByNumber(number);
                DisplayChannel(channel);
                lastTime = time_ms();
+               // Lets see if there can be any useful further input:
+               int n = channel ? number : 0;
+               while (channel && (channel = Channels.Next(channel)) != NULL) {
+                     if (!channel->GroupSep()) {
+                        if (channel->Number() > n)
+                           n *= 10;
+                        if (n <= channel->Number() && channel->Number() <= n + 9) {
+                           n = 0;
+                           break;
+                           }
+                        }
+                     }
+               if (n > 0) {
+                  // This channel is the only one that fits the input, so let's take it right away:
+                  Interface->Flush(); // makes sure the user sees his last input
+                  Channels.SwitchTo(number);
+                  return osEnd;
+                  }
                }
             }
          break;


-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index