QmlProfiler: refactored warning messagebox

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>
This commit is contained in:
Christiaan Janssen
2011-07-22 15:52:59 +02:00
committed by Aurindam Jana
parent cd9fceba3a
commit 02120e45e7
2 changed files with 5 additions and 13 deletions

View File

@@ -159,7 +159,7 @@ void QmlProfilerEngine::start()
if (LocalQmlProfilerRunner *qmlRunner = qobject_cast<LocalQmlProfilerRunner *>(d->m_runner)) { if (LocalQmlProfilerRunner *qmlRunner = qobject_cast<LocalQmlProfilerRunner *>(d->m_runner)) {
if (!qmlRunner->hasExecutable()) { if (!qmlRunner->hasExecutable()) {
showNoExecutableWarning(); showNonmodalWarning(tr("No executable file to launch."));
AnalyzerManager::stopTool(); AnalyzerManager::stopTool();
return; return;
} }
@@ -193,15 +193,7 @@ void QmlProfilerEngine::stopped()
{ {
// user feedback // user feedback
if (d->m_running && d->m_fetchingData) { if (d->m_running && d->m_fetchingData) {
Core::ICore * const core = Core::ICore::instance(); showNonmodalWarning(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
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();
} }
d->m_running = false; 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(); Core::ICore * const core = Core::ICore::instance();
QMessageBox *noExecWarning = new QMessageBox(core->mainWindow()); QMessageBox *noExecWarning = new QMessageBox(core->mainWindow());
noExecWarning->setIcon(QMessageBox::Warning); noExecWarning->setIcon(QMessageBox::Warning);
noExecWarning->setWindowTitle(tr("QML Profiler")); noExecWarning->setWindowTitle(tr("QML Profiler"));
noExecWarning->setText(tr("No executable file to launch.")); noExecWarning->setText(warningMsg);
noExecWarning->setStandardButtons(QMessageBox::Ok); noExecWarning->setStandardButtons(QMessageBox::Ok);
noExecWarning->setDefaultButton(QMessageBox::Ok); noExecWarning->setDefaultButton(QMessageBox::Ok);
noExecWarning->setModal(false); noExecWarning->setModal(false);

View File

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