Ticket #6153: mythtv_ticket_6153_patch.txt

File mythtv_ticket_6153_patch.txt, 1.6 KB (added by jkcko@…, 15 years ago)

PATCH

Line 
1Index: libs/libmythtv/guidegrid.cpp
2===================================================================
3--- libs/libmythtv/guidegrid.cpp        (revision 20550)
4+++ libs/libmythtv/guidegrid.cpp        (working copy)
5@@ -2157,20 +2157,35 @@
6     // Not the best method, but the channel list is small and this isn't time critical
7     // Go through until the ith channel is equal to or greater than the one we're looking for
8 
9-    for (i=0; (i < GetChannelCount()-1) &&
10-             (GetChannelInfo(i)->channum.toInt() < jumpToChannel); i++);
11+    if (sortReverse)
12+    {
13+        for (i=GetChannelCount()-2; (i>0) &&
14+                 (GetChannelInfo(i)->channum.toInt() < jumpToChannel); i--);
15     
16-    if ((i > 0) &&
17-        ((GetChannelInfo(i)->channum.toInt() - jumpToChannel) >
18-         (jumpToChannel - GetChannelInfo(i-1)->channum.toInt())))
19+        if ((i < GetChannelCount()-2) &&
20+            ((GetChannelInfo(i)->channum.toInt() - jumpToChannel) >
21+             (jumpToChannel - GetChannelInfo(i+1)->channum.toInt())))
22+        {
23+            i++;
24+        }
25+    }
26+    else
27     {
28-        i--;
29+        for (i=0; (i < GetChannelCount()-1) &&
30+                 (GetChannelInfo(i)->channum.toInt() < jumpToChannel); i++);
31+   
32+        if ((i > 0) &&
33+            ((GetChannelInfo(i)->channum.toInt() - jumpToChannel) >
34+             (jumpToChannel - GetChannelInfo(i-1)->channum.toInt())))
35+        {
36+            i--;
37+        }
38     }
39 
40     // DISPLAY_CHANS to center
41     setStartChannel(i-DISPLAY_CHANS/2);
42     m_currentRow = DISPLAY_CHANS/2;
43-   
44+
45     fillProgramInfos();
46 
47     repaint(fullRect, false);
48