Ticket #3676: mythmusic.patch

File mythmusic.patch, 7.8 KB (added by maverik044, 17 years ago)
  • ./mythmusic/mythmusic/playbackbox.cpp

    old new PlaybackBoxMusic::PlaybackBoxMusic(MythM 
    9393    show_album_art = gContext->GetNumSetting("VisualAlbumArtOnSongChange", 0);
    9494    random_visualizer = gContext->GetNumSetting("VisualRandomize", 0);
    9595
    96     m_pushedButton = NULL;
     96    m_pushedButton  = NULL;
     97        m_ShuffleIcon   = NULL;
     98        m_RepeatIcon    = NULL;
    9799
    98100    // Through the magic of themes, our "GUI" already exists we just need to
    99101    // wire up it
    void PlaybackBoxMusic::setShuffleMode(un 
    15631565                else
    15641566                    shuffle_button->setText(tr("Shuffle: Smart"));
    15651567            }
     1568
     1569            if (m_ShuffleIcon)
     1570                m_ShuffleIcon->hide();
     1571
     1572            if (shuffle_icon_intelligent)
     1573                shuffle_icon_intelligent->show();
     1574
     1575            m_ShuffleIcon = shuffle_icon_intelligent;
     1576                       
    15661577            music_tree_list->scrambleParents(true);
    15671578
    15681579            if (class LCD *lcd = LCD::Get())
    void PlaybackBoxMusic::setShuffleMode(un 
    15781589                else
    15791590                    shuffle_button->setText(tr("Shuffle: Rand"));
    15801591            }
     1592
     1593            if (m_ShuffleIcon)
     1594                m_ShuffleIcon->hide();
     1595
     1596            if (shuffle_icon_random)
     1597                shuffle_icon_random->show();
     1598
     1599            m_ShuffleIcon = shuffle_icon_random;
     1600
    15811601            music_tree_list->scrambleParents(true);
    15821602
    15831603            if (class LCD *lcd = LCD::Get())
    void PlaybackBoxMusic::setShuffleMode(un 
    15931613                else
    15941614                    shuffle_button->setText(tr("Shuffle: Album"));
    15951615            }
     1616
     1617            if (m_ShuffleIcon)
     1618                m_ShuffleIcon->hide();
     1619
     1620            if (shuffle_icon_album)
     1621                shuffle_icon_album->show();
     1622
     1623            m_ShuffleIcon = shuffle_icon_album;
     1624
    15961625            music_tree_list->scrambleParents(true);
    15971626
    15981627            if (class LCD *lcd = LCD::Get())
    void PlaybackBoxMusic::setShuffleMode(un 
    16081637                else
    16091638                    shuffle_button->setText(tr("Shuffle: None"));
    16101639            }
     1640
     1641            if (m_ShuffleIcon)
     1642                m_ShuffleIcon->hide();
     1643
     1644            m_ShuffleIcon = NULL;
     1645
    16111646            music_tree_list->scrambleParents(false);
    16121647
    16131648            if (class LCD *lcd = LCD::Get())
    void PlaybackBoxMusic::setRepeatMode(uns 
    16711706    switch (repeatmode)
    16721707    {
    16731708        case REPEAT_ALL:
    1674             if (keyboard_accelerators)
    1675                 repeat_button->setText(tr("2 Repeat: All"));
    1676             else
    1677                 repeat_button->setText(tr("Repeat: All"));
     1709            if (repeat_button)
     1710            {
     1711                if (keyboard_accelerators)
     1712                        repeat_button->setText(tr("2 Repeat: All"));
     1713                else
     1714                        repeat_button->setText(tr("Repeat: All"));
     1715            }
     1716
     1717            if (m_RepeatIcon)
     1718                m_RepeatIcon->hide();
     1719
     1720            if (repeat_icon_all)
     1721                repeat_icon_all->show();
     1722
     1723            m_RepeatIcon = repeat_icon_all;
    16781724
    16791725            if (class LCD *lcd = LCD::Get())
    16801726                lcd->setMusicRepeat (LCD::MUSIC_REPEAT_ALL);
    void PlaybackBoxMusic::setRepeatMode(uns 
    16821728            bannerEnable(tr("Repeat: All"), 4000);
    16831729            break;
    16841730        case REPEAT_TRACK:
    1685             if (keyboard_accelerators)
    1686                 repeat_button->setText(tr("2 Repeat: Track"));
    1687             else
    1688                 repeat_button->setText(tr("Repeat: Track"));
     1731            if (repeat_button)
     1732            {
     1733                if (keyboard_accelerators)
     1734                        repeat_button->setText(tr("2 Repeat: Track"));
     1735                else
     1736                        repeat_button->setText(tr("Repeat: Track"));
     1737            }
     1738
     1739            if (m_RepeatIcon)
     1740                m_RepeatIcon->hide();
     1741
     1742            if (repeat_icon_track)
     1743                repeat_icon_track->show();
     1744
     1745            m_RepeatIcon = repeat_icon_track;
    16891746
    16901747            if (class LCD *lcd = LCD::Get())
    16911748                lcd->setMusicRepeat (LCD::MUSIC_REPEAT_TRACK);
    void PlaybackBoxMusic::setRepeatMode(uns 
    16931750            bannerEnable(tr("Repeat: Track"), 4000);
    16941751            break;
    16951752        default:
    1696             if (keyboard_accelerators)
    1697                 repeat_button->setText(tr("2 Repeat: None"));
    1698             else
    1699                 repeat_button->setText(tr("Repeat: None"));
     1753            if (repeat_button)
     1754            {
     1755                if (keyboard_accelerators)
     1756                        repeat_button->setText(tr("2 Repeat: None"));
     1757                else
     1758                        repeat_button->setText(tr("Repeat: None"));
     1759            }
     1760
     1761            if (m_RepeatIcon)
     1762                m_RepeatIcon->hide();
     1763
     1764            m_RepeatIcon = NULL;
    17001765
    17011766            if (class LCD *lcd = LCD::Get())
    17021767                lcd->setMusicRepeat (LCD::MUSIC_REPEAT_NONE);
    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 
    20382106    if (album_text)
    20392107        album_text->SetText(mdata->Album());
    20402108
     2109        if (albumart_image)
     2110                ShowAlbumArtImage(mdata);
     2111
    20412112    setTrackOnLCD(mdata);
    20422113}
    20432114
     2115void PlaybackBoxMusic::ShowAlbumArtImage(Metadata *mdata)
     2116{
     2117        QSize img_size = albumart_image->GetSize(true);
     2118
     2119        QImage albumArt = mdata->getAlbumArt(IT_FRONTCOVER);
     2120
     2121        if (!albumArt.isNull())
     2122    {
     2123                // draw the albumArt image
     2124                albumArt = albumArt.smoothScale(img_size.width(), img_size.height(), QImage::ScaleMin);
     2125
     2126                QPixmap img(img_size.width(), img_size.height());
     2127
     2128                if (img.convertFromImage(albumArt))
     2129                {               
     2130                        albumart_image->SetImage(img);
     2131                        albumart_image->show();
     2132                }
     2133                else
     2134                        albumart_image->hide();
     2135        }
     2136        else
     2137                albumart_image->hide();
     2138}
     2139
     2140void PlaybackBoxMusic::WipeAlbumArt()
     2141{
     2142        albumart_image->hide();
     2143}
     2144
    20442145void PlaybackBoxMusic::openOutputDevice(void)
    20452146{
    20462147    QString adevice;
    void PlaybackBoxMusic::wireUpTheme() 
    22072308    }
    22082309    visual_blackhole = getUIBlackHoleType("visual_blackhole");
    22092310
     2311    albumart_image   = getUIImageType("albumart");
     2312    albumart_image->hide();
     2313
    22102314    //  Buttons
    22112315    prev_button = getUIPushButtonType("prev_button");
    22122316    if (prev_button)
    void PlaybackBoxMusic::wireUpTheme() 
    22502354    if (repeat_button)
    22512355        connect(repeat_button, SIGNAL(pushed()), this, SLOT(toggleRepeat()));
    22522356
     2357    shuffle_icon_random = getUIImageType("icon-shuffle-random");
     2358    shuffle_icon_intelligent = getUIImageType("icon-shuffle-intelligent");
     2359    shuffle_icon_album = getUIImageType("icon-shuffle-album");
     2360    shuffle_icon_random->hide();
     2361    shuffle_icon_intelligent->hide();
     2362    shuffle_icon_album->hide();
     2363
     2364    repeat_icon_track = getUIImageType("icon-repeat-track");
     2365    repeat_icon_all = getUIImageType("icon-repeat-all");
     2366    repeat_icon_track->hide();
     2367    repeat_icon_all->hide();
     2368
    22532369    pledit_button = getUITextButtonType("pledit_button");
    22542370    if (pledit_button)
    22552371        connect(pledit_button, SIGNAL(pushed()), this, SLOT(editPlaylist()));
  • ./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           *m_ShuffleIcon;
     240    UIImageType           *m_RepeatIcon;
     241
     242    UIImageType           *shuffle_icon_off;
     243    UIImageType           *shuffle_icon_random;
     244    UIImageType           *shuffle_icon_intelligent;
     245    UIImageType           *shuffle_icon_album;
     246
     247    UIImageType           *repeat_icon_off;
     248    UIImageType           *repeat_icon_track;
     249    UIImageType           *repeat_icon_all;
     250        UIImageType               *albumart_image;
     251
    237252    UITextButtonType      *shuffle_button;
    238253    UITextButtonType      *repeat_button;
    239254    UITextButtonType      *pledit_button;