From 678e6b1e2c664dbfa9e24b35dcf11a03f3074a02 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen <christiaan.janssen@nokia.com> Date: Fri, 22 Jul 2011 15:26:40 +0200 Subject: [PATCH] QmlProfiler: show warning when no executable given Task-number: QTCREATORBUG-5266 Change-Id: If1639e322f4ab0d7065e3394129c6649f17e98c9 Reviewed-on: http://codereview.qt.nokia.com/2039 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com> --- .../qmlprofiler/localqmlprofilerrunner.h | 2 ++ src/plugins/qmlprofiler/qmlprofilerengine.cpp | 21 +++++++++++++++++++ src/plugins/qmlprofiler/qmlprofilerengine.h | 1 + 3 files changed, 24 insertions(+) diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.h b/src/plugins/qmlprofiler/localqmlprofilerrunner.h index 2a8b7031b24..b4d45d4ca33 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.h +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.h @@ -62,6 +62,8 @@ public: virtual void stop(); virtual int debugPort() const; + bool hasExecutable() const { return !m_configuration.executable.isEmpty(); } + private slots: void spontaneousStop(int exitCode); diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 8b4d72edd3c..c4324f1d5ca 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -150,12 +150,20 @@ void QmlProfilerEngine::start() qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration())) { if (rc->observerPath().isEmpty()) { QmlProjectManager::QmlProjectPlugin::showQmlObserverToolWarning(); + AnalyzerManager::stopTool(); return; } } d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this); + if (LocalQmlProfilerRunner *qmlRunner = qobject_cast<LocalQmlProfilerRunner *>(d->m_runner)) { + if (!qmlRunner->hasExecutable()) { + showNoExecutableWarning(); + AnalyzerManager::stopTool(); + return; + } + } connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped())); connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), @@ -292,5 +300,18 @@ void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button) } } +void QmlProfilerEngine::showNoExecutableWarning() +{ + 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->setStandardButtons(QMessageBox::Ok); + noExecWarning->setDefaultButton(QMessageBox::Ok); + noExecWarning->setModal(false); + noExecWarning->show(); +} + } // namespace Internal } // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h index 02dceaf8e2e..48b3457ed5d 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.h +++ b/src/plugins/qmlprofiler/qmlprofilerengine.h @@ -48,6 +48,7 @@ public: ProjectExplorer::RunConfiguration *runConfiguration); ~QmlProfilerEngine(); + static void showNoExecutableWarning(); signals: void processRunning(int port); void stopRecording(); -- GitLab