diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 8c032134642..1c2dfe66409 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -515,12 +516,20 @@ void QmlProfilerTool::tryToConnect() d->m_connectionTimer.stop(); d->m_connectionAttempts = 0; - if (d->m_client) { - logError("QML Profiler: Failed to connect! " + d->m_client->errorString()); - } else { - logError("QML Profiler: Failed to connect!"); - } - emit connectionFailed(); + Core::ICore * const core = Core::ICore::instance(); + QMessageBox *infoBox = new QMessageBox(core->mainWindow()); + infoBox->setIcon(QMessageBox::Critical); + infoBox->setWindowTitle(tr("Qt Creator")); + infoBox->setText(tr("Could not connect to the in-process QML profiler.\n" + "Do you want to retry?")); + infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help); + infoBox->setDefaultButton(QMessageBox::Retry); + infoBox->setModal(true); + + connect(infoBox, SIGNAL(finished(int)), + this, SLOT(retryMessageBoxFinished(int))); + + infoBox->show(); } else { connectToClient(); } @@ -638,3 +647,29 @@ void QmlProfilerTool::showErrorDialog(const QString &error) errorDialog->setModal(false); errorDialog->show(); } + +void QmlProfilerTool::retryMessageBoxFinished(int result) +{ + switch (result) { + case QMessageBox::Retry: { + d->m_connectionAttempts = 0; + d->m_connectionTimer.start(); + break; + } + case QMessageBox::Help: { + Core::HelpManager *helpManager = Core::HelpManager::instance(); + helpManager->handleHelpRequest("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html"); + // fall through + } + default: { + if (d->m_client) { + logStatus("QML Profiler: Failed to connect! " + d->m_client->errorString()); + } else { + logStatus("QML Profiler: Failed to connect!"); + } + + emit connectionFailed(); + break; + } + } +} diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index 7ade2fffa64..1e8d542ed8c 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -96,6 +96,7 @@ private slots: void showSaveDialog(); void showLoadDialog(); void showErrorDialog(const QString &error); + void retryMessageBoxFinished(int result); private: void connectToClient();