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

77 lines
2.2 KiB
C
Raw Normal View History

/* This file is part of Clementine.
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/>.
*/
#ifndef RADIOMODEL_H
#define RADIOMODEL_H
#include "radioitem.h"
#include "simpletreemodel.h"
2010-02-23 19:33:09 +01:00
#include "multiloadingindicator.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);
2010-02-03 19:32:48 +01:00
void ReloadSettings();
2009-12-30 00:01:07 +01:00
2009-12-26 22:35:45 +01:00
signals:
2010-02-23 19:33:09 +01:00
void TaskStarted(MultiLoadingIndicator::TaskType);
void TaskFinished(MultiLoadingIndicator::TaskType);
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