OSDN Git Service

QmlProfiler: refactored warning messagebox
authorChristiaan Janssen <christiaan.janssen@nokia.com>
Fri, 22 Jul 2011 13:52:59 +0000 (15:52 +0200)
committerAurindam Jana <aurindam.jana@nokia.com>
Fri, 22 Jul 2011 13:59:36 +0000 (15:59 +0200)
Change-Id: I41e361fc2dc1cab0f103eccbb15b9c38cc78cb77
Reviewed-on: http://codereview.qt.nokia.com/2041
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
src/plugins/qmlprofiler/qmlprofilerengine.cpp
src/plugins/qmlprofiler/qmlprofilerengine.h

index c4324f1..9a3c5dc 100644 (file)
@@ -159,7 +159,7 @@ void QmlProfilerEngine::start()
 
     if (LocalQmlProfilerRunner *qmlRunner = qobject_cast<LocalQmlProfilerRunner *>(d->m_runner)) {
         if (!qmlRunner->hasExecutable()) {
-            showNoExecutableWarning();
+            showNonmodalWarning(tr("No executable file to launch."));
             AnalyzerManager::stopTool();
             return;
         }
@@ -193,15 +193,7 @@ void QmlProfilerEngine::stopped()
 {
     // user feedback
     if (d->m_running && d->m_fetchingData) {
-        Core::ICore * const core = Core::ICore::instance();
-        QMessageBox *killedWarning = new QMessageBox(core->mainWindow());
-        killedWarning->setIcon(QMessageBox::Warning);
-        killedWarning->setWindowTitle(tr("QML Profiler"));
-        killedWarning->setText(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
-        killedWarning->setStandardButtons(QMessageBox::Ok);
-        killedWarning->setDefaultButton(QMessageBox::Ok);
-        killedWarning->setModal(false);
-        killedWarning->show();
+        showNonmodalWarning(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
     }
 
     d->m_running = false;
@@ -300,13 +292,13 @@ void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button)
     }
 }
 
-void QmlProfilerEngine::showNoExecutableWarning()
+void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
 {
     Core::ICore * const core = Core::ICore::instance();
     QMessageBox *noExecWarning = new QMessageBox(core->mainWindow());
     noExecWarning->setIcon(QMessageBox::Warning);
     noExecWarning->setWindowTitle(tr("QML Profiler"));
-    noExecWarning->setText(tr("No executable file to launch."));
+    noExecWarning->setText(warningMsg);
     noExecWarning->setStandardButtons(QMessageBox::Ok);
     noExecWarning->setDefaultButton(QMessageBox::Ok);
     noExecWarning->setModal(false);
index 48b3457..8b0133b 100644 (file)
@@ -48,7 +48,7 @@ public:
         ProjectExplorer::RunConfiguration *runConfiguration);
     ~QmlProfilerEngine();
 
-    static void showNoExecutableWarning();
+    static void showNonmodalWarning(const QString &warningMsg);
 signals:
     void processRunning(int port);
     void stopRecording();