[mythtv] [PATCH] Toggle recording group view in Watch Recordings

Kevin Kuphal kuphal at dls.net
Wed Jan 19 23:03:22 EST 2005


This patch replaces my previously flawed idea for a favorites category 
and instead implements :

- A toggle that changes the list on the left hand side of Watch 
Recordings from Title View to Recording Group View and back again.  I 
bound this to the TOGGLERECORD action.  If this button is an issue, it 
can be bound do anything else that makes sense.
- An item on the MENU menu which also toggles the view

Recording Group View displays recording groups in place of titles in the 
left hand column.  Also, if the user has selected the playback option of 
"Use categories as recording groups" then categories will also appear in 
Recording Group View along with the Recording Groups just as they would 
in the existing feature to filter the view by recording group.

I find this method preferable to the filter for my viewing habits (and I 
hope others find it useful as well) as it does not hide items from view 
but simply gives an alternative means of navigation.

Thanks,
Kevin

-------------- next part --------------
Index: mythtv/programs/mythfrontend/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.181
diff -n -u -r1.181 playbackbox.cpp
--- mythtv/programs/mythfrontend/playbackbox.cpp	18 Jan 2005 05:15:23 -0000	1.181
+++ mythtv/programs/mythfrontend/playbackbox.cpp	20 Jan 2005 03:23:32 -0000
@@ -76,6 +76,8 @@
     popup = NULL;
     curitem = NULL;
     delitem = NULL;
+ 
+    titleView = true;
 
     if (gContext->GetNumSetting("UseArrowAccels", 1))
         arrowAccel = true;
@@ -932,14 +933,14 @@
                 tempCurrent = RemoteGetRecordingStatus(tempInfo, overrectime,
                                                      underrectime);
 
-                if (titleList[titleIndex] == "")
+                if ((titleList[titleIndex] == "") || (!(titleView)))
                     tempSubTitle = tempInfo->title; 
                 else
                     tempSubTitle = tempInfo->subtitle;
                 if (tempSubTitle.stripWhiteSpace().length() == 0)
                     tempSubTitle = tempInfo->title;
                 if ((tempInfo->subtitle).stripWhiteSpace().length() > 0 
-                    && titleList[titleIndex] == "")
+                    && ((titleList[titleIndex] == "") || (!(titleView))))
                 {
                     tempSubTitle = tempSubTitle + " - \"" + 
                         tempInfo->subtitle + "\"";
@@ -1155,11 +1156,26 @@
                  (p->category == recGroup ) &&
                  ( !recGroupPwCache.contains(p->recgroup))))
             {
-                progLists[""].prepend(p);
-                progLists[p->title].prepend(p);
-                sTitle = p->title;
-                sTitle.remove(prefixes);
-                sortedList[sTitle] = p->title;
+                if (titleView) // Normal title view 
+                {
+                    progLists[""].prepend(p);
+                    progLists[p->title].prepend(p);
+                    sTitle = p->title;
+                    sTitle.remove(prefixes);
+                    sortedList[sTitle] = p->title;
+                } else { 
+                    progLists[""].prepend(p);
+                    progLists[p->recgroup].prepend(p);
+                    sortedList[p->recgroup] = p->recgroup;
+                    // If categories are used as recording groups...
+                    if (gContext->GetNumSetting("UseCategoriesAsRecGroups"))
+                    {
+                        // Recording groups and categories overlap so set flag
+                        progLists[p->category].setAutoDelete(false);
+                        progLists[p->category].prepend(p);
+                        sortedList[p->category] = p->category;
+                    }
+                }
             }
             else
                 delete p;
@@ -1461,6 +1477,13 @@
         popup->addButton(tr("Change Group Password"), this,
                          SLOT(showRecGroupPasswordChanger()));
 
+    if (titleView)
+        popup->addButton(tr("Show group list as recording groups"), this,
+                         SLOT(toggleTitleView()));
+    else
+        popup->addButton(tr("Show group list as titles"), this,
+                         SLOT(toggleTitleView()));
+
     popup->addButton(tr("Cancel"), this, SLOT(doCancel()));
 
     popup->ShowPopup(this, SLOT(doCancel()));
@@ -2294,6 +2317,20 @@
     state = kChanging;
 }
 
+void PlaybackBox::toggleTitleView(void)
+{
+    if (expectingPopup)
+        cancelPopup();
+
+    if (titleView) titleView = false;
+    else titleView = true;
+
+    playList.clear();
+    connected = FillList();      
+    skipUpdate = false;
+    update(fullRect);
+}
+
 void PlaybackBox::promptEndOfRecording(ProgramInfo *rec)
 {
     if (!rec)
@@ -2406,6 +2443,15 @@
             skipUpdate = false;
             update(fullRect);
         }
+        else if (action == "TOGGLERECORD")
+        {
+            if (titleView) titleView = false;
+            else titleView = true;
+            playList.clear();
+            connected = FillList();
+            skipUpdate = false;
+            update(fullRect);
+        }
         else if (titleList.count() > 1)
         {
             if (action == "DELETE")
Index: mythtv/programs/mythfrontend/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.h,v
retrieving revision 1.61
diff -n -u -r1.61 playbackbox.h
--- mythtv/programs/mythfrontend/playbackbox.h	18 Jan 2005 05:15:24 -0000	1.61
+++ mythtv/programs/mythfrontend/playbackbox.h	20 Jan 2005 03:23:32 -0000
@@ -79,6 +79,7 @@
     void noPreserveEpisode();
 
     void doCancel();
+    void toggleTitleView();
 
     void exitWin();
 
@@ -262,6 +263,7 @@
     int underrectime;
 
     bool playingSomething;
+    bool titleView;
 };
 
 #endif


More information about the mythtv-dev mailing list