diff --git a/localization/rssguard_cs.ts b/localization/rssguard_cs.ts index 5c63a4003..7b78bb4f2 100644 --- a/localization/rssguard_cs.ts +++ b/localization/rssguard_cs.ts @@ -444,7 +444,7 @@ Launch RSS Guard on operating system startup - Spouštět RSS Guard při spuštěníí operačního systému + Spouštět RSS Guard při spuštění operačního systému Icons && skins diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp index d119e3791..5ec93cae8 100644 --- a/src/gui/formsettings.cpp +++ b/src/gui/formsettings.cpp @@ -142,6 +142,31 @@ bool FormSettings::doSaveCheck() { return everything_ok; } +void FormSettings::promptForRestart() { + if (m_changedDataTexts.count() > 0) { + QMessageBox msg_question(this); + + msg_question.setText(tr("Some critical settings were changed and will be applied after the application gets restarted.")); + msg_question.setInformativeText(tr("Do you want to restart now?")); + msg_question.setWindowTitle(tr("Critical settings were changed")); + msg_question.setDetailedText(tr("List of changes:\n %1.").arg(m_changedDataTexts.join(",\n"))); + msg_question.setIcon(QMessageBox::Question); + msg_question.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msg_question.setDefaultButton(QMessageBox::Yes); + + if (msg_question.exec() == QMessageBox::Yes) { + if (!QProcess::startDetached(qApp->applicationFilePath())) { + QMessageBox::warning(this, + tr("Problem with application restart"), + tr("Application couldn't be restarted. Please, restart it manually for changes to take effect.")); + } + else { + qApp->quit(); + } + } + } +} + void FormSettings::saveSettings() { // Make sure everything is saveable. if (!doSaveCheck()) { @@ -157,6 +182,7 @@ void FormSettings::saveSettings() { saveLanguage(); Settings::getInstance()->checkSettings(); + promptForRestart(); accept(); } @@ -289,26 +315,8 @@ void FormSettings::saveLanguage() { QString new_lang = m_ui->m_treeLanguages->currentItem()->text(1); if (new_lang != actual_lang) { + m_changedDataTexts.append(tr("• language changed")); settings->setValue(APP_CFG_GEN, "language", new_lang); - - QMessageBox msg_question(this); - msg_question.setText(tr("Language of RSS Guard was changed. Note that changes will take effect on next Qonverter start.")); - msg_question.setInformativeText(tr("Do you want to restart now?")); - msg_question.setWindowTitle(tr("Language changed")); - msg_question.setIcon(QMessageBox::Question); - msg_question.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msg_question.setDefaultButton(QMessageBox::Yes); - - if (msg_question.exec() == QMessageBox::Yes) { - if (!QProcess::startDetached(qApp->applicationFilePath())) { - QMessageBox::warning(this, - tr("Problem with RSS Guard restart"), - tr("RSS Guard couldn't be restarted, please restart it manually for changes to take effect.")); - } - else { - qApp->quit(); - } - } } } @@ -428,6 +436,7 @@ void FormSettings::loadInterface() { m_ui->m_treeSkins->addTopLevelItem(new_item); if (skin.m_baseName == selected_skin) { + m_initialSettings.m_skin = selected_skin; m_ui->m_treeSkins->setCurrentItem(new_item); m_ui->m_lblActiveContents->setText(skin.m_visibleName); } diff --git a/src/gui/formsettings.h b/src/gui/formsettings.h index ff6a6c8e6..646d60ed3 100644 --- a/src/gui/formsettings.h +++ b/src/gui/formsettings.h @@ -12,7 +12,17 @@ namespace Ui { // Structure holding some initial values. struct TemporarySettings { + + public: + TemporarySettings() + : m_webBrowserProgress(QColor()), + m_skin(QString()) { + } + QColor m_webBrowserProgress; + QString m_skin; + + }; class FormSettings : public QDialog { @@ -28,6 +38,9 @@ class FormSettings : public QDialog { bool doSaveCheck(); protected slots: + // Displays "restart" dialog if some critical settings changed. + void promptForRestart(); + // Saves settings into global configuration. void saveSettings(); @@ -57,6 +70,7 @@ class FormSettings : public QDialog { private: Ui::FormSettings *m_ui; TemporarySettings m_initialSettings; + QStringList m_changedDataTexts; }; #endif // FORMSETTINGS_H