[mythtv] [PATCH] Playlist feature UI tweaking

Kevin Kuphal kuphal at dls.net
Sun Jan 23 09:21:00 EST 2005


This patch modifies the UI of the new playlist functions in Watch 
Recordings:

1.  Removes the "alternative" INFO pop-up that occured when a playlist 
had items.  I didn't feel that changing the entire UI path when 
playlists exist was a good idea.

2.  Adds label with playlist count (if exists) and button for Add to 
Playlist to standard INFO menu.  Add turns to Remove if items is already 
in the playlist.

3.  Adds "Clear playlist" button to MENU popup accessible from anywhere 
in the screen to dump the current playlist if a playlist is present.

4.  Moved "Shuffle play" and "Play from playlist" to "Play from..." when 
playlist is present.

I did not change the keyboard behavior or the modified behavior of the 
Play key when a playlist is present.  This patch mainly makes the 
functions accessible from the menus in addition to the keys.  The only 
function not accessible from the menus is "Add all titles of this group 
to Playlist" which I felt, if added, would have necessitated a "Playlist 
options" button on the main info menu to hold all the Playlist functions 
which would bury the Add to Playlist function deeper in the structure.

I'd be more than happy to change the patch to group all the playlist 
functions under a "Playlist Options" button but that seemed a far more 
drastic approach to getting most of the functions menu accessible.  I 
leave that decision up to Isaac and others if they feel it would be more 
appropriate.

Kevin
-------------- next part --------------
Index: mythtv/programs/mythfrontend/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.184
diff -n -u -r1.184 playbackbox.cpp
--- mythtv/programs/mythfrontend/playbackbox.cpp	21 Jan 2005 20:38:46 -0000	1.184
+++ mythtv/programs/mythfrontend/playbackbox.cpp	23 Jan 2005 14:01:56 -0000
@@ -90,7 +90,6 @@
 
     curGroupPassword = QString("");
     recGroup = gContext->GetSetting("DisplayRecGroup", QString("All Programs"));
-    VERBOSE( VB_GENERAL, recGroup);
     if (groupnameAsAllProg)
     {
         if ((recGroup == "Default") || (recGroup == "All Programs"))
@@ -1485,6 +1484,10 @@
         popup->addButton(tr("Show group list as titles"), this,
                          SLOT(toggleTitleView()));
 
+    if (playList.count())
+        popup->addButton(tr("Clear playlist"), this,
+                         SLOT(clearPlayList()));
+
     popup->addButton(tr("Cancel"), this, SLOT(doCancel()));
 
     popup->ShowPopup(this, SLOT(doCancel()));
@@ -1739,6 +1742,12 @@
     QButton *playButton = popup->addButton(tr("Play from bookmark"), this,
             SLOT(doPlay()));
     popup->addButton(tr("Play from beginning"), this, SLOT(doPlayFromBeg()));
+
+    if (playList.count())
+    {
+        popup->addButton(tr("Play from playlist"), this, SLOT(doPlay()));
+        popup->addButton(tr("Play from playlist randomly"), this, SLOT(doPlay()));
+    }
      
     popup->ShowPopup(this, SLOT(doCancel()));
     playButton->setFocus();
@@ -1861,63 +1870,56 @@
                              popupForeground, popupBackground,
                              popupHighlight, "action popup");
 
-    if (playList.count())
-    {
-        QLabel *label;
-        label = popup->addLabel(tr("Playlist Actions"), MythPopupBox::Large,
-                               false);
-        label->setAlignment(Qt::AlignCenter | Qt::WordBreak);
-
-        label = popup->addLabel(tr("There are %1 items in the list.")
-                                   .arg(playList.count()));
-        label->setAlignment(Qt::AlignCenter | Qt::WordBreak);
-    }
-    else
-    {
-        initPopup(popup, program, "", "");
-    }
+    initPopup(popup, program, "", "");
 
     QSqlDatabase *db = QSqlDatabase::database();
     QButton *playButton;
 
