OSDN Git Service

L10n: tr()-fixes.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Tue, 15 Mar 2011 13:18:41 +0000 (14:18 +0100)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>
Tue, 15 Mar 2011 13:18:41 +0000 (14:18 +0100)
Use standard checkable message box in analyzer.

src/plugins/analyzerbase/analyzermanager.cpp
src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp

index c2e71f1..2e72046 100644 (file)
@@ -70,6 +70,7 @@
 #include <utils/fancymainwindow.h>
 #include <utils/styledbar.h>
 #include <utils/qtcassert.h>
+#include <utils/checkablemessagebox.h>
 
 #include <cmakeprojectmanager/cmakeprojectconstants.h>
 #include <qt4projectmanager/qt4projectmanagerconstants.h>
@@ -90,6 +91,7 @@
 #include <QtGui/QLabel>
 #include <QtGui/QCheckBox>
 #include <QtGui/QDialogButtonBox>
+#include <QtGui/QMainWindow>
 
 using namespace Core;
 using namespace Analyzer;
@@ -464,38 +466,25 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
         const QString currentMode = buildType == ProjectExplorer::BuildConfiguration::Debug ? tr("Debug") : tr("Release");
 
         QSettings *settings = Core::ICore::instance()->settings();
-        const QString configKey = QString("%1/%2").arg(Constants::MODE_ANALYZE, "AnalyzeCorrectMode");
+        const QString configKey = QLatin1String(Constants::MODE_ANALYZE) + QLatin1Char('/') + QLatin1String("AnalyzeCorrectMode");
         int ret;
         if (settings->contains(configKey)) {
             ret = settings->value(configKey, QDialog::Accepted).toInt();
         } else {
-            QDialog dialog;
-            dialog.setWindowTitle(tr("Run %1 in %2 mode?").arg(toolName).arg(currentMode));
-            QGridLayout *layout = new QGridLayout;
-            QLabel *iconLabel = new QLabel;
-            iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-            QIcon icon = dialog.style()->standardIcon(QStyle::SP_MessageBoxInformation);
-            dialog.setWindowIcon(icon);
-            iconLabel->setPixmap(icon.pixmap(QSize(icon.actualSize(QSize(64, 64)))));
-            layout->addWidget(iconLabel, 0, 0);
-            QLabel *textLabel = new QLabel;
-            textLabel->setWordWrap(true);
-            textLabel->setText(tr("You are trying to run %1 on an application in %2 mode. "
-                                "%1 is designed to be used in %3 mode.\n\n"
-                                "Do you want to continue and run %1 in %2 mode?").arg(toolName).arg(currentMode).arg(toolMode));
-            layout->addWidget(textLabel, 0, 1);
-            QCheckBox *dontAskAgain = new QCheckBox;
-            dontAskAgain->setText(tr("&Do not ask again"));
-            layout->addWidget(dontAskAgain, 1, 0, 1, 2);
-            QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::Cancel);
-            connect(buttons, SIGNAL(accepted()),
-                    &dialog, SLOT(accept()));
-            connect(buttons, SIGNAL(rejected()),
-                    &dialog, SLOT(reject()));
-            layout->addWidget(buttons, 2, 0, 1, 2);
-            dialog.setLayout(layout);
-            ret = dialog.exec();
-            if (dontAskAgain->isChecked() && ret == QDialog::Accepted)
+            const QString title = tr("Run %1 in %2 Mode?").arg(toolName).arg(currentMode);
+            const QString message = tr("<html><head/><body><p>You are trying to run the tool '%1' on an application in %2 mode. "
+                                       "The tool is designed to be used in %3 mode.</p><p>"
+                                       "Do you want to continue and run it in %2 mode?</p></body></html>").
+                                       arg(toolName).arg(currentMode).arg(toolMode);
+            const QString checkBoxText = tr("&Do not ask again");
+            bool checkBoxSetting = false;
+            const QDialogButtonBox::StandardButton button =
+                Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(), title, message, checkBoxText,
+                                                     &checkBoxSetting, QDialogButtonBox::Yes|QDialogButtonBox::Cancel,
+                                                     QDialogButtonBox::Cancel);
+            ret = button == QDialogButtonBox::Yes ? QDialog::Accepted : QDialog::Rejected;
+
+            if (checkBoxSetting && ret == QDialog::Accepted)
                 settings->setValue(configKey, ret);
         }
         if (ret == QDialog::Rejected)
index 1b776d7..68a1cb6 100644 (file)
@@ -570,10 +570,10 @@ void S60DeployStep::handleSymbianInstall(const Coda::CodaCommandResult &result)
         else
             initFileInstallation();
     } else {
-        reportError(tr("Installation failed: %1, "
-                       "Explanation of error codes is available at: %2")
-                    .arg(result.errorString())
-                    .arg(QLatin1String("http://wiki.forum.nokia.com/index.php/Symbian_OS_Error_Codes")));
+        reportError(tr("Installation failed: %1; "
+                       "see %2 for descriptions of the error codes")
+                    .arg(result.errorString(),
+                         QLatin1String("http://wiki.forum.nokia.com/index.php/Symbian_OS_Error_Codes")));
     }
 }