Clementine-audio-player-Mac.../src/lastfmservice.h

58 lines
1.2 KiB
C
Raw Normal View History

#ifndef LASTFMSERVICE_H
#define LASTFMSERVICE_H
#include "radioservice.h"
2009-12-26 22:35:45 +01:00
#include <lastfm/RadioTuner>
2009-12-26 18:19:14 +01:00
class LastFMConfig;
class LastFMService : public RadioService {
2009-12-26 18:19:14 +01:00
Q_OBJECT
public:
LastFMService(QObject* parent = 0);
2009-12-26 18:19:14 +01:00
~LastFMService();
static const char* kSettingsGroup;
enum ItemType {
Type_MyRecommendations = 1000,
Type_MyRadio,
Type_MyLoved,
Type_MyNeighbourhood,
};
2009-12-26 22:35:45 +01:00
// RadioService
RadioItem* CreateRootItem(RadioItem* parent);
void LazyPopulate(RadioItem *item);
2009-12-26 23:15:57 +01:00
QList<RadioItem::PlaylistData> DataForItem(RadioItem* item);
2009-12-26 22:35:45 +01:00
void StartLoading(const QUrl& url);
void LoadNext(const QUrl& url);
2009-12-26 18:19:14 +01:00
void Authenticate(const QString& username, const QString& password);
signals:
void AuthenticationComplete(bool success);
private slots:
void AuthenticateReplyFinished();
2009-12-26 22:35:45 +01:00
void TunerTrackAvailable();
void TunerError(lastfm::ws::Error error);
private:
RadioItem* CreateStationItem(ItemType type, const QString& name,
const QString& icon, RadioItem* parent);
2009-12-26 22:35:45 +01:00
QString ErrorString(lastfm::ws::Error error) const;
2009-12-26 18:19:14 +01:00
private:
LastFMConfig* config_;
2009-12-26 22:35:45 +01:00
lastfm::RadioTuner* tuner_;
QUrl last_url_;
bool initial_tune_;
};
#endif // LASTFMSERVICE_H