Ticket #2685: albumart.2.diff

File albumart.2.diff, 4.4 KB (added by dave@…, 13 years ago)

Latest patch against trunk revision 13192

  • playbackbox.cpp

     
    9191    showrating = gContext->GetNumSetting("MusicShowRatings", 0);
    9292    listAsShuffled = gContext->GetNumSetting("ListAsShuffled", 0);
    9393    cycle_visualizer = gContext->GetNumSetting("VisualCycleOnSongChange", 0);
     94    show_album_art = gContext->GetNumSetting("AlbumArtOnSongChange", 0);
    9495
    9596    // Through the magic of themes, our "GUI" already exists we just need to
    9697    // wire up it
     
    12401245{
    12411246    if (visualizer_status != 2)
    12421247        return;
    1243 
     1248   
    12441249    banner_timer->start(millis);
     1250    if (show_album_art)
     1251        mainvisual->forceVisual("AlbumArt");
    12451252    mainvisual->addInformation(text);
    12461253}
    12471254
     
    12631270{
    12641271    banner_timer->stop();
    12651272    mainvisual->addInformation("");
     1273    if (show_album_art)
     1274        mainvisual->unforceVisual();
    12661275}
    12671276
    12681277void PlaybackBoxMusic::CycleVisualizer()
  • mainvisual.h

     
    8080    void setVis( VisualBase *newvis );
    8181    void setVisual( const QString &visualname );
    8282
     83    void forceVisual ( const QString &visualname );
     84    void unforceVisual();
     85
    8386    QString getCurrentVisual() const;
    8487    QString getCurrentVisualDesc() const;
    8588    int numVisualizers() const;
     
    126129
    127130    QString current_visual_name;
    128131    QStringList allowed_modes;
     132
     133    QString next_visual;
     134    bool visual_forced;
    129135};
    130136
    131137class InfoWidget : public QWidget
  • globalsettings.cpp

     
    372372    return gc;
    373373};
    374374
     375static HostCheckBox *AlbumArtOnSongChange()
     376{
     377    HostCheckBox *gc = new HostCheckBox("AlbumArtOnSongChange");
     378    gc->setLabel(QObject::tr("Show album art at start of each song"));
     379    gc->setValue(false);
     380    gc->setHelpText(QObject::tr("Show the album art when the song "
     381                    "change."));
     382    return gc;
     383};
     384
    375385static HostSpinBox *VisualScaleWidth()
    376386{
    377387    HostSpinBox *gc = new HostSpinBox("VisualScaleWidth", 1, 2, 1);
     
    599609    playersettings3->setLabel(QObject::tr("Visualization Settings"));
    600610    playersettings3->addChild(VisualizationMode());
    601611    playersettings3->addChild(VisualCycleOnSongChange());
     612    playersettings3->addChild(AlbumArtOnSongChange());
    602613    playersettings3->addChild(VisualModeDelay());
    603614    playersettings3->addChild(VisualScaleWidth());
    604615    playersettings3->addChild(VisualScaleHeight());
  • playbackbox.h

     
    192192    GenericTree *playlist_tree;
    193193   
    194194    bool cycle_visualizer;
     195    bool show_album_art;
    195196    bool show_whole_tree;
    196197    bool keyboard_accelerators;
    197198    bool volume_control;
  • mainvisual.cpp

     
    101101MainVisual::MainVisual(QWidget *parent, const char *name)
    102102    : QWidget( parent, name ), vis( 0 ), playing( FALSE ), fps( 20 )
    103103{
     104    visual_forced = false;
     105
    104106    int screenwidth = 0, screenheight = 0;
    105107    float wmult = 0, hmult = 0;
    106108   
     
    134136    nodes.clear();
    135137}
    136138
     139void MainVisual::forceVisual( const QString &visualname )
     140{
     141    if (visual_forced)
     142        return;
     143    next_visual = getCurrentVisual();
     144    setVisual(visualname);
     145    visual_forced = true;
     146}
     147
     148void MainVisual::unforceVisual(void)
     149{
     150    if (!visual_forced)
     151        return;
     152    visual_forced = false;
     153    setVisual(next_visual);
     154}
     155
    137156void MainVisual::setVisual( const QString &visualname )
    138157{
     158    if (visual_forced)
     159    {
     160        next_visual = visualname;
     161        return;
     162    }
     163
    139164    if (vis)
    140165    {
    141166        delete vis;
     
    218243
    219244QString MainVisual::getCurrentVisual(void) const
    220245{
     246    if (visual_forced)
     247        return next_visual;
     248    //else
    221249    return current_visual_name;
    222250}
    223251
     
    225253{
    226254    /* XXX This should be changed to a real call to visual->description()
    227255     * it works as long as ::name and ::desc uses the same string */
     256    if (visual_forced)
     257        return next_visual;
     258    //else
    228259    return QObject::tr(current_visual_name);
    229260}
    230261