From: Nikolay Tischenko Date: Sun, 28 Nov 2010 13:48:29 +0000 (+0600) Subject: Settings for autopausing X-Git-Tag: 1.4.3-1~20 X-Git-Url: http://vcs.maemo.org/git/?p=someplayer;a=commitdiff_plain;h=0f46d45329c2ac7590c6e9ce91ee030ebe64f79b Settings for autopausing --- diff --git a/resources/someplayer_ru.ts b/resources/someplayer_ru.ts index 477fb02..198428e 100644 --- a/resources/someplayer_ru.ts +++ b/resources/someplayer_ru.ts @@ -14,12 +14,12 @@ Аудиоклипы - + Inner memory Внутренняя память - + Memory card Карта памяти @@ -187,7 +187,7 @@ Ctrl+S - + Music off: Отключение: @@ -268,45 +268,45 @@ - + Clear playlist Очистить плейлист - + Delete Удалить - - + + Add to favorites В избранное - + Enqueue В очередь - + Add to playlists Добавить в плейлисты - + Edit tags Редактировать теги - + Remove from favorites Удалить из избранного @@ -375,12 +375,14 @@ + Yes Да + No Нет @@ -484,6 +486,11 @@ Russian Русский + + + Pause when headphones unplugged: + Пауза при отключении наушников: + TimerDialog diff --git a/src/dbusadaptor.cpp b/src/dbusadaptor.cpp index 3ca01fa..8286441 100644 --- a/src/dbusadaptor.cpp +++ b/src/dbusadaptor.cpp @@ -26,6 +26,7 @@ #include #include #include +#include "config.h" /* * Implementation of adaptor class DBusAdaptop @@ -109,6 +110,10 @@ void DBusAdaptop::processBTSignal(QString event, QString state) { } else if (state == "play-cd" || state == "pause-cd") { toggle(); } else if (state == "connection") { + SomePlayer::Storage::Config config; + if (config.getValue("playback/hpautopause").toString() != "yes") { + return; + } bool present = QDBusInterface ("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/platform_headphone", "org.freedesktop.Hal.Device", diff --git a/src/settingsform.cpp b/src/settingsform.cpp index dde85ef..2d5978b 100644 --- a/src/settingsform.cpp +++ b/src/settingsform.cpp @@ -46,6 +46,7 @@ SettingsForm::SettingsForm(QWidget *parent) : ui->gradientYButton->setChecked(true); ui->engLangButton->setChecked(true); ui->cBlueButton->setChecked(true); + ui->pauseHPNoButton->setChecked(true); if (albumSorting == "alphabet") { ui->albumsSortAButton->setChecked(true); } @@ -81,6 +82,9 @@ SettingsForm::SettingsForm(QWidget *parent) : } else if (track_color == "light") { ui->cLightButton->setChecked(true); } + if (config.getValue("playback/hpautopause").toString() == "yes") { + ui->pauseHPYesButton->setChecked(true); + } if (!QFile::exists(QString(_APPLICATION_PATH_)+"/someplayer_ru.qm")) { ui->langBox->hide(); } // refactor this when more translations will be added @@ -105,6 +109,8 @@ SettingsForm::SettingsForm(QWidget *parent) : connect (ui->cRedButton, SIGNAL(toggled(bool)), this, SLOT(_set_color_red(bool))); connect (ui->cWhiteButton, SIGNAL(toggled(bool)), this, SLOT(_set_color_white(bool))); connect (ui->cYellowButton, SIGNAL(toggled(bool)), this, SLOT(_set_color_yellow(bool))); + connect (ui->pauseHPNoButton, SIGNAL(toggled(bool)), this, SLOT(_set_pause_hp_no(bool))); + connect (ui->pauseHPYesButton, SIGNAL(toggled(bool)), this, SLOT(_set_pause_hp_yes(bool))); setAttribute(Qt::WA_Maemo5StackedWindow); setWindowFlags(Qt::Window | windowFlags()); } @@ -261,6 +267,18 @@ void SettingsForm::_set_lang_ru(bool checked) { emit translationChanged(); } +void SettingsForm::_set_pause_hp_no(bool checked) { + if (!checked) return; + Config config; + config.setValue("playback/hpautopause", "no"); +} + +void SettingsForm::_set_pause_hp_yes(bool checked) { + if (!checked) return; + Config config; + config.setValue("playback/hpautopause", "yes"); +} + void SettingsForm::updateTranslations() { ui->retranslateUi(this); } diff --git a/src/settingsform.h b/src/settingsform.h index e0f3b58..1ade75d 100644 --- a/src/settingsform.h +++ b/src/settingsform.h @@ -73,6 +73,8 @@ private slots: void _set_color_black(bool); void _set_color_light(bool); void _set_color_dark(bool); + void _set_pause_hp_yes(bool); + void _set_pause_hp_no(bool); }; #endif // SETTINGSFORM_H diff --git a/src/ui/settingsform.ui b/src/ui/settingsform.ui index 4ac5d69..d434d76 100644 --- a/src/ui/settingsform.ui +++ b/src/ui/settingsform.ui @@ -32,9 +32,9 @@ 0 - -47 + -97 780 - 403 + 474 @@ -415,6 +415,40 @@ + + + + + + + + + + Pause when headphones unplugged: + + + + + + + + + Yes + + + + + + + No + + + + + + + +