bool LibraryModel::HasCompilations(const LibraryQuery& query) { LibraryQuery q = query; q.AddCompilationRequirement(true); q.SetLimit(1); QMutexLocker l(backend_->db()->Mutex()); if (!backend_->ExecQuery(&q)) return false; return q.Next(); }
SongList AlbumCoverManager::GetSongsInAlbum(const QModelIndex& index) const { SongList ret; LibraryQuery q; q.SetColumnSpec("ROWID," + Song::kColumnSpec); q.AddWhere("album", index.data(Role_AlbumName).toString()); q.SetOrderBy("disc, track, title"); QString artist = index.data(Role_ArtistName).toString(); q.AddCompilationRequirement(artist.isEmpty()); if (!artist.isEmpty()) q.AddWhere("artist", artist); if (!library_backend_->ExecQuery(&q)) return ret; while (q.Next()) { Song song; song.InitFromQuery(q, true); ret << song; } return ret; }