[mythtv] PATCH: mythmusic enhancements

Joseph A. Caputo jcaputo1 at comcast.net
Fri Mar 14 15:42:42 EST 2003


Oops.  Found a bug in my patch which caused it to crash if you tried to pause
with keyboard accelerators enabled.  Try this updated patch instead.

-Joe C.


-------------- next part --------------
? mythmusic.diff
Index: mythmusic/playbackbox.cpp
===================================================================
RCS file: /var/lib/cvs/mythmusic/mythmusic/playbackbox.cpp,v
retrieving revision 1.30
diff -u -d -r1.30 playbackbox.cpp
--- mythmusic/playbackbox.cpp	10 Mar 2003 15:22:14 -0000	1.30
+++ mythmusic/playbackbox.cpp	14 Mar 2003 20:39:30 -0000
@@ -13,6 +13,7 @@
 #include <qstyle.h>
 #include <qimage.h>
 #include <qheader.h>
+#include <qaction.h>
 #include <stdlib.h>
 
 #include <iostream>
@@ -42,17 +43,66 @@
 #include "res/rateup.xpm"
 #include "res/ratedn.xpm"
 
-PlaybackBox::PlaybackBox(QSqlDatabase *ldb, QValueList<Metadata> *playlist,
-                         QWidget *parent, const char *name)
-           : MythDialog(parent, name)
+PlaybackBox::PlaybackBox(QSqlDatabase * ldb,
+                         QValueList < Metadata > *playlist, QWidget * parent,
+                         const char *name)
+  :MythDialog(parent, name),
+   input(NULL),
+   output(NULL),
+   decoder(NULL),
+   db(ldb),
+   plist(NULL),
+   shufflelabel(NULL),
+   repeatlabel(NULL),
+   timelabel(NULL),
+   titlelabel(NULL),
+   playview(NULL),
+   seekbar(NULL),
+   randomize(NULL),
+   repeat(NULL),
+   pledit(NULL),
+   vis(NULL),
+   pauseb(NULL),
+   prevb(NULL),
+   prevfileb(NULL),
+   stopb(NULL),
+   nextb(NULL),
+   nextfileb(NULL),
+   rateup(NULL),
+   ratedn(NULL),
+   playb(NULL),
+   prevfileAction(NULL),
+   prevAction(NULL),
+   pauseAction(NULL),
+   playAction(NULL),
+   stopAction(NULL),
+   nextAction(NULL),
+   nextfileAction(NULL),
+   rateupAction(NULL),
+   ratednAction(NULL),
+   shuffleAction(NULL),
+   repeatAction(NULL),
+   pleditAction(NULL),
+   visAction(NULL),
+   timeDisplaySelect(NULL),
+   playlistViewAction(NULL),
+   visual_mode_timer(NULL),
+   lcd_update_timer(NULL),
+   playlist_timer(NULL)
 {
-    db = ldb;
+    keyboard_accelerator_flag =
+        gContext->GetNumSetting("KeyboardAccelerators");
+    showrating = gContext->GetNumSetting("MusicShowRatings", 0);
 
-    QVBoxLayout *vbox = new QVBoxLayout(this, (int)(20 * wmult));
+    QFont buttonfont("Arial",
+                     (int) ((gContext->GetSmallFontSize() + 2) * hmult),
+                     QFont::Bold);
+
+    QGridLayout *vbox = new QGridLayout(this, 2, 1);
 
     mainvisual = new MainVisual();
-    
-    QVBoxLayout *vbox2 = new QVBoxLayout(vbox, (int)(2 * wmult));
+
+    QVBoxLayout *vbox2 = new QVBoxLayout(vbox, (int) (2 * wmult));
 
     QGroupBox *topdisplay = new QGroupBox(this);
     vbox2->addWidget(topdisplay);
@@ -64,19 +114,37 @@
     topdisplay->setPaletteBackgroundColor(palette().color(QPalette::Active,
                                                           QColorGroup::Mid));
 
-    QVBoxLayout *framebox = new QVBoxLayout(topdisplay, (int)(10 * wmult));
+    QVBoxLayout *framebox = new QVBoxLayout(topdisplay, (int) (10 * wmult));
 
     titlelabel = new ScrollLabel(topdisplay);
     titlelabel->setFont(font());
     titlelabel->setText("  ");
     titlelabel->setPaletteBackgroundColor(palette().color(QPalette::Active,
                                                           QColorGroup::Mid));
-    framebox->addWidget(titlelabel);   
+    framebox->addWidget(titlelabel);
 
     QHBoxLayout *framehbox = new QHBoxLayout(framebox);
+    QFont statusFont = font();
+    statusFont.setPointSize(statusFont.pointSize() - 2);
+
+    shufflelabel = new QLabel(topdisplay);
+    shufflelabel->setFont(statusFont);
+    shufflelabel->setText("");
+    shufflelabel->setPaletteBackgroundColor(palette().color(QPalette::Active,
+                                                            QColorGroup::
+                                                            Mid));
+    shufflelabel->setAlignment(AlignLeft);
+    framehbox->addWidget(shufflelabel);
+
+    repeatlabel = new QLabel(topdisplay);
+    repeatlabel->setFont(statusFont);
+    repeatlabel->setText("");
+    repeatlabel->setPaletteBackgroundColor(palette().color(QPalette::Active,
+                                                           QColorGroup::Mid));
+    framehbox->addWidget(repeatlabel);
 
     timelabel = new QLabel(topdisplay);
-    timelabel->setFont(font());
+    timelabel->setFont(statusFont);
     timelabel->setText("  ");
     timelabel->setPaletteBackgroundColor(palette().color(QPalette::Active,
                                                          QColorGroup::Mid));
@@ -85,161 +153,199 @@
 
     seekbar = new QSlider(Qt::Horizontal, this);
     seekbar->setFocusPolicy(NoFocus);
-    seekbar->setTracking(false);   
-    seekbar->blockSignals(true); 
+    seekbar->setTracking(false);
+    seekbar->blockSignals(true);
 
     vbox2->addWidget(seekbar);
 
-    QHBoxLayout *controlbox = new QHBoxLayout(vbox2, (int)(2 * wmult));
+    prevfileAction = new QAction(this, "prevfileAction");
+    connect(prevfileAction, SIGNAL(activated()), this, SLOT(previous()));
 
-    MythToolButton *prevfileb = new MythToolButton(this);
-    prevfileb->setAutoRaise(true);
-    prevfileb->setIconSet(scalePixmap((const char **)prevfile_pix));  
-    connect(prevfileb, SIGNAL(clicked()), this, SLOT(previous()));
- 
-    MythToolButton *prevb = new MythToolButton(this);
-    prevb->setAutoRaise(true);
-    prevb->setIconSet(scalePixmap((const char **)prev_pix));
-    connect(prevb, SIGNAL(clicked()), this, SLOT(seekback()));
+    prevAction = new QAction(this, "prevAction");
+    connect(prevAction, SIGNAL(activated()), this, SLOT(seekback()));
 
-    pauseb = new MythToolButton(this);
-    pauseb->setAutoRaise(true);
-    pauseb->setToggleButton(true);
-    pauseb->setIconSet(scalePixmap((const char **)pause_pix));
-    connect(pauseb, SIGNAL(clicked()), this, SLOT(pause()));
+    pauseAction = new QAction(this, "pauseAction");
+    connect(pauseAction, SIGNAL(activated()), this, SLOT(pause()));
 
-    MythToolButton *playb = new MythToolButton(this);
-    playb->setAutoRaise(true);
-    playb->setIconSet(scalePixmap((const char **)play_pix));
-    connect(playb, SIGNAL(clicked()), this, SLOT(play()));
+    playAction = new QAction(this, "playAction");
+    connect(playAction, SIGNAL(activated()), this, SLOT(play()));
 
-    MythToolButton *stopb = new MythToolButton(this);
-    stopb->setAutoRaise(true);
-    stopb->setIconSet(scalePixmap((const char **)stop_pix));
-    connect(stopb, SIGNAL(clicked()), this, SLOT(stop()));
-    
-    MythToolButton *nextb = new MythToolButton(this);
-    nextb->setAutoRaise(true);
-    nextb->setIconSet(scalePixmap((const char **)next_pix));
-    connect(nextb, SIGNAL(clicked()), this, SLOT(seekforward()));
+    stopAction = new QAction(this, "stopAction");
+    connect(stopAction, SIGNAL(activated()), this, SLOT(stop()));
 
-    MythToolButton *nextfileb = new MythToolButton(this);
-    nextfileb->setAutoRaise(true);
-    nextfileb->setIconSet(scalePixmap((const char **)nextfile_pix));
-    connect(nextfileb, SIGNAL(clicked()), this, SLOT(next()));    
+    nextAction = new QAction(this, "nextAction");
+    connect(nextAction, SIGNAL(activated()), this, SLOT(seekforward()));
 
-    showrating = gContext->GetNumSetting("MusicShowRatings", 0);
+    nextfileAction = new QAction(this, "nextfileAction");
+    connect(nextfileAction, SIGNAL(activated()), this, SLOT(next()));
 
-    MythToolButton *rateup = NULL, *ratedn = NULL;
+    rateupAction = new QAction(this, "rateupAction");
+    connect(rateupAction, SIGNAL(activated()), this, SLOT(increaseRating()));
 
-    if (showrating)
-    {    
-        rateup = new MythToolButton(this);
-        rateup->setAutoRaise(true);
-        rateup->setIconSet(scalePixmap((const char **)rateup_pix));
-        connect(rateup, SIGNAL(clicked()), this, SLOT(increaseRating()));
+    ratednAction = new QAction(this, "ratednAction");
+    connect(ratednAction, SIGNAL(activated()), this, SLOT(decreaseRating()));
 
-        ratedn = new MythToolButton(this);
-        ratedn->setAutoRaise(true);
-        ratedn->setIconSet(scalePixmap((const char **)ratedn_pix));
-        connect(ratedn, SIGNAL(clicked()), this, SLOT(decreaseRating()));
-    }
+    shuffleAction = new QAction(this, "shuffleAction");
+    connect(shuffleAction, SIGNAL(activated()), this, SLOT(toggleShuffle()));
 
-    controlbox->addWidget(prevfileb);
-    controlbox->addWidget(prevb);
-    controlbox->addWidget(pauseb);
-    controlbox->addWidget(playb);
-    controlbox->addWidget(stopb);
-    controlbox->addWidget(nextb);
-    controlbox->addWidget(nextfileb);
+    repeatAction = new QAction(this, "repeatAction");
+    connect(repeatAction, SIGNAL(activated()), this, SLOT(toggleRepeat()));
 
-    if (showrating)
+    pleditAction = new QAction(this, "pleditAction");
+    connect(pleditAction, SIGNAL(activated()), this, SLOT(editPlaylist()));
+
+    visAction = new QAction(this, "visAction");
+    connect(visAction, SIGNAL(activated()), this, SLOT(visEnable()));
+
+    timeDisplaySelect = new QAction(this, "timeDisplaySelect");
+    connect(timeDisplaySelect, SIGNAL(activated()), this, SLOT(toggleTime()));
+
+    playlistViewAction = new QAction(this, "playlistViewAction");
+    connect(playlistViewAction, SIGNAL(activated()), this,
+            SLOT(togglePlaylistView()));
+
+    if (!keyboard_accelerator_flag)
     {
-        controlbox->addWidget(rateup);
-        controlbox->addWidget(ratedn);
-    }
 
-    QHBoxLayout *secondcontrol = new QHBoxLayout(vbox2, (int)(2 * wmult));
+        QHBoxLayout *controlbox = new QHBoxLayout(vbox2, (int) (2 * wmult));
 
-    QFont buttonfont("Arial", (int)((gContext->GetSmallFontSize() + 2) * hmult),
-                     QFont::Bold);
+        prevfileb = new MythToolButton(this);
+        prevfileb->setAutoRaise(true);
+        prevfileb->setIconSet(scalePixmap((const char **) prevfile_pix));
+        connect(prevfileb, SIGNAL(clicked()), prevfileAction,
+                SIGNAL(activated()));
 
-    randomize = new MythToolButton(this);
-    randomize->setAutoRaise(true);
-    randomize->setText("Shuffle: Normal");
-    randomize->setFont(buttonfont); 
-    secondcontrol->addWidget(randomize);
-    connect(randomize, SIGNAL(clicked()), this, SLOT(toggleShuffle()));
+        prevb = new MythToolButton(this);
+        prevb->setAutoRaise(true);
+        prevb->setIconSet(scalePixmap((const char **) prev_pix));
+        connect(prevb, SIGNAL(clicked()), prevAction, SIGNAL(activated()));
 
-    repeat = new MythToolButton(this);
-    repeat->setAutoRaise(true);
-    repeat->setText("Repeat: Playlist");
-    repeat->setFont(buttonfont);
-    secondcontrol->addWidget(repeat);
-    connect(repeat, SIGNAL(clicked()), this, SLOT(toggleRepeat()));
+        pauseb = new MythToolButton(this);
+        pauseb->setAutoRaise(true);
+        pauseb->setToggleButton(true);
+        pauseb->setIconSet(scalePixmap((const char **) pause_pix));
+        connect(pauseb, SIGNAL(clicked()), pauseAction, SIGNAL(activated()));
 
-    pledit = new MythToolButton(this);
-    pledit->setAutoRaise(true);
-    pledit->setText("Edit Playlist");
-    pledit->setFont(buttonfont);
-    secondcontrol->addWidget(pledit);
-    connect(pledit, SIGNAL(clicked()), this, SLOT(editPlaylist()));
+        playb = new MythToolButton(this);
+        playb->setAutoRaise(true);
+        playb->setIconSet(scalePixmap((const char **) play_pix));
+        connect(playb, SIGNAL(clicked()), playAction, SIGNAL(activated()));
 
-    vis = new MythToolButton(this);
-    vis->setAutoRaise(true);
-    vis->setText("Visualize");
-    vis->setFont(buttonfont);
-    secondcontrol->addWidget(vis);
-    connect(vis, SIGNAL(clicked()), this, SLOT(visEnable()));
+        stopb = new MythToolButton(this);
+        stopb->setAutoRaise(true);
+        stopb->setIconSet(scalePixmap((const char **) stop_pix));
+        connect(stopb, SIGNAL(clicked()), stopAction, SIGNAL(activated()));
 
-    keyboard_accelerator_flag = gContext->GetNumSetting("KeyboardAccelerators");
-    if(keyboard_accelerator_flag)
+        nextb = new MythToolButton(this);
+        nextb->setAutoRaise(true);
+        nextb->setIconSet(scalePixmap((const char **) next_pix));
+        connect(nextb, SIGNAL(clicked()), nextAction, SIGNAL(activated()));
+
+        nextfileb = new MythToolButton(this);
+        nextfileb->setAutoRaise(true);
+        nextfileb->setIconSet(scalePixmap((const char **) nextfile_pix));
+        connect(nextfileb, SIGNAL(clicked()), nextfileAction,
+                SIGNAL(activated()));
+
+        rateup = NULL;
+        ratedn = NULL;
+
+        if (showrating)
+        {
+            rateup = new MythToolButton(this);
+            rateup->setAutoRaise(true);
+            rateup->setIconSet(scalePixmap((const char **) rateup_pix));
+            connect(rateup, SIGNAL(clicked()), rateupAction,
+                    SIGNAL(activated()));
+
+            ratedn = new MythToolButton(this);
+            ratedn->setAutoRaise(true);
+            ratedn->setIconSet(scalePixmap((const char **) ratedn_pix));
+            connect(ratedn, SIGNAL(clicked()), ratednAction,
+                    SIGNAL(activated()));
+        }
+
+        controlbox->addWidget(prevfileb);
+        controlbox->addWidget(prevb);
+        controlbox->addWidget(pauseb);
+        controlbox->addWidget(playb);
+        controlbox->addWidget(stopb);
+        controlbox->addWidget(nextb);
+        controlbox->addWidget(nextfileb);
+
+        if (showrating)
+        {
+            controlbox->addWidget(rateup);
+            controlbox->addWidget(ratedn);
+        }
+
+        QHBoxLayout *secondcontrol =
+            new QHBoxLayout(vbox2, (int) (2 * wmult));
+
+        randomize = new MythToolButton(this);
+        randomize->setAutoRaise(true);
+        randomize->setText("Shuffle Mode");
+        randomize->setFont(buttonfont);
+        secondcontrol->addWidget(randomize);
+        connect(randomize, SIGNAL(clicked()), shuffleAction,
+                SIGNAL(activated()));
+
+        repeat = new MythToolButton(this);
+        repeat->setAutoRaise(true);
+        repeat->setText("Repeat Mode");
+        repeat->setFont(buttonfont);
+        secondcontrol->addWidget(repeat);
+        connect(repeat, SIGNAL(clicked()), repeatAction, SIGNAL(activated()));
+
+        pledit = new MythToolButton(this);
+        pledit->setAutoRaise(true);
+        pledit->setText("Edit Playlist");
+        pledit->setFont(buttonfont);
+        secondcontrol->addWidget(pledit);
+        connect(pledit, SIGNAL(clicked()), pleditAction, SIGNAL(activated()));
+
+        vis = new MythToolButton(this);
+        vis->setAutoRaise(true);
+        vis->setText("Visualize");
+        vis->setFont(buttonfont);
+        secondcontrol->addWidget(vis);
+        connect(vis, SIGNAL(clicked()), visAction, SIGNAL(activated()));
+    }
+    else
     {
         // There may be a better key press
         // mapping, but I have a pretty
         // serious flu at the moment and 
         // I can't think of one
 
-        prevfileb->setAccel(Key_Up);
-        prevfileb->setFocusPolicy( QWidget::NoFocus);
-        prevb->setAccel(Key_Left);
-        prevb->setFocusPolicy( QWidget::NoFocus);
-        pauseb->setAccel(Key_P);
-        pauseb->setFocusPolicy( QWidget::NoFocus);
-        playb->setAccel(Key_Space);
-        playb->setFocusPolicy( QWidget::NoFocus);
-        stopb->setAccel(Key_S);
-        stopb->setFocusPolicy( QWidget::NoFocus);
-        nextb->setAccel(Key_Right);
-        nextb->setFocusPolicy( QWidget::NoFocus);
-        nextfileb->setAccel(Key_Down);
-        nextfileb->setFocusPolicy( QWidget::NoFocus);
+        prevfileAction->setAccel(Key_Up);
+        prevAction->setAccel(Key_Left);
+        pauseAction->setAccel(Key_P);
+        playAction->setAccel(Key_Space);
+        stopAction->setAccel(Key_S);
+        nextAction->setAccel(Key_Right);
+        nextfileAction->setAccel(Key_Down);
 
         if (showrating)
         {
-            rateup->setAccel(Key_U);
-            rateup->setFocusPolicy( QWidget::NoFocus);
-            ratedn->setAccel(Key_D);
-            ratedn->setFocusPolicy( QWidget::NoFocus);	
+            rateupAction->setAccel(Key_U);
+            ratednAction->setAccel(Key_D);
         }
-	
-        randomize->setAccel(Key_1);
-        randomize->setFocusPolicy( QWidget::NoFocus);
-        repeat->setAccel(Key_2);
-        repeat->setFocusPolicy( QWidget::NoFocus);
-        pledit->setAccel(Key_3);
-        pledit->setFocusPolicy( QWidget::NoFocus);
-        vis->setAccel(Key_4);
-        vis->setFocusPolicy( QWidget::NoFocus);
+
+        shuffleAction->setAccel(Key_1);
+        repeatAction->setAccel(Key_2);
+        pleditAction->setAccel(Key_3);
+        visAction->setAccel(Key_4);
+        timeDisplaySelect->setAccel(Key_T);
     }
 
