1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-17 20:09:50 +01:00

Never start playing a background stream on startup, even if it was enabled last time.

This commit is contained in:
David Sansome 2013-05-04 19:25:43 +10:00
parent 73517ea475
commit fe964b9457
2 changed files with 7 additions and 10 deletions

View File

@ -41,8 +41,7 @@ void BackgroundStreams::LoadStreams() {
s.setArrayIndex(i); s.setArrayIndex(i);
AddStream(s.value("name").toString(), AddStream(s.value("name").toString(),
s.value("url").toUrl(), s.value("url").toUrl(),
s.value("volume").toInt(), s.value("volume").toInt());
s.value("enabled").toBool());
} }
SaveStreams(); SaveStreams();
@ -60,24 +59,23 @@ void BackgroundStreams::SaveStreams() {
s.setValue("name", stream->name); s.setValue("name", stream->name);
s.setValue("url", stream->url); s.setValue("url", stream->url);
s.setValue("volume", stream->volume); s.setValue("volume", stream->volume);
s.setValue("enabled", stream->id != -1);
} }
s.endArray(); s.endArray();
} }
void BackgroundStreams::AddStream(const QString& name, void BackgroundStreams::AddStream(const QString& name,
const QUrl& url, const QUrl& url,
int volume, int volume) {
bool enabled) { if (streams_.contains(name)) {
return;
}
Stream* s = new Stream; Stream* s = new Stream;
s->name = name; s->name = name;
s->url = url; s->url = url;
s->volume = volume; s->volume = volume;
s->id = -1; s->id = -1;
streams_[name] = s; streams_[name] = s;
if (enabled) {
PlayStream(s);
}
} }
void BackgroundStreams::EnableStream(const QString& name, bool enable) { void BackgroundStreams::EnableStream(const QString& name, bool enable) {

View File

@ -49,8 +49,7 @@ class BackgroundStreams : public QObject {
QAction* action; QAction* action;
}; };
void AddStream( void AddStream(const QString& name, const QUrl& url, int volume = 50);
const QString& name, const QUrl& url, int volume = 50, bool enabled = false);
void PlayStream(Stream* stream); void PlayStream(Stream* stream);
void StopStream(Stream* stream); void StopStream(Stream* stream);