[mythtv] New Program Listing Screen

David Engel dlengel at attbi.com
Sun Jul 13 22:25:28 EDT 2003


This patch adds a new screen for listing the upcoming showings of a
single program.  I didn't include the new themes/default/pl-lines.png
and themes/default/pl-selectbar.png files since they are the same as
their rk- equivalents.

I realize this screen duplicates some of the functionality of the
Program Finder screen.  I added this new screen for two reasons.
First, I wanted the channel and subtitle information always visible to
more easily find the showings I'm interested in.  With the Program
Finder screen, this information is only visible when the particular
showing is highlighted.  Second, I wanted to view the upcoming
showings from multiple places within mythfrontend.  Besides from the
Program Finder screen, this new screen can be called from the Program
Guide and Resolve Conflicts screens.

Since this is my first foray into the graphical and database sides of
mythtv, please be merciful in your criticisms.  Let me know what I've
done wrong and I'll try to fix it.

David
-- 
David Engel
dlengel at attbi.com
-------------- next part --------------
Index: libs/libmythtv/guidegrid.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/guidegrid.cpp,v
retrieving revision 1.122
diff -u -r1.122 guidegrid.cpp
--- libs/libmythtv/guidegrid.cpp	9 Jul 2003 07:36:48 -0000	1.122
+++ libs/libmythtv/guidegrid.cpp	14 Jul 2003 02:01:36 -0000
@@ -26,6 +26,7 @@
 #include "oldsettings.h"
 #include "tv.h"
 #include "progfind.h"
+#include "proglist.h"
 #include "util.h"
 
 QString RunProgramGuide(QString startchannel, bool thread, TV *player)
@@ -256,6 +257,7 @@
         case Key_PageDown: case Key_9: pageDown(); break;
       
         case Key_4: toggleGuideListing(); break;
+        case Key_5: showProgLister(); break;
         case Key_6: showProgFinder(); break;   
       
         case Key_Slash: toggleChannelFavorite(); break;
@@ -1396,6 +1398,29 @@
     update(fullRect);
 }
  
+void GuideGrid::showProgLister()
+{
+    ProgramInfo *pginfo = m_programInfos[m_currentRow][m_currentCol];
+
+    if (!pginfo || pginfo->title == unknownTitle)
+        return;
+
+    showInfo = 1;
+
+    ProgLister *pl = new ProgLister(pginfo->title, m_db, 
+	gContext->GetMainWindow(), "proglist");
+    pl->exec();
+    delete pl;
+
+    showInfo = 0;
+
+    setActiveWindow();
+    setFocus();
+
+    fillProgramInfos();
+    update(fullRect);
+}
+
 void GuideGrid::showProgFinder()
 {
     showInfo = 1;
Index: libs/libmythtv/guidegrid.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/guidegrid.h,v
retrieving revision 1.46
diff -u -r1.46 guidegrid.h
--- libs/libmythtv/guidegrid.h	14 Jun 2003 23:21:15 -0000	1.46
+++ libs/libmythtv/guidegrid.h	14 Jul 2003 02:01:36 -0000
@@ -66,6 +66,7 @@
     void escape();
 
     void showProgFinder();
+    void showProgLister();
     void channelUpdate();
 
     void quickRecord();
Index: libs/libmythtv/libmythtv.pro
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/libmythtv.pro,v
retrieving revision 1.30
diff -u -r1.30 libmythtv.pro
--- libs/libmythtv/libmythtv.pro	15 May 2003 02:16:26 -0000	1.30
+++ libs/libmythtv/libmythtv.pro	14 Jul 2003 02:01:36 -0000
@@ -23,7 +23,7 @@
 HEADERS += ttfont.h tv_play.h tv_rec.h videosource.h XJ.h yuv2rgb.h
 HEADERS += progfind.h decoderbase.h nuppeldecoder.h avformatdecoder.h
 HEADERS += recorderbase.h mpegrecorder.h channelbase.h dvbrecorder.h
-HEADERS += dvbchannel.h vsync.h
+HEADERS += dvbchannel.h vsync.h proglist.h
 
 SOURCES += channel.cpp commercial_skip.cpp filter.c frequencies.c guidegrid.cpp
 SOURCES += infodialog.cpp infostructs.cpp jitterometer.cpp minilzo.cpp 
@@ -33,4 +33,4 @@
 SOURCES += ttfont.cpp tv_play.cpp tv_rec.cpp videosource.cpp XJ.cpp yuv2rgb.cpp
 SOURCES += progfind.cpp nuppeldecoder.cpp avformatdecoder.cpp recorderbase.cpp
 SOURCES += mpegrecorder.cpp channelbase.cpp dvbrecorder.cpp dvbchannel.cpp
-SOURCES += vsync.c
+SOURCES += vsync.c proglist.cpp
Index: libs/libmythtv/progfind.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/progfind.cpp,v
retrieving revision 1.32
diff -u -r1.32 progfind.cpp
--- libs/libmythtv/progfind.cpp	9 Jul 2003 07:36:48 -0000	1.32
+++ libs/libmythtv/progfind.cpp	14 Jul 2003 02:01:40 -0000
@@ -25,6 +25,7 @@
 #include "programinfo.h"
 #include "oldsettings.h"
 #include "tv.h"
+#include "proglist.h"
 
 using namespace std;
 
@@ -167,6 +168,7 @@
         case Key_PageDown: case Key_9: pageDown(); break;
 
         case Key_4: showGuide(); break;
+	case Key_5: showProgLister(); break;
 
         case Key_C: case Key_M: case Key_Escape: escape(); break;
  
@@ -388,6 +390,21 @@
 
     unsetCursor();
     emit accept();
+}
+
+void ProgFinder::showProgLister()
+{
+    if (inSearch != 1)
+	return;
+
+    showInfo = true;
+
+    ProgLister *pl = new ProgLister(progData[curProgram], m_db, 
+	gContext->GetMainWindow(), "proglist");
+    pl->exec();
+    delete pl;
+
+    showInfo = false;
 }
 
 void ProgFinder::LoadWindow(QDomElement &element)
