X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fsettingsform.cpp;h=a922f326665806c8e937347898bd83eecbce6c02;hb=34d1d49dbf3d57d14b2df6ca511613a08443f4ec;hp=dde85efd98d659192609037aede8b58beba463bf;hpb=1447251be3f6cffa5ef38f9236ef5e861d41f106;p=someplayer diff --git a/src/settingsform.cpp b/src/settingsform.cpp index dde85ef..a922f32 100644 --- a/src/settingsform.cpp +++ b/src/settingsform.cpp @@ -23,6 +23,7 @@ #include #include #include "someplayer.h" +#include "fmtxsettingsdialog.h" using namespace SomePlayer::Storage; @@ -46,6 +47,12 @@ SettingsForm::SettingsForm(QWidget *parent) : ui->gradientYButton->setChecked(true); ui->engLangButton->setChecked(true); ui->cBlueButton->setChecked(true); + ui->pauseHPNoButton->setChecked(true); + ui->hwKeysBox->setChecked(false); + ui->hwkeysLabel->setEnabled(false); + ui->hwTControlButton->setEnabled(false); + ui->hwVolumeButton->setEnabled(false); + ui->fmtxGroupBox->setChecked(false); if (albumSorting == "alphabet") { ui->albumsSortAButton->setChecked(true); } @@ -81,6 +88,28 @@ SettingsForm::SettingsForm(QWidget *parent) : } else if (track_color == "light") { ui->cLightButton->setChecked(true); } + if (config.getValue("hw/hpautopause").toString() == "yes") { + ui->pauseHPYesButton->setChecked(true); + } + if (config.getValue("hw/zoomkeys").toString() == "enabled") { + ui->hwKeysBox->setChecked(true); + ui->hwkeysLabel->setEnabled(true); + ui->hwTControlButton->setEnabled(true); + ui->hwVolumeButton->setEnabled(true); + } + QString behavior = config.getValue("hw/zoom_action").toString(); + if (behavior == "volume") { + ui->hwVolumeButton->setChecked(true); + } else if (behavior == "track") { + ui->hwTControlButton->setChecked(true); + } else { + ui->hwVolumeButton->setChecked(true); + config.setValue("hw/zoom_action", "volume"); + } + if (config.getValue("fmtx/enabled").toString() == "yes") { + ui->fmtxGroupBox->setChecked(true); + emit fmtxSettingsChanged(); + } if (!QFile::exists(QString(_APPLICATION_PATH_)+"/someplayer_ru.qm")) { ui->langBox->hide(); } // refactor this when more translations will be added @@ -105,6 +134,17 @@ 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))); + connect (ui->hwKeysBox, SIGNAL(toggled(bool)), this, SLOT(_toggle_hw_settings(bool))); + connect (ui->hwVolumeButton, SIGNAL(toggled(bool)), this, SLOT(_set_hw_volume_control(bool))); + connect (ui->hwTControlButton, SIGNAL(toggled(bool)), this, SLOT(_set_hw_track_control(bool))); + connect (ui->uiButton, SIGNAL(clicked()), this, SLOT(_toggle_view_ui())); + connect (ui->hwButton, SIGNAL(clicked()), this, SLOT(_toggle_view_hw())); + connect (ui->libraryButton, SIGNAL(clicked()), this, SLOT(_toggle_view_lib())); + connect (ui->fmtxSettingsButton, SIGNAL(clicked()), this, SLOT(_open_fmtx_settings())); + connect (ui->fmtxGroupBox, SIGNAL(toggled(bool)), this, SLOT(_toggle_fmtx_settings(bool))); + _toggle_view_ui(); setAttribute(Qt::WA_Maemo5StackedWindow); setWindowFlags(Qt::Window | windowFlags()); } @@ -261,6 +301,60 @@ void SettingsForm::_set_lang_ru(bool checked) { emit translationChanged(); } +void SettingsForm::_set_pause_hp_no(bool checked) { + if (!checked) return; + Config config; + config.setValue("hw/hpautopause", "no"); +} + +void SettingsForm::_set_pause_hp_yes(bool checked) { + if (!checked) return; + Config config; + config.setValue("hw/hpautopause", "yes"); +} + +void SettingsForm::_toggle_hw_settings(bool checked) { + Config config; + config.setValue("hw/zoomkeys", checked ? "enabled" : "disabled"); + ui->hwkeysLabel->setEnabled(checked); + ui->hwTControlButton->setEnabled(checked); + ui->hwVolumeButton->setEnabled(checked); + emit hwZoomPolicyChanged(); +} + +void SettingsForm::_set_hw_track_control(bool checked) { + if (!checked) return; + Config config; + config.setValue("hw/zoom_action", "track"); +} + +void SettingsForm::_set_hw_volume_control(bool checked) { + if (!checked) return; + Config config; + config.setValue("hw/zoom_action", "volume"); +} + +void SettingsForm::_toggle_view_ui() { + ui->hwButton->setChecked(false); + ui->libraryButton->setChecked(false); + ui->uiButton->setChecked(true); + ui->stackedWidget->setCurrentIndex(0); +} + +void SettingsForm::_toggle_view_lib() { + ui->hwButton->setChecked(false); + ui->uiButton->setChecked(false); + ui->libraryButton->setChecked(true); + ui->stackedWidget->setCurrentIndex(1); +} + +void SettingsForm::_toggle_view_hw() { + ui->uiButton->setChecked(false); + ui->libraryButton->setChecked(false); + ui->hwButton->setChecked(true); + ui->stackedWidget->setCurrentIndex(2); +} + void SettingsForm::updateTranslations() { ui->retranslateUi(this); } @@ -316,3 +410,18 @@ void SettingsForm::portraitMode() { ui->orientationGridLayout->addWidget(ui->orientationAButton, 0, 1); ui->orientationGridLayout->addWidget(ui->orientationPButton, 1, 0, 1, 2); } + +void SettingsForm::_open_fmtx_settings() { + FmtxSettingsDialog dialog(this); + dialog.exec(); + Config config; + config.setValue("fmtx/station_name", dialog.stationName()); + config.setValue("fmtx/frequency", dialog.frequency()); + emit fmtxSettingsChanged(); +} + +void SettingsForm::_toggle_fmtx_settings(bool checked) { + Config config; + config.setValue("fmtx/enabled", checked ? "yes" : "no"); + emit fmtxSettingsChanged(); +}