QmlDebug: Improve 'Failed to connect to debugger ...' dialog

Task-number: QTCREATORBUG-3795
This commit is contained in:
Kai Koehne
2011-02-16 14:35:26 +01:00
parent a24ae63c9f
commit b07f742d69
2 changed files with 25 additions and 6 deletions

View File

@@ -114,9 +114,9 @@ void QmlAdapter::pollInferior()
d->m_connectionTimer.stop(); d->m_connectionTimer.stop();
d->m_connectionAttempts = 0; d->m_connectionAttempts = 0;
} else if (d->m_connectionAttempts == d->m_maxConnectionAttempts) { } else if (d->m_connectionAttempts == d->m_maxConnectionAttempts) {
emit connectionStartupFailed();
d->m_connectionTimer.stop(); d->m_connectionTimer.stop();
d->m_connectionAttempts = 0; d->m_connectionAttempts = 0;
emit connectionStartupFailed();
} else { } else {
connectToViewer(); connectToViewer();
} }

View File

@@ -57,6 +57,8 @@
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/helpmanager.h>
#include <QtCore/QDateTime> #include <QtCore/QDateTime>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QDir> #include <QtCore/QDir>
@@ -239,11 +241,28 @@ void QmlEngine::connectionEstablished()
void QmlEngine::connectionStartupFailed() void QmlEngine::connectionStartupFailed()
{ {
QMessageBox::critical(0, tr("Failed to connect to debugger"), QMessageBox::Button button =
tr("Could not connect to QML debugger server at %1:%2.") QMessageBox::critical(0, tr("Failed to connect to QML debugger"),
.arg(startParameters().qmlServerAddress) tr("Qt Creator could not connect to the in-process debugger at %1:%2.\n"
.arg(startParameters().qmlServerPort)); "Do you want to retry?")
notifyEngineRunFailed(); .arg(startParameters().qmlServerAddress)
.arg(startParameters().qmlServerPort),
QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help,
QMessageBox::Retry);
switch (button) {
case QMessageBox::Retry: {
d->m_adapter.beginConnection();
break;
}
case QMessageBox::Help: {
Core::HelpManager *helpManager = Core::HelpManager::instance();
helpManager->handleHelpRequest("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html");
break;
}
default:
notifyEngineRunFailed();
}
} }
void QmlEngine::connectionError(QAbstractSocket::SocketError socketError) void QmlEngine::connectionError(QAbstractSocket::SocketError socketError)