2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-03-24 00:11:46 +01: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/>.
|
|
|
|
*/
|
|
|
|
|
2009-12-26 16:13:38 +01:00
|
|
|
#ifndef RADIOSERVICE_H
|
|
|
|
#define RADIOSERVICE_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2009-12-26 22:35:45 +01:00
|
|
|
#include <QList>
|
|
|
|
#include <QUrl>
|
2009-12-26 16:13:38 +01:00
|
|
|
|
2009-12-26 23:15:57 +01:00
|
|
|
#include "radioitem.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "core/song.h"
|
|
|
|
#include "playlist/playlistitem.h"
|
2010-08-27 17:42:58 +02:00
|
|
|
#include "ui/settingsdialog.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "widgets/multiloadingindicator.h"
|
2009-12-26 23:15:57 +01:00
|
|
|
|
2010-05-09 17:51:04 +02:00
|
|
|
class RadioModel;
|
2010-05-09 22:18:05 +02:00
|
|
|
class LibraryFilterWidget;
|
2009-12-26 16:13:38 +01:00
|
|
|
|
|
|
|
class RadioService : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-05-09 17:51:04 +02:00
|
|
|
RadioService(const QString& name, RadioModel* model);
|
2009-12-26 18:19:14 +01:00
|
|
|
virtual ~RadioService() {}
|
2009-12-26 16:13:38 +01:00
|
|
|
|
|
|
|
QString name() const { return name_; }
|
2010-05-09 17:51:04 +02:00
|
|
|
RadioModel* model() const { return model_; }
|
2009-12-26 16:13:38 +01:00
|
|
|
|
|
|
|
virtual RadioItem* CreateRootItem(RadioItem* parent) = 0;
|
|
|
|
virtual void LazyPopulate(RadioItem* item) = 0;
|
|
|
|
|
2010-01-18 03:23:55 +01:00
|
|
|
virtual QUrl UrlForItem(const RadioItem* item) const;
|
|
|
|
virtual QString TitleForItem(const RadioItem* item) const;
|
|
|
|
virtual QString ArtistForItem(const RadioItem* item) const;
|
2009-12-30 00:17:54 +01:00
|
|
|
|
2010-05-09 19:53:27 +02:00
|
|
|
virtual void ShowContextMenu(RadioItem* item, const QModelIndex& index,
|
|
|
|
const QPoint& global_pos) {
|
|
|
|
Q_UNUSED(item); Q_UNUSED(index); Q_UNUSED(global_pos); }
|
2009-12-26 23:59:11 +01:00
|
|
|
|
2010-05-18 22:43:10 +02:00
|
|
|
virtual PlaylistItem::SpecialLoadResult StartLoading(const QUrl& url);
|
|
|
|
virtual PlaylistItem::SpecialLoadResult LoadNext(const QUrl& url);
|
2009-12-26 22:35:45 +01:00
|
|
|
|
2010-05-18 22:43:10 +02:00
|
|
|
virtual PlaylistItem::Options playlistitem_options() const { return PlaylistItem::Default; }
|
2009-12-29 17:12:08 +01:00
|
|
|
|
2010-06-09 17:38:00 +02:00
|
|
|
virtual QWidget* HeaderWidget() const { return NULL; }
|
2010-05-09 22:18:05 +02:00
|
|
|
|
2010-02-03 19:32:48 +01:00
|
|
|
virtual void ReloadSettings() {}
|
|
|
|
|
2010-03-25 19:38:20 +01:00
|
|
|
virtual QString Icon() { return QString(); }
|
|
|
|
|
2009-12-26 22:35:45 +01:00
|
|
|
signals:
|
2010-05-18 22:43:10 +02:00
|
|
|
void AsyncLoadFinished(const PlaylistItem::SpecialLoadResult& result);
|
2009-12-26 22:35:45 +01:00
|
|
|
void StreamError(const QString& message);
|
2009-12-26 23:15:57 +01:00
|
|
|
void StreamMetadataFound(const QUrl& original_url, const Song& song);
|
2010-08-27 17:42:58 +02:00
|
|
|
void OpenSettingsAtPage(SettingsDialog::Page page);
|
2009-12-26 22:35:45 +01:00
|
|
|
|
2009-12-30 02:41:37 +01:00
|
|
|
void AddItemToPlaylist(RadioItem* item);
|
2010-05-10 16:19:43 +02:00
|
|
|
void AddItemsToPlaylist(const PlaylistItemList& items);
|
2009-12-30 02:41:37 +01:00
|
|
|
|
2009-12-26 16:13:38 +01:00
|
|
|
private:
|
2010-05-09 17:51:04 +02:00
|
|
|
RadioModel* model_;
|
2009-12-26 16:13:38 +01:00
|
|
|
QString name_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RADIOSERVICE_H
|