diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 10f9961802f9f401fa13c1cdba06b4d144d6d679..b329fa777e980c982f8c30d51e169aa669e6f476 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -346,7 +346,7 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters, connect(&d->m_outputParser, SIGNAL(noOutputMessage()), this, SLOT(beginConnection())); connect(&d->m_outputParser, SIGNAL(errorMessage(QString)), - this, SLOT(connectionStartupFailed(QString))); + this, SLOT(appStartupFailed(QString))); // Only wait 8 seconds for the 'Waiting for connection' on application ouput, then just try to connect // (application output might be redirected / blocked) @@ -434,7 +434,7 @@ void QmlEngine::beginConnection(quint16 port) } } -void QmlEngine::connectionStartupFailed(const QString &errorMessage) +void QmlEngine::connectionStartupFailed() { if (isSlaveEngine()) { if (masterEngine()->state() != InferiorRunOk) { @@ -447,19 +447,11 @@ void QmlEngine::connectionStartupFailed(const QString &errorMessage) QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow()); infoBox->setIcon(QMessageBox::Critical); infoBox->setWindowTitle(tr("Qt Creator")); - if (qobject_cast<QmlAdapter *>(sender())) { - infoBox->setText(tr("Could not connect to the in-process QML debugger." - "\nDo you want to retry?")); - infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | - QMessageBox::Help); - infoBox->setDefaultButton(QMessageBox::Retry); - } - if (qobject_cast<QmlJsDebugClient::QDeclarativeOutputParser *>(sender())) { - infoBox->setText(tr("Could not connect to the in-process QML debugger." - "\n%1").arg(errorMessage)); - infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help); - infoBox->setDefaultButton(QMessageBox::Ok); - } + infoBox->setText(tr("Could not connect to the in-process QML debugger." + "\nDo you want to retry?")); + infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | + QMessageBox::Help); + infoBox->setDefaultButton(QMessageBox::Retry); infoBox->setModal(true); connect(infoBox, SIGNAL(finished(int)), @@ -468,6 +460,22 @@ void QmlEngine::connectionStartupFailed(const QString &errorMessage) infoBox->show(); } +void QmlEngine::appStartupFailed(const QString &errorMessage) +{ + QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow()); + infoBox->setIcon(QMessageBox::Critical); + infoBox->setWindowTitle(tr("Qt Creator")); + infoBox->setText(tr("Could not connect to the in-process QML debugger." + "\n%1").arg(errorMessage)); + infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help); + infoBox->setDefaultButton(QMessageBox::Ok); + connect(infoBox, SIGNAL(finished(int)), + this, SLOT(errorMessageBoxFinished(int))); + infoBox->show(); + + notifyEngineRunFailed(); +} + void QmlEngine::errorMessageBoxFinished(int result) { switch (result) { @@ -484,7 +492,7 @@ void QmlEngine::errorMessageBoxFinished(int result) if (state() == InferiorRunOk) { notifyInferiorSpontaneousStop(); notifyInferiorIll(); - } else { + } else if (state() == EngineRunRequested) { notifyEngineRunFailed(); } break; diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index 25e11669563a4e42e2d083334ff7f47a6876a2f7..4e1bb26082db847821d9d48996fb0e663839cc8c 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -163,7 +163,8 @@ signals: private slots: void beginConnection(quint16 port = 0); void connectionEstablished(); - void connectionStartupFailed(const QString &errorMessage = QString()); + void connectionStartupFailed(); + void appStartupFailed(const QString &errorMessage); void connectionError(QAbstractSocket::SocketError error); void serviceConnectionError(const QString &service); void appendMessage(const QString &msg, Utils::OutputFormat);