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/>.
|
|
|
|
*/
|
|
|
|
|
2010-01-18 03:23:55 +01:00
|
|
|
#ifndef SOMAFMSERVICE_H
|
|
|
|
#define SOMAFMSERVICE_H
|
|
|
|
|
2010-02-10 14:15:18 +01:00
|
|
|
#include <QXmlStreamReader>
|
|
|
|
|
2010-01-18 03:23:55 +01:00
|
|
|
#include "radioservice.h"
|
|
|
|
|
|
|
|
class QNetworkAccessManager;
|
2010-01-18 03:49:07 +01:00
|
|
|
class QMenu;
|
2010-01-18 03:23:55 +01:00
|
|
|
|
|
|
|
class SomaFMService : public RadioService {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-05-09 17:51:04 +02:00
|
|
|
SomaFMService(RadioModel* parent);
|
2010-01-18 03:49:07 +01:00
|
|
|
~SomaFMService();
|
2010-01-18 03:23:55 +01:00
|
|
|
|
|
|
|
enum ItemType {
|
|
|
|
Type_Stream = 2000,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char* kServiceName;
|
|
|
|
static const char* kChannelListUrl;
|
2010-01-18 03:49:07 +01:00
|
|
|
static const char* kHomepage;
|
2010-01-18 03:23:55 +01:00
|
|
|
|
|
|
|
RadioItem* CreateRootItem(RadioItem* parent);
|
|
|
|
void LazyPopulate(RadioItem* item);
|
|
|
|
|
|
|
|
QString TitleForItem(const RadioItem* item) const;
|
|
|
|
|
2010-05-09 19:53:27 +02:00
|
|
|
void ShowContextMenu(RadioItem* item, const QModelIndex& index, const QPoint& global_pos);
|
2010-01-18 03:23:55 +01:00
|
|
|
|
2010-05-18 22:43:10 +02:00
|
|
|
PlaylistItem::Options playlistitem_options() const;
|
|
|
|
PlaylistItem::SpecialLoadResult StartLoading(const QUrl& url);
|
2010-01-18 03:23:55 +01:00
|
|
|
|
|
|
|
private slots:
|
2010-01-18 03:49:07 +01:00
|
|
|
void RefreshChannels();
|
2010-01-18 03:23:55 +01:00
|
|
|
void RefreshChannelsFinished();
|
|
|
|
void LoadPlaylistFinished();
|
|
|
|
|
2010-01-18 03:49:07 +01:00
|
|
|
void AddToPlaylist();
|
|
|
|
void Homepage();
|
|
|
|
|
2010-01-18 03:23:55 +01:00
|
|
|
private:
|
|
|
|
void ReadChannel(QXmlStreamReader& reader);
|
|
|
|
void ConsumeElement(QXmlStreamReader& reader);
|
|
|
|
|
|
|
|
private:
|
|
|
|
RadioItem* root_;
|
2010-01-18 03:49:07 +01:00
|
|
|
QMenu* context_menu_;
|
|
|
|
RadioItem* context_item_;
|
2010-01-18 03:23:55 +01:00
|
|
|
|
2010-06-23 15:21:30 +02:00
|
|
|
int get_channels_task_id_;
|
|
|
|
int get_stream_task_id_;
|
|
|
|
|
2010-01-18 03:23:55 +01:00
|
|
|
QNetworkAccessManager* network_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SOMAFMSERVICE_H
|