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>
This commit is contained in:
Christiaan Janssen
2011-07-22 15:26:40 +02:00
committed by Aurindam Jana
parent bcb2965d09
commit 678e6b1e2c
3 changed files with 24 additions and 0 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -48,6 +48,7 @@ public:
ProjectExplorer::RunConfiguration *runConfiguration);
~QmlProfilerEngine();
static void showNoExecutableWarning();
signals:
void processRunning(int port);
void stopRecording();