Ticket #3988: filters.diff
File filters.diff, 4.8 KB (added by , 17 years ago) |
---|
-
metadata.cpp
977 977 delete builder; 978 978 } 979 979 980 void AllMusic::writeTree(GenericTree *tree_to_write_to )980 void AllMusic::writeTree(GenericTree *tree_to_write_to, bool skiproot) 981 981 { 982 m_root_node->writeTree(tree_to_write_to, 0 );982 m_root_node->writeTree(tree_to_write_to, 0, !skiproot); 983 983 } 984 984 985 985 bool AllMusic::putYourselfOnTheListView(TreeCheckItem *where) … … 1265 1265 1266 1266 } 1267 1267 1268 void MusicNode::writeTree(GenericTree *tree_to_write_to, int a_counter )1268 void MusicNode::writeTree(GenericTree *tree_to_write_to, int a_counter, bool addself) 1269 1269 { 1270 1270 1271 GenericTree *sub_node = tree_to_write_to->addNode(my_title); 1272 sub_node->setAttribute(0, 0); 1273 sub_node->setAttribute(1, a_counter); 1274 sub_node->setAttribute(2, rand()); 1275 sub_node->setAttribute(3, rand()); 1271 GenericTree *sub_node; 1272 1273 if(addself) 1274 { 1275 sub_node = tree_to_write_to->addNode(my_title); 1276 sub_node->setAttribute(0, 0); 1277 sub_node->setAttribute(1, a_counter); 1278 sub_node->setAttribute(2, rand()); 1279 sub_node->setAttribute(3, rand()); 1280 } 1281 else 1282 sub_node = tree_to_write_to; 1276 1283 1277 1284 QPtrListIterator<Metadata> anit(my_tracks); 1278 1285 Metadata *a_track; -
playlist.cpp
1069 1069 1070 1070 GenericTree* PlaylistsContainer::writeTree(GenericTree *tree_to_write_to) 1071 1071 { 1072 GenericTree *sub_node; 1073 1072 1074 all_available_music->writeTree(tree_to_write_to); 1073 1075 1074 GenericTree *sub_node = tree_to_write_to->addNode(QObject::tr("All My Playlists"), 1); 1076 MSqlQuery query(MSqlQuery::InitCon()); 1077 1078 MSqlQuery subquery(MSqlQuery::InitCon()); 1079 subquery.prepare("SELECT smartplaylistid, name FROM music_smartplaylists " 1080 "WHERE categoryid = :CATEGORYID ORDER BY name;"); 1081 1082 int a_counter = 1; 1083 if (query.exec("SELECT categoryid, name FROM music_smartplaylist_categories ORDER BY name;")) 1084 { 1085 if (query.isActive() && query.numRowsAffected() > 0) 1086 { 1087 while (query.next()) 1088 { 1089 sub_node = tree_to_write_to->addNode(QString::fromUtf8(query.value(1).toString()), a_counter++); 1090 1091 subquery.bindValue(":CATEGORYID", query.value(0)); 1092 if (subquery.exec()) 1093 { 1094 if (subquery.isActive() && subquery.numRowsAffected() > 0) 1095 { 1096 while (subquery.next()) 1097 { 1098 Playlist *pl_playlist = new Playlist(all_available_music); 1099 1100 pl_playlist->fillSonglistFromSmartPlaylist(query.value(1).toString(), 1101 subquery.value(1).toString(), false, PL_FILTERONLY, 0); 1102 1103 GenericTree *subsub_node = 1104 sub_node->addNode(QString::fromUtf8(subquery.value(1).toString()), 2); 1105 1106 all_available_music->writeTree(subsub_node, true); 1107 1108 delete pl_playlist; 1109 } 1110 } 1111 } 1112 1113 } 1114 } 1115 } 1116 1117 sub_node = tree_to_write_to->addNode(QObject::tr("All My Playlists"), a_counter); 1075 1118 sub_node->setAttribute(0, 1); 1076 1119 sub_node->setAttribute(1, 1); 1077 1120 sub_node->setAttribute(2, 1); … … 1085 1128 1086 1129 active_playlist->writeTree(subsub_node, 0); 1087 1130 1088 inta_counter = 0;1131 a_counter = 0; 1089 1132 1090 1133 // 1091 1134 // Write the CD playlist (if there's anything in it) -
metadata.h
269 269 QString getTitle(){return my_title;} 270 270 void printYourself(int indent_amount); // debugging 271 271 void putYourselfOnTheListView(TreeCheckItem *parent, bool show_node); 272 void writeTree(GenericTree *tree_to_write_to, int a_counter );272 void writeTree(GenericTree *tree_to_write_to, int a_counter, bool addself = true); 273 273 void sort(); 274 274 void setPlayCountMin(int tmp_min) { m_playcountMin = tmp_min; } 275 275 void setPlayCountMax(int tmp_max) { m_playcountMax = tmp_max; } … … 348 348 void printTree(); // debugging 349 349 void sortTree(); 350 350 inline void clearTree() { m_root_node-> clear(); } 351 void writeTree(GenericTree *tree_to_write_to );351 void writeTree(GenericTree *tree_to_write_to, bool skiproot = false); 352 352 void setSorting(QString a_paths); 353 353 bool putYourselfOnTheListView(TreeCheckItem *where); 354 354 void putCDOnTheListView(CDCheckItem *where);