Ticket #3988: filters.2.diff
File filters.2.diff, 5.0 KB (added by , 17 years ago) |
---|
-
mythmusic/mythmusic/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; -
mythmusic/mythmusic/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 sub_node = tree_to_write_to->addNode(QObject::tr("All My Playlists"), 1); 1075 1077 sub_node->setAttribute(0, 1); 1076 1078 sub_node->setAttribute(1, 1); 1077 1079 sub_node->setAttribute(2, 1); … … 1126 1128 1127 1129 GenericTree* active_playlist_node = subsub_node->findLeaf(); 1128 1130 if(!active_playlist_node) active_playlist_node = subsub_node; 1131 1132 MSqlQuery query(MSqlQuery::InitCon()); 1133 1134 MSqlQuery subquery(MSqlQuery::InitCon()); 1135 subquery.prepare("SELECT smartplaylistid, name FROM music_smartplaylists " 1136 "WHERE categoryid = :CATEGORYID ORDER BY name;"); 1137 1138 a_counter = 2; 1139 if (query.exec("SELECT categoryid, name FROM music_smartplaylist_categories ORDER BY name;")) 1140 { 1141 if (query.isActive() && query.numRowsAffected() > 0) 1142 { 1143 while (query.next()) 1144 { 1145 sub_node = tree_to_write_to->addNode(QString::fromUtf8(query.value(1).toString()), a_counter++); 1146 1147 subquery.bindValue(":CATEGORYID", query.value(0)); 1148 if (subquery.exec()) 1149 { 1150 if (subquery.isActive() && subquery.numRowsAffected() > 0) 1151 { 1152 while (subquery.next()) 1153 { 1154 Playlist *pl_playlist = new Playlist(all_available_music); 1155 1156 pl_playlist->fillSonglistFromSmartPlaylist(query.value(1).toString(), 1157 subquery.value(1).toString(), false, PL_FILTERONLY, 0); 1158 1159 GenericTree *subsub_node = 1160 sub_node->addNode(QString::fromUtf8(subquery.value(1).toString()), 2); 1161 1162 all_available_music->writeTree(subsub_node, true); 1163 1164 delete pl_playlist; 1165 } 1166 } 1167 } 1168 1169 } 1170 } 1171 } 1172 1129 1173 return active_playlist_node; 1130 1174 } 1131 1175 -
mythmusic/mythmusic/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);