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/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
|
#include <coreplugin/helpmanager.h>
|
||||||
|
|
||||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||||
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
|
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
|
||||||
@@ -515,12 +516,20 @@ void QmlProfilerTool::tryToConnect()
|
|||||||
d->m_connectionTimer.stop();
|
d->m_connectionTimer.stop();
|
||||||
d->m_connectionAttempts = 0;
|
d->m_connectionAttempts = 0;
|
||||||
|
|
||||||
if (d->m_client) {
|
Core::ICore * const core = Core::ICore::instance();
|
||||||
logError("QML Profiler: Failed to connect! " + d->m_client->errorString());
|
QMessageBox *infoBox = new QMessageBox(core->mainWindow());
|
||||||
} else {
|
infoBox->setIcon(QMessageBox::Critical);
|
||||||
logError("QML Profiler: Failed to connect!");
|
infoBox->setWindowTitle(tr("Qt Creator"));
|
||||||
}
|
infoBox->setText(tr("Could not connect to the in-process QML profiler.\n"
|
||||||
emit connectionFailed();
|
"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 {
|
} else {
|
||||||
connectToClient();
|
connectToClient();
|
||||||
}
|
}
|
||||||
@@ -638,3 +647,29 @@ void QmlProfilerTool::showErrorDialog(const QString &error)
|
|||||||
errorDialog->setModal(false);
|
errorDialog->setModal(false);
|
||||||
errorDialog->show();
|
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 showSaveDialog();
|
||||||
void showLoadDialog();
|
void showLoadDialog();
|
||||||
void showErrorDialog(const QString &error);
|
void showErrorDialog(const QString &error);
|
||||||
|
void retryMessageBoxFinished(int result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void connectToClient();
|
void connectToClient();
|
||||||
|
|||||||
Reference in New Issue
Block a user