-    if (playList.count())
+    if ((curitem->programflags & FL_BOOKMARK) || playList.count())
     {
-        playButton = popup->addButton(tr("Play"), this, SLOT(doPlay()));
-        popup->addButton(tr("Shuffle Play"), this, SLOT(doPlayListRandom()));
-        popup->addButton(tr("Change Recording Group"), this,
-                     SLOT(showRecGroupChanger()));
+        playButton = popup->addButton(tr("Play from..."), this, SLOT(showPlayFromPopup()));
     }
     else
     {
-        if (curitem->programflags & FL_BOOKMARK)
-        {
-            playButton = popup->addButton(tr("Play from..."), this, SLOT(showPlayFromPopup()));
-        }
+        playButton = popup->addButton(tr("Play"), this, SLOT(doPlay()));
+    }
+
+    if (RemoteGetRecordingStatus(program, overrectime, underrectime) > 0)
+        popup->addButton(tr("Stop Recording"), this, SLOT(askStop()));
+
+    // Remove this check and the auto expire buttons if a third button is added to the StoragePopup screen
+    // Otherwise for non-max-episode schedules, the popup will only show one button
+    if (delitem && delitem->UsesMaxEpisodes(db))
+    {
+        popup->addButton(tr("Storage Options"), this, SLOT(showStoragePopup()));
+    } else {
+        if (delitem && delitem->GetAutoExpireFromRecorded(db))
+            popup->addButton(tr("Don't Auto Expire"), this, SLOT(noAutoExpire()));
         else
-        {
-            playButton = popup->addButton(tr("Play"), this, SLOT(doPlay()));
-        }
+            popup->addButton(tr("Auto Expire"), this, SLOT(doAutoExpire()));
+    }
 
-        if (RemoteGetRecordingStatus(program, overrectime, underrectime) > 0)
-            popup->addButton(tr("Stop Recording"), this, SLOT(askStop()));
+    popup->addButton(tr("Recording Options"), this, SLOT(showRecordingPopup()));
+    popup->addButton(tr("Job Options"), this, SLOT(showJobPopup()));
 
-        // Remove this check and the auto expire buttons if a third button is added to the StoragePopup screen
-        // Otherwise for non-max-episode schedules, the popup will only show one button
-        if (delitem && delitem->UsesMaxEpisodes(db))
-        {
-            popup->addButton(tr("Storage Options"), this, SLOT(showStoragePopup()));
-        } else {
-            if (delitem && delitem->GetAutoExpireFromRecorded(db))
-                popup->addButton(tr("Don't Auto Expire"), this, SLOT(noAutoExpire()));
-            else
-                popup->addButton(tr("Auto Expire"), this, SLOT(doAutoExpire()));
-        }
+    popup->addButton(tr("Delete"), this, SLOT(askDelete()));
 
-        popup->addButton(tr("Recording Options"), this, SLOT(showRecordingPopup()));
-        popup->addButton(tr("Job Options"), this, SLOT(showJobPopup()));
+    if (playList.count())
+    {
+        QLabel *label;
+        label = popup->addLabel(tr("Your playlist contains %1 items.")
+                                   .arg(playList.count()));
+        label->setAlignment(Qt::AlignCenter | Qt::WordBreak);
     }
 
-    popup->addButton(tr("Delete"), this, SLOT(askDelete()));
+    QString key;
+    key = curitem->chanid + "_" +
+         curitem->startts.toString(Qt::ISODate);
+
+    if (playList.grep(key).count())
+        popup->addButton(tr("Remove from Playlist"), this, SLOT(togglePlayListItem()));
+    else
+        popup->addButton(tr("Add to Playlist"), this, SLOT(togglePlayListItem()));
 
     popup->ShowPopup(this, SLOT(doCancel()));
 
@@ -2356,6 +2358,9 @@
 
 void PlaybackBox::togglePlayListItem(void)
 {
+    if (expectingPopup)
+        cancelPopup();
+
     if (!curitem)
         return;
 
@@ -2409,6 +2414,14 @@
     }
 }
 
+void PlaybackBox::clearPlayList(void)
+{
+    if (expectingPopup)
+        cancelPopup();
+
+    playList.clear();
+}
+
 void PlaybackBox::timeout(void)
 {
     if (titleList.count() <= 1)
Index: mythtv/programs/mythfrontend/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.h,v
retrieving revision 1.62
diff -n -u -r1.62 playbackbox.h
--- mythtv/programs/mythfrontend/playbackbox.h	21 Jan 2005 07:12:48 -0000	1.62
+++ mythtv/programs/mythfrontend/playbackbox.h	23 Jan 2005 14:01:56 -0000
@@ -93,6 +93,9 @@
     void changeOldPasswordChanged(const QString &newText);
     void doBeginTranscoding();
     void doBeginFlagging();
+    void togglePlayListItem(void);
+    void clearPlayList();
+
   protected:
     void paintEvent(QPaintEvent *);
     void keyPressEvent(QKeyEvent *e);
@@ -110,7 +113,6 @@
     void expire(ProgramInfo *);
     void showActions(ProgramInfo *);
 
-    void togglePlayListItem(void);
     void togglePlayListItem(ProgramInfo *pginfo);
     void randomizePlayList(void);
 


More information about the mythtv-dev mailing list