Merge pull request #4042 from hugochiquito/master
Added ability to quickly display partial results on Song Info and Artist Info Panes.
This commit is contained in:
commit
1130efe4b1
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
QList<SongInfoProvider*> 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
|
||||
|
||||
|
@ -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<const UltimateLyricsProvider*> SongInfoView::lyric_providers() const {
|
||||
qSort(ret.begin(), ret.end(), CompareLyricProviders);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user