Ticket #3676: mythmusic-albumart.patch

File mythmusic-albumart.patch, 2.7 KB (added by maverik044, 17 years ago)

Patch to show album art on playback screen

  • mythmusic/mythmusic/playbackbox.cpp

    old new void PlaybackBoxMusic::wipeTrackInfo() 
    20272092            ratings_image->setRepeat(0);
    20282093        if (current_visualization_text)
    20292094            current_visualization_text->SetText("");
     2095
     2096        if (albumart_image)
     2097            WipeAlbumArt();
    20302098}
    20312099
    20322100void PlaybackBoxMusic::updateTrackInfo(Metadata *mdata)
    void PlaybackBoxMusic::updateTrackInfo(M 
    20372105        artist_text->SetText(mdata->FormatArtist());
    20382106    if (album_text)
    20392107        album_text->SetText(mdata->Album());
     2108    if (albumart_image)
     2109        ShowAlbumArtImage(mdata);
    20402110
    20412111    setTrackOnLCD(mdata);
    20422112}
    20432113
     2114void PlaybackBoxMusic::ShowAlbumArtImage(Metadata *mdata)
     2115{
     2116    QSize img_size = albumart_image->GetSize(true);
     2117
     2118    QImage albumArt = mdata->getAlbumArt(IT_FRONTCOVER);
     2119   
     2120    if (!albumart_image)
     2121       return;
     2122
     2123    if (!albumArt.isNull())
     2124    {
     2125       // draw the albumArt image
     2126       albumArt = albumArt.smoothScale(img_size.width(), img_size.height(), QImage::ScaleMin);
     2127
     2128       QPixmap img(img_size.width(), img_size.height());
     2129
     2130       albumart_image->hide();
     2131
     2132       if (img.convertFromImage(albumArt))
     2133       {               
     2134          albumart_image->SetImage(img);
     2135          albumart_image->show();
     2136       }
     2137//       else
     2138//         albumart_image->hide();
     2139    }
     2140    else
     2141      albumart_image->hide();
     2142}
     2143
     2144void PlaybackBoxMusic::WipeAlbumArt()
     2145{
     2146    if (albumart_image)
     2147       albumart_image->hide();
     2148}
     2149
    20442150void PlaybackBoxMusic::openOutputDevice(void)
    20452151{
    20462152    QString adevice;
    void PlaybackBoxMusic::wireUpTheme() 
    22052317        volume_status->SetTotal(100);
    22062318        volume_status->SetOrder(-1);
    22072319    }
     2320   
    22082321    visual_blackhole = getUIBlackHoleType("visual_blackhole");
    22092322
     2323    albumart_image   = getUIImageType("albumart");
     2324    if (albumart_image)
     2325       albumart_image->hide();
     2326
    22102327    //  Buttons
    22112328    prev_button = getUIPushButtonType("prev_button");
    22122329    if (prev_button)
  • ./mythmusic/mythmusic/playbackbox.h

    old new class PlaybackBoxMusic : public MythThem 
    7676    void toggleFullBlankVisualizer();
    7777    void end();
    7878    void resetScrollCount();
     79    void ShowAlbumArtImage(Metadata *mdata);
     80    void WipeAlbumArt();
    7981
    8082    void handlePush(QString buttonname);
    8183
    class PlaybackBoxMusic : public MythThem 
    234236
    235237    UIPushButtonType      *m_pushedButton;
    236238
     239    UIImageType           *albumart_image;
     240
    237241    UITextButtonType      *shuffle_button;
    238242    UITextButtonType      *repeat_button;
    239243    UITextButtonType      *pledit_button;