[mythtv] music playbackbox

Isaac Richards ijr at po.cwru.edu
Sat Feb 22 09:22:09 EST 2003


On Saturday 22 February 2003 08:24 am, Andy Davidoff wrote:
> A few minor fixes in one patch:
> 	- consistency cleanups WRT buttons
> 	- keyboard acceleration didn't work for me WRT shuffle/repeat buttons
> 		+ I reinstalled the accel key in the callback
> 	- pause button toggles
> 	- removed apparently vestigial changeSong()
> 	- selection bar did not highlight the current track when launching
> 	  in random-shuffle mode or while progressing to the next track via
> 	  nextAuto(), despite the fact that the same code was executed and
> 	  works fine when the track is changed manually.
> 		+ my fix exploits this behavior with a timer callback
>
> I spent an inordinate amount of time on this last issue, so if someone
> could verify this on their system, I'd appreciate it.  It's trivial code,
> but I'm trying to learn Qt, and that includes the undocumented features.

It properly highlights the current track for me.  I am using a recent version 
of Qt, though.

> -    playview->setFocusPolicy(NoFocus);
> +    playview->setFocusPolicy(QWidget::NoFocus);

Why this?  The object inherits from QWidget, so there's no need to explicitly 
say it.. 

> -    plist = playlist;
> -    playlistindex = 0;
> -    setupListView();
> -
>      vbox->addWidget(playview, 1);
>
> -    if(keyboard_accelerator_flag.lower() != "true")
> -    {
> -        playb->setFocus();
> -    }
> -
> +    isplaying = false;
>      input = 0; decoder = 0; seeking = false; remainingTime = false;
>      output = 0; outputBufferSize = 256;
> -
> -    shufflemode = false;
>      repeatmode = false;
> -
> -    curMeta = ((*plist)[playlistindex]);
> +    shufflemode = false;
> +    plist = playlist;
>
>     QString playmode = gContext->GetSetting("PlayMode");
> -    if (playmode == "random")
> -    {
> +    if (playmode.lower() == "random")
>         toggleShuffle();
> -        curMeta = ((*plist)[shuffleindex]);
> -    }
> -
> +    else // setupPlaylist() already called by toggleShuffle()
>     setupPlaylist();
> +    playlistindex = playlistorder[shuffleindex];
> +    curMeta = (*plist)[playlistindex];
 
> -    isplaying = false;
> +    setupListView();

Any particular reason for most of the reordering here?  Seems fairly 
gratuitous.

> -    curMeta = (*plist)[playlistindex];
> -    shuffleindex = playlistorder.findIndex(playlistindex);

Removing the curMeta assignment breaks editing the selection list in place 
from the Edit Playlist button.

> void PlaybackBox::visEnable()
> {
>+    // get the list of preferred vis modes
>+    QString visual_mode = gContext->GetSetting("VisualMode");
>+    QStringList modes = QStringList::split(",", visual_mode);
>+
>     if (!visualizer_is_active)
>     {
>         visual_mode_timer->stop();
>         mainvisual->setVisual("Blank");
>         mainvisual->showFullScreen();
>-        mainvisual->setVisual(visual_mode);
>+        // select one of the list of visualization modes
>+        mainvisual->setVisual(modes[rand() % modes.size()]);
>         visualizer_is_active = true;
>     }
> }

Could've picked up on how I modified your previous patch, here.

Isaac


More information about the mythtv-dev mailing list