forked from qt-creator/qt-creator
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/4891 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user