2010-10-02 18:23:33 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-10-02 18:23:33 +02:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "artistinfoview.h"
|
2016-06-22 15:53:35 +02:00
|
|
|
|
2016-06-28 15:15:23 +02:00
|
|
|
#include "songinfo/artistbiography.h"
|
2016-06-22 15:53:35 +02:00
|
|
|
#include "songinfo/songinfofetcher.h"
|
|
|
|
#include "songinfo/songkickconcerts.h"
|
2018-11-17 15:08:37 +01:00
|
|
|
#include "songinfo/spotifyimages.h"
|
2020-09-18 16:15:19 +02:00
|
|
|
#include "widgets/prettyimageview.h"
|
2010-10-02 18:23:33 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
ArtistInfoView::ArtistInfoView(QWidget* parent) : SongInfoBase(parent) {
|
2012-05-30 01:31:27 +02:00
|
|
|
fetcher_->AddProvider(new SongkickConcerts);
|
2016-06-22 15:53:35 +02:00
|
|
|
fetcher_->AddProvider(new SpotifyImages);
|
2016-06-28 15:15:23 +02:00
|
|
|
fetcher_->AddProvider(new ArtistBiography);
|
2010-10-02 18:23:33 +02:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
ArtistInfoView::~ArtistInfoView() {}
|
2010-10-02 18:23:33 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
bool ArtistInfoView::NeedsUpdate(const Song& old_metadata,
|
|
|
|
const Song& new_metadata) const {
|
|
|
|
if (new_metadata.artist().isEmpty()) return false;
|
2010-10-10 20:57:23 +02:00
|
|
|
|
2010-10-09 14:39:49 +02:00
|
|
|
return old_metadata.artist() != new_metadata.artist();
|
2010-10-02 18:23:33 +02:00
|
|
|
}
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
void ArtistInfoView::InfoResultReady(int id,
|
|
|
|
const CollapsibleInfoPane::Data& data) {
|
|
|
|
if (id != current_request_id_) return;
|
|
|
|
|
|
|
|
AddSection(new CollapsibleInfoPane(data, this));
|
2013-12-21 19:58:51 +01:00
|
|
|
CollapseSections();
|
|
|
|
}
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
void ArtistInfoView::ResultReady(int id,
|
|
|
|
const SongInfoFetcher::Result& result) {
|
|
|
|
if (id != current_request_id_) return;
|
2010-10-09 15:34:28 +02:00
|
|
|
|
2010-10-24 01:44:16 +02:00
|
|
|
if (!result.images_.isEmpty()) {
|
|
|
|
// Image view goes at the top
|
2010-12-30 18:35:10 +01:00
|
|
|
PrettyImageView* image_view = new PrettyImageView(network_, this);
|
2010-10-24 01:44:16 +02:00
|
|
|
AddWidget(image_view);
|
2010-10-02 18:23:33 +02:00
|
|
|
|
2014-02-10 14:29:07 +01:00
|
|
|
for (const QUrl& url : result.images_) {
|
|
|
|
image_view->AddImage(url);
|
|
|
|
}
|
2010-10-02 18:23:33 +02:00
|
|
|
}
|
2010-10-11 21:49:12 +02:00
|
|
|
CollapseSections();
|
2010-10-02 18:23:33 +02:00
|
|
|
}
|