Commit 771f47c0 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Use Core::AsynchronousMessageBox

Warning which needs return value should be asynchronous because the event
loop of the blocking dialog leads to crashes.

Change-Id: Ie49c95d63ec3f2183378013c726c3b99680dc7b0
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent e5c16c79
......@@ -49,7 +49,7 @@
#include <QApplication>
#include <QPointF>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include <QtDebug>
......@@ -346,7 +346,7 @@ void NavigatorTreeModel::updateItemRow(const ModelNode &node)
static void handleWrongId(QStandardItem *item, const ModelNode &modelNode, const QString &errorTitle, const QString &errorMessage, NavigatorTreeModel *treeModel)
{
Utils::AsynchronousMessageBox::warning(errorTitle, errorMessage);
Core::AsynchronousMessageBox::warning(errorTitle, errorMessage);
bool blockSingals = treeModel->blockItemChangedSignal(true);
item->setText(modelNode.id());
treeModel->blockItemChangedSignal(blockSingals);
......
......@@ -48,7 +48,7 @@
#include <coreplugin/icore.h>
#include <utils/fileutils.h>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include <QCoreApplication>
#include <QDir>
......@@ -157,9 +157,9 @@ void PropertyEditorView::changeValue(const QString &name)
value->setValue(m_selectedNode.id());
m_locked = false;
if (!m_selectedNode.isValidId(newId))
Utils::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId));
Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId));
else
Utils::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 already exists.").arg(newId));
Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 already exists.").arg(newId));
}
return;
}
......
......@@ -38,7 +38,7 @@
#include <variantproperty.h>
#include <coreplugin/icore.h>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
enum {
debug = false
......@@ -176,7 +176,7 @@ void StatesEditorModel::renameState(int internalNodeId, const QString &newName)
return;
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
Utils::AsynchronousMessageBox::warning(tr("Invalid state name"),
Core::AsynchronousMessageBox::warning(tr("Invalid state name"),
newName.isEmpty() ?
tr("The empty string as a name is reserved for the base state.") :
tr("Name already used in another state"));
......
......@@ -37,7 +37,7 @@
#include <QFileInfo>
#include <coreplugin/icore.h>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include <documentmanager.h>
#include <nodemetainfo.h>
......@@ -117,7 +117,7 @@ void AddTabDesignerAction::addNewTab()
QString newFilePath = directoryPath +QStringLiteral("/") + tabName + QStringLiteral(".qml");
if (QFileInfo::exists(newFilePath)) {
Utils::AsynchronousMessageBox::warning(tr("Naming Error"), tr("Component already exists."));
Core::AsynchronousMessageBox::warning(tr("Naming Error"), tr("Component already exists."));
} else {
const QString sourceString = QStringLiteral("import QtQuick 2.1\nimport QtQuick.Controls 1.0\n\nItem {\n anchors.fill: parent\n}");
bool fileCreated = DocumentManager::createFile(newFilePath, sourceString);
......
......@@ -37,7 +37,7 @@
#include <QCoreApplication>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
/*!
\defgroup CoreExceptions
......@@ -155,7 +155,7 @@ QString Exception::description() const
void Exception::showException(const QString &title) const
{
QString composedTitle = title.isEmpty() ? QCoreApplication::translate("QmlDesigner", "Error") : title;
Utils::AsynchronousMessageBox::warning(composedTitle, description());
Core::AsynchronousMessageBox::warning(composedTitle, description());
}
/*!
......
......@@ -78,7 +78,7 @@
#include <coreplugin/icore.h>
#include <utils/hostosinfo.h>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include <projectexplorer/kit.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/baseqtversion.h>
......@@ -101,7 +101,7 @@ static bool hasQtQuick1(NodeInstanceView *nodeInstanceView)
static void showCannotConnectToPuppetWarningAndSwitchToEditMode()
{
Utils::AsynchronousMessageBox::warning(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to QML Emulation Layer (QML Puppet)"),
Core::AsynchronousMessageBox::warning(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to QML Emulation Layer (QML Puppet)"),
QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the QML emulation layer (QML Puppet) may not be responding. "
"Switching to another kit might help."));
......@@ -201,7 +201,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
}
} else {
Utils::AsynchronousMessageBox::warning(tr("Cannot Start QML Emulation Layer (QML Puppet)"),
Core::AsynchronousMessageBox::warning(tr("Cannot Start QML Emulation Layer (QML Puppet)"),
tr("The executable of the QML emulation layer (QML Puppet) process cannot be started or does not respond."));
QmlDesignerPlugin::instance()->switchToTextModeDeferred();
......@@ -385,7 +385,7 @@ void NodeInstanceServerProxy::processFinished(int exitCode, QProcess::ExitStatus
if (m_captureFileForTest.isOpen()) {
m_captureFileForTest.close();
m_captureFileForTest.remove();
Utils::AsynchronousMessageBox::warning(tr("QML Emulation Layer (QML Puppet) Crashed"),
Core::AsynchronousMessageBox::warning(tr("QML Emulation Layer (QML Puppet) Crashed"),
tr("You are recording a puppet stream and the emulations layer crashed. "
"It is recommended to reopen the Qt Quick Designer and start again."));
}
......
......@@ -41,7 +41,7 @@
#include <projectexplorer/kit.h>
#include <projectexplorer/toolchain.h>
#include <utils/environment.h>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include <coreplugin/icore.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
......@@ -230,14 +230,14 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const
}
if (!buildSucceeded)
Utils::AsynchronousMessageBox::warning(QCoreApplication::translate("PuppetCreator", "QML Emulation Layer (QML Puppet) Building was Unsuccessful"),
Core::AsynchronousMessageBox::warning(QCoreApplication::translate("PuppetCreator", "QML Emulation Layer (QML Puppet) Building was Unsuccessful"),
QCoreApplication::translate("PuppetCreator",
"The QML emulation layer (QML Puppet) cannot be built. "
"The fallback emulation layer, which does not support all features, will be used."
));
}
} else {
Utils::AsynchronousMessageBox::warning(QCoreApplication::translate("PuppetCreator", "Qt Version is not supported"),
Core::AsynchronousMessageBox::warning(QCoreApplication::translate("PuppetCreator", "Qt Version is not supported"),
QCoreApplication::translate("PuppetCreator",
"The QML emulation layer (QML Puppet) cannot be built because the Qt version is too old "
"or it cannot run natively on your computer. "
......@@ -250,7 +250,7 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const
static void warnAboutInvalidKit()
{
Utils::AsynchronousMessageBox::warning(QCoreApplication::translate("PuppetCreator", "Kit is invalid"),
Core::AsynchronousMessageBox::warning(QCoreApplication::translate("PuppetCreator", "Kit is invalid"),
QCoreApplication::translate("PuppetCreator",
"The QML emulation layer (QML Puppet) cannot be built because the kit is not configured correctly. "
"For example the compiler can be misconfigured. "
......
......@@ -34,7 +34,7 @@
#include "metainforeader.h"
#include "iwidgetplugin.h"
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include "pluginmanager/widgetpluginmanager.h"
......@@ -99,7 +99,7 @@ void MetaInfoPrivate::parseItemLibraryDescriptions()
} catch (InvalidMetaInfoException &e) {
qWarning() << e.description();
const QString errorMessage = plugin->metaInfo() + QLatin1Char('\n') + QLatin1Char('\n') + reader.errors().join(QLatin1Char('\n'));
Utils::AsynchronousMessageBox::warning(QCoreApplication::translate("QmlDesigner::Internal::MetaInfoPrivate", "Invalid meta info"),
Core::AsynchronousMessageBox::warning(QCoreApplication::translate("QmlDesigner::Internal::MetaInfoPrivate", "Invalid meta info"),
errorMessage);
}
}
......
......@@ -37,7 +37,7 @@
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include <QDir>
#include <QMessageBox>
......@@ -238,7 +238,7 @@ void SubComponentManager::parseDirectory(const QString &canonicalDirPath, bool a
} catch (InvalidMetaInfoException &e) {
qWarning() << e.description();
const QString errorMessage = metaInfoFile.absoluteFilePath() + QLatin1Char('\n') + QLatin1Char('\n') + reader.errors().join(QLatin1Char('\n'));
Utils::AsynchronousMessageBox::warning(QCoreApplication::translate("SubComponentManager::parseDirectory", "Invalid meta info"),
Core::AsynchronousMessageBox::warning(QCoreApplication::translate("SubComponentManager::parseDirectory", "Invalid meta info"),
errorMessage);
}
}
......
......@@ -44,7 +44,7 @@
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
#include <coreplugin/icore.h>
#include <utils/messagebox.h>
#include <coreplugin/messagebox.h>
#include <QMessageBox>
......@@ -338,7 +338,7 @@ void DocumentManager::addFileToVersionControl(const QString &directoryPath, cons
Core::VcsManager::msgPromptToAddToVcs(QStringList(newFilePath), versionControl),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes && !versionControl->vcsAdd(newFilePath)) {
Utils::AsynchronousMessageBox::warning(Core::VcsManager::msgAddToVcsFailedTitle(),
Core::AsynchronousMessageBox::warning(Core::VcsManager::msgAddToVcsFailedTitle(),
Core::VcsManager::msgToAddToVcsFailed(QStringList(newFilePath), versionControl));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment