2010-03-24 00:11:46 +01:00
|
|
|
/* 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/>.
|
|
|
|
*/
|
|
|
|
|
2010-02-24 23:26:01 +01:00
|
|
|
#ifndef SAVEDRADIO_H
|
|
|
|
#define SAVEDRADIO_H
|
|
|
|
|
|
|
|
#include "radioservice.h"
|
|
|
|
|
2010-05-28 00:53:07 +02:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
2010-02-24 23:26:01 +01:00
|
|
|
class QMenu;
|
|
|
|
|
2010-05-28 00:53:07 +02:00
|
|
|
class AddStreamDialog;
|
|
|
|
|
2010-02-24 23:26:01 +01:00
|
|
|
class SavedRadio : public RadioService {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-05-09 17:51:04 +02:00
|
|
|
SavedRadio(RadioModel* parent);
|
2010-02-24 23:26:01 +01:00
|
|
|
~SavedRadio();
|
|
|
|
|
|
|
|
enum ItemType {
|
|
|
|
Type_Stream = 2000,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char* kServiceName;
|
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
|
|
|
RadioItem* CreateRootItem(RadioItem* parent);
|
|
|
|
void LazyPopulate(RadioItem* item);
|
|
|
|
|
2010-05-09 19:53:27 +02:00
|
|
|
void ShowContextMenu(RadioItem* item, const QModelIndex& index,
|
|
|
|
const QPoint& global_pos);
|
2010-02-24 23:26:01 +01:00
|
|
|
|
2010-05-28 00:53:07 +02:00
|
|
|
void Add(const QUrl& url, const QString& name = QString());
|
2010-02-24 23:26:01 +01:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void ShowAddStreamDialog();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void AddToPlaylist();
|
|
|
|
void Remove();
|
2010-05-28 00:53:07 +02:00
|
|
|
void Edit();
|
2010-02-24 23:26:01 +01:00
|
|
|
|
|
|
|
private:
|
2010-05-28 00:53:07 +02:00
|
|
|
struct Stream {
|
|
|
|
Stream(const QUrl& url, const QString& name = QString())
|
|
|
|
: url_(url), name_(name) {}
|
|
|
|
|
|
|
|
// For QList::contains
|
|
|
|
bool operator ==(const Stream& other) const { return url_ == other.url_; }
|
|
|
|
|
|
|
|
QUrl url_;
|
|
|
|
QString name_;
|
|
|
|
};
|
|
|
|
|
2010-02-24 23:26:01 +01:00
|
|
|
void LoadStreams();
|
|
|
|
void SaveStreams();
|
2010-05-28 00:53:07 +02:00
|
|
|
RadioItem* ItemForStream(const Stream& stream, RadioItem* parent);
|
2010-02-24 23:26:01 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
RadioItem* root_;
|
|
|
|
QMenu* context_menu_;
|
|
|
|
RadioItem* context_item_;
|
|
|
|
|
|
|
|
QAction* add_action_;
|
|
|
|
QAction* remove_action_;
|
2010-05-28 00:53:07 +02:00
|
|
|
QAction* edit_action_;
|
|
|
|
|
|
|
|
QList<Stream> streams_;
|
2010-02-24 23:26:01 +01:00
|
|
|
|
2010-05-28 00:53:07 +02:00
|
|
|
boost::scoped_ptr<AddStreamDialog> edit_dialog_;
|
2010-02-24 23:26:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SAVEDRADIO_H
|