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