Ticket #2935: mythmusic_transport_r12872.patch
File mythmusic_transport_r12872.patch, 10.2 KB (added by , 17 years ago) |
---|
-
mythmusic/mythmusic/playbackbox.cpp
307 307 seekback(); 308 308 } 309 309 else if (action == "PAUSE") 310 { 310 { 311 311 if (isplaying) 312 { 313 if (pause_button) 314 pause_button->push(); 315 else 316 pause(); 317 } 312 pause(); 318 313 else 319 { 320 if (play_button) 321 play_button->push(); 322 else 323 play(); 324 } 314 play(); 325 315 } 326 316 else if (action == "STOP") 327 { 328 if (stop_button) 329 stop_button->push(); 330 else 331 stop(); 317 { 318 stop(); 332 319 } 333 320 else if (action == "THMBUP") 334 321 increaseRating(); … … 799 786 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 800 787 branches_to_current_node.append(0); // Active play Queue 801 788 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 789 play(); 802 790 } 803 791 804 792 void PlaybackBoxMusic::updatePlaylistFromCD() … … 952 940 if (curMeta) 953 941 updateTrackInfo(curMeta); 954 942 943 play(); 944 955 945 return; // Do not restart Timer 956 946 } 957 947 else … … 1059 1049 visual_mode_timer->changeInterval(visual_mode_delay * 1000); 1060 1050 } 1061 1051 1062 void PlaybackBoxMusic::play( )1052 void PlaybackBoxMusic::play(bool state) 1063 1053 { 1054 if (!state && play_button) 1055 play_button->setState(!state); 1064 1056 1065 1057 if (isplaying) 1066 1058 stop(); … … 1135 1127 1136 1128 bannerEnable(curMeta); 1137 1129 isplaying = true; 1130 if (play_button) 1131 play_button->setState(true); 1132 if (pause_button) 1133 pause_button->setState(false); 1134 if (stop_button) 1135 stop_button->setState(false); 1138 1136 curMeta->setLastPlay(); 1139 curMeta->incPlayCount(); 1137 curMeta->incPlayCount(); 1140 1138 } 1141 1139 } 1142 1140 … … 1257 1255 mdata->Title()); 1258 1256 } 1259 1257 1260 void PlaybackBoxMusic::pause( void)1258 void PlaybackBoxMusic::pause(bool state) 1261 1259 { 1262 1260 if (output) 1263 1261 { 1264 1262 isplaying = !isplaying; 1263 if (play_button) 1264 play_button->setState(isplaying); 1265 if (pause_button) 1266 pause_button->setState(!isplaying); 1265 1267 output->Pause(!isplaying); //Note pause doesn't take effect instantly 1268 1269 // wake up threads 1270 if (decoder) 1271 { 1272 decoder->lock(); 1273 decoder->cond()->wakeAll(); 1274 decoder->unlock(); 1275 } 1266 1276 } 1267 // wake up threads 1268 if (decoder) 1277 else if (pause_button) 1269 1278 { 1270 decoder->lock(); 1271 decoder->cond()->wakeAll(); 1272 decoder->unlock(); 1279 pause_button->setState(false); 1273 1280 } 1274 1275 1281 } 1276 1282 1277 1283 void PlaybackBoxMusic::stopDecoder(void) … … 1294 1300 decoder->wait(); 1295 1301 } 1296 1302 1297 void PlaybackBoxMusic::stop( void)1303 void PlaybackBoxMusic::stop(bool state) 1298 1304 { 1305 if (!state && stop_button) 1306 stop_button->setState(!state); 1307 1299 1308 if (output) 1300 1309 { 1301 1310 output->Reset(); … … 1317 1326 QString time_string; 1318 1327 int maxh = maxTime / 3600; 1319 1328 int maxm = (maxTime / 60) % 60; 1320 int maxs = max m% 60;1329 int maxs = maxTime % 60; 1321 1330 if (maxh > 0) 1322 1331 time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs); 1323 1332 else … … 1329 1338 info_text->SetText(""); 1330 1339 1331 1340 isplaying = false; 1341 if (play_button) 1342 play_button->setState(false); 1343 if (pause_button) 1344 pause_button->setState(false); 1345 if (stop_button) 1346 stop_button->setState(true); 1332 1347 } 1333 1348 1334 1349 void PlaybackBoxMusic::stopAll() … … 1393 1408 stopDecoder(); 1394 1409 1395 1410 isplaying = false; 1411 if (play_button) 1412 play_button->setState(false); 1413 if (stop_button) 1414 stop_button->setState(true); 1396 1415 1397 1416 if (repeatmode == REPEAT_TRACK) 1398 1417 play(); … … 1670 1689 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 1671 1690 branches_to_current_node.append(0); // Active play Queue 1672 1691 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 1692 play(); 1673 1693 } 1674 1694 music_tree_list->refresh(); 1675 1695 } … … 1918 1938 QString time_string; 1919 1939 int maxh = maxTime / 3600; 1920 1940 int maxm = (maxTime / 60) % 60; 1921 int maxs = max m% 60;1941 int maxs = maxTime % 60; 1922 1942 if (maxh > 0) 1923 1943 time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs); 1924 1944 else … … 1931 1951 ratings_image->setRepeat(curMeta->Rating()); 1932 1952 } 1933 1953 1934 if (output && output->GetPause())1954 if (output) 1935 1955 { 1936 1956 stop(); 1937 if(play_button)1938 {1939 play_button->push();1940 }1941 else1942 {1943 play();1944 }1945 }1946 else1947 1957 play(); 1958 } 1948 1959 } 1949 1960 else 1950 1961 { … … 1999 2010 2000 2011 void PlaybackBoxMusic::end() 2001 2012 { 2013 stop(); 2014 2002 2015 if (class LCD *lcd = LCD::Get()) 2003 2016 lcd->switchToTime (); 2004 2017 } … … 2043 2056 if (rew_button) 2044 2057 connect(rew_button, SIGNAL(pushed()), this, SLOT(seekback())); 2045 2058 2046 pause_button = getUI PushButtonType("pause_button");2059 pause_button = getUICheckBoxType("pause_button"); 2047 2060 if (pause_button) 2048 connect(pause_button, SIGNAL(pushed( )), this, SLOT(pause()));2061 connect(pause_button, SIGNAL(pushed(bool)), this, SLOT(pause(bool))); 2049 2062 2050 play_button = getUI PushButtonType("play_button");2063 play_button = getUICheckBoxType("play_button"); 2051 2064 if (play_button) 2052 connect(play_button, SIGNAL(pushed( )), this, SLOT(play()));2065 connect(play_button, SIGNAL(pushed(bool)), this, SLOT(play(bool))); 2053 2066 2054 stop_button = getUI PushButtonType("stop_button");2067 stop_button = getUICheckBoxType("stop_button"); 2055 2068 if (stop_button) 2056 connect(stop_button, SIGNAL(pushed()), this, SLOT(stop())); 2069 { 2070 connect(stop_button, SIGNAL(pushed(bool)), this, SLOT(stop(bool))); 2071 stop_button->setState(true); 2072 } 2057 2073 2058 2074 ff_button = getUIPushButtonType("ff_button"); 2059 2075 if (ff_button) -
mythmusic/mythmusic/music-ui.xml
369 369 <image function="pushed" filename="rew_button_pushed.png"></image> 370 370 </pushbutton> 371 371 372 < pushbuttonname="pause_button" draworder="0">372 <checkbox name="pause_button" draworder="0"> 373 373 <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> 378 379 379 < pushbuttonname="play_button" draworder="0">380 <checkbox name="play_button" draworder="0"> 380 381 <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> 385 387 386 <pushbuttonname="stop_button" draworder="0">388 <checkbox name="stop_button" draworder="0"> 387 389 <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> 392 395 393 396 <pushbutton name="ff_button" draworder="0"> 394 397 <position>585,40</position> -
mythmusic/mythmusic/playbackbox.h
45 45 46 46 public slots: 47 47 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); 51 51 void stopDecoder(); 52 52 void previous(); 53 53 void next(); … … 205 205 206 206 UIPushButtonType *prev_button; 207 207 UIPushButtonType *rew_button; 208 UI PushButtonType*pause_button;209 UI PushButtonType*play_button;210 UI PushButtonType*stop_button;208 UICheckBoxType *pause_button; 209 UICheckBoxType *play_button; 210 UICheckBoxType *stop_button; 211 211 UIPushButtonType *ff_button; 212 212 UIPushButtonType *next_button; 213 213