diff --git a/src/songinfo/artistinfoview.cpp b/src/songinfo/artistinfoview.cpp index cdf3879ae..816c49c5c 100644 --- a/src/songinfo/artistinfoview.cpp +++ b/src/songinfo/artistinfoview.cpp @@ -48,13 +48,19 @@ bool ArtistInfoView::NeedsUpdate(const Song& old_metadata, const Song& new_metad return old_metadata.artist() != new_metadata.artist(); } - + +void ArtistInfoView::InfoResultReady (int id, const CollapsibleInfoPane::Data& data) { + if (id != current_request_id_) + return; + + AddSection (new CollapsibleInfoPane(data, this)); + CollapseSections(); +} + void ArtistInfoView::ResultReady(int id, const SongInfoFetcher::Result& result) { if (id != current_request_id_) return; - Clear(); - if (!result.images_.isEmpty()) { // Image view goes at the top PrettyImageView* image_view = new PrettyImageView(network_, this); @@ -64,10 +70,6 @@ void ArtistInfoView::ResultReady(int id, const SongInfoFetcher::Result& result) image_view->AddImage(url); } } - - foreach (const CollapsibleInfoPane::Data& data, result.info_) { - AddSection(new CollapsibleInfoPane(data, this)); - } - CollapseSections(); } + diff --git a/src/songinfo/artistinfoview.h b/src/songinfo/artistinfoview.h index 5272e91bb..5a597d11f 100644 --- a/src/songinfo/artistinfoview.h +++ b/src/songinfo/artistinfoview.h @@ -36,6 +36,7 @@ public: ~ArtistInfoView(); protected: + virtual void InfoResultReady (int id, const CollapsibleInfoPane::Data& data); bool NeedsUpdate(const Song& old_metadata, const Song& new_metadata) const; protected slots: @@ -43,3 +44,4 @@ protected slots: }; #endif // ARTISTINFOVIEW_H + diff --git a/src/songinfo/songinfobase.cpp b/src/songinfo/songinfobase.cpp index 164cb8fea..3b36e7649 100644 --- a/src/songinfo/songinfobase.cpp +++ b/src/songinfo/songinfobase.cpp @@ -64,6 +64,8 @@ SongInfoBase::SongInfoBase(QWidget* parent) connect(fetcher_, SIGNAL(ResultReady(int,SongInfoFetcher::Result)), SLOT(ResultReady(int,SongInfoFetcher::Result))); + connect(fetcher_, SIGNAL(InfoResultReady(int,CollapsibleInfoPane::Data)), + SLOT(InfoResultReady(int,CollapsibleInfoPane::Data))); } void SongInfoBase::Clear() { @@ -142,9 +144,13 @@ void SongInfoBase::Update(const Song& metadata) { // Do this after the new pane has been shown otherwise it'll just grab a // black rectangle. + Clear (); QTimer::singleShot(0, fader_, SLOT(StartBlur())); } +void SongInfoBase::InfoResultReady (int id, const CollapsibleInfoPane::Data& data) { +} + void SongInfoBase::ResultReady(int id, const SongInfoFetcher::Result& result) { foreach (const CollapsibleInfoPane::Data& data, result.info_) { delete data.contents_; @@ -225,3 +231,4 @@ void SongInfoBase::ConnectWidget(QWidget* widget) { connect(widget, SIGNAL(DoGlobalSearch(QString)), SIGNAL(DoGlobalSearch(QString))); } } + diff --git a/src/songinfo/songinfobase.h b/src/songinfo/songinfobase.h index 90b4c5e02..ab8c8448c 100644 --- a/src/songinfo/songinfobase.h +++ b/src/songinfo/songinfobase.h @@ -63,6 +63,7 @@ protected: void CollapseSections(); protected slots: + virtual void InfoResultReady (int id, const CollapsibleInfoPane::Data& data); virtual void ResultReady(int id, const SongInfoFetcher::Result& result); protected: @@ -94,3 +95,4 @@ private: }; #endif // SONGINFOBASE_H + diff --git a/src/songinfo/songinfofetcher.cpp b/src/songinfo/songinfofetcher.cpp index df395a204..1497fa994 100644 --- a/src/songinfo/songinfofetcher.cpp +++ b/src/songinfo/songinfofetcher.cpp @@ -68,6 +68,10 @@ void SongInfoFetcher::InfoReady(int id, const CollapsibleInfoPane::Data& data) { if (!results_.contains(id)) return; results_[id].info_ << data; + + if (!waiting_for_.contains(id)) + return; + emit InfoResultReady (id, data); } void SongInfoFetcher::ProviderFinished(int id) { @@ -107,3 +111,4 @@ void SongInfoFetcher::Timeout(int id) { // Remove the timer delete timeout_timers_.take(id); } + diff --git a/src/songinfo/songinfofetcher.h b/src/songinfo/songinfofetcher.h index 399bafb7c..987716a4e 100644 --- a/src/songinfo/songinfofetcher.h +++ b/src/songinfo/songinfofetcher.h @@ -50,6 +50,7 @@ public: QList providers() const { return providers_; } signals: + void InfoResultReady (int id, const CollapsibleInfoPane::Data& data); void ResultReady(int id, const SongInfoFetcher::Result& result); private slots: @@ -72,3 +73,4 @@ private: }; #endif // SONGINFOFETCHER_H + diff --git a/src/songinfo/songinfoview.cpp b/src/songinfo/songinfoview.cpp index a4c642d5b..a5de1e308 100644 --- a/src/songinfo/songinfoview.cpp +++ b/src/songinfo/songinfoview.cpp @@ -76,19 +76,17 @@ bool SongInfoView::NeedsUpdate(const Song& old_metadata, const Song& new_metadat old_metadata.artist() != new_metadata.artist(); } -void SongInfoView::ResultReady(int id, const SongInfoFetcher::Result& result) { +void SongInfoView::InfoResultReady (int id, const CollapsibleInfoPane::Data& data) { if (id != current_request_id_) return; - - Clear(); - - foreach (const CollapsibleInfoPane::Data& data, result.info_) { - AddSection(new CollapsibleInfoPane(data, this)); - } - + + AddSection (new CollapsibleInfoPane(data, this)); CollapseSections(); } +void SongInfoView::ResultReady(int id, const SongInfoFetcher::Result& result) { +} + void SongInfoView::ReloadSettings() { QSettings s; s.beginGroup(kSettingsGroup); @@ -170,3 +168,4 @@ QList SongInfoView::lyric_providers() const { qSort(ret.begin(), ret.end(), CompareLyricProviders); return ret; } + diff --git a/src/songinfo/songinfoview.h b/src/songinfo/songinfoview.h index 744a4d5c0..887e31242 100644 --- a/src/songinfo/songinfoview.h +++ b/src/songinfo/songinfoview.h @@ -43,7 +43,8 @@ protected: bool NeedsUpdate(const Song& old_metadata, const Song& new_metadata) const; protected slots: - void ResultReady(int id, const SongInfoFetcher::Result& result); + virtual void InfoResultReady (int id, const CollapsibleInfoPane::Data& data); + virtual void ResultReady(int id, const SongInfoFetcher::Result& result); private: SongInfoProvider* ProviderByName(const QString& name) const; @@ -56,3 +57,4 @@ private: }; #endif // SONGINFOVIEW_H +