Ticket #2935: mythmusic_transport_r13303.patch
File mythmusic_transport_r13303.patch, 10.1 KB (added by , 19 years ago) |
---|
-
mythmusic/mythmusic/playbackbox.cpp
333 333 seekback(); 334 334 } 335 335 else if (action == "PAUSE") 336 { 336 { 337 337 if (isplaying) 338 { 339 if (pause_button) 340 pause_button->push(); 341 else 342 pause(); 343 } 338 pause(); 344 339 else 345 { 346 if (play_button) 347 play_button->push(); 348 else 349 play(); 350 } 340 play(); 351 341 } 352 342 else if (action == "STOP") 353 343 { 354 if (stop_button) 355 stop_button->push(); 356 else 357 stop(); 358 359 currentTime = 0; 344 stop(); 360 345 } 361 346 else if (action == "THMBUP") 362 347 increaseRating(); … … 858 843 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 859 844 branches_to_current_node.append(0); // Active play Queue 860 845 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 846 play(); 861 847 } 862 848 863 849 void PlaybackBoxMusic::updatePlaylistFromCD() … … 1026 1012 if (curMeta) 1027 1013 updateTrackInfo(curMeta); 1028 1014 1015 play(); 1016 1029 1017 return; // Do not restart Timer 1030 1018 } 1031 1019 else … … 1133 1121 visual_mode_timer->changeInterval(visual_mode_delay * 1000); 1134 1122 } 1135 1123 1136 void PlaybackBoxMusic::play( )1124 void PlaybackBoxMusic::play(bool state) 1137 1125 { 1126 if (!state && play_button) 1127 play_button->setState(!state); 1138 1128 1139 1129 if (isplaying) 1140 1130 stop(); … … 1216 1206 1217 1207 bannerEnable(curMeta, show_album_art); 1218 1208 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); 1219 1215 curMeta->setLastPlay(); 1220 1216 curMeta->incPlayCount(); 1221 1217 } … … 1312 1308 mdata->Title()); 1313 1309 } 1314 1310 1315 void PlaybackBoxMusic::pause( void)1311 void PlaybackBoxMusic::pause(bool state) 1316 1312 { 1317 1313 if (output) 1318 1314 { 1319 1315 isplaying = !isplaying; 1316 if (play_button) 1317 play_button->setState(isplaying); 1318 if (pause_button) 1319 pause_button->setState(!isplaying); 1320 1320 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 } 1321 1329 } 1322 // wake up threads 1323 if (decoder) 1330 else if (pause_button) 1324 1331 { 1325 decoder->lock(); 1326 decoder->cond()->wakeAll(); 1327 decoder->unlock(); 1332 pause_button->setState(false); 1328 1333 } 1329 1330 1334 } 1331 1335 1332 1336 void PlaybackBoxMusic::stopDecoder(void) … … 1349 1353 decoder->wait(); 1350 1354 } 1351 1355 1352 void PlaybackBoxMusic::stop( void)1356 void PlaybackBoxMusic::stop(bool state) 1353 1357 { 1358 if (!state && stop_button) 1359 stop_button->setState(!state); 1360 1354 1361 stopDecoder(); 1355 1362 1356 1363 if (output) … … 1372 1379 QString time_string; 1373 1380 int maxh = maxTime / 3600; 1374 1381 int maxm = (maxTime / 60) % 60; 1375 int maxs = max m% 60;1382 int maxs = maxTime % 60; 1376 1383 if (maxh > 0) 1377 1384 time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs); 1378 1385 else … … 1384 1391 info_text->SetText(""); 1385 1392 1386 1393 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); 1387 1400 } 1388 1401 1389 1402 void PlaybackBoxMusic::stopAll() … … 1448 1461 stopDecoder(); 1449 1462 1450 1463 isplaying = false; 1464 if (play_button) 1465 play_button->setState(false); 1466 if (stop_button) 1467 stop_button->setState(true); 1451 1468 1452 1469 if (repeatmode == REPEAT_TRACK) 1453 1470 play(); … … 1782 1799 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 1783 1800 branches_to_current_node.append(0); // Active play Queue 1784 1801 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 1802 play(); 1785 1803 } 1786 1804 music_tree_list->refresh(); 1787 1805 } … … 2033 2051 QString time_string; 2034 2052 int maxh = maxTime / 3600; 2035 2053 int maxm = (maxTime / 60) % 60; 2036 int maxs = max m% 60;2054 int maxs = maxTime % 60; 2037 2055 if (maxh > 0) 2038 2056 time_string.sprintf("%d:%02d:%02d", maxh, maxm, maxs); 2039 2057 else … … 2046 2064 ratings_image->setRepeat(curMeta->Rating()); 2047 2065 } 2048 2066 2049 if (output && output->GetPause())2067 if (output) 2050 2068 { 2051 2069 stop(); 2052 if (play_button)2053 {2054 play_button->push();2055 }2056 else2057 {2058 play();2059 }2060 }2061 else2062 2070 play(); 2071 } 2063 2072 } 2064 2073 else 2065 2074 { … … 2117 2126 2118 2127 void PlaybackBoxMusic::end() 2119 2128 { 2129 stop(); 2130 2120 2131 if (class LCD *lcd = LCD::Get()) 2121 2132 lcd->switchToTime (); 2122 2133 } … … 2161 2172 if (rew_button) 2162 2173 connect(rew_button, SIGNAL(pushed()), this, SLOT(seekback())); 2163 2174 2164 pause_button = getUI PushButtonType("pause_button");2175 pause_button = getUICheckBoxType("pause_button"); 2165 2176 if (pause_button) 2166 connect(pause_button, SIGNAL(pushed( )), this, SLOT(pause()));2177 connect(pause_button, SIGNAL(pushed(bool)), this, SLOT(pause(bool))); 2167 2178 2168 play_button = getUI PushButtonType("play_button");2179 play_button = getUICheckBoxType("play_button"); 2169 2180 if (play_button) 2170 connect(play_button, SIGNAL(pushed( )), this, SLOT(play()));2181 connect(play_button, SIGNAL(pushed(bool)), this, SLOT(play(bool))); 2171 2182 2172 stop_button = getUI PushButtonType("stop_button");2183 stop_button = getUICheckBoxType("stop_button"); 2173 2184 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 } 2175 2189 2176 2190 ff_button = getUIPushButtonType("ff_button"); 2177 2191 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(); … … 221 221 222 222 UIPushButtonType *prev_button; 223 223 UIPushButtonType *rew_button; 224 UI PushButtonType*pause_button;225 UI PushButtonType*play_button;226 UI PushButtonType*stop_button;224 UICheckBoxType *pause_button; 225 UICheckBoxType *play_button; 226 UICheckBoxType *stop_button; 227 227 UIPushButtonType *ff_button; 228 228 UIPushButtonType *next_button; 229 229