Clementine-audio-player-Mac.../src/radio/somafmservice.h

77 lines
1.9 KiB
C
Raw Normal View History

/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
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:
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;
void ShowContextMenu(RadioItem* item, const QModelIndex& index, const QPoint& global_pos);
2010-01-18 03:23:55 +01: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
int get_channels_task_id_;
int get_stream_task_id_;
2010-01-18 03:23:55 +01:00
QNetworkAccessManager* network_;
};
#endif // SOMAFMSERVICE_H