Ticket #3676: mythmusic-shuffle_repeat.patch

File mythmusic-shuffle_repeat.patch, 7.2 KB (added by maverik044, 17 years ago)

patch to allow shuffle-repeat icons in playback screen

  • 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::wireUpTheme() 
    22172334        connect(rew_button, SIGNAL(pushed()), this, SLOT(seekback()));
    22182335
    22192336    pause_button = getUIPushButtonType("pause_button");
    2220     pause_button->setLockOn();
     2337   
    22212338    if (pause_button)
     2339    {
     2340        pause_button->setLockOn();
    22222341        connect(pause_button, SIGNAL(pushed(QString)), this,
    22232342        SLOT(handlePush(QString)));
     2343    }
    22242344
    22252345    play_button = getUIPushButtonType("play_button");
    2226     play_button->setLockOn();
     2346   
    22272347    if (play_button)
     2348    {
     2349        play_button->setLockOn();
    22282350        connect(play_button, SIGNAL(pushed(QString)), this,
    22292351        SLOT(handlePush(QString)));
     2352    }
    22302353
    22312354    stop_button = getUIPushButtonType("stop_button");
    2232     stop_button->setLockOn();
     2355   
    22332356    if (stop_button)
     2357    {
     2358        stop_button->setLockOn();
    22342359        connect(stop_button, SIGNAL(pushed(QString)), this,
    22352360        SLOT(handlePush(QString)));
     2361    }
    22362362
    22372363    ff_button = getUIPushButtonType("ff_button");
    22382364    if (ff_button)
    void PlaybackBoxMusic::wireUpTheme() 
    22502376    if (repeat_button)
    22512377        connect(repeat_button, SIGNAL(pushed()), this, SLOT(toggleRepeat()));
    22522378
     2379    shuffle_icon_random = getUIImageType("icon-shuffle-random");
     2380    shuffle_icon_intelligent = getUIImageType("icon-shuffle-intelligent");
     2381    shuffle_icon_album = getUIImageType("icon-shuffle-album");
     2382   
     2383    if (shuffle_icon_random)
     2384        shuffle_icon_random->hide();
     2385   
     2386    if (shuffle_icon_intelligent)
     2387        shuffle_icon_intelligent->hide();
     2388   
     2389    if (shuffle_icon_album)
     2390        shuffle_icon_album->hide();
     2391
     2392    repeat_icon_track = getUIImageType("icon-repeat-track");
     2393    repeat_icon_all   = getUIImageType("icon-repeat-all");
     2394   
     2395    if (repeat_icon_track)
     2396        repeat_icon_track->hide();
     2397   
     2398    if (repeat_icon_all)
     2399        repeat_icon_all->hide();
     2400
    22532401    pledit_button = getUITextButtonType("pledit_button");
    22542402    if (pledit_button)
    22552403        connect(pledit_button, SIGNAL(pushed()), this, SLOT(editPlaylist()));
  • ./mythmusic/mythmusic/playbackbox.h

    old new class PlaybackBoxMusic : public MythThem 
    234234
    235235    UIPushButtonType      *m_pushedButton;
    236236
     237    UIImageType           *m_ShuffleIcon;
     238    UIImageType           *m_RepeatIcon;
     239
     240    UIImageType           *shuffle_icon_off;
     241    UIImageType           *shuffle_icon_random;
     242    UIImageType           *shuffle_icon_intelligent;
     243    UIImageType           *shuffle_icon_album;
     244
     245    UIImageType           *repeat_icon_off;
     246    UIImageType           *repeat_icon_track;
     247    UIImageType           *repeat_icon_all;
     248
    237249    UITextButtonType      *shuffle_button;
    238250    UITextButtonType      *repeat_button;
    239251    UITextButtonType      *pledit_button;