X-Git-Url: http://git.maemo.org/git/?p=yandex-traffic;a=blobdiff_plain;f=settingsDialog.cpp;h=77ff7eb74eb35a39ec0a51a9546d7b0389394cb0;hp=629bcb832e6a9fe6b39558828aea8cc630173494;hb=1bdbc2ea55ab4ae821f8cab85db4beee912e2797;hpb=5ce4c1f253dc58e9aa02a48819a57a3b1603fad3 diff --git a/settingsDialog.cpp b/settingsDialog.cpp index 629bcb8..77ff7eb 100644 --- a/settingsDialog.cpp +++ b/settingsDialog.cpp @@ -21,11 +21,13 @@ SettingsDialog::SettingsDialog (Settings *settings) QVBoxLayout *layout = new QVBoxLayout (this); _displayButton = new QMaemo5ValueButton (tr ("Display"), this); + _displayButton->setValueLayout (QMaemo5ValueButton::ValueUnderText); + updateDisplayButtonValue (); layout->addWidget (_displayButton); _updateButton = new QMaemo5ValueButton (tr ("Update"), this); + _updateButton->setValueLayout (QMaemo5ValueButton::ValueUnderText); + updateUpdateButtonValue (); layout->addWidget (_updateButton); - _alertsButton = new QMaemo5ValueButton (tr ("Alerts"), this); - layout->addWidget (_alertsButton); connect (_displayButton, SIGNAL (clicked ()), SLOT (displayClicked ())); connect (_updateButton, SIGNAL (clicked ()), SLOT (updateClicked ())); @@ -36,6 +38,7 @@ void SettingsDialog::displayClicked () { DisplaySettingsDialog dlg (_settings); dlg.exec (); + updateDisplayButtonValue (); } @@ -43,6 +46,43 @@ void SettingsDialog::updateClicked () { UpdateSettingsDialog dlg (_settings); dlg.exec (); + updateUpdateButtonValue (); +} + + +void SettingsDialog::updateDisplayButtonValue () +{ + QString val; + QStringList list; + + val = tr ("City: ") + _settings->cities ()[_settings->regionID ()] + ", " + tr ("Data: "); + + if (_settings->check (Settings::C_ShowLight)) + list.append (tr ("lights")); + if (_settings->check (Settings::C_ShowRank)) + list.append (tr ("rank")); + if (_settings->check (Settings::C_ShowTime)) + list.append (tr ("time")); + if (_settings->check (Settings::C_ShowHint)) + list.append (tr ("hint")); + + _displayButton->setValueText (val + list.join (", ")); +} + + +void SettingsDialog::updateUpdateButtonValue () +{ + QStringList list, intervals = _settings->updateIntervals (); + QString val; + + val = tr ("Interval: ") + intervals[_settings->getUpdateIntervalIndex ()] + ", " + tr ("Update via: "); + + if (_settings->check (Settings::C_UpdateOnWiFi)) + list.append (tr ("WiFi")); + if (_settings->check (Settings::C_UpdateOnGSM)) + list.append (tr ("GSM")); + + _updateButton->setValueText (val + list.join (", ")); } @@ -162,15 +202,18 @@ UpdateSettingsDialog::UpdateSettingsDialog (Settings *_settings) { setWindowTitle (tr ("Update settings")); - _wifiUpdate = new QCheckBox (tr ("Update on WiFi connection"), this); + _wifiUpdate = new QCheckBox (tr ("Update via WiFi"), this); _wifiUpdate->setChecked (settings ()->check (Settings::C_UpdateOnWiFi)); - _gsmUpdate = new QCheckBox (tr ("Update on GSM connection"), this); + _gsmUpdate = new QCheckBox (tr ("Update via GSM"), this); _gsmUpdate->setChecked (settings ()->check (Settings::C_UpdateOnGSM)); + _lockedUpdate = new QCheckBox (tr ("Update when device locked"), this); + _lockedUpdate->setChecked (settings ()->check (Settings::C_UpdateWhenLocked)); initUpdateInterval (layout ()); layout ()->addWidget (_wifiUpdate); layout ()->addWidget (_gsmUpdate); + layout ()->addWidget (_lockedUpdate); } @@ -184,6 +227,7 @@ void UpdateSettingsDialog::saveSettings () #endif settings ()->setCheck (Settings::C_UpdateOnWiFi, _wifiUpdate->isChecked ()); settings ()->setCheck (Settings::C_UpdateOnGSM, _gsmUpdate->isChecked ()); + settings ()->setCheck (Settings::C_UpdateWhenLocked, _lockedUpdate->isChecked ()); }