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"
|
2010-10-10 23:45:01 +02:00
|
|
|
#include "echonestbiographies.h"
|
|
|
|
#include "echonestimages.h"
|
2010-10-10 18:09:20 +02:00
|
|
|
#include "songinfofetcher.h"
|
2012-05-30 01:31:27 +02:00
|
|
|
#include "songkickconcerts.h"
|
2010-10-08 01:13:41 +02:00
|
|
|
#include "widgets/prettyimageview.h"
|
2010-10-02 18:23:33 +02:00
|
|
|
|
2010-12-18 18:28:02 +01:00
|
|
|
#ifdef HAVE_LIBLASTFM
|
|
|
|
#include "echonestsimilarartists.h"
|
|
|
|
#include "echonesttags.h"
|
|
|
|
#endif
|
|
|
|
|
2010-10-16 19:20:54 +02:00
|
|
|
ArtistInfoView::ArtistInfoView(QWidget *parent)
|
|
|
|
: SongInfoBase(parent)
|
2010-10-02 18:23:33 +02:00
|
|
|
{
|
2010-10-10 23:45:01 +02:00
|
|
|
fetcher_->AddProvider(new EchoNestBiographies);
|
|
|
|
fetcher_->AddProvider(new EchoNestImages);
|
2012-05-30 01:31:27 +02:00
|
|
|
fetcher_->AddProvider(new SongkickConcerts);
|
2010-12-18 18:28:02 +01:00
|
|
|
#ifdef HAVE_LIBLASTFM
|
2010-10-10 23:45:01 +02:00
|
|
|
fetcher_->AddProvider(new EchoNestSimilarArtists);
|
|
|
|
fetcher_->AddProvider(new EchoNestTags);
|
2010-12-18 18:28:02 +01:00
|
|
|
#endif
|
2010-10-02 18:23:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ArtistInfoView::~ArtistInfoView() {
|
|
|
|
}
|
|
|
|
|
2010-10-09 14:39:49 +02:00
|
|
|
bool ArtistInfoView::NeedsUpdate(const Song& old_metadata, const Song& new_metadata) const {
|
2010-10-10 20:57:23 +02:00
|
|
|
if (new_metadata.artist().isEmpty())
|
|
|
|
return false;
|
|
|
|
|
2010-10-09 14:39:49 +02:00
|
|
|
return old_metadata.artist() != new_metadata.artist();
|
2010-10-02 18:23:33 +02:00
|
|
|
}
|
2013-12-21 19:58:51 +01:00
|
|
|
|
|
|
|
void ArtistInfoView::InfoResultReady (int id, const CollapsibleInfoPane::Data& data) {
|
|
|
|
if (id != current_request_id_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
AddSection (new CollapsibleInfoPane(data, this));
|
|
|
|
CollapseSections();
|
|
|
|
}
|
|
|
|
|
2010-10-10 18:09:20 +02:00
|
|
|
void ArtistInfoView::ResultReady(int id, const SongInfoFetcher::Result& result) {
|
2010-10-09 15:34:28 +02:00
|
|
|
if (id != current_request_id_)
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
|
2010-10-24 01:44:16 +02:00
|
|
|
foreach (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
|
|
|
}
|
2013-12-21 19:58:51 +01:00
|
|
|
|