From 01b5d1c91995a9f7f6d73f4f6f9b63acebb2781a Mon Sep 17 00:00:00 2001 From: Gres Date: Sun, 18 Oct 2015 12:19:32 +0300 Subject: [PATCH] Edit update settings. --- Settings.h | 4 ++ SettingsEditor.cpp | 6 +++ SettingsEditor.h | 1 + SettingsEditor.ui | 108 +++++++++++++++++++++++++++++++++------------ 4 files changed, 92 insertions(+), 27 deletions(-) diff --git a/Settings.h b/Settings.h index 0c705a3..223503a 100644 --- a/Settings.h +++ b/Settings.h @@ -18,6 +18,8 @@ namespace settings_names { const QString proxyUser = "proxyUser"; const QString proxyPassword = "proxyPassword"; const QString proxySavePassword = "proxySavePassword"; + const QString autoUpdateType = "autoUpdateType"; + const QString lastUpdateCheck = "lastUpdateCheck"; //! Recognition const QString recogntionGroup = "Recognition"; @@ -51,6 +53,8 @@ namespace settings_values { const QString proxyUser = ""; const QString proxyPassword = ""; const bool proxySavePassword = false; + const int autoUpdateType = 0; //Never + const QString lastUpdateCheck = ""; //! Recognition const QString tessDataPlace = "./"; diff --git a/SettingsEditor.cpp b/SettingsEditor.cpp index 5537196..72b75c7 100644 --- a/SettingsEditor.cpp +++ b/SettingsEditor.cpp @@ -23,6 +23,10 @@ SettingsEditor::SettingsEditor (const LanguageHelper &dictionary, QWidget *paren buttonGroup_->addButton (ui->trayRadio, 0); buttonGroup_->addButton (ui->dialogRadio, 1); + connect (ui->updateButton, SIGNAL (clicked (bool)), SIGNAL (updateCheckRequested ())); + QStringList updateTypes = QStringList () << tr ("Никогда") << tr ("Ежедневно") + << tr ("Еженедельно") << tr ("Ежемесячно"); + ui->updateCombo->addItems (updateTypes); connect (ui->tessdataButton, SIGNAL (clicked ()), SLOT (openTessdataDialog ())); connect (ui->tessdataEdit, SIGNAL (textChanged (const QString &)), @@ -89,6 +93,7 @@ void SettingsEditor::saveSettings () const { QNetworkProxy::setApplicationProxy (proxy); } settings.setValue (proxySavePassword, ui->proxySaveCheck->isChecked ()); + settings.setValue (autoUpdateType, ui->updateCombo->currentIndex ()); settings.endGroup (); @@ -179,6 +184,7 @@ void SettingsEditor::loadSettings () { else { ui->proxyPassEdit->setText (QNetworkProxy::applicationProxy ().password ()); } + ui->updateCombo->setCurrentIndex (GET (autoUpdateType).toInt ()); settings.endGroup (); settings.beginGroup (settings_names::recogntionGroup); diff --git a/SettingsEditor.h b/SettingsEditor.h index 6cb5796..8b6f669 100644 --- a/SettingsEditor.h +++ b/SettingsEditor.h @@ -26,6 +26,7 @@ class SettingsEditor : public QDialog { signals: void settingsEdited (); + void updateCheckRequested (); public slots: void done (int result); diff --git a/SettingsEditor.ui b/SettingsEditor.ui index cc031a3..d7a1fab 100644 --- a/SettingsEditor.ui +++ b/SettingsEditor.ui @@ -33,7 +33,7 @@ Общее - + @@ -96,32 +96,6 @@ - - - Вывод результата - - - - - - Трей - - - - - - - Окно - - - true - - - - - - - Прокси @@ -194,6 +168,86 @@ + + + + + + + 0 + 0 + + + + Вывод результата + + + + + + + 0 + 0 + + + + Трей + + + + + + + + 0 + 0 + + + + Окно + + + true + + + + + + + + + + Обновление + + + + + + Проверять обновления: + + + + + + + + + + + 0 + 0 + + + + Проверить + + + + + + + +