From fe964b94579350121871a472e14936f05ba39e88 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 4 May 2013 19:25:43 +1000 Subject: [PATCH] Never start playing a background stream on startup, even if it was enabled last time. --- src/core/backgroundstreams.cpp | 14 ++++++-------- src/core/backgroundstreams.h | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/core/backgroundstreams.cpp b/src/core/backgroundstreams.cpp index cbb9641a3..347b95908 100644 --- a/src/core/backgroundstreams.cpp +++ b/src/core/backgroundstreams.cpp @@ -41,8 +41,7 @@ void BackgroundStreams::LoadStreams() { s.setArrayIndex(i); AddStream(s.value("name").toString(), s.value("url").toUrl(), - s.value("volume").toInt(), - s.value("enabled").toBool()); + s.value("volume").toInt()); } SaveStreams(); @@ -60,24 +59,23 @@ void BackgroundStreams::SaveStreams() { s.setValue("name", stream->name); s.setValue("url", stream->url); s.setValue("volume", stream->volume); - s.setValue("enabled", stream->id != -1); } s.endArray(); } void BackgroundStreams::AddStream(const QString& name, const QUrl& url, - int volume, - bool enabled) { + int volume) { + if (streams_.contains(name)) { + return; + } + Stream* s = new Stream; s->name = name; s->url = url; s->volume = volume; s->id = -1; streams_[name] = s; - if (enabled) { - PlayStream(s); - } } void BackgroundStreams::EnableStream(const QString& name, bool enable) { diff --git a/src/core/backgroundstreams.h b/src/core/backgroundstreams.h index ed581f714..942f40dfa 100644 --- a/src/core/backgroundstreams.h +++ b/src/core/backgroundstreams.h @@ -49,8 +49,7 @@ class BackgroundStreams : public QObject { QAction* action; }; - void AddStream( - const QString& name, const QUrl& url, int volume = 50, bool enabled = false); + void AddStream(const QString& name, const QUrl& url, int volume = 50); void PlayStream(Stream* stream); void StopStream(Stream* stream);