Ticket #84: filter.diff
File filter.diff, 8.7 KB (added by , 19 years ago) |
---|
-
mythmusic/playbackbox.cpp
51 51 curSmartPlaylistCategory = ""; 52 52 curSmartPlaylistName = ""; 53 53 54 menufilters = gContext->GetNumSetting("MusicMenuFilters", 0); 55 54 56 // Set our pointers the playlists and the metadata containers 55 57 56 58 all_playlists = the_playlists; … … 316 318 else if (action == "MUTE") 317 319 toggleMute(); 318 320 else if (action == "MENU") 321 { 322 menufilters = false; 319 323 showMenu(); 324 } 325 else if (action == "FILTER") 326 { 327 menufilters = true; 328 showMenu(); 329 } 320 330 else if (action == "INFO") 321 331 showEditMetadataDialog(); 322 332 else … … 554 564 555 565 visual_mode_timer->stop(); 556 566 557 all_playlists->getActive()->removeAllTracks(); 567 if (!menufilters) 568 all_playlists->getActive()->removeAllTracks(); 558 569 all_playlists->getActive()->fillSonglistFromQuery(whereClause); 559 all_playlists->getActive()->fillSongsFromSonglist(); 560 all_playlists->getActive()->postLoad(); 570 all_playlists->getActive()->fillSongsFromSonglist(menufilters); 571 if (!menufilters) 572 all_playlists->getActive()->postLoad(); 561 573 562 574 if (visual_mode_delay > 0) 563 575 visual_mode_timer->start(visual_mode_delay * 1000); 564 576 565 constructPlaylistTree(); 566 567 stop(); 568 wipeTrackInfo(); 569 570 // move to first track in list 571 branches_to_current_node.clear(); 572 branches_to_current_node.append(0); // Root node 573 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 574 branches_to_current_node.append(0); // Active play Queue 575 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 577 if (!menufilters) 578 { 579 constructPlaylistTree(); 580 581 stop(); 582 wipeTrackInfo(); 583 584 // move to first track in list 585 branches_to_current_node.clear(); 586 branches_to_current_node.append(0); // Root node 587 branches_to_current_node.append(1); // We're on a playlist (not "My Music") 588 branches_to_current_node.append(0); // Active play Queue 589 music_tree_list->moveToNodesFirstChild(branches_to_current_node); 590 } 576 591 music_tree_list->refresh(); 577 592 } 578 593 … … 584 599 585 600 all_playlists->getActive()->removeAllTracks(); 586 601 all_playlists->getActive()->fillSonglistFromSmartPlaylist(category, name); 587 all_playlists->getActive()->fillSongsFromSonglist( );602 all_playlists->getActive()->fillSongsFromSonglist(menufilters); 588 603 all_playlists->getActive()->postLoad(); 589 604 590 605 if (visual_mode_delay > 0) -
mythmusic/playlist.h
75 75 76 76 void describeYourself(void); // debugging 77 77 78 void fillSongsFromSonglist( );78 void fillSongsFromSonglist(bool filter); 79 79 void fillSonglistFromSongs(); 80 80 void fillSonglistFromQuery(QString whereClause); 81 81 void fillSonglistFromSmartPlaylist(QString category, QString name); -
mythmusic/metadata.cpp
892 892 Metadata *inserter; 893 893 while ( (inserter = an_iterator.current()) != 0 ) 894 894 { 895 intoTree(inserter); 895 if (inserter->isVisible()) 896 intoTree(inserter); 896 897 ++an_iterator; 897 898 } 898 899 } … … 1203 1204 } 1204 1205 } 1205 1206 1207 void AllMusic::setAllVisible(bool visible) 1208 { 1209 QPtrListIterator<Metadata> an_iterator( all_music ); 1210 Metadata *md; 1211 while ( (md = an_iterator.current()) != 0 ) 1212 { 1213 md->setVisible(visible); 1214 ++an_iterator; 1215 } 1216 } 1217 1206 1218 MusicNode::MusicNode(QString a_title, QStringList tree_levels, uint depth) 1207 1219 { 1208 1220 my_title = a_title; -
mythmusic/playlist.cpp
319 319 cd_playlist.clear(); 320 320 321 321 active_playlist->loadPlaylist("default_playlist_storage", my_host); 322 active_playlist->fillSongsFromSonglist( );322 active_playlist->fillSongsFromSonglist(false); 323 323 324 324 backup_playlist->loadPlaylist("backup_playlist_storage", my_host); 325 backup_playlist->fillSongsFromSonglist( );325 backup_playlist->fillSongsFromSonglist(false); 326 326 327 327 all_other_playlists->clear(); 328 328 … … 342 342 Playlist *temp_playlist = new Playlist(all_available_music); // No, we don't destruct this ... 343 343 temp_playlist->setParent(this); 344 344 temp_playlist->loadPlaylistByID(query.value(0).toInt(), my_host); 345 temp_playlist->fillSongsFromSonglist( );345 temp_playlist->fillSongsFromSonglist(false); 346 346 all_other_playlists->append(temp_playlist); // ... cause it's sitting on this PtrList 347 347 } 348 348 } … … 520 520 name = "and they should **REALLY** never see this"; 521 521 } 522 522 523 void Playlist::fillSongsFromSonglist( )523 void Playlist::fillSongsFromSonglist(bool filter) 524 524 { 525 525 int an_int; 526 527 if (filter) 528 all_available_music->setAllVisible(false); 529 526 530 QStringList list = QStringList::split(",", raw_songlist); 527 531 QStringList::iterator it = list.begin(); 528 532 for (; it != list.end(); it++) … … 530 534 an_int = QString(*it).toInt(); 531 535 if (an_int != 0) 532 536 { 533 Track *a_track = new Track(an_int, all_available_music); 534 a_track->setParent(this); 535 songs.append(a_track); 537 if (filter) 538 { 539 Metadata *md = all_available_music->getMetadata(an_int); 540 if(md) 541 md->setVisible(true); 542 } 543 else 544 { 545 Track *a_track = new Track(an_int, all_available_music); 546 a_track->setParent(this); 547 songs.append(a_track); 548 } 536 549 } 537 550 else 538 551 { … … 541 554 cerr << " If this happens on repeated invocations of mythmusic, then something is really wrong" << endl; 542 555 } 543 556 } 557 558 if (filter) 559 { 560 all_available_music->buildTree(); 561 all_available_music->sortTree(); 562 } 544 563 } 545 564 546 565 void Playlist::fillSonglistFromSongs() -
mythmusic/metadata.h
38 38 lastplay = llastplay; 39 39 compilation = lcompilation; 40 40 changed = false; 41 show = true; 41 42 } 42 43 43 44 Metadata(const Metadata &other) … … 58 59 lastplay = other.lastplay; 59 60 playcount = other.playcount; 60 61 compilation = other.compilation; 62 show = other.show; 61 63 changed = false; 62 64 } 63 65 … … 110 112 int PlayCount() { return playcount; } 111 113 void incPlayCount(); 112 114 115 bool isVisible() { return show; } 116 void setVisible(bool visible) { show = visible; } 117 113 118 // track is part of a compilation album 114 119 bool Compilation() { return compilation; } 115 120 void setCompilation(bool state) { compilation = state; formattedartist = formattedtitle = ""; } … … 153 158 QString filename; 154 159 bool changed; 155 160 161 bool show; 162 156 163 static QString m_startdir; 157 164 158 165 // Various formatting strings … … 264 271 bool cleanOutThreads(); 265 272 int getCDTrackCount(){return cd_data.count();} 266 273 void resetListings(){last_listed = -1;} 274 void setAllVisible(bool visible); 267 275 268 276 private: 269 277 -
mythmusic/main.cpp
393 393 REG_KEY("Music", "THMBUP", "Increase rating", "9"); 394 394 REG_KEY("Music", "THMBDOWN", "Decrease rating", "7"); 395 395 REG_KEY("Music", "REFRESH", "Refresh music tree", "8"); 396 REG_KEY("Music", "FILTER", "Filter All My Music", "F"); 396 397 397 398 REG_MEDIA_HANDLER("MythMusic Media Handler", "", "", handleMedia, MEDIATYPE_AUDIO | MEDIATYPE_MIXED); 398 399 } -
mythmusic/playbackbox.h
129 129 bool isplaying; 130 130 bool lcd_volume_visible; 131 131 132 bool menufilters; 133 132 134 MainVisual *mainvisual; 133 135 134 136 QString visual_mode;