forked from qt-creator/qt-creator
QmlDebug: Make error dialogs non-blocking and shorter
This commit is contained in:
@@ -237,16 +237,25 @@ void QmlEngine::connectionEstablished()
|
|||||||
|
|
||||||
void QmlEngine::connectionStartupFailed()
|
void QmlEngine::connectionStartupFailed()
|
||||||
{
|
{
|
||||||
QMessageBox::Button button =
|
Core::ICore * const core = Core::ICore::instance();
|
||||||
QMessageBox::critical(0, tr("Failed to connect to QML debugger"),
|
QMessageBox *infoBox = new QMessageBox(core->mainWindow());
|
||||||
tr("Qt Creator could not connect to the in-process debugger at %1:%2.\n"
|
infoBox->setIcon(QMessageBox::Critical);
|
||||||
"Do you want to retry?")
|
infoBox->setWindowTitle(tr("Qt Creator"));
|
||||||
.arg(startParameters().qmlServerAddress)
|
infoBox->setText(tr("Could not connect to the in-process QML debugger.\n"
|
||||||
.arg(startParameters().qmlServerPort),
|
"Do you want to retry?"));
|
||||||
QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help,
|
infoBox->setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel | QMessageBox::Help);
|
||||||
QMessageBox::Retry);
|
infoBox->setDefaultButton(QMessageBox::Retry);
|
||||||
|
infoBox->setModal(true);
|
||||||
|
|
||||||
switch (button) {
|
connect(infoBox, SIGNAL(finished(int)),
|
||||||
|
this, SLOT(retryMessageBoxFinished(int)));
|
||||||
|
|
||||||
|
infoBox->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlEngine::retryMessageBoxFinished(int result)
|
||||||
|
{
|
||||||
|
switch (result) {
|
||||||
case QMessageBox::Retry: {
|
case QMessageBox::Retry: {
|
||||||
d->m_adapter.beginConnection();
|
d->m_adapter.beginConnection();
|
||||||
break;
|
break;
|
||||||
@@ -254,6 +263,7 @@ void QmlEngine::connectionStartupFailed()
|
|||||||
case QMessageBox::Help: {
|
case QMessageBox::Help: {
|
||||||
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
||||||
helpManager->handleHelpRequest("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html");
|
helpManager->handleHelpRequest("qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html");
|
||||||
|
// fall through
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
notifyEngineRunFailed();
|
notifyEngineRunFailed();
|
||||||
@@ -281,7 +291,8 @@ bool QmlEngine::canDisplayTooltip() const
|
|||||||
void QmlEngine::filterApplicationMessage(const QString &msg, int /*channel*/)
|
void QmlEngine::filterApplicationMessage(const QString &msg, int /*channel*/)
|
||||||
{
|
{
|
||||||
static QString qddserver = QLatin1String("QDeclarativeDebugServer: ");
|
static QString qddserver = QLatin1String("QDeclarativeDebugServer: ");
|
||||||
static QString cannotRetrieve = "Cannot retrieve debugging output!";
|
//: Must be the same translation as the one in WinGuiProcess
|
||||||
|
static QString cannotRetrieve = tr("Cannot retrieve debugging output!");
|
||||||
|
|
||||||
int index = msg.indexOf(qddserver);
|
int index = msg.indexOf(qddserver);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
@@ -297,9 +308,11 @@ void QmlEngine::filterApplicationMessage(const QString &msg, int /*channel*/)
|
|||||||
if (status.startsWith(waitingForConnection)) {
|
if (status.startsWith(waitingForConnection)) {
|
||||||
d->m_adapter.beginConnection();
|
d->m_adapter.beginConnection();
|
||||||
} else if (status.startsWith(unableToListen)) {
|
} else if (status.startsWith(unableToListen)) {
|
||||||
|
//: Error message shown after 'Could not connect ... debugger:"
|
||||||
errorMessage = tr("The port seems to be in use.");
|
errorMessage = tr("The port seems to be in use.");
|
||||||
} else if (status.startsWith(debuggingNotEnabled)) {
|
} else if (status.startsWith(debuggingNotEnabled)) {
|
||||||
errorMessage = tr("The application isn't set up for QML/JS debugging.");
|
//: Error message shown after 'Could not connect ... debugger:"
|
||||||
|
errorMessage = tr("The application is not set up for QML/JS debugging.");
|
||||||
} else if (status.startsWith(connectionEstablished)) {
|
} else if (status.startsWith(connectionEstablished)) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
} else {
|
} else {
|
||||||
@@ -313,18 +326,16 @@ void QmlEngine::filterApplicationMessage(const QString &msg, int /*channel*/)
|
|||||||
QMessageBox *infoBox = new QMessageBox(core->mainWindow());
|
QMessageBox *infoBox = new QMessageBox(core->mainWindow());
|
||||||
infoBox->setIcon(QMessageBox::Critical);
|
infoBox->setIcon(QMessageBox::Critical);
|
||||||
infoBox->setWindowTitle(tr("Qt Creator"));
|
infoBox->setWindowTitle(tr("Qt Creator"));
|
||||||
infoBox->setText(tr("Failed to connect to QML debugger\n\n"
|
//: %3 is detailed error message
|
||||||
"Qt Creator could not connect to the in-process debugger at %1:%2:\n"
|
infoBox->setText(tr("Could not connect to the in-process QML debugger:\n"
|
||||||
"%3")
|
"%3")
|
||||||
.arg(startParameters().qmlServerAddress)
|
|
||||||
.arg(startParameters().qmlServerPort)
|
|
||||||
.arg(errorMessage));
|
.arg(errorMessage));
|
||||||
infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help);
|
infoBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Help);
|
||||||
infoBox->setDefaultButton(QMessageBox::Ok);
|
infoBox->setDefaultButton(QMessageBox::Ok);
|
||||||
infoBox->setModal(true);
|
infoBox->setModal(true);
|
||||||
|
|
||||||
connect(infoBox, SIGNAL(finished(int)),
|
connect(infoBox, SIGNAL(finished(int)),
|
||||||
this, SLOT(messageBoxFinished(int)));
|
this, SLOT(wrongSetupMessageBoxFinished(int)));
|
||||||
|
|
||||||
infoBox->show();
|
infoBox->show();
|
||||||
}
|
}
|
||||||
@@ -934,7 +945,7 @@ void QmlEngine::disconnected()
|
|||||||
notifyInferiorExited();
|
notifyInferiorExited();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::messageBoxFinished(int result)
|
void QmlEngine::wrongSetupMessageBoxFinished(int result)
|
||||||
{
|
{
|
||||||
if (result == QMessageBox::Help) {
|
if (result == QMessageBox::Help) {
|
||||||
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
||||||
|
@@ -70,7 +70,8 @@ public slots:
|
|||||||
void disconnected();
|
void disconnected();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void messageBoxFinished(int result);
|
void retryMessageBoxFinished(int result);
|
||||||
|
void wrongSetupMessageBoxFinished(int result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// DebuggerEngine implementation.
|
// DebuggerEngine implementation.
|
||||||
|
@@ -136,6 +136,7 @@ void WinGuiProcess::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!dbgInterface) {
|
if (!dbgInterface) {
|
||||||
|
// Text is dublicated in qmlengine.cpp
|
||||||
emit receivedDebugOutput(tr("Cannot retrieve debugging output!"), true);
|
emit receivedDebugOutput(tr("Cannot retrieve debugging output!"), true);
|
||||||
WaitForSingleObject(m_pid->hProcess, INFINITE);
|
WaitForSingleObject(m_pid->hProcess, INFINITE);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user