Clean up the background streams settings page a bit, and use a different icon

This commit is contained in:
David Sansome 2010-12-04 15:11:50 +00:00
parent b67bc3939a
commit f94f2cd03c
43 changed files with 164 additions and 45 deletions

View File

@ -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);
}

View File

@ -1,9 +1,9 @@
#ifndef BACKGROUNDSTREAMS_H
#define BACKGROUNDSTREAMS_H
#include <QList>
#include <QMap>
#include <QObject>
#include <QStringList>
#include <QUrl>
#include "engines/engine_fwd.h"
@ -17,7 +17,7 @@ class BackgroundStreams : public QObject {
void LoadStreams();
void SaveStreams();
QList<QString> 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);

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -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 <span style=\" font-weight:600;"
"\">paid subscribers</span> can stream Last.fm radio from Clementine."

View File

@ -46,43 +46,39 @@
#include <QtDebug>
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<QVBoxLayout*>(
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<QCheckBox*>(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<QSlider*>(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<QString>& 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

View File

@ -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<QString, QString> language_map_;
QMap<QSlider*, QString> sliders_;
QMap<QCheckBox*, QString> checkboxes_;
BackgroundStreams* streams_;
#ifdef ENABLE_WIIMOTEDEV

View File

@ -124,7 +124,7 @@
<item>
<widget class="QStackedWidget" name="stacked_widget">
<property name="currentIndex">
<number>2</number>
<number>8</number>
</property>
<widget class="QWidget" name="playback_page">
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -366,7 +366,7 @@
<item row="2" column="1">
<widget class="QSpinBox" name="buffer_duration">
<property name="enabled">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="suffix">
<string> ms</string>
@ -796,6 +796,30 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="streams_page">
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>You can listen to background streams at the same time as other music.</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>