1
/* This file is part of Clementine.
2
Copyright 2010, David Sansome <me@davidsansome.com>
4
Clementine is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
9
Clementine is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef RADIOSERVICE_H
19
#define RADIOSERVICE_H
25
#include "core/song.h"
26
#include "playlist/playlistitem.h"
27
#include "ui/settingsdialog.h"
28
#include "widgets/multiloadingindicator.h"
31
class LibraryFilterWidget;
33
class RadioService : public QObject {
37
// Constructs a new radio service with the given name and model. The name
38
// should be user-friendly (like 'DigitallyImported' or 'Last.fm').
39
RadioService(const QString& name, RadioModel* model);
40
virtual ~RadioService() {}
42
QString name() const { return name_; }
43
RadioModel* model() const { return model_; }
45
virtual QStandardItem* CreateRootItem() = 0;
46
virtual void LazyPopulate(QStandardItem* parent) = 0;
48
virtual void ShowContextMenu(const QModelIndex& index, const QPoint& global_pos) {
49
Q_UNUSED(index); Q_UNUSED(global_pos); }
51
virtual PlaylistItem::SpecialLoadResult StartLoading(const QUrl& url);
52
virtual PlaylistItem::SpecialLoadResult LoadNext(const QUrl& url);
54
virtual PlaylistItem::Options playlistitem_options() const { return PlaylistItem::Default; }
56
virtual QWidget* HeaderWidget() const { return NULL; }
58
virtual void ReloadSettings() {}
60
virtual QString Icon() { return QString(); }
63
void AsyncLoadFinished(const PlaylistItem::SpecialLoadResult& result);
64
void StreamError(const QString& message);
65
void StreamMetadataFound(const QUrl& original_url, const Song& song);
66
void OpenSettingsAtPage(SettingsDialog::Page page);
68
void AddToPlaylistSignal(QMimeData* data);
71
void AppendToPlaylist();
72
void ReplacePlaylist();
73
void OpenInNewPlaylist();
76
// Subclass provides the currently selected QModelIndex on RadioService's
78
virtual QModelIndex GetCurrentIndex() = 0;
80
// Returns all the playlist insertion related QActions (see below).
81
QList<QAction*> GetPlaylistActions();
83
// Returns the 'append to playlist' QAction.
84
QAction* GetAppendToPlaylistAction();
85
// Returns the 'replace playlist' QAction.
86
QAction* GetReplacePlaylistAction();
87
// Returns the 'open in new playlist' QAction.
88
QAction* GetOpenInNewPlaylistAction();
90
// Describes how songs should be added to playlist.
92
// appends songs to the current playlist
94
// clears the current playlist and then appends all songs to it
96
// creates a new, empty playlist and then adds all songs to it
100
// Adds the 'index' element to playlist using the 'add_mode' mode.
101
void AddItemToPlaylist(const QModelIndex& index, AddMode add_mode);
102
// Adds the 'indexes' elements to playlist using the 'add_mode' mode.
103
void AddItemsToPlaylist(const QModelIndexList& indexes, AddMode add_mode);
109
QAction* append_to_playlist_;
110
QAction* replace_playlist_;
111
QAction* open_in_new_playlist_;
115
Q_DECLARE_METATYPE(RadioService*);
117
#endif // RADIOSERVICE_H