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

59 lines
1.4 KiB
C
Raw Normal View History

#ifndef RADIOMODEL_H
#define RADIOMODEL_H
#include "radioitem.h"
#include "simpletreemodel.h"
class RadioService;
2009-12-29 20:22:02 +01:00
class LastFMService;
2009-12-26 23:15:57 +01:00
class Song;
class RadioModel : public SimpleTreeModel<RadioItem> {
2009-12-26 22:35:45 +01:00
Q_OBJECT
public:
RadioModel(QObject* parent = 0);
enum {
Role_Type = Qt::UserRole + 1,
Role_SortText,
Role_Key,
};
2009-12-26 22:35:45 +01:00
// Needs to be static for RadioPlaylistItem::restore
static RadioService* ServiceByName(const QString& name);
2009-12-29 20:22:02 +01:00
// This is special because Player needs it for scrobbling
LastFMService* GetLastFMService() const;
// QAbstractItemModel
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
2009-12-26 22:35:45 +01:00
Qt::ItemFlags flags(const QModelIndex& index) const;
QStringList mimeTypes() const;
QMimeData* mimeData(const QModelIndexList& indexes) const;
2009-12-30 00:01:07 +01:00
void ShowContextMenu(RadioItem* item, const QPoint& global_pos);
2009-12-26 22:35:45 +01:00
signals:
2010-01-18 03:23:55 +01:00
void TaskStarted(const QString&);
void TaskFinished(const QString&);
2009-12-26 22:35:45 +01:00
void StreamReady(const QUrl& original_url, const QUrl& media_url);
void StreamFinished();
void StreamError(const QString& message);
2009-12-26 23:15:57 +01:00
void StreamMetadataFound(const QUrl& original_url, const Song& song);
2009-12-30 02:41:37 +01:00
void AddItemToPlaylist(RadioItem* item);
protected:
void LazyPopulate(RadioItem* parent);
private:
QVariant data(const RadioItem* item, int role) const;
2009-12-26 22:35:45 +01:00
void AddService(RadioService* service);
private:
2009-12-26 22:35:45 +01:00
static QMap<QString, RadioService*> sServices;
};
#endif // RADIOMODEL_H