Index: libs/libmythtv/progfind.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/progfind.h,v
retrieving revision 1.11
diff -u -r1.11 progfind.h
--- libs/libmythtv/progfind.h	14 Jun 2003 23:21:16 -0000	1.11
+++ libs/libmythtv/progfind.h	14 Jul 2003 02:01:40 -0000
@@ -70,6 +70,7 @@
     void cursorUp();
     void getInfo();
     void showGuide();
+    void showProgLister();
     void pageUp();
     void pageDown();
     void select();
Index: libs/libmythtv/programinfo.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/programinfo.cpp,v
retrieving revision 1.62
diff -u -r1.62 programinfo.cpp
--- libs/libmythtv/programinfo.cpp	9 Jul 2003 07:36:48 -0000	1.62
+++ libs/libmythtv/programinfo.cpp	14 Jul 2003 02:01:40 -0000
@@ -256,21 +256,16 @@
     return startts.secsTo(endts);
 }
 
-void ProgramInfo::GetProgramRangeDateTime(QSqlDatabase *db,
+void ProgramInfo::GetProgramListByQuery(QSqlDatabase *db,
                                           QPtrList<ProgramInfo> *proglist, 
-                                          const QString &channel, 
-                                          const QString &ltime,
-                                          const QString &rtime)
+					  const QString &where)
 {
     QString thequery;
 
     thequery = QString("SELECT channel.chanid,starttime,endtime,title,subtitle,"
                        "description,category,channel.channum,channel.callsign, "
-                       "channel.name FROM program,channel "
-                       "WHERE program.chanid = %1 AND endtime >= %1 AND "
-                       "starttime <= %3 AND program.chanid = channel.chanid "
-                       "ORDER BY starttime;")
-                       .arg(channel).arg(ltime).arg(rtime);
+                       "channel.name FROM program,channel ") + where;
+
     // allowed to use default connection
     QSqlQuery query = db->exec(thequery);
 
@@ -306,6 +301,22 @@
             proglist->append(proginfo);
         }
     }
