Ticket #2935: mythmusic_transport_r13303.patch

File mythmusic_transport_r13303.patch, 10.1 KB (added by mythtv@…, 19 years ago)

Patch refresh against head revision 13303

  • mythmusic/mythmusic/playbackbox.cpp

     
    333333                seekback();
    334334        }
    335335        else if (action == "PAUSE")
    336         { 
     336        {
    337337            if (isplaying)
    338             {
    339                 if (pause_button)
    340                     pause_button->push();
    341                 else
    342                     pause();
    343             }
     338                pause();
    344339            else
    345             {
    346                 if (play_button)
    347                     play_button->push();
    348                 else
    349                     play();
    350             }
     340                play();
    351341        }
    352342        else if (action == "STOP")
    353343        {
    354             if (stop_button)
    355                 stop_button->push();
    356             else
    357                 stop();
    358 
    359             currentTime = 0;
     344            stop();
    360345        }
    361346        else if (action == "THMBUP")
    362347            increaseRating();
     
    858843    branches_to_current_node.append(1); //  We're on a playlist (not "My Music")
    859844    branches_to_current_node.append(0); //  Active play Queue
    860845    music_tree_list->moveToNodesFirstChild(branches_to_current_node);
     846    play();
    861847}
    862848
    863849void PlaybackBoxMusic::updatePlaylistFromCD()
     
    10261012                if (curMeta)
    10271013                    updateTrackInfo(curMeta);
    10281014
     1015                play();
     1016
    10291017                return;     // Do not restart Timer
    10301018            }
    10311019            else
     
    11331121        visual_mode_timer->changeInterval(visual_mode_delay * 1000);
    11341122}
    11351123
    1136 void PlaybackBoxMusic::play()
     1124void PlaybackBoxMusic::play(bool state)
    11371125{
     1126    if (!state && play_button)
     1127        play_button->setState(!state);
    11381128
    11391129    if (isplaying)
    11401130        stop();
     
    12161206
    12171207        bannerEnable(curMeta, show_album_art);
    12181208        isplaying = true;
     1209        if (play_button)
     1210            play_button->setState(true);
     1211        if (pause_button)
     1212            pause_button->setState(false);
     1213        if (stop_button)
     1214            stop_button->setState(false);
    12191215        curMeta->setLastPlay();
    12201216        curMeta->incPlayCount();
    12211217    }
     
    13121308                       mdata->Title());
    13131309}
    13141310
    1315 void PlaybackBoxMusic::pause(void)
     1311void PlaybackBoxMusic::pause(bool state)
    13161312{
    13171313    if (output)
    13181314    {
    13191315        isplaying = !isplaying;
     1316        if (play_button)
     1317            play_button->setState(isplaying);
     1318        if (pause_button)
     1319            pause_button->setState(!isplaying);
    13201320        output->Pause(!isplaying); //Note pause doesn't take effect instantly
     1321
     1322        // wake up threads
     1323        if (decoder)
     1324        {
     1325            decoder->lock();
     1326            decoder->cond()->wakeAll();
     1327            decoder->unlock();
     1328        }
    13211329    }
    1322     // wake up threads
    1323     if (decoder)
     1330    else if (pause_button)
    13241331    {
    1325         decoder->lock();
    1326         decoder->cond()->wakeAll();
    1327         decoder->unlock();
     1332        pause_button->setState(false);
    13281333    }
    1329 
    13301334}
    13311335
    13321336void PlaybackBoxMusic::stopDecoder(void)
     
    13491353        decoder->wait();
    13501354}
    13511355
    1352 void PlaybackBoxMusic::stop(void)
     1356void PlaybackBoxMusic::stop(bool state)
    13531357{
     1358    if (!state && stop_button)
     1359        stop_button->setState(!state);
     1360
    13541361    stopDecoder();
    13551362
    13561363    if (output)
     
    13721379    QString time_string;
    13731380    int maxh = maxTime / 3600;
    13741381    int maxm = (maxTime / 60) % 60;
    1375     int maxs = maxm % 60;
     1382    int maxs = maxTime % 60;
    13761383    if (maxh > 0)
    13771384        time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs);
    13781385    else
     
    13841391        info_text->SetText("");
    13851392
    13861393    isplaying = false;
     1394    if (play_button)
     1395        play_button->setState(false);
     1396    if (pause_button)
     1397        pause_button->setState(false);
     1398    if (stop_button)
     1399        stop_button->setState(true);
    13871400}
    13881401
    13891402void PlaybackBoxMusic::stopAll()
     
    14481461    stopDecoder();
    14491462
    14501463    isplaying = false;
     1464    if (play_button)
     1465        play_button->setState(false);
     1466    if (stop_button)
     1467        stop_button->setState(true);
    14511468
    14521469    if (repeatmode == REPEAT_TRACK)
    14531470        play();
     
    17821799        branches_to_current_node.append(1); //  We're on a playlist (not "My Music")
    17831800        branches_to_current_node.append(0); //  Active play Queue
    17841801        music_tree_list->moveToNodesFirstChild(branches_to_current_node);
     1802        play();
    17851803    }
    17861804    music_tree_list->refresh();
    17871805}
     
    20332051        QString time_string;
    20342052        int maxh = maxTime / 3600;
    20352053        int maxm = (maxTime / 60) % 60;
    2036         int maxs = maxm % 60;
     2054        int maxs = maxTime % 60;
    20372055        if (maxh > 0)
    20382056            time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs);
    20392057        else
     
    20462064                ratings_image->setRepeat(curMeta->Rating());
    20472065        }
    20482066
    2049         if (output && output->GetPause())
     2067        if (output)
    20502068        {
    20512069            stop();
    2052             if (play_button)
    2053             {
    2054                 play_button->push();
    2055             }
    2056             else
    2057             {
    2058                 play();
    2059             }
    2060         }
    2061         else
    20622070            play();
     2071       }
    20632072    }
    20642073    else
    20652074    {
     
    21172126
    21182127void PlaybackBoxMusic::end()
    21192128{
     2129    stop();
     2130
    21202131    if (class LCD *lcd = LCD::Get())
    21212132        lcd->switchToTime ();
    21222133}
     
    21612172    if (rew_button)
    21622173        connect(rew_button, SIGNAL(pushed()), this, SLOT(seekback()));
    21632174
    2164     pause_button = getUIPushButtonType("pause_button");
     2175    pause_button = getUICheckBoxType("pause_button");
    21652176    if (pause_button)
    2166         connect(pause_button, SIGNAL(pushed()), this, SLOT(pause()));
     2177        connect(pause_button, SIGNAL(pushed(bool)), this, SLOT(pause(bool)));
    21672178
    2168     play_button = getUIPushButtonType("play_button");
     2179    play_button = getUICheckBoxType("play_button");
    21692180    if (play_button)
    2170         connect(play_button, SIGNAL(pushed()), this, SLOT(play()));
     2181        connect(play_button, SIGNAL(pushed(bool)), this, SLOT(play(bool)));
    21712182
    2172     stop_button = getUIPushButtonType("stop_button");
     2183    stop_button = getUICheckBoxType("stop_button");
    21732184    if (stop_button)
    2174         connect(stop_button, SIGNAL(pushed()), this, SLOT(stop()));
     2185    {
     2186        connect(stop_button, SIGNAL(pushed(bool)), this, SLOT(stop(bool)));
     2187        stop_button->setState(true);
     2188    }
    21752189
    21762190    ff_button = getUIPushButtonType("ff_button");
    21772191    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();
     
    221221
    222222    UIPushButtonType      *prev_button;
    223223    UIPushButtonType      *rew_button;
    224     UIPushButtonType      *pause_button;
    225     UIPushButtonType      *play_button;
    226     UIPushButtonType      *stop_button;
     224    UICheckBoxType        *pause_button;
     225    UICheckBoxType        *play_button;
     226    UICheckBoxType        *stop_button;
    227227    UIPushButtonType      *ff_button;
    228228    UIPushButtonType      *next_button;
    229229