Ticket #2935: mythmusic_transport_r12662.patch

File mythmusic_transport_r12662.patch, 10.2 KB (added by mythtv@…, 17 years ago)

Patch refresh against head revision 12662

  • mythmusic/mythmusic/playbackbox.cpp

     
    302302                seekback();
    303303        }
    304304        else if (action == "PAUSE")
    305         { 
     305        {
    306306            if (isplaying)
    307             {
    308                 if (pause_button)
    309                     pause_button->push();
    310                 else
    311                     pause();
    312             }
     307                pause();
    313308            else
    314             {
    315                 if (play_button)
    316                     play_button->push();
    317                 else
    318                     play();
    319             }
     309                play();
    320310        }
    321311        else if (action == "STOP")
    322         {
    323             if (stop_button)
    324                 stop_button->push();
    325             else
    326                 stop();
     312        {
     313            stop();
    327314        }
    328315        else if (action == "THMBUP")
    329316            increaseRating();
     
    794781    branches_to_current_node.append(1); //  We're on a playlist (not "My Music")
    795782    branches_to_current_node.append(0); //  Active play Queue
    796783    music_tree_list->moveToNodesFirstChild(branches_to_current_node);
     784    play();
    797785}
    798786
    799787void PlaybackBoxMusic::updatePlaylistFromCD()
     
    947935                if (curMeta)
    948936                    updateTrackInfo(curMeta);
    949937
     938                play();
     939
    950940                return;     // Do not restart Timer
    951941            }
    952942            else
     
    10571047        visual_mode_timer->changeInterval(visual_mode_delay * 1000);
    10581048}
    10591049
    1060 void PlaybackBoxMusic::play()
     1050void PlaybackBoxMusic::play(bool state)
    10611051{
     1052    if (!state && play_button)
     1053        play_button->setState(!state);
     1054
    10621055    if (isplaying)
    10631056        stop();
    10641057
     
    11321125
    11331126        bannerEnable(curMeta);
    11341127        isplaying = true;
     1128        if (play_button)
     1129            play_button->setState(true);
     1130        if (pause_button)
     1131            pause_button->setState(false);
     1132        if (stop_button)
     1133            stop_button->setState(false);
    11351134        curMeta->setLastPlay();
    1136         curMeta->incPlayCount();   
     1135        curMeta->incPlayCount();
    11371136    }
    11381137}
    11391138
     
    12471246                       mdata->Title());
    12481247}
    12491248
    1250 void PlaybackBoxMusic::pause(void)
     1249void PlaybackBoxMusic::pause(bool state)
    12511250{
    12521251    if (output)
    12531252    {
    12541253        isplaying = !isplaying;
     1254        if (play_button)
     1255            play_button->setState(isplaying);
     1256        if (pause_button)
     1257            pause_button->setState(!isplaying);
    12551258        output->Pause(!isplaying); //Note pause doesn't take effet instantly
     1259
     1260        // wake up threads
     1261        if (decoder)
     1262        {
     1263            decoder->lock();
     1264            decoder->cond()->wakeAll();
     1265            decoder->unlock();
     1266        }
    12561267    }
    1257     // wake up threads
    1258     if (decoder)
     1268    else if (pause_button)
    12591269    {
    1260         decoder->lock();
    1261         decoder->cond()->wakeAll();
    1262         decoder->unlock();
     1270        pause_button->setState(false);
    12631271    }
    1264 
    12651272}
    12661273
    12671274void PlaybackBoxMusic::stopDecoder(void)
     
    12841291        decoder->wait();
    12851292}
    12861293
    1287 void PlaybackBoxMusic::stop(void)
     1294void PlaybackBoxMusic::stop(bool state)
    12881295{
     1296    if (!state && stop_button)
     1297        stop_button->setState(!state);
     1298
    12891299    stopDecoder();
    12901300
    12911301    if (output)
     
    13031313    QString time_string;
    13041314    int maxh = maxTime / 3600;
    13051315    int maxm = (maxTime / 60) % 60;
    1306     int maxs = maxm % 60;
     1316    int maxs = maxTime % 60;
    13071317    if (maxh > 0)
    13081318        time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs);
    13091319    else
     
    13151325        info_text->SetText("");
    13161326
    13171327    isplaying = false;
     1328    if (play_button)
     1329        play_button->setState(false);
     1330    if (pause_button)
     1331        pause_button->setState(false);
     1332    if (stop_button)
     1333        stop_button->setState(true);
    13181334}
    13191335
    13201336void PlaybackBoxMusic::stopAll()
     
    13791395    stopDecoder();
    13801396
    13811397    isplaying = false;
     1398    if (play_button)
     1399        play_button->setState(false);
     1400    if (stop_button)
     1401        stop_button->setState(true);
    13821402
    13831403    if (repeatmode == REPEAT_TRACK)
    13841404        play();
     
    16421662        branches_to_current_node.append(1); //  We're on a playlist (not "My Music")
    16431663        branches_to_current_node.append(0); //  Active play Queue
    16441664        music_tree_list->moveToNodesFirstChild(branches_to_current_node);
     1665        play();
    16451666    }
    16461667    music_tree_list->refresh();
    16471668}
     
    18901911        QString time_string;
    18911912        int maxh = maxTime / 3600;
    18921913        int maxm = (maxTime / 60) % 60;
    1893         int maxs = maxm % 60;
     1914        int maxs = maxTime % 60;
    18941915        if (maxh > 0)
    18951916            time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs);
    18961917        else
     
    19031924                ratings_image->setRepeat(curMeta->Rating());
    19041925        }
    19051926
    1906         if (output && output->GetPause())
     1927        if (output)
    19071928        {
    19081929            stop();
    1909             if(play_button)
    1910             {
    1911                 play_button->push();
    1912             }
    1913             else
    1914             {
    1915                 play();
    1916             }
    1917         }
    1918         else
    19191930            play();
     1931       }
    19201932    }
    19211933    else
    19221934    {
     
    19711983
    19721984void PlaybackBoxMusic::end()
    19731985{
     1986    stop();
     1987
    19741988    if (class LCD *lcd = LCD::Get())
    19751989        lcd->switchToTime ();
    19761990}
     
    20152029    if (rew_button)
    20162030        connect(rew_button, SIGNAL(pushed()), this, SLOT(seekback()));
    20172031
    2018     pause_button = getUIPushButtonType("pause_button");
     2032    pause_button = getUICheckBoxType("pause_button");
    20192033    if (pause_button)
    2020         connect(pause_button, SIGNAL(pushed()), this, SLOT(pause()));
     2034        connect(pause_button, SIGNAL(pushed(bool)), this, SLOT(pause(bool)));
    20212035
    2022     play_button = getUIPushButtonType("play_button");
     2036    play_button = getUICheckBoxType("play_button");
    20232037    if (play_button)
    2024         connect(play_button, SIGNAL(pushed()), this, SLOT(play()));
     2038        connect(play_button, SIGNAL(pushed(bool)), this, SLOT(play(bool)));
    20252039
    2026     stop_button = getUIPushButtonType("stop_button");
     2040    stop_button = getUICheckBoxType("stop_button");
    20272041    if (stop_button)
    2028         connect(stop_button, SIGNAL(pushed()), this, SLOT(stop()));
     2042    {
     2043        connect(stop_button, SIGNAL(pushed(bool)), this, SLOT(stop(bool)));
     2044        stop_button->setState(true);
     2045    }
    20292046
    20302047    ff_button = getUIPushButtonType("ff_button");
    20312048    if (ff_button)
  • mythmusic/mythmusic/music-ui.xml

     
    369369                <image function="pushed" filename="rew_button_pushed.png"></image>
    370370            </pushbutton>
    371371           
    372             <pushbutton name="pause_button" draworder="0">
     372            <checkbox name="pause_button" draworder="0">
    373373                <position>240,40</position>
    374                 <image function="on" filename="pause_button_on.png"></image>
    375                 <image function="off" filename="pause_button_off.png"></image>
    376                 <image function="pushed" filename="pause_button_pushed.png"></image>
    377             </pushbutton>
     374                <image function="checked" filename="pause_button_checked.png"></image>
     375                <image function="unchecked" filename="pause_button_unchecked.png"></image>
     376                <image function="checked_high" filename="pause_button_checked_high.png"></image>
     377                <image function="unchecked_high" filename="pause_button_unchecked_high.png"></image>
     378            </checkbox>
    378379           
    379             <pushbutton name="play_button" draworder="0">
     380            <checkbox name="play_button" draworder="0">
    380381                <position>355,40</position>
    381                 <image function="on" filename="play_button_on.png"></image>
    382                 <image function="off" filename="play_button_off.png"></image>
    383                 <image function="pushed" filename="play_button_pushed.png"></image>
    384             </pushbutton>
     382                <image function="checked" filename="play_button_checked.png"></image>
     383                <image function="unchecked" filename="play_button_unchecked.png"></image>
     384                <image function="checked_high" filename="play_button_checked_high.png"></image>
     385                <image function="unchecked_high" filename="play_button_unchecked_high.png"></image>
     386            </checkbox>
    385387           
    386             <pushbutton name="stop_button" draworder="0">
     388            <checkbox name="stop_button" draworder="0">
    387389                <position>470,40</position>
    388                 <image function="on" filename="stop_button_on.png"></image>
    389                 <image function="off" filename="stop_button_off.png"></image>
    390                 <image function="pushed" filename="stop_button_pushed.png"></image>
    391             </pushbutton>
     390                <image function="checked" filename="stop_button_checked.png"></image>
     391                <image function="unchecked" filename="stop_button_unchecked.png"></image>
     392                <image function="checked_high" filename="stop_button_checked_high.png"></image>
     393                <image function="unchecked_high" filename="stop_button_unchecked_high.png"></image>
     394            </checkbox>
    392395           
    393396            <pushbutton name="ff_button" draworder="0">
    394397                <position>585,40</position>
  • mythmusic/mythmusic/playbackbox.h

     
    4545
    4646  public slots:
    4747
    48     void play();
    49     void pause();
    50     void stop();
     48    void play(bool state = true);
     49    void pause(bool state = true);
     50    void stop(bool state = true);
    5151    void stopDecoder();
    5252    void previous();
    5353    void next();
     
    205205
    206206    UIPushButtonType      *prev_button;
    207207    UIPushButtonType      *rew_button;
    208     UIPushButtonType      *pause_button;
    209     UIPushButtonType      *play_button;
    210     UIPushButtonType      *stop_button;
     208    UICheckBoxType        *pause_button;
     209    UICheckBoxType        *play_button;
     210    UICheckBoxType        *stop_button;
    211211    UIPushButtonType      *ff_button;
    212212    UIPushButtonType      *next_button;
    213213