+}    
+
+void ProgramInfo::GetProgramRangeDateTime(QSqlDatabase *db,
+                                          QPtrList<ProgramInfo> *proglist, 
+                                          const QString &channel, 
+                                          const QString &ltime,
+                                          const QString &rtime)
+{
+    QString where;
+
+    where = QString("WHERE program.chanid = %1 AND endtime >= %1 AND "
+		    "starttime <= %3 AND program.chanid = channel.chanid "
+		    "ORDER BY starttime;")
+                    .arg(channel).arg(ltime).arg(rtime);
+
+    GetProgramListByQuery(db, proglist, where);
 }    
 
 ProgramInfo *ProgramInfo::GetProgramAtDateTime(QSqlDatabase *db,
Index: libs/libmythtv/programinfo.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/programinfo.h,v
retrieving revision 1.45
diff -u -r1.45 programinfo.h
--- libs/libmythtv/programinfo.h	13 Jul 2003 00:28:53 -0000	1.45
+++ libs/libmythtv/programinfo.h	14 Jul 2003 02:01:40 -0000
@@ -112,6 +112,9 @@
 
     void DeleteHistory(QSqlDatabase *db);
 
+    static void GetProgramListByQuery(QSqlDatabase *db,
+                                        QPtrList<ProgramInfo> *proglist, 
+                                        const QString &where);
     static void GetProgramRangeDateTime(QSqlDatabase *db,
                                         QPtrList<ProgramInfo> *proglist, 
                                         const QString &channel, 
Index: programs/mythfrontend/viewscheduled.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/viewscheduled.cpp,v
retrieving revision 1.58
diff -u -r1.58 viewscheduled.cpp
--- programs/mythfrontend/viewscheduled.cpp	9 Jul 2003 07:36:49 -0000	1.58
+++ programs/mythfrontend/viewscheduled.cpp	14 Jul 2003 02:01:43 -0000
@@ -20,6 +20,7 @@
 #include "dialogbox.h"
 #include "mythcontext.h"
 #include "remoteutil.h"
+#include "proglist.h"
 
 ViewScheduled::ViewScheduled(QSqlDatabase *ldb, MythMainWindow *parent, 
                              const char *name)
@@ -102,6 +103,7 @@
         switch (e->key())
         {
             case Key_Space: case Key_Enter: case Key_Return: selected(); return;
+	    case Key_5: showProgLister(); return;
             case Key_I: edit(); return;
             default: break;
         }
@@ -700,6 +702,28 @@
         FillList();
         update(fullRect);
     }
+
+    doingSel = false;
+}
+
+void ViewScheduled::showProgLister()
+{
+    if (doingSel)
+        return;
+
+    doingSel = true;
+
+    MythContext::KickDatabase(db);
+
+    ProgLister *pl = new ProgLister(curitem->title, db,
+	gContext->GetMainWindow(), "proglist");
+    pl->exec();
+    delete pl;
+
+    ScheduledRecording::signalChange(db);
+
+    FillList();
+    update(fullRect);
 
     doingSel = false;
 }
Index: programs/mythfrontend/viewscheduled.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/viewscheduled.h,v
retrieving revision 1.21
diff -u -r1.21 viewscheduled.h
--- programs/mythfrontend/viewscheduled.h	2 Jul 2003 06:12:13 -0000	1.21
+++ programs/mythfrontend/viewscheduled.h	14 Jul 2003 02:01:43 -0000
@@ -39,6 +39,7 @@
     void handleDuplicate(ProgramInfo *rec);
     void handleNotRecording(ProgramInfo *rec);
     void chooseConflictingProgram(ProgramInfo *rec);
+    void showProgLister(void);
 
     void grayOut(QPainter *);
     void updateBackground(void);
Index: themes/blue/ui.xml
===================================================================
RCS file: /var/lib/mythcvs/mythtv/themes/blue/ui.xml,v
retrieving revision 1.19
diff -u -r1.19 ui.xml
--- themes/blue/ui.xml	9 Jul 2003 07:36:49 -0000	1.19
+++ themes/blue/ui.xml	14 Jul 2003 02:01:43 -0000
@@ -1627,4 +1627,120 @@
  
   </window>
 
+  <window name="programlist">
+
+    <font name="active_font" face="Arial">
+      <color>#ffffff</color>
+      <size>16</size>
+      <bold>yes</bold>
+    </font>
+
+    <font name="inactive_font" face="Arial">
+      <color>#9999cc</color>
+      <size>16</size>
+      <bold>yes</bold>
+    </font>
+
+    <font name="record_font" face="Arial">
+      <color>#ffff33</color>
+      <size>16</size>
+      <bold>yes</bold>
+    </font>
+
+    <font name="title" face="Arial">
+      <color>#ffffff</color>
+      <dropcolor>#000000</dropcolor>
+      <size>27</size>
+      <shadow>3,3</shadow>
+      <bold>yes</bold>
+    </font>
+
+    <font name="info" face="Arial">
+      <color>#ffffff</color>
+      <size>17</size>
+      <shadow>1,1</shadow>
+      <bold>yes</bold>
+    </font>
+
+    <font name="yellowinfo" face="Arial">
+      <color>#ffff33</color>
+      <size>17</size>
+      <shadow>1,1</shadow>
+      <bold>yes</bold>
+    </font>
+
+    <font name="message" face="Arial">
+      <color>#ffffff</color>
+      <size>16</size>
+      <shadow>1,1</shadow>
+      <bold>yes</bold>
+    </font>
+
+    <container name="background">
+      <textarea name="sched" draworder="0">
+        <area>20,10,800,40</area>
+        <font>info</font>
+        <value>Program Listings</value>
+      </textarea>
+      <image name="filler" draworder="0" fleximage="yes">
+        <filename>pl-background.png</filename>
+        <position>0,35</position>
+      </image>
+    </container>
+
+    <container name="selector">
+      <area>0,39,800,375</area>
+      <listarea name="proglist" draworder="4">
+        <area>20,12,760,330</area>
+        <fcnfont name="active_font" function="active"></fcnfont>
+        <fcnfont name="inactive_font" function="inactive"></fcnfont>
+        <fcnfont name="active_font" function="selected"></fcnfont>
+        <fcnfont name="record_font" function="recording"></fcnfont>
+        <columnpadding>1</columnpadding>
+        <column number="1" width="150" context="-1"></column>
+        <column number="2" width="130" context="-1"></column>
+        <column number="3" width="500" context="-1"></column>
+        <items>11</items>
+        <image function="selectionbar" filename="pl-selectbar.png" location="-6,-2"></image>
+        <image function="uparrow" filename="uparrow.png" location="755,22"></image>
+        <image function="downarrow" filename="downarrow.png" location="755,290"></image>
+      </listarea>
+      <image name="showinglines" draworder="5" fleximage="no">
+        <filename>pl-lines.png</filename>
+        <position>0,0</position>
+      </image>
+    </container>
+
+    <container name="program_info">
+      <area>0,410,800,240</area>
+      <textarea name="title" draworder="6">
+        <area>20,0,800,50</area>
+        <font>title</font>
+      </textarea>
+      <textarea name="subtitle" draworder="6">
+        <area>20,40,579,30</area>
+        <font>info</font>
+      </textarea>
+      <textarea name="description" draworder="6">
+        <area>20,70,579,90</area>
+        <font>info</font>
+	<multiline>yes</multiline>
+      </textarea>
+      <textarea name="type" draworder="6">
+        <area>20,160,430,30</area>
+        <font>yellowinfo</font>
+      </textarea>
+    </container>
+
+    <container name="noprograms_list">
+      <textarea name="msg" align="center" draworder="8">
+         <area>0,110,800,70</area>
+         <font>info</font>
+         <value>No listings found for this program. </value>
+         <multiline>yes</multiline>
+      </textarea>
+    </container>
+
+  </window>
+
 </mythuitheme>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proglist.h
Type: text/x-chdr
Size: 1293 bytes
Desc: not available
Url : http://lists.snowman.net/pipermail/mythtv-dev/attachments/20030713/2c328ec0/proglist.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proglist.cpp
Type: text/x-c++src
Size: 11824 bytes
Desc: not available
Url : http://lists.snowman.net/pipermail/mythtv-dev/attachments/20030713/2c328ec0/proglist-0001.bin


More information about the mythtv-dev mailing list