-    showrating = gContext->GetNumSetting("MusicShowRatings", 0);
+    playlistViewAction->setAccel(Key_L);
 
     playview = new MythListView(this);
     playview->addColumn("#");
     if (showrating)
         playview->addColumn("Rating");
-    playview->addColumn("Artist");  
+    playview->addColumn("Artist");
     playview->addColumn("Title");
     playview->addColumn("Length");
     playview->setFont(buttonfont);
@@ -248,11 +354,11 @@
 
     if (showrating)
     {
-        playview->setColumnWidth(0, (int)(50 * wmult));
-        playview->setColumnWidth(1, (int)(60 * wmult));
-        playview->setColumnWidth(2, (int)(195 * wmult));
-        playview->setColumnWidth(3, (int)(355 * wmult));
-        playview->setColumnWidth(4, (int)(80 * wmult));
+        playview->setColumnWidth(0, (int) (50 * wmult));
+        playview->setColumnWidth(1, (int) (60 * wmult));
+        playview->setColumnWidth(2, (int) (195 * wmult));
+        playview->setColumnWidth(3, (int) (355 * wmult));
+        playview->setColumnWidth(4, (int) (80 * wmult));
         playview->setColumnWidthMode(0, QListView::Manual);
         playview->setColumnWidthMode(1, QListView::Manual);
         playview->setColumnWidthMode(2, QListView::Manual);
@@ -263,10 +369,10 @@
     }
     else
     {
-        playview->setColumnWidth(0, (int)(50 * wmult));
-        playview->setColumnWidth(1, (int)(210 * wmult));
-        playview->setColumnWidth(2, (int)(385 * wmult));
-        playview->setColumnWidth(3, (int)(90 * wmult));
+        playview->setColumnWidth(0, (int) (50 * wmult));
+        playview->setColumnWidth(1, (int) (210 * wmult));
+        playview->setColumnWidth(2, (int) (385 * wmult));
+        playview->setColumnWidth(3, (int) (90 * wmult));
         playview->setColumnWidthMode(0, QListView::Manual);
         playview->setColumnWidthMode(1, QListView::Manual);
         playview->setColumnWidthMode(2, QListView::Manual);
@@ -283,31 +389,40 @@
     shuffleindex = 0;
     setupListView();
 
-    vbox->addWidget(playview, 1);
+    vbox->addWidget(playview, 1, 0);
+    vbox->setRowStretch(0, 0);
+    vbox->setRowStretch(1, 10);
 
     if (!keyboard_accelerator_flag)
     {
         playb->setFocus();
     }
 
-    input = 0; decoder = 0; seeking = false; remainingTime = false;
-    output = 0; outputBufferSize = 256;
+    input = 0;
+    decoder = 0;
+    seeking = false;
+    output = 0;
+    outputBufferSize = 256;
+    plTime = 0;
+    plElapsed = 0;
+    timeMode = TRACK_ELAPSED;
 
-    shufflemode = 0;
-    repeatmode = false;  
+    setRepeatMode(REPEAT_OFF);
 
     curMeta = Metadata("dummy.music");
 
     QString playmode = gContext->GetSetting("PlayMode");
     if (playmode.lower() == "random")
-        toggleShuffle();
+        setShuffleMode(SHUFFLE_RANDOM);
     else if (playmode.lower() == "intelligent")
     {
-        shufflemode++;
-        toggleShuffle();
+        setShuffleMode(SHUFFLE_INTELLIGENT);
     }
     else
+    {
+        setShuffleMode(SHUFFLE_OFF);
         setupPlaylist();
+    }
 
     playlistindex = playlistorder[shuffleindex];
     curMeta = (*plist)[playlistindex];
@@ -317,52 +432,55 @@
     connect(playlist_timer, SIGNAL(timeout()), this, SLOT(jumpToItem()));
 
     isplaying = false;
- 
+
     if (plist->size() > 0)
-    { 
+    {
         playfile = curMeta.Filename();
         emit play();
     }
-    
+
     //
-    //	Load Visualization settings and set up timer
+    //  Load Visualization settings and set up timer
     //
-	
+
     visual_mode = gContext->GetSetting("VisualMode");
     QString visual_delay = gContext->GetSetting("VisualModeDelay");
-    
+
     bool delayOK;
     visual_mode_delay = visual_delay.toInt(&delayOK);
-    if(!delayOK)
+    if (!delayOK)
     {
-    	visual_mode_delay = 0;
+        visual_mode_delay = 0;
     }
-    
+
     visual_mode_timer = new QTimer();
-    if(visual_mode_delay > 0)
+    if (visual_mode_delay > 0)
     {
-    	visual_mode_timer->start(visual_mode_delay * 1000);
-        connect(prevfileb, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(pauseb, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(playb, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(stopb, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(nextb, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(nextfileb, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(randomize, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(repeat, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(pledit, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        connect(vis, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        if (showrating)
-        {
-            connect(rateup, SIGNAL(clicked()), this, SLOT(resetTimer()));
-            connect(ratedn, SIGNAL(clicked()), this, SLOT(resetTimer()));
-        }
+        visual_mode_timer->start(visual_mode_delay * 1000);
+        connect(prevfileAction, SIGNAL(activated()), this,
+                SLOT(resetTimer()));
+        connect(pauseAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(playAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(stopAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(nextAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(nextfileAction, SIGNAL(activated()), this,
+                SLOT(resetTimer()));
+        connect(shuffleAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(repeatAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(pleditAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(visAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(rateupAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(ratednAction, SIGNAL(activated()), this, SLOT(resetTimer()));
+        connect(timeDisplaySelect, SIGNAL(activated()), this,
+                SLOT(resetTimer()));
+        connect(playlistViewAction, SIGNAL(activated()), this,
+                SLOT(resetTimer()));
     }
 
     visualizer_is_active = false;
     connect(visual_mode_timer, SIGNAL(timeout()), this, SLOT(visEnable()));
 
-    connect(mainvisual, SIGNAL(hidingVisualization()), 
+    connect(mainvisual, SIGNAL(hidingVisualization()),
             this, SLOT(restartTimer()));
     connect(mainvisual, SIGNAL(keyPress(QKeyEvent *)),
             this, SLOT(keyPressFromVisual(QKeyEvent *)));
@@ -373,7 +491,7 @@
     stopAll();
 }
 
-void PlaybackBox::keyPressFromVisual(QKeyEvent *e)
+void PlaybackBox::keyPressFromVisual(QKeyEvent * e)
 {
     if (keyboard_accelerator_flag)
     {
@@ -381,43 +499,43 @@
         //  force Qt to have this (object) accept the keypresses
         //  automatically to the buttons they were assigned to in
         //  the constructor ... so ... repeat the same logic here
-        switch(e->key())
+        switch (e->key())
         {
-            case Key_Up:
-                previous();
-                break;
-                
-            case Key_Left:
-                seekback();
-                break;
-                
-            case Key_P:
-                pause();
-                break;
-                
-            case Key_Space:
-                play();
-                break;
-                
-            case Key_S:
-                stop();
-                break;
-                
-            case Key_Right:
-                seekforward();
-                break;
-               
-            case Key_Down:
-                next();
-                break;
-                
-            case Key_1:
-                toggleRepeat();
-                break; 
+        case Key_Up:
+            previous();
+            break;
 
-            case Key_2:
-                toggleShuffle();
-                break; 
+        case Key_Left:
+            seekback();
+            break;
+
+        case Key_P:
+            pause();
+            break;
+
+        case Key_Space:
+            play();
+            break;
+
+        case Key_S:
+            stop();
+            break;
+
+        case Key_Right:
+            seekforward();
+            break;
+
+        case Key_Down:
+            next();
+            break;
+
+        case Key_1:
+            toggleRepeat();
+            break;
+
+        case Key_2:
+            toggleShuffle();
+            break;
 
         }
     }
@@ -443,8 +561,8 @@
 QPixmap PlaybackBox::scalePixmap(const char **xpmdata)
 {
     QImage tmpimage(xpmdata);
-    QImage tmp2 = tmpimage.smoothScale((int)(tmpimage.width() * wmult),
-                                       (int)(tmpimage.height() * hmult));
+    QImage tmp2 = tmpimage.smoothScale((int) (tmpimage.width() * wmult),
+                                       (int) (tmpimage.height() * hmult));
     QPixmap ret;
     ret.convertFromImage(tmp2);
 
@@ -456,8 +574,8 @@
     playview->clear();
 
     QListViewItem *litem;
-   
-    QValueList<Metadata>::iterator it = plist->end();
+
+    QValueList < Metadata >::iterator it = plist->end();
     int count = plist->size();
     if (count == 0)
         return;
@@ -469,22 +587,23 @@
         int secs = (*it).Length() / 1000;
         int min = secs / 60;
         secs -= min * 60;
-        
+
         QString timestr;
         timestr.sprintf("%2d:%02d", min, secs);
-       
+
         QString rating;
         for (int i = 0; i < (*it).Rating(); i++)
             rating.append("|");
 
         if (showrating)
-            litem = new QListViewItem(playview, position, rating, 
+            litem = new QListViewItem(playview, position, rating,
                                       (*it).Artist(), (*it).Title(), timestr);
         else
             litem = new QListViewItem(playview, position, (*it).Artist(),
                                       (*it).Title(), timestr);
         listlist.prepend(litem);
-        it--; count--;
+        it--;
+        count--;
     }
 
     jumpToItem(listlist.at(playlistindex));
@@ -497,7 +616,7 @@
     jumpToItem(listlist.at(playlistindex));
 }
 
-void PlaybackBox::jumpToItem(QListViewItem *curItem)
+void PlaybackBox::jumpToItem(QListViewItem * curItem)
 {
     if (curItem)
     {
@@ -511,7 +630,7 @@
     }
 }
 
-double PlaybackBox::computeIntelligentWeight(Metadata & mdata, 
+double PlaybackBox::computeIntelligentWeight(Metadata & mdata,
                                              double currentDateTime)
 {
     int rating;
@@ -524,11 +643,11 @@
     rating = mdata.Rating();
     playcount = mdata.PlayCount();
     lastplay = mdata.LastPlay();
-    ratingValue = (double)rating / 10;
-    playcountValue = (double)playcount / 50;
+    ratingValue = (double) rating / 10;
+    playcountValue = (double) playcount / 50;
     lastplayValue = (currentDateTime - lastplay) / currentDateTime * 2000;
     return (35 * ratingValue - 25 * playcountValue + 25 * lastplayValue +
-            15 * (double)rand() / (RAND_MAX + 1.0));
+            15 * (double) rand() / (RAND_MAX + 1.0));
 }
 
 void PlaybackBox::setupPlaylist(void)
@@ -536,7 +655,10 @@
     if (playlistorder.size() > 0)
         playlistorder.clear();
 
-    if (playlistindex >= (int)plist->size())
+    plTime = 0;
+    plElapsed = 0;
+
+    if (playlistindex >= (int) plist->size())
     {
         playlistindex = 0;
         shuffleindex = 0;
@@ -553,52 +675,74 @@
     // to decrease memory allocation overhead
     playlistorder.reserve(plist->size());
 
+    bool doing_elapsed = true;
+
+    if (curMeta == Metadata("dummy.music"))
+    {
+        doing_elapsed = false;
+    }
+
     if (shufflemode == 0)
     {
-        for (int i = 0; i < (int)plist->size(); i++)
+        for (int i = 0; i < (int) plist->size(); i++)
         {
+            plTime += ((*plist)[i]).Length() / 1000;
             playlistorder.push_back(i);
             if (curMeta == (*plist)[i])
+            {
                 shuffleindex = playlistindex = i;
-        } 
+                doing_elapsed = false;
+            }
+            else if (doing_elapsed)
+            {
+                plElapsed += ((*plist)[i]).Length() / 1000;
+            }
+        }
     }
     else if (shufflemode == 1)
     {
         int max = plist->size();
-        srand((unsigned int)time(NULL));
+        srand((unsigned int) time(NULL));
 
         int i;
         bool usedList[max];
         for (i = 0; i < max; i++)
             usedList[i] = false;
 
-        int index = 0; 
+        int index = 0;
         int lastindex = 0;
 
         for (i = 0; i < max; i++)
         {
             while (1)
             {
-                index = (int)((double)rand() / (RAND_MAX + 1.0) * max);
+                index = (int) ((double) rand() / (RAND_MAX + 1.0) * max);
                 if (max - i > 50 && abs(index - lastindex) < 10)
                     continue;
                 if (usedList[index] == false)
                     break;
             }
             usedList[index] = true;
+            plTime += ((*plist)[index]).Length() / 1000;
             playlistorder.push_back(index);
             lastindex = index;
 
-            if (curMeta == (*plist)[i])
-                playlistindex = i;
             if (curMeta == (*plist)[index])
+            {
                 shuffleindex = i;
+                doing_elapsed = false;
+            }
+            else if (doing_elapsed)
+            {
+                plElapsed += ((*plist)[index]).Length() / 1000;
+            }
+
         }
     }
     else if (shufflemode == 2)
     {
         int max = plist->size();
-        srand((unsigned int)time(NULL));
+        srand((unsigned int) time(NULL));
 
         int i, j, temp;
         double tempd;
@@ -606,14 +750,15 @@
         double currentDateTime = cTime.toString("yyyyMMddhhmmss").toDouble();
         double weight;
 
-        QValueVector<double> playlistweight;
+        QValueVector < double >playlistweight;
         playlistweight.reserve(max);
 
         for (i = 0; i < max; i++)
         {
-            weight = computeIntelligentWeight((*plist)[i], currentDateTime); 
+            weight = computeIntelligentWeight((*plist)[i], currentDateTime);
             playlistweight.push_back(weight);
             playlistorder.push_back(i);
+            plTime += ((*plist)[i]).Length() / 1000;
         }
 
         for (i = 0; i < (max - i); i++)
@@ -625,13 +770,26 @@
                     tempd = playlistweight[i];
                     playlistweight[i] = playlistweight[j];
                     playlistweight[j] = tempd;
- 
+
                     temp = playlistorder[i];
                     playlistorder[i] = playlistorder[j];
                     playlistorder[j] = temp;
                 }
             }
         }
+
+        for (i = 0; i < max && doing_elapsed; i++)
+        {
+            if (curMeta == (*plist)[i])
+            {
+                shuffleindex = i;
+                doing_elapsed = false;
+            }
+            else
+            {
+                plElapsed += ((*plist)[i]).Length() / 1000;
+            }
+        }
     }
 
     playlistindex = playlistorder[shuffleindex];
@@ -660,35 +818,39 @@
         output = new AudioOutput(outputBufferSize * 1024, adevice);
         output->setBufferSize(outputBufferSize * 1024);
         output->addListener(this);
-		output->addListener(mainvisual);
-    	output->addVisual(mainvisual);
-	
+        output->addListener(mainvisual);
+        output->addVisual(mainvisual);
+
         startoutput = true;
 
         if (!output->initialize())
             return;
     }
-   
+
     if (output->isPaused())
     {
         pause();
         return;
     }
- 
-    if (!sourceurl.isLocalFile()) {
+
+    if (!sourceurl.isLocalFile())
+    {
         StreamInput streaminput(sourceurl);
         streaminput.setup();
         input = streaminput.socket();
-    } else
+    }
+    else
         input = new QFile(sourceurl.toString(FALSE, FALSE));
 
     if (decoder && !decoder->factory()->supports(sourcename))
         decoder = 0;
 
-    if (!decoder) {
+    if (!decoder)
+    {
         decoder = Decoder::create(sourcename, input, output);
 
-        if (! decoder) {
+        if (!decoder)
+        {
             printf("mythmusic: unsupported fileformat\n");
             stopAll();
             return;
@@ -696,13 +858,15 @@
 
         decoder->setBlockSize(globalBlockSize);
         decoder->addListener(this);
-    } else {
+    }
+    else
+    {
         decoder->setInput(input);
         decoder->setOutput(output);
     }
 
-    QString disp = curMeta.Artist() + "  ~  " + curMeta.Album() + 
-                   "  ~   " + curMeta.Title();
+    QString disp = curMeta.Artist() + "  ~  " + curMeta.Album() +
+        "  ~   " + curMeta.Title();
     titlelabel->setText(disp);
 
     jumpToItem(listlist.at(playlistindex));
@@ -712,17 +876,21 @@
 
     mainvisual->setDecoder(decoder);
     mainvisual->setOutput(output);
-    
-    if (decoder->initialize()) {
+
+    if (decoder->initialize())
+    {
         seekbar->setMinValue(0);
         seekbar->setValue(0);
         seekbar->setMaxValue(maxTime);
-        if (seekbar->maxValue() == 0) {
+        if (seekbar->maxValue() == 0)
+        {
             seekbar->setEnabled(false);
-        } else {
+        }
+        else
+        {
             seekbar->setEnabled(true);
         }
- 
+
         if (output)
         {
             if (startoutput)
@@ -735,10 +903,10 @@
 
         isplaying = true;
         curMeta.setLastPlay(db);
-        curMeta.incPlayCount(db);    
-   
+        curMeta.incPlayCount(db);
+
         playlist_timer->start(1, true);
- 
+
         gContext->LCDswitchToChannel(curMeta.Artist(), curMeta.Title(), "");
     }
 }
@@ -757,22 +925,26 @@
 
 void PlaybackBox::pause(void)
 {
-    if (output) {
+    if (output)
+    {
         output->mutex()->lock();
         output->pause();
         isplaying = !isplaying;
-        pauseb->setOn(!isplaying);
+	if (pauseb)
+	  pauseb->setOn(!isplaying);
         output->mutex()->unlock();
     }
 
     // wake up threads
-    if (decoder) {
+    if (decoder)
+    {
         decoder->mutex()->lock();
         decoder->cond()->wakeAll();
         decoder->mutex()->unlock();
     }
 
-    if (output) {
+    if (output)
+    {
         output->recycler()->mutex()->lock();
         output->recycler()->cond()->wakeAll();
         output->recycler()->mutex()->unlock();
@@ -781,13 +953,15 @@
 
 void PlaybackBox::stopDecoder(void)
 {
-    if (decoder && decoder->running()) {
+    if (decoder && decoder->running())
+    {
         decoder->mutex()->lock();
         decoder->stop();
         decoder->mutex()->unlock();
     }
 
-    if (decoder) {
+    if (decoder)
+    {
         decoder->mutex()->lock();
         decoder->cond()->wakeAll();
         decoder->mutex()->unlock();
@@ -799,26 +973,30 @@
 
 void PlaybackBox::stop(void)
 {
-    if (decoder && decoder->running()) {
+    if (decoder && decoder->running())
+    {
         decoder->mutex()->lock();
         decoder->stop();
         decoder->mutex()->unlock();
     }
 
-    if (output && output->running()) {
+    if (output && output->running())
+    {
         output->mutex()->lock();
         output->stop();
         output->mutex()->unlock();
     }
 
     // wake up threads
-    if (decoder) {
+    if (decoder)
+    {
         decoder->mutex()->lock();
         decoder->cond()->wakeAll();
         decoder->mutex()->unlock();
     }
 
-    if (output) {
+    if (output)
+    {
         output->recycler()->mutex()->lock();
         output->recycler()->cond()->wakeAll();
         output->recycler()->mutex()->unlock();
@@ -854,7 +1032,8 @@
     gContext->LCDswitchToTime();
     stop();
 
-    if (decoder) {
+    if (decoder)
+    {
         decoder->removeListener(this);
         decoder = 0;
     }
@@ -866,11 +1045,15 @@
 
     shuffleindex--;
     if (shuffleindex < 0)
+    {
         shuffleindex = plist->size() - 1;
+        plElapsed = plTime;
+    }
 
     playlistindex = playlistorder[shuffleindex];
 
     curMeta = ((*plist)[playlistindex]);
+    plElapsed -= curMeta.Length() / 1000;
 
     listlock.unlock();
 
@@ -885,8 +1068,12 @@
         curMeta.decRating(db);
 
     shuffleindex++;
-    if (shuffleindex >= (int)plist->size())
+    plElapsed += curMeta.Length() / 1000;
+    if (shuffleindex >= (int) plist->size())
+    {
         shuffleindex = 0;
+        plElapsed = 0;
+    }
 
     playlistindex = playlistorder[shuffleindex];
 
@@ -894,7 +1081,10 @@
 
     listlock.unlock();
 
-    play();
+    if (0 == shuffleindex && REPEAT_OFF == repeatmode)
+        stop();
+    else
+        play();
 }
 
 void PlaybackBox::nextAuto()
@@ -903,9 +1093,9 @@
 
     isplaying = false;
 
-    if (repeatmode)
+    if (REPEAT_TRACK == repeatmode)
         play();
-    else 
+    else
         next();
 }
 
@@ -937,15 +1127,18 @@
 
 void PlaybackBox::seek(int pos)
 {
-    if (output && output->running()) {
+    if (output && output->running())
+    {
         output->mutex()->lock();
         output->seek(pos);
 
-        if (decoder && decoder->running()) {
+        if (decoder && decoder->running())
+        {
             decoder->mutex()->lock();
             decoder->seek(pos);
 
-            if (mainvisual) {
+            if (mainvisual)
+            {
                 mainvisual->mutex()->lock();
                 mainvisual->prepare();
                 mainvisual->mutex()->unlock();
@@ -958,23 +1151,45 @@
     }
 }
 
-void PlaybackBox::toggleShuffle()
+void PlaybackBox::setShuffleMode(unsigned int mode)
 {
-    shufflemode = (shufflemode + 1) % 3;
+    shufflemode = mode;
 
     setupPlaylist();
 
-    if (shufflemode == 2)
-        randomize->setText("Shuffle: Intelligent");
-    else if (shufflemode == 1)
-        randomize->setText("Shuffle: Random");
-    else
-        randomize->setText("Shuffle: Normal"); 
+    switch (shufflemode)
+    {
+    case SHUFFLE_INTELLIGENT:
+        shufflelabel->setText("Shuffle: Intelligent");
+        break;
 
-    if (keyboard_accelerator_flag)
-        randomize->setAccel(Key_1);
+    case SHUFFLE_RANDOM:
+        shufflelabel->setText("Shuffle: Random");
+        break;
+
+    case SHUFFLE_OFF:
+    default:
+        shufflelabel->setText("");
+        break;
+    }
 }
 
+void PlaybackBox::toggleShuffle()
+{
+    setShuffleMode(++shufflemode % MAX_SHUFFLE_MODES);
+}
+
+void PlaybackBox::setTimeMode(unsigned int mode)
+{
+    timeMode = mode;
+}
+
+void PlaybackBox::toggleTime()
+{
+    setTimeMode(++timeMode % MAX_TIME_DISPLAY_MODES);
+}
+
+
 void PlaybackBox::increaseRating()
 {
     curMeta.incRating(db);
@@ -1004,24 +1219,45 @@
     }
 }
 
-void PlaybackBox::toggleRepeat()
+void PlaybackBox::togglePlaylistView()
 {
-    repeatmode = !repeatmode;
-
-    if (repeatmode)
-        repeat->setText("Repeat: Track");
+    if (playview->isVisible())
+        playview->hide();
     else
-        repeat->setText("Repeat: Playlist");
+        playview->show();
+}
 
-    if (keyboard_accelerator_flag)
-        repeat->setAccel(Key_2);
+void PlaybackBox::setRepeatMode(unsigned int mode)
+{
+    repeatmode = mode;
+
+    switch (repeatmode)
+    {
+    case REPEAT_TRACK:
+        repeatlabel->setText("Repeat: Track");
+        break;
+
+    case REPEAT_ALL:
+        repeatlabel->setText("Repeat: All");
+        break;
+
+    case REPEAT_OFF:
+    default:
+        repeatlabel->setText("");
+        break;
+    }
+}
+
+void PlaybackBox::toggleRepeat()
+{
+    setRepeatMode(++repeatmode % MAX_REPEAT_MODES);
 }
 
 void PlaybackBox::editPlaylist()
 {
     Metadata firstdata = curMeta;
-    
-    QValueList<Metadata> dblist = *plist; 
+
+    QValueList < Metadata > dblist = *plist;
     QString paths = gContext->GetSetting("TreeLevels");
     DatabaseBox dbbox(db, paths, &dblist);
 
@@ -1052,10 +1288,10 @@
 
             play();
         }
-    }    
+    }
 }
 
-void PlaybackBox::closeEvent(QCloseEvent *event)
+void PlaybackBox::closeEvent(QCloseEvent * event)
 {
     stopAll();
 
@@ -1063,14 +1299,15 @@
     event->accept();
 }
 
-void PlaybackBox::showEvent(QShowEvent *event)
+void PlaybackBox::showEvent(QShowEvent * event)
 {
     QWidget::showEvent(event);
 }
 
-void PlaybackBox::customEvent(QCustomEvent *event)
+void PlaybackBox::customEvent(QCustomEvent * event)
 {
-    switch ((int) event->type()) {
+    switch ((int) event->type())
+    {
     case OutputEvent::Playing:
         {
             statusString = tr("Playing stream.");
@@ -1096,24 +1333,59 @@
         {
             OutputEvent *oe = (OutputEvent *) event;
 
-            int em, es, rs;
+            int eh, em, es, rs, ts;
             float percent_heard;
+            char *timeModeString = NULL;
 
-            currentTime = rs = oe->elapsedSeconds();
+            currentTime = rs = ts = oe->elapsedSeconds();
 
-            em = rs / 60;
-            es = rs % 60;
+            switch (timeMode)
+            {
+            case TRACK_REMAIN:
+                ts = (curMeta.Length() / 1000) - ts;
+                timeModeString = "Track Remaining: ";
+                break;
 
-            timeString.sprintf("%02d:%02d", em, es);
-			
-            percent_heard = ((float)rs / (float)curMeta.Length() ) * 1000.0;
+            case PLIST_ELAPSED:
+                ts = plElapsed + ts;
+                timeModeString = "Total Elapsed: ";
+                break;
+
+            case PLIST_REMAIN:
+                ts = plTime - plElapsed - ts;
+                timeModeString = "Total Remaining: ";
+                break;
+
+            case TRACK_ELAPSED:
+            default:
+                timeModeString = "Track Elapsed: ";
+                break;
+            }
+
+            eh = ts / 3600;
+            em = (ts / 60) % 60;
+            es = ts % 60;
+
+            if (0 < eh)
+            {
+                timeString.sprintf("%s%5d:%02d:%02d", timeModeString, eh, em,
+                                   es);
+            }
+            else
+            {
+                timeString.sprintf("%s      %2d:%02d", timeModeString, em,
+                                   es);
+            }
+
+            percent_heard = ((float) rs / (float) curMeta.Length()) * 1000.0;
 
             gContext->LCDsetChannelProgress(percent_heard);
-            if (! seeking)
+            if (!seeking)
                 seekbar->setValue(oe->elapsedSeconds());
 
             infoString.sprintf("%d kbps, %.1f kHz %s.",
-                               oe->bitrate(), float(oe->frequency()) / 1000.0,
+                               oe->bitrate(),
+                               float (oe->frequency()) / 1000.0,
                                oe->channels() > 1 ? "stereo" : "mono");
 
             timelabel->setText(timeString);
@@ -1165,4 +1437,3 @@
 
     QWidget::customEvent(event);
 }
-
Index: mythmusic/playbackbox.h
===================================================================
RCS file: /var/lib/cvs/mythmusic/mythmusic/playbackbox.h,v
retrieving revision 1.18
diff -u -d -r1.18 playbackbox.h
--- mythmusic/playbackbox.h	10 Mar 2003 15:22:14 -0000	1.18
+++ mythmusic/playbackbox.h	14 Mar 2003 20:39:30 -0000
@@ -24,25 +24,24 @@
 class QSqlDatabase;
 class QListViewItem;
 class QSlider;
+class QAction;
 class ScrollLabel;
 class MyToolButton;
 class MainVisual;
 
-class PlaybackBox : public MythDialog
+class PlaybackBox:public MythDialog
 {
-    Q_OBJECT
-  public:
-    PlaybackBox(QSqlDatabase *ldb, QValueList<Metadata> *playlist,
-                QWidget *parent = 0, const char *name = 0);
+  Q_OBJECT public:
+    PlaybackBox(QSqlDatabase * ldb, QValueList < Metadata > *playlist,
+                QWidget * parent = 0, const char *name = 0);
 
-    ~PlaybackBox(void);
+     ~PlaybackBox(void);
 
     void closeEvent(QCloseEvent *);
     void customEvent(QCustomEvent *);
     void showEvent(QShowEvent *);
 
-  public slots:
-    void play();
+    public slots: void play();
     void pause();
     void stop();
     void stopDecoder();
@@ -52,27 +51,31 @@
     void seekback();
     void seek(int);
     void stopAll();
+    void setShuffleMode(unsigned int mode);
     void toggleShuffle();
+    void setTimeMode(unsigned int mode);
+    void toggleTime();
     void increaseRating();
     void decreaseRating();
+    void setRepeatMode(unsigned int mode);
     void toggleRepeat();
     void editPlaylist();
+    void togglePlaylistView();
     void nextAuto();
     void visEnable();
     void resetTimer();
     void restartTimer();
-    void jumpToItem(QListViewItem *curItem);
-    void jumpToItem();   
-    void keyPressFromVisual(QKeyEvent *e);
- 
-  private slots:
-    void startseek();
+    void jumpToItem(QListViewItem * curItem);
+    void jumpToItem();
+    void keyPressFromVisual(QKeyEvent * e);
+
+    private slots: void startseek();
     void doneseek();
 
   private:
     void setupListView(void);
 
-    double computeIntelligentWeight(Metadata &mdata, double currentDateTime);
+    double computeIntelligentWeight(Metadata & mdata, double currentDateTime);
     void setupPlaylist(void);
 
     QPixmap scalePixmap(const char **xpmdata);
@@ -83,44 +86,61 @@
 
     QString playfile;
     QString statusString, timeString, infoString;
+    QString shuffleString, repeatString;
 
-    bool firstShow, remainingTime, seeking;
+    enum TimeDisplayMode
+        { TRACK_ELAPSED, TRACK_REMAIN, PLIST_ELAPSED, PLIST_REMAIN,
+                MAX_TIME_DISPLAY_MODES };
+    enum RepeatMode
+        { REPEAT_OFF, REPEAT_TRACK, REPEAT_ALL, MAX_REPEAT_MODES };
+    enum ShuffleMode
+        { SHUFFLE_OFF, SHUFFLE_RANDOM, SHUFFLE_INTELLIGENT,
+                MAX_SHUFFLE_MODES };
+
+    unsigned int timeMode;
+    int plTime, plElapsed;
+
+    bool firstShow, seeking;
     int outputBufferSize;
     int currentTime, maxTime;
 
     QSqlDatabase *db;
 
-    QValueList<Metadata> *plist;
-    QValueVector<int> playlistorder;
+      QValueList < Metadata > *plist;
+      QValueVector < int >playlistorder;
     QMutex listlock;
 
     int playlistindex;
     int shuffleindex;
     Metadata curMeta;
 
+    QLabel *shufflelabel;
+    QLabel *repeatlabel;
     QLabel *timelabel;
     ScrollLabel *titlelabel;
 
     MythListView *playview;
-    QPtrList<QListViewItem> listlist;
+      QPtrList < QListViewItem > listlist;
 
     QSlider *seekbar;
 
-    MythToolButton *randomize;
-    MythToolButton *repeat;
-    MythToolButton *pledit;
-    MythToolButton *vis;
-    MythToolButton *pauseb;
+    MythToolButton *randomize, *repeat, *pledit, *vis, *pauseb, *prevb,
+        *prevfileb, *stopb, *nextb, *nextfileb, *rateup, *ratedn, *playb;
 
-    int shufflemode;
-    bool repeatmode;
+    QAction *prevfileAction, *prevAction, *pauseAction, *playAction,
+        *stopAction, *nextAction, *nextfileAction, *rateupAction,
+        *ratednAction, *shuffleAction, *repeatAction, *pleditAction,
+        *visAction, *timeDisplaySelect, *playlistViewAction;
+
+    unsigned int shufflemode;
+    unsigned int repeatmode;
 
     bool isplaying;
 
     MainVisual *mainvisual;
 
     QString visual_mode;
-    int	visual_mode_delay;
+    int visual_mode_delay;
     QTimer *visual_mode_timer;
     QTimer *lcd_update_timer;
     QTimer *playlist_timer;


More information about the mythtv-dev mailing list