From f94f2cd03ccb37d6fe54e98b6a0f1b23f874ebf0 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 4 Dec 2010 15:11:50 +0000 Subject: [PATCH] Clean up the background streams settings page a bit, and use a different icon --- src/core/backgroundstreams.cpp | 18 +++++++-------- src/core/backgroundstreams.h | 4 ++-- src/translations/ar.po | 3 +++ src/translations/bg.po | 3 +++ src/translations/ca.po | 3 +++ src/translations/cs.po | 3 +++ src/translations/cy.po | 3 +++ src/translations/da.po | 3 +++ src/translations/de.po | 3 +++ src/translations/el.po | 3 +++ src/translations/en_CA.po | 3 +++ src/translations/en_GB.po | 3 +++ src/translations/eo.po | 3 +++ src/translations/es.po | 3 +++ src/translations/et.po | 3 +++ src/translations/fi.po | 3 +++ src/translations/fr.po | 3 +++ src/translations/gl.po | 3 +++ src/translations/hu.po | 3 +++ src/translations/it.po | 3 +++ src/translations/ja.po | 3 +++ src/translations/kk.po | 3 +++ src/translations/lt.po | 3 +++ src/translations/nb.po | 3 +++ src/translations/nl.po | 3 +++ src/translations/oc.po | 3 +++ src/translations/pl.po | 3 +++ src/translations/pt.po | 3 +++ src/translations/pt_BR.po | 3 +++ src/translations/ro.po | 3 +++ src/translations/ru.po | 3 +++ src/translations/sk.po | 3 +++ src/translations/sl.po | 3 +++ src/translations/sr.po | 3 +++ src/translations/sv.po | 3 +++ src/translations/tr.po | 3 +++ src/translations/translations.pot | 3 +++ src/translations/uk.po | 3 +++ src/translations/zh_CN.po | 3 +++ src/translations/zh_TW.po | 3 +++ src/ui/settingsdialog.cpp | 37 +++++++++++-------------------- src/ui/settingsdialog.h | 8 +------ src/ui/settingsdialog.ui | 28 +++++++++++++++++++++-- 43 files changed, 164 insertions(+), 45 deletions(-) diff --git a/src/core/backgroundstreams.cpp b/src/core/backgroundstreams.cpp index f06fd5011..17c679f95 100644 --- a/src/core/backgroundstreams.cpp +++ b/src/core/backgroundstreams.cpp @@ -25,9 +25,8 @@ void BackgroundStreams::LoadStreams() { int version = s.value("version", 0).toInt(); if (version < kVersion) { s.setValue("version", kVersion); - // TODO: Make these robust against translations. - AddStream(tr("Hypnotoad"), QUrl(kHypnotoadUrl)); - AddStream(tr("Rain"), QUrl(kRainUrl)); + AddStream(QT_TR_NOOP("Hypnotoad"), QUrl(kHypnotoadUrl)); + AddStream(QT_TR_NOOP("Rain"), QUrl(kRainUrl)); SaveStreams(); return; } @@ -115,16 +114,15 @@ bool BackgroundStreams::IsPlaying(const QString& name) { } void BackgroundStreams::MakeItRain(bool enable) { - if (!streams_.contains(tr("Rain"))) { - AddStream(tr("Rain"), QUrl(kRainUrl)); + if (!streams_.contains("Rain")) { + AddStream("Rain", QUrl(kRainUrl)); } - EnableStream(tr("Rain"), enable); + EnableStream("Rain", enable); } void BackgroundStreams::AllGloryToTheHypnotoad(bool enable) { - if (!streams_.contains(tr("Hypnotoad"))) { - AddStream(tr("Hypnotoad"), QUrl(kHypnotoadUrl)); + if (!streams_.contains("Hypnotoad")) { + AddStream("Hypnotoad", QUrl(kHypnotoadUrl)); } - EnableStream(tr("Hypnotoad"), enable); - + EnableStream("Hypnotoad", enable); } diff --git a/src/core/backgroundstreams.h b/src/core/backgroundstreams.h index 6bbc97e4c..5e322f0e8 100644 --- a/src/core/backgroundstreams.h +++ b/src/core/backgroundstreams.h @@ -1,9 +1,9 @@ #ifndef BACKGROUNDSTREAMS_H #define BACKGROUNDSTREAMS_H -#include #include #include +#include #include #include "engines/engine_fwd.h" @@ -17,7 +17,7 @@ class BackgroundStreams : public QObject { void LoadStreams(); void SaveStreams(); - QList streams() const { return streams_.keys(); } + QStringList streams() const { return streams_.keys(); } void EnableStream(const QString& name, bool enable); void SetStreamVolume(const QString& name, int volume); diff --git a/src/translations/ar.po b/src/translations/ar.po index 809b65ca9..d5a4d3d73 100644 --- a/src/translations/ar.po +++ b/src/translations/ar.po @@ -2306,6 +2306,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/bg.po b/src/translations/bg.po index 57e749924..a2661ea0f 100644 --- a/src/translations/bg.po +++ b/src/translations/bg.po @@ -2310,6 +2310,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/ca.po b/src/translations/ca.po index 4a4e84a14..7baba8997 100644 --- a/src/translations/ca.po +++ b/src/translations/ca.po @@ -2348,6 +2348,9 @@ msgstr "" "Pots sentir cançons de Magnatune gratuïtament sense compte. Comprant una " "afiliació s'eliminaran els missatges al final de cada pista." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/cs.po b/src/translations/cs.po index fa1445dc3..74457615b 100644 --- a/src/translations/cs.po +++ b/src/translations/cs.po @@ -2310,6 +2310,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/cy.po b/src/translations/cy.po index a98d4d207..f622b8a85 100644 --- a/src/translations/cy.po +++ b/src/translations/cy.po @@ -2306,6 +2306,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/da.po b/src/translations/da.po index 5728a306a..93fe2564f 100644 --- a/src/translations/da.po +++ b/src/translations/da.po @@ -2313,6 +2313,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/de.po b/src/translations/de.po index d9cf5880d..71d8894d8 100644 --- a/src/translations/de.po +++ b/src/translations/de.po @@ -2357,6 +2357,9 @@ msgstr "" "Ende der einzelnen Stücke zu entfernen, müssen Sie eine Mitgliedschaft " "kaufen." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/el.po b/src/translations/el.po index e12b8f7ff..bf60bf3ea 100644 --- a/src/translations/el.po +++ b/src/translations/el.po @@ -2370,6 +2370,9 @@ msgstr "" "Μπορείτε να ακούσετε τραγούδια δωρεάν από το Magnatune χωρίς λογαριασμό. Η " "αγορά μιας συνδρομής αφαιρεί το μήνυμα από το τέλος κάθε κομματιού." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/en_CA.po b/src/translations/en_CA.po index 5e6f1f1c7..428091028 100644 --- a/src/translations/en_CA.po +++ b/src/translations/en_CA.po @@ -2311,6 +2311,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/en_GB.po b/src/translations/en_GB.po index e80e51970..b1a2b6adb 100644 --- a/src/translations/en_GB.po +++ b/src/translations/en_GB.po @@ -2308,6 +2308,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/eo.po b/src/translations/eo.po index 5dd7759b2..06702f5d5 100644 --- a/src/translations/eo.po +++ b/src/translations/eo.po @@ -2306,6 +2306,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/es.po b/src/translations/es.po index bd43585cf..e1c82981f 100644 --- a/src/translations/es.po +++ b/src/translations/es.po @@ -2365,6 +2365,9 @@ msgstr "" "Puede escuchar canciones de Magnatune gratis sin la necesidad de una cuenta. " "Comprar una cuenta elimina el mensaje al final de cada canción." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/et.po b/src/translations/et.po index 8a4b843b2..bd205ea4d 100644 --- a/src/translations/et.po +++ b/src/translations/et.po @@ -2308,6 +2308,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/fi.po b/src/translations/fi.po index 0c327fa21..c584b176e 100644 --- a/src/translations/fi.po +++ b/src/translations/fi.po @@ -2308,6 +2308,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/fr.po b/src/translations/fr.po index 2a942ab81..4aadd5292 100644 --- a/src/translations/fr.po +++ b/src/translations/fr.po @@ -2370,6 +2370,9 @@ msgstr "" "Vous pouvez écouter gratuitement les chansons de Magnatune sans avoir un " "compte. L'achat d'un abonnement supprime le message à la fin de chaque piste." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/gl.po b/src/translations/gl.po index 522a121f7..a408d8658 100644 --- a/src/translations/gl.po +++ b/src/translations/gl.po @@ -2312,6 +2312,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/hu.po b/src/translations/hu.po index a5fb3770d..c87b01944 100644 --- a/src/translations/hu.po +++ b/src/translations/hu.po @@ -2356,6 +2356,9 @@ msgstr "" "Hallgathat Magnatune számokat ingyen, előfizetés nélkül. Előfizetés " "vásárlása esetén a számvégi üzenetek eltávolításra kerülnek." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/it.po b/src/translations/it.po index 3d182eb9f..0c43af083 100644 --- a/src/translations/it.po +++ b/src/translations/it.po @@ -2371,6 +2371,9 @@ msgstr "" "Il versamento della quota d'iscrizione rimuove i messaggi alla fine di ogni " "traccia." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/ja.po b/src/translations/ja.po index 95989e1eb..362d83735 100644 --- a/src/translations/ja.po +++ b/src/translations/ja.po @@ -2344,6 +2344,9 @@ msgstr "" "Magnatune の曲はアカウントなしで無料で聴取できます。メンバーシップを購入する" "とトラックの最後のメッセージを削除できます。" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/kk.po b/src/translations/kk.po index 6a18988a5..926478f19 100644 --- a/src/translations/kk.po +++ b/src/translations/kk.po @@ -2308,6 +2308,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/lt.po b/src/translations/lt.po index f9871b9aa..606fe5824 100644 --- a/src/translations/lt.po +++ b/src/translations/lt.po @@ -2306,6 +2306,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/nb.po b/src/translations/nb.po index cd7ea814b..79a7ad442 100644 --- a/src/translations/nb.po +++ b/src/translations/nb.po @@ -2321,6 +2321,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/nl.po b/src/translations/nl.po index 0120ee7a0..b1b1c2b0c 100644 --- a/src/translations/nl.po +++ b/src/translations/nl.po @@ -2361,6 +2361,9 @@ msgstr "" "U kunt zonder account gratis naar Magnatunes nummers luisteren. Bij " "lidmaatschap worden de berichten aan aan het eind van elk nummer verwijderd." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/oc.po b/src/translations/oc.po index 7cadd93b8..8dc74eb5b 100644 --- a/src/translations/oc.po +++ b/src/translations/oc.po @@ -2306,6 +2306,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/pl.po b/src/translations/pl.po index c390dc21b..79f67333f 100644 --- a/src/translations/pl.po +++ b/src/translations/pl.po @@ -2350,6 +2350,9 @@ msgstr "" "Możesz słuchać utworów z Magnatune za darmo nie posiadając konta. Opłacenie " "członkostwa usuwa komunikaty na końcu każdej ścieżki." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/pt.po b/src/translations/pt.po index b0e32393e..395a0da24 100644 --- a/src/translations/pt.po +++ b/src/translations/pt.po @@ -2362,6 +2362,9 @@ msgstr "" "Você pode ouvir as músicas Magnatune sem possuir uma conta. Se aderir ao " "serviço, a mensagem no final de cada faixa será removida." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/pt_BR.po b/src/translations/pt_BR.po index 577cdd5e0..92cd65617 100644 --- a/src/translations/pt_BR.po +++ b/src/translations/pt_BR.po @@ -2327,6 +2327,9 @@ msgstr "" "Você pode ouvir as músicas do Magnatune de graça, sem uma conta. Comprando " "uma assinatura as mensagens no final de cada faixa serão removidas." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/ro.po b/src/translations/ro.po index 27399875d..20facf5f7 100644 --- a/src/translations/ro.po +++ b/src/translations/ro.po @@ -2307,6 +2307,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/ru.po b/src/translations/ru.po index 9dc8ade50..fee2ae16d 100644 --- a/src/translations/ru.po +++ b/src/translations/ru.po @@ -2345,6 +2345,9 @@ msgstr "" "Вы можете слушать песни с Magnatune свободно без регистрации. Регистрация " "убирает сообщения в конце каждой композиции." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/sk.po b/src/translations/sk.po index c38737a3e..ebd75d171 100644 --- a/src/translations/sk.po +++ b/src/translations/sk.po @@ -2348,6 +2348,9 @@ msgstr "" "Môžte zadarmo počúvať Magnatune piesne bez účtu. Zakúpenie členstva odstráni " "správy na konci každej skladby." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/sl.po b/src/translations/sl.po index 21c99d4e1..28e0ab4f5 100644 --- a/src/translations/sl.po +++ b/src/translations/sl.po @@ -2349,6 +2349,9 @@ msgstr "" "Skladbe iz Magnatune lahko poslušate brezplačno tudi brez računa. Če plačate " "članstvo, bodo sporočila na koncu skladb odstranjena." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/sr.po b/src/translations/sr.po index 174100ae7..00a18fde5 100644 --- a/src/translations/sr.po +++ b/src/translations/sr.po @@ -2313,6 +2313,9 @@ msgstr "" "Можете бесплатно слушати песеме на Магнатјуну без регистровања налога. " "Куповином чланства ослободићете се порука на крају сваке нумере." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/sv.po b/src/translations/sv.po index 22eaddf17..3aa4a85d2 100644 --- a/src/translations/sv.po +++ b/src/translations/sv.po @@ -2347,6 +2347,9 @@ msgstr "" "Du kan lyssna på Magnatune-låtar gratis utan ett konto. Köp av ett " "medlemskap tar bort meddelandena i slutet av varje spår." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/tr.po b/src/translations/tr.po index 6f612d321..e5bbfb8d5 100644 --- a/src/translations/tr.po +++ b/src/translations/tr.po @@ -2339,6 +2339,9 @@ msgstr "" "dinleyebilirsiniz. Üyelik alırsanız her şarkının sonunda görünen bu mesajı " "kaldırabilirsiniz." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/translations.pot b/src/translations/translations.pot index fde2c1fac..2c8e62d73 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -2296,6 +2296,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/uk.po b/src/translations/uk.po index a9476092c..c84f9be80 100644 --- a/src/translations/uk.po +++ b/src/translations/uk.po @@ -2343,6 +2343,9 @@ msgstr "" "Ви можете прослухати композиції з Magnatune безкоштовно і без реєстрації. " "Набуття членства дає змогу вилучати повідомлення в кінці кожної композиції." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/zh_CN.po b/src/translations/zh_CN.po index b5a2c6961..0eedebc14 100644 --- a/src/translations/zh_CN.po +++ b/src/translations/zh_CN.po @@ -2308,6 +2308,9 @@ msgid "" "membership removes the messages at the end of each track." msgstr "" +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/translations/zh_TW.po b/src/translations/zh_TW.po index 492e7264f..1289599aa 100644 --- a/src/translations/zh_TW.po +++ b/src/translations/zh_TW.po @@ -2313,6 +2313,9 @@ msgstr "" "你可以免費聽Magnatune歌曲,而不需要一個帳戶.而當你購買成為會員時,每首歌曲後的" "廣告訊息將刪除." +msgid "You can listen to background streams at the same time as other music." +msgstr "" + msgid "" "You can scrobble tracks for free, but only paid subscribers can stream Last.fm radio from Clementine." diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index dde685d7d..59018fabb 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -46,43 +46,39 @@ #include void SettingsDialog::AddStream(const QString& name) { - QGroupBox* box = new QGroupBox(name, streams_page_); + QGroupBox* box = new QGroupBox(tr(name.toUtf8())); QSlider* slider = new QSlider(Qt::Horizontal, box); QCheckBox* check = new QCheckBox(box); QHBoxLayout* layout = new QHBoxLayout(box); layout->addWidget(slider); layout->addWidget(check); - streams_layout_->addWidget(box); + QVBoxLayout* streams_layout = qobject_cast( + ui_->streams_page->layout()); + streams_layout->insertWidget(streams_layout->count() - 1, box); - sliders_[slider] = name; - checkboxes_[check] = name; + slider->setProperty("stream_name", name); + check->setProperty("stream_name", name); connect(slider, SIGNAL(valueChanged(int)), SLOT(StreamVolumeChanged(int))); - connect(check, SIGNAL(stateChanged(int)), SLOT(EnableStream(int))); + connect(check, SIGNAL(toggled(bool)), SLOT(EnableStream(bool))); slider->setValue(streams_->GetStreamVolume(name)); check->setCheckState(streams_->IsPlaying(name) ? Qt::Checked : Qt::Unchecked); } -void SettingsDialog::EnableStream(int state) { - QCheckBox* check = qobject_cast(sender()); - Q_ASSERT(check); - const QString& name = checkboxes_[check]; - streams_->EnableStream(name, state == Qt::Checked ? true : false); +void SettingsDialog::EnableStream(bool enabled) { + const QString name = sender()->property("stream_name").toString(); + streams_->EnableStream(name, enabled); } void SettingsDialog::StreamVolumeChanged(int value) { - QSlider* slider = qobject_cast(sender()); - Q_ASSERT(slider); - - const QString& name = sliders_[slider]; + const QString name = sender()->property("stream_name").toString(); streams_->SetStreamVolume(name, value); } void SettingsDialog::AddStreams() { - const QList& streams = streams_->streams(); - foreach (const QString& name, streams) { + foreach (const QString& name, streams_->streams()) { AddStream(name); } } @@ -91,8 +87,6 @@ SettingsDialog::SettingsDialog(BackgroundStreams* streams, QWidget* parent) : QDialog(parent), gst_engine_(NULL), ui_(new Ui_SettingsDialog), - streams_page_(new QWidget(this)), - streams_layout_(new QVBoxLayout(streams_page_)), loading_settings_(false), pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable)), streams_(streams) @@ -107,14 +101,9 @@ SettingsDialog::SettingsDialog(BackgroundStreams* streams, QWidget* parent) ui_->list->item(Page_GlobalShortcuts)->setIcon(IconLoader::Load("input-keyboard")); ui_->list->item(Page_Notifications)->setIcon(IconLoader::Load("help-hint")); ui_->list->item(Page_Library)->setIcon(IconLoader::Load("folder-sound")); - ui_->list->item(Page_BackgroundStreams)->setIcon(IconLoader::Load("folder-sound")); - - streams_page_->setObjectName(QString::fromUtf8("streams_page")); - streams_layout_->setObjectName(QString::fromUtf8("streams_layout")); + ui_->list->item(Page_BackgroundStreams)->setIcon(QIcon(":/icons/32x32/weather-showers-scattered.png")); AddStreams(); - streams_layout_->addStretch(1); - ui_->stacked_widget->addWidget(streams_page_); #ifdef ENABLE_WIIMOTEDEV // Wiimotedev page diff --git a/src/ui/settingsdialog.h b/src/ui/settingsdialog.h index b7686255a..d96c775aa 100644 --- a/src/ui/settingsdialog.h +++ b/src/ui/settingsdialog.h @@ -101,7 +101,7 @@ class SettingsDialog : public QDialog { void SongInfoFontSizeChanged(double value); // Background streams. - void EnableStream(int state); + void EnableStream(bool enabled); void StreamVolumeChanged(int value); private: @@ -111,18 +111,12 @@ class SettingsDialog : public QDialog { const GstEngine* gst_engine_; Ui_SettingsDialog* ui_; - QWidget* streams_page_; - QBoxLayout* streams_layout_; - bool loading_settings_; OSDPretty* pretty_popup_; QMap language_map_; - QMap sliders_; - QMap checkboxes_; - BackgroundStreams* streams_; #ifdef ENABLE_WIIMOTEDEV diff --git a/src/ui/settingsdialog.ui b/src/ui/settingsdialog.ui index 3745191a1..8285c1ef6 100644 --- a/src/ui/settingsdialog.ui +++ b/src/ui/settingsdialog.ui @@ -124,7 +124,7 @@ - 2 + 8 @@ -366,7 +366,7 @@ - true + false ms @@ -796,6 +796,30 @@ + + + + + + You can listen to background streams at the same time as other music. + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + +