Clementine-audio-player-Mac.../src/core/backgroundstreams.h

89 lines
2.3 KiB
C
Raw Normal View History

2014-11-01 19:26:05 +01:00
/* This file is part of Clementine.
2014-11-01 19:30:40 +01:00
Copyright 2010-2011, 2013, David Sansome <me@davidsansome.com>
Copyright 2010, 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
2014-11-01 19:26:05 +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/>.
*/
#ifndef CORE_BACKGROUNDSTREAMS_H_
#define CORE_BACKGROUNDSTREAMS_H_
#include <QMap>
#include <QObject>
#include <QStringList>
#include <QUrl>
#include "engines/engine_fwd.h"
class QAction;
class BackgroundStreams : public QObject {
Q_OBJECT
2014-11-01 19:26:05 +01:00
public:
2014-11-02 19:32:48 +01:00
explicit BackgroundStreams(EngineBase* engine, QObject* parent = nullptr);
~BackgroundStreams();
void LoadStreams();
void SaveStreams();
QStringList streams() const { return streams_.keys(); }
void EnableStream(const QString& name, bool enable);
void SetStreamVolume(const QString& name, int volume);
int GetStreamVolume(const QString& name) const;
bool IsPlaying(const QString& name) const;
void AddAction(const QString& name, QAction* action);
2014-11-01 19:26:05 +01:00
signals:
void StreamStarted(const QString& name);
void StreamStopped(const QString& name);
private slots:
void StreamActionToggled(bool checked);
void StreamActionDestroyed();
private:
struct Stream {
2014-02-21 17:24:49 +01:00
Stream() : volume(0), id(0), action(nullptr) {}
QString name;
QUrl url;
int volume;
int id;
QAction* action;
};
void AddStream(const QString& name, const QUrl& url, int volume = 50);
void PlayStream(Stream* stream);
void StopStream(Stream* stream);
EngineBase* engine_;
QMap<QString, Stream*> streams_;
static const char* kSettingsGroup;
2012-01-10 17:00:17 +01:00
static const int kVersion = 2;
static const char* kHypnotoadUrl;
static const char* kRainUrl;
2012-01-10 17:00:17 +01:00
static const char* kEnterpriseUrl;
};
2014-11-01 19:26:05 +01:00
#endif // CORE_BACKGROUNDSTREAMS_H_