2011-09-30 16:01:07 +02:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
Copyright 2011, David Sansome <me@davidsansome.com>
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2011-09-30 15:35:09 +02:00
|
|
|
#ifndef GROOVESHARKSEARCHPROVIDER_H
|
|
|
|
#define GROOVESHARKSEARCHPROVIDER_H
|
|
|
|
|
|
|
|
#include "searchprovider.h"
|
2012-02-13 21:44:04 +01:00
|
|
|
#include "covers/albumcoverloaderoptions.h"
|
2012-06-19 23:25:15 +02:00
|
|
|
#include "internet/groovesharkservice.h"
|
2011-09-30 15:35:09 +02:00
|
|
|
|
2011-09-30 15:58:24 +02:00
|
|
|
class AlbumCoverLoader;
|
2011-09-30 15:35:09 +02:00
|
|
|
|
2011-10-05 21:59:15 +02:00
|
|
|
class GroovesharkSearchProvider : public SearchProvider {
|
2011-09-30 15:35:09 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-02-13 21:44:04 +01:00
|
|
|
explicit GroovesharkSearchProvider(Application* app, QObject* parent = 0);
|
2011-10-05 21:59:15 +02:00
|
|
|
void Init(GroovesharkService* service);
|
2011-09-30 15:35:09 +02:00
|
|
|
|
|
|
|
// SearchProvider
|
|
|
|
void SearchAsync(int id, const QString& query);
|
|
|
|
void LoadArtAsync(int id, const Result& result);
|
2011-10-20 15:03:47 +02:00
|
|
|
bool IsLoggedIn();
|
|
|
|
void ShowConfig();
|
2012-06-19 23:25:15 +02:00
|
|
|
InternetService* internet_service() { return service_; }
|
2011-09-30 15:35:09 +02:00
|
|
|
|
|
|
|
private slots:
|
2011-10-01 11:03:36 +02:00
|
|
|
void SearchDone(int id, const SongList& songs);
|
2012-03-05 00:54:24 +01:00
|
|
|
void AlbumSearchResult(int id, const QList<quint64>& albums_ids);
|
2011-09-30 15:58:24 +02:00
|
|
|
void AlbumArtLoaded(quint64 id, const QImage& image);
|
2012-03-05 00:54:24 +01:00
|
|
|
void AlbumSongsLoaded(quint64 id, const SongList& songs);
|
2011-09-30 15:35:09 +02:00
|
|
|
|
|
|
|
private:
|
2011-10-16 22:57:28 +02:00
|
|
|
void MaybeSearchFinished(int id);
|
2011-10-05 14:08:33 +02:00
|
|
|
|
2011-10-05 21:59:15 +02:00
|
|
|
GroovesharkService* service_;
|
2011-11-01 13:00:27 +01:00
|
|
|
QMap<int, PendingState> pending_searches_;
|
2011-09-30 15:35:09 +02:00
|
|
|
|
2012-02-13 21:44:04 +01:00
|
|
|
AlbumCoverLoaderOptions cover_loader_options_;
|
2011-09-30 15:58:24 +02:00
|
|
|
QMap<quint64, int> cover_loader_tasks_;
|
2011-09-30 15:35:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|