Ticket #2935: mythmusic_transport_r12662.patch
File mythmusic_transport_r12662.patch, 10.2 KB (added by , 17 years ago) |
---|
-
mythmusic/mythmusic/playbackbox.cpp
302 302 seekback(); 303 303 } 304 304 else if (action == "PAUSE") 305 { 305 { 306 306 if (isplaying) 307 { 308 if (pause_button) 309 pause_button->push(); 310 else 311 pause(); 312 } 307 pause(); 313 308 else 314 { 315 if (play_button) 316 play_button->push(); 317 else 318 play(); 319 } 309 play(); 320 310 } 321 311 else if (action == "STOP") 322 { 323 if (stop_button) 324 stop_button->push(); 325 else 326 stop(); 312 { 313 stop(); 327 314 } 328 315 else if (action == "THMBUP") 329 316 increaseRating(); … … 794 781 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 795 782 branches_to_current_node.append(0); // Active play Queue 796 783 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 784 play(); 797 785 } 798 786 799 787 void PlaybackBoxMusic::updatePlaylistFromCD() … … 947 935 if (curMeta) 948 936 updateTrackInfo(curMeta); 949 937 938 play(); 939 950 940 return; // Do not restart Timer 951 941 } 952 942 else … … 1057 1047 visual_mode_timer->changeInterval(visual_mode_delay * 1000); 1058 1048 } 1059 1049 1060 void PlaybackBoxMusic::play( )1050 void PlaybackBoxMusic::play(bool state) 1061 1051 { 1052 if (!state && play_button) 1053 play_button->setState(!state); 1054 1062 1055 if (isplaying) 1063 1056 stop(); 1064 1057 … … 1132 1125 1133 1126 bannerEnable(curMeta); 1134 1127 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); 1135 1134 curMeta->setLastPlay(); 1136 curMeta->incPlayCount(); 1135 curMeta->incPlayCount(); 1137 1136 } 1138 1137 } 1139 1138 … … 1247 1246 mdata->Title()); 1248 1247 } 1249 1248 1250 void PlaybackBoxMusic::pause( void)1249 void PlaybackBoxMusic::pause(bool state) 1251 1250 { 1252 1251 if (output) 1253 1252 { 1254 1253 isplaying = !isplaying; 1254 if (play_button) 1255 play_button->setState(isplaying); 1256 if (pause_button) 1257 pause_button->setState(!isplaying); 1255 1258 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 } 1256 1267 } 1257 // wake up threads 1258 if (decoder) 1268 else if (pause_button) 1259 1269 { 1260 decoder->lock(); 1261 decoder->cond()->wakeAll(); 1262 decoder->unlock(); 1270 pause_button->setState(false); 1263 1271 } 1264 1265 1272 } 1266 1273 1267 1274 void PlaybackBoxMusic::stopDecoder(void) … … 1284 1291 decoder->wait(); 1285 1292 } 1286 1293 1287 void PlaybackBoxMusic::stop( void)1294 void PlaybackBoxMusic::stop(bool state) 1288 1295 { 1296 if (!state && stop_button) 1297 stop_button->setState(!state); 1298 1289 1299 stopDecoder(); 1290 1300 1291 1301 if (output) … … 1303 1313 QString time_string; 1304 1314 int maxh = maxTime / 3600; 1305 1315 int maxm = (maxTime / 60) % 60; 1306 int maxs = max m% 60;1316 int maxs = maxTime % 60; 1307 1317 if (maxh > 0) 1308 1318 time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs); 1309 1319 else … … 1315 1325 info_text->SetText(""); 1316 1326 1317 1327 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); 1318 1334 } 1319 1335 1320 1336 void PlaybackBoxMusic::stopAll() … … 1379 1395 stopDecoder(); 1380 1396 1381 1397 isplaying = false; 1398 if (play_button) 1399 play_button->setState(false); 1400 if (stop_button) 1401 stop_button->setState(true); 1382 1402 1383 1403 if (repeatmode == REPEAT_TRACK) 1384 1404 play(); … … 1642 1662 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 1643 1663 branches_to_current_node.append(0); // Active play Queue 1644 1664 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 1665 play(); 1645 1666 } 1646 1667 music_tree_list->refresh(); 1647 1668 } … … 1890 1911 QString time_string; 1891 1912 int maxh = maxTime / 3600; 1892 1913 int maxm = (maxTime / 60) % 60; 1893 int maxs = max m% 60;1914 int maxs = maxTime % 60; 1894 1915 if (maxh > 0) 1895 1916 time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs); 1896 1917 else … … 1903 1924 ratings_image->setRepeat(curMeta->Rating()); 1904 1925 } 1905 1926 1906 if (output && output->GetPause())1927 if (output) 1907 1928 { 1908 1929 stop(); 1909 if(play_button)1910 {1911 play_button->push();1912 }1913 else1914 {1915 play();1916 }1917 }1918 else1919 1930 play(); 1931 } 1920 1932 } 1921 1933 else 1922 1934 { … … 1971 1983 1972 1984 void PlaybackBoxMusic::end() 1973 1985 { 1986 stop(); 1987 1974 1988 if (class LCD *lcd = LCD::Get()) 1975 1989 lcd->switchToTime (); 1976 1990 } … … 2015 2029 if (rew_button) 2016 2030 connect(rew_button, SIGNAL(pushed()), this, SLOT(seekback())); 2017 2031 2018 pause_button = getUI PushButtonType("pause_button");2032 pause_button = getUICheckBoxType("pause_button"); 2019 2033 if (pause_button) 2020 connect(pause_button, SIGNAL(pushed( )), this, SLOT(pause()));2034 connect(pause_button, SIGNAL(pushed(bool)), this, SLOT(pause(bool))); 2021 2035 2022 play_button = getUI PushButtonType("play_button");2036 play_button = getUICheckBoxType("play_button"); 2023 2037 if (play_button) 2024 connect(play_button, SIGNAL(pushed( )), this, SLOT(play()));2038 connect(play_button, SIGNAL(pushed(bool)), this, SLOT(play(bool))); 2025 2039 2026 stop_button = getUI PushButtonType("stop_button");2040 stop_button = getUICheckBoxType("stop_button"); 2027 2041 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 } 2029 2046 2030 2047 ff_button = getUIPushButtonType("ff_button"); 2031 2048 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