Ticket #9362: 99-mythmusic-cdio-playbackbox.diff
File 99-mythmusic-cdio-playbackbox.diff, 4.9 KB (added by , 13 years ago) |
---|
-
mythplugins/mythmusic/mythmusic/playbackbox.cpp
33 33 #include "playlistcontainer.h" 34 34 #include "search.h" 35 35 36 #ifndef USING_MINGW37 #include "cddecoder.h"38 #endif // USING_MINGW39 40 36 PlaybackBoxMusic::PlaybackBoxMusic(MythMainWindow *parent, QString window_name, 41 37 QString theme_filename, const QString &dev, const char *name) 42 38 … … 468 464 160, 160); 469 465 mainvisual->setVisual(visual_modes[current_visual]); 470 466 bannerDisable(); 471 updateTrackInfo(curMeta); 467 if (curMeta) 468 updateTrackInfo(curMeta); 472 469 473 470 if (!m_parent->IsExitingToMain()) 474 471 handled = true; … … 970 967 971 968 void PlaybackBoxMusic::occasionallyCheckCD() 972 969 { 973 if (!cd_reader_thread ->getLock()->tryLock())970 if (!cd_reader_thread || !cd_reader_thread->getLock()->tryLock()) 974 971 return; 975 972 cd_reader_thread->getLock()->unlock(); 976 973 … … 1068 1065 1069 1066 GenericTree *node = music_tree_list->getCurrentNode(); 1070 1067 curMeta = gMusicData->all_music->getMetadata(node->getInt()); 1071 updateTrackInfo(curMeta); 1068 if (curMeta) 1069 updateTrackInfo(curMeta); 1072 1070 1073 1071 setShuffleMode(gPlayer->getShuffleMode()); 1074 1072 … … 1106 1104 if (scan_for_cd) 1107 1105 updatePlaylistFromCD(); 1108 1106 1107 bool bLocked = cd_reader_thread ? 1108 cd_reader_thread->getLock()->lock(), true : false; 1109 1109 1110 music_tree_list->showWholeTree(show_whole_tree); 1110 1111 Q3ValueList <int> branches_to_current_node; 1111 1112 branches_to_current_node.append(0); // Root node … … 1135 1136 if (curMeta) 1136 1137 updateTrackInfo(curMeta); 1137 1138 1139 if (bLocked && cd_reader_thread) 1140 cd_reader_thread->getLock()->unlock(); 1138 1141 return; // Do not restart Timer 1139 1142 } 1140 1143 else … … 1357 1360 gPlayer->getOutput()->SetTimecode(0); 1358 1361 } 1359 1362 1360 bannerEnable(curMeta, show_album_art); 1363 if (curMeta) 1364 bannerEnable(curMeta, show_album_art); 1361 1365 } 1362 1366 1363 1367 void PlaybackBoxMusic::visEnable() … … 1388 1392 { 1389 1393 if (mainvisual->bannerIsShowing()) 1390 1394 bannerDisable(); 1391 else 1395 else if (mdata) 1392 1396 bannerEnable(mdata, false); 1393 1397 } 1394 1398 … … 1801 1805 if (node) 1802 1806 { 1803 1807 curMeta = gMusicData->all_music->getMetadata(node->getInt()); 1804 updateTrackInfo(curMeta); 1808 if (curMeta) 1809 updateTrackInfo(curMeta); 1805 1810 1806 1811 maxTime = curMeta->Length() / 1000; 1807 1812 … … 1827 1832 if (node) 1828 1833 { 1829 1834 curMeta = gMusicData->all_music->getMetadata(node->getInt()); 1830 updateTrackInfo(curMeta); 1835 if (curMeta) 1836 updateTrackInfo(curMeta); 1831 1837 1832 1838 maxTime = curMeta->Length() / 1000; 1833 1839 … … 2069 2075 2070 2076 void PlaybackBoxMusic::updateTrackInfo(Metadata *mdata) 2071 2077 { 2072 if ( visualizer_status != 2)2078 if (mdata) 2073 2079 { 2074 if (title_text) 2075 title_text->SetText(mdata->FormatTitle()); 2076 if (artist_text) 2077 artist_text->SetText(mdata->FormatArtist()); 2078 if (album_text) 2079 album_text->SetText(mdata->Album()); 2080 if (albumart_image) 2081 showAlbumArtImage(mdata); 2080 if (visualizer_status != 2) 2081 { 2082 if (title_text) 2083 title_text->SetText(mdata->FormatTitle()); 2084 if (artist_text) 2085 artist_text->SetText(mdata->FormatArtist()); 2086 if (album_text) 2087 album_text->SetText(mdata->Album()); 2088 if (albumart_image) 2089 showAlbumArtImage(mdata); 2082 2090 2083 if (showrating) 2084 { 2085 if (ratings_image) 2086 ratings_image->setRepeat(mdata->Rating()); 2091 if (showrating) 2092 { 2093 if (ratings_image) 2094 ratings_image->setRepeat(mdata->Rating()); 2095 } 2087 2096 } 2097 setTrackOnLCD(mdata); 2088 2098 } 2089 setTrackOnLCD(mdata);2090 2099 } 2091 2100 2092 2101 void PlaybackBoxMusic::showAlbumArtImage(Metadata *mdata) … … 2164 2173 } 2165 2174 2166 2175 curMeta = gMusicData->all_music->getMetadata(node_int); 2176 if (curMeta) 2177 updateTrackInfo(curMeta); 2167 2178 2168 updateTrackInfo(curMeta);2169 2170 2179 maxTime = curMeta->Length() / 1000; 2171 2180 2172 2181 QString time_string = getTimeString(maxTime, 0);