Commit d23a1adc authored by Kai Koehne's avatar Kai Koehne

QmlProfiler: Show 'retry' message box when connect fails

Show the same message box as in the debugger if connecting to
the port fails.

Change-Id: I5f101fa6e7fc6166ad37c88d046aafca24a4276f
Reviewed-on: http://codereview.qt-project.org/4891Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarAurindam Jana <aurindam.jana@nokia.com>
parent 94f95b4b
......@@ -65,6 +65,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/helpmanager.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
......@@ -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;
}
}
}
......@@ -96,6 +96,7 @@ private slots:
void showSaveDialog();
void showLoadDialog();
void showErrorDialog(const QString &error);
void retryMessageBoxFinished(int result);
private:
void connectToClient();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment