[mythtv] [patch] Add LCD output to playbackbox

Leo Weppelman leo at wau.mis.ah.nl
Sat Jan 1 22:05:55 UTC 2005


Apart from adding the code to generate the lcd munu items, I had to
change the subtitle quote used from " to ' to make things work with the
lcd code.

Leo.
-------------- next part --------------
Index: playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.180
diff -u -r1.180 playbackbox.cpp
--- playbackbox.cpp	24 Dec 2004 23:24:07 -0000	1.180
+++ playbackbox.cpp	1 Jan 2005 21:59:33 -0000
@@ -27,6 +27,7 @@
 #include "oldsettings.h"
 #include "NuppelVideoPlayer.h"
 #include "yuv2rgb.h"
+#include "lcddevice.h"
 
 #include "mythcontext.h"
 #include "programinfo.h"
@@ -835,6 +836,12 @@
     pix.fill(this, pr.topLeft());
     QPainter tmp(&pix);
 
+    class LCD * lcddev = LCD::Get();
+    QString lcdTitle;
+    QPtrList<LCDMenuItem> lcdItems;
+    lcdItems.setAutoDelete(true);
+
+
     container = theme->GetSet("selector");
 
     ProgramInfo *tempInfo;
@@ -867,14 +874,41 @@
 
             for (int cnt = 0; cnt < ltype->GetItems(); cnt++)
             {
+                QString tstring;
                 if (titleList[h] == "")
-                    ltype->SetItemText(cnt, groupDisplayName);
+                    tstring =  groupDisplayName;
                 else
-                    ltype->SetItemText(cnt, titleList[h]);
+                    tstring = titleList[h];
+
+                ltype->SetItemText(cnt, tstring);
+                if (lcddev && inTitle) {
+                    lcdItems.append(new LCDMenuItem(0, NOTCHECKABLE, tstring));
+                }
+
                 h = ++h % titleList.count();
              }
         }
 
+        UITextType *typeText = (UITextType *)container->GetType("current");
+        if (typeText)
+        {
+            QString tstring;
+
+            if (titleList[titleIndex] == "")
+                tstring = groupDisplayName;
+            else
+                tstring = titleList[titleIndex];
+            typeText->SetText(tstring);
+            if (lcddev) {
+                if(inTitle) {
+                    lcdItems.append(new LCDMenuItem(1, NOTCHECKABLE, tstring));
+                    lcdTitle = "Recordings";
+                }
+                else
+                    lcdTitle = " <<" + tstring;
+            }
+        }
+
         ltype = (UIListType *)container->GetType("bottomtitles");
         if (ltype)
         {
@@ -884,25 +918,23 @@
             int h = titleIndex + 1;
             h = h % titleList.count();
 
+            QString tstring;
+
             for (int cnt = 0; cnt < ltype->GetItems(); cnt++)
             {
                 if (titleList[h] == "")
-                    ltype->SetItemText(cnt, groupDisplayName);
+                    tstring = groupDisplayName;
                 else
-                    ltype->SetItemText(cnt, titleList[h]);
+                    tstring = titleList[h];
+
+                ltype->SetItemText(cnt, tstring);
+                if (lcddev && inTitle) {
+                    lcdItems.append(new LCDMenuItem(0, NOTCHECKABLE, tstring));
+                }
                 h = ++h % titleList.count();
             }
         }
 
-        UITextType *typeText = (UITextType *)container->GetType("current");
-        if (typeText)
-        {
-            if (titleList[titleIndex] == "")
-                typeText->SetText(groupDisplayName);
-            else
-                typeText->SetText(titleList[titleIndex]);
-        }
-
         ltype = (UIListType *)container->GetType("showing");
         if (ltype)
         {
@@ -940,8 +972,8 @@
                 if ((tempInfo->subtitle).stripWhiteSpace().length() > 0 
                     && titleList[titleIndex] == "")
                 {
-                    tempSubTitle = tempSubTitle + " - \"" + 
-                        tempInfo->subtitle + "\"";
+                    tempSubTitle = tempSubTitle + " - '" + 
+                        tempInfo->subtitle + "'";
                 }
 
                 tempDate = (tempInfo->startts).toString(showDateFormat);
@@ -955,6 +987,11 @@
                     curitem = new ProgramInfo(*tempInfo);
                     ltype->SetItemCurrent(cnt);
                 }
+                if (lcddev && !inTitle) {
+                    lcdItems.append(new LCDMenuItem(skip + cnt == progIndex,
+                                       NOTCHECKABLE,
+                                       tempSubTitle + " " + tempDate));
+                }
 
                 ltype->SetItemText(cnt, 1, tempSubTitle);
                 ltype->SetItemText(cnt, 2, tempDate);
@@ -968,6 +1005,10 @@
 
         } 
     } 
+    if (lcddev) {
+            if (!lcdItems.isEmpty())
+                lcddev->switchToMenu(&lcdItems, lcdTitle);
+    }
 
     // DRAW LAYERS
     if (container && type != Delete)


More information about the mythtv-dev mailing list