From a7a2fdc95d9135de53287de21f1cce985895950f Mon Sep 17 00:00:00 2001 From: Mike Kremer Date: Tue, 18 May 2010 12:06:52 +0000 Subject: [PATCH] Added message box informaing the user that a restart will be required to change the language settings. git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9342 383ad7c9-94d9-4d36-a494-682f7c89f535 --- widgets/optionsWidget/optionsWidget.cc | 21 ++++++++++++++++++--- widgets/optionsWidget/optionsWidget.hh | 7 +++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/widgets/optionsWidget/optionsWidget.cc b/widgets/optionsWidget/optionsWidget.cc index fb907d3b..c568d61a 100644 --- a/widgets/optionsWidget/optionsWidget.cc +++ b/widgets/optionsWidget/optionsWidget.cc @@ -58,8 +58,8 @@ OptionsWidget::OptionsWidget(std::vector& _plugins, std::vector& _plugins, std::vectorsetCurrentIndex(1); else translation->setCurrentIndex(2); + + // Listen to changes... + connect(translation, SIGNAL(currentIndexChanged(int)), this, SLOT(slotTranslationIndexChanged(int))); updateVersionsTable(); @@ -657,6 +663,15 @@ void OptionsWidget::slotApply() { OpenFlipper::Options::defaultViewerLayout( viewerLayout->currentIndex() ); OpenFlipper::Options::gridVisible( gridVisible->isChecked() ); + // Show warning message that restart is required if language has been changed... + if(translationIndexChanged_) { + int restart = QMessageBox::information(this, tr("Restart required!"), + tr("The changes will take effect after next restart. Do you want to close OpenFlipper now?"), + QMessageBox::Yes | QMessageBox::No); + + if(restart == QMessageBox::Yes) emit exit(0); + } + switch ( translation->currentIndex() ){ case 0 : OpenFlipper::Options::translation("en_US"); break; case 1 : OpenFlipper::Options::translation("de_DE"); break; diff --git a/widgets/optionsWidget/optionsWidget.hh b/widgets/optionsWidget/optionsWidget.hh index bdb8cde3..641495de 100644 --- a/widgets/optionsWidget/optionsWidget.hh +++ b/widgets/optionsWidget/optionsWidget.hh @@ -208,6 +208,9 @@ private slots: // Update component of OpenFlipper void updateComponent(); + + // Tracks whether another language has been selected + void slotTranslationIndexChanged(int); private: /** After checking for updates this variable will contain a list of filenames for which updates are available @@ -221,6 +224,10 @@ private: /** Current filename of the plugin to be updated */ QString currentUpdateName_; + + /** Used to track whether another language has been selected + */ + bool translationIndexChanged_; }; -- GitLab