mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 19:31:02 +01:00
Make GrooveShark emit a SearchFinished signal, and fix aggregate SearchFinished signals if some providers are disabled
This commit is contained in:
parent
da825d4659
commit
452fccc2f5
@ -59,11 +59,13 @@ int GlobalSearch::SearchAsync(const QString& query) {
|
||||
|
||||
int timer_id = -1;
|
||||
|
||||
pending_search_providers_[id] = providers_.count();
|
||||
pending_search_providers_[id] = 0;
|
||||
foreach (SearchProvider* provider, providers_.keys()) {
|
||||
if (!providers_[provider].enabled_)
|
||||
continue;
|
||||
|
||||
pending_search_providers_[id] ++;
|
||||
|
||||
if (provider->wants_delayed_queries()) {
|
||||
if (timer_id == -1) {
|
||||
timer_id = startTimer(kDelayedSearchTimeoutMs);
|
||||
|
@ -73,7 +73,7 @@ void GroovesharkSearchProvider::SearchDone(int id, const SongList& songs) {
|
||||
}
|
||||
|
||||
emit ResultsAvailable(global_search_id, ret);
|
||||
// TODO: emit SearchFinished() when the album search is complete too.
|
||||
MaybeSearchFinished(global_search_id);
|
||||
}
|
||||
|
||||
void GroovesharkSearchProvider::AlbumSearchResult(int id, const SongList& songs) {
|
||||
@ -90,6 +90,14 @@ void GroovesharkSearchProvider::AlbumSearchResult(int id, const SongList& songs)
|
||||
}
|
||||
|
||||
emit ResultsAvailable(global_search_id, ret);
|
||||
MaybeSearchFinished(global_search_id);
|
||||
}
|
||||
|
||||
void GroovesharkSearchProvider::MaybeSearchFinished(int id) {
|
||||
qLog(Debug) << id << pending_searches_.keys(id);
|
||||
if (pending_searches_.keys(id).isEmpty()) {
|
||||
emit SearchFinished(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,7 @@ class GroovesharkSearchProvider : public SearchProvider {
|
||||
void AlbumSongsLoaded(int id, const SongList& songs);
|
||||
|
||||
private:
|
||||
void MaybeSearchFinished(int id);
|
||||
void FetchAlbum(int id, const Result& result);
|
||||
|
||||
GroovesharkService* service_;
|
||||
|
Loading…
Reference in New Issue
Block a user