forked from qt-creator/qt-creator
QmlDesigner: rename RewriterError -> DocumentMessage
Change-Id: I8cbb1b8b83ec10c33e416de96a09281208be8773 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
759db2b7b6
commit
fa84524c0c
@@ -264,18 +264,18 @@ void DebugView::auxiliaryDataChanged(const ModelNode &node, const PropertyName &
|
||||
}
|
||||
}
|
||||
|
||||
void DebugView::documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &warnings)
|
||||
void DebugView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
if (isDebugViewEnabled()) {
|
||||
QTextStream message;
|
||||
QString string;
|
||||
message.setString(&string);
|
||||
|
||||
foreach (const RewriterError &error, errors) {
|
||||
foreach (const DocumentMessage &error, errors) {
|
||||
message << error.toString();
|
||||
}
|
||||
|
||||
foreach (const RewriterError &warning, warnings) {
|
||||
foreach (const DocumentMessage &warning, warnings) {
|
||||
message << warning.toString();
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ public:
|
||||
void propertiesRemoved(const QList<AbstractProperty> &propertyList) override;
|
||||
|
||||
void auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data) override;
|
||||
void documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &warnings) override;
|
||||
void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
|
||||
|
||||
void rewriterBeginTransaction() override;
|
||||
void rewriterEndTransaction() override;
|
||||
|
@@ -284,7 +284,7 @@ void FormEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNodeLi
|
||||
m_scene->update();
|
||||
}
|
||||
|
||||
void FormEditorView::documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &warnings)
|
||||
void FormEditorView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
if (!errors.isEmpty())
|
||||
formEditorWidget()->showErrorMessageBox(errors);
|
||||
|
@@ -76,7 +76,7 @@ public:
|
||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||
const QList<ModelNode> &lastSelectedNodeList) override;
|
||||
|
||||
virtual void documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &warnings) override;
|
||||
virtual void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
|
||||
|
||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) override;
|
||||
|
||||
|
@@ -252,7 +252,7 @@ void FormEditorWidget::setFocus()
|
||||
m_graphicsView->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
|
||||
void FormEditorWidget::showErrorMessageBox(const QList<RewriterError> &errors)
|
||||
void FormEditorWidget::showErrorMessageBox(const QList<DocumentMessage> &errors)
|
||||
{
|
||||
errorWidget()->setErrors(errors);
|
||||
errorWidget()->setVisible(true);
|
||||
@@ -269,7 +269,7 @@ void FormEditorWidget::hideErrorMessageBox()
|
||||
m_toolBox->setDisabled(false);
|
||||
}
|
||||
|
||||
void FormEditorWidget::showWarningMessageBox(const QList<RewriterError> &warnings)
|
||||
void FormEditorWidget::showWarningMessageBox(const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
if (!errorWidget()->warningsEnabled())
|
||||
return;
|
||||
|
@@ -74,10 +74,10 @@ public:
|
||||
|
||||
void setFocus();
|
||||
|
||||
void showErrorMessageBox(const QList<RewriterError> &errors);
|
||||
void showErrorMessageBox(const QList<DocumentMessage> &errors);
|
||||
void hideErrorMessageBox();
|
||||
|
||||
void showWarningMessageBox(const QList<RewriterError> &warnings);
|
||||
void showWarningMessageBox(const QList<DocumentMessage> &warnings);
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
|
@@ -165,7 +165,7 @@ Model* DesignDocument::createInFileComponentModel()
|
||||
return model;
|
||||
}
|
||||
|
||||
QList<RewriterError> DesignDocument::qmlParseWarnings() const
|
||||
QList<DocumentMessage> DesignDocument::qmlParseWarnings() const
|
||||
{
|
||||
return m_rewriterView->warnings();
|
||||
}
|
||||
@@ -175,7 +175,7 @@ bool DesignDocument::hasQmlParseWarnings() const
|
||||
return !m_rewriterView->warnings().isEmpty();
|
||||
}
|
||||
|
||||
QList<RewriterError> DesignDocument::qmlParseErrors() const
|
||||
QList<DocumentMessage> DesignDocument::qmlParseErrors() const
|
||||
{
|
||||
return m_rewriterView->errors();
|
||||
}
|
||||
|
@@ -77,9 +77,9 @@ public:
|
||||
Model *documentModel() const;
|
||||
|
||||
QString contextHelpId() const;
|
||||
QList<RewriterError> qmlParseWarnings() const;
|
||||
QList<DocumentMessage> qmlParseWarnings() const;
|
||||
bool hasQmlParseWarnings() const;
|
||||
QList<RewriterError> qmlParseErrors() const;
|
||||
QList<DocumentMessage> qmlParseErrors() const;
|
||||
bool hasQmlParseErrors() const;
|
||||
|
||||
RewriterView *rewriterView() const;
|
||||
@@ -104,7 +104,7 @@ signals:
|
||||
void undoAvailable(bool isAvailable);
|
||||
void redoAvailable(bool isAvailable);
|
||||
void designDocumentClosed();
|
||||
void qmlErrorsChanged(const QList<RewriterError> &errors);
|
||||
void qmlErrorsChanged(const QList<DocumentMessage> &errors);
|
||||
|
||||
public slots:
|
||||
void deleteSelected();
|
||||
|
@@ -122,12 +122,12 @@ void TextEditorView::customNotification(const AbstractView * /*view*/, const QSt
|
||||
{
|
||||
}
|
||||
|
||||
void TextEditorView::documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &)
|
||||
void TextEditorView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &)
|
||||
{
|
||||
if (errors.isEmpty()) {
|
||||
m_widget->clearStatusBar();
|
||||
} else {
|
||||
const RewriterError error = errors.first();
|
||||
const DocumentMessage error = errors.first();
|
||||
m_widget->setStatusText(QString("%1 (Line: %2)").arg(error.description()).arg(error.line()));
|
||||
}
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ public:
|
||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||
const QList<ModelNode> &lastSelectedNodeList) override;
|
||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) override;
|
||||
void documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &warnings) override;
|
||||
void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
|
||||
|
||||
// TextEditorView
|
||||
WidgetInfo widgetInfo() override;
|
||||
|
@@ -15,7 +15,7 @@ include (../../../../share/qtcreator/qml/qmlpuppet/types/types.pri)
|
||||
|
||||
SOURCES += $$PWD/model/abstractview.cpp \
|
||||
$$PWD/model/rewriterview.cpp \
|
||||
$$PWD/model/rewritererror.cpp \
|
||||
$$PWD/model/documentmessage.cpp \
|
||||
$$PWD/metainfo/metainfo.cpp \
|
||||
$$PWD/metainfo/metainforeader.cpp \
|
||||
$$PWD/metainfo/nodemetainfo.cpp \
|
||||
@@ -84,7 +84,7 @@ HEADERS += $$PWD/include/qmldesignercorelib_global.h \
|
||||
$$PWD/include/abstractview.h \
|
||||
$$PWD/include/nodeinstanceview.h \
|
||||
$$PWD/include/rewriterview.h \
|
||||
$$PWD/include/rewritererror.h \
|
||||
$$PWD/include/documentmessage.h \
|
||||
$$PWD/include/metainfo.h \
|
||||
$$PWD/include/metainforeader.h \
|
||||
$$PWD/include/nodemetainfo.h \
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <model.h>
|
||||
#include <modelnode.h>
|
||||
#include <abstractproperty.h>
|
||||
#include <rewritererror.h>
|
||||
#include <documentmessage.h>
|
||||
#include <rewritertransaction.h>
|
||||
#include <commondefines.h>
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
|
||||
QList<ModelNode> allModelNodes() const;
|
||||
|
||||
void emitDocumentMessage(const QList<RewriterError> &errors, const QList<RewriterError> &warnings = QList<RewriterError>());
|
||||
void emitDocumentMessage(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings = QList<DocumentMessage>());
|
||||
void emitDocumentMessage(const QString &error);
|
||||
void emitCustomNotification(const QString &identifier);
|
||||
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList);
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
|
||||
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||
|
||||
virtual void documentMessagesChanged(const QList<RewriterError> &errors, const QList<RewriterError> &warnings);
|
||||
virtual void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings);
|
||||
|
||||
void changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion);
|
||||
|
||||
|
@@ -35,8 +35,8 @@ class DiagnosticMessage;
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class RewriterError {
|
||||
Q_DECLARE_TR_FUNCTIONS(QmlDesigner::RewriterError)
|
||||
class DocumentMessage {
|
||||
Q_DECLARE_TR_FUNCTIONS(QmlDesigner::DocumentMessage)
|
||||
public:
|
||||
enum Type {
|
||||
NoError = 0,
|
||||
@@ -45,10 +45,10 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
RewriterError();
|
||||
RewriterError(const QmlJS::DiagnosticMessage &qmlError, const QUrl &document);
|
||||
RewriterError(const QString &shortDescription);
|
||||
RewriterError(Exception *exception);
|
||||
DocumentMessage();
|
||||
DocumentMessage(const QmlJS::DiagnosticMessage &qmlError, const QUrl &document);
|
||||
DocumentMessage(const QString &shortDescription);
|
||||
DocumentMessage(Exception *exception);
|
||||
|
||||
Type type() const
|
||||
{ return m_type; }
|
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <qmldesignercorelib_global.h>
|
||||
|
||||
#include <rewritererror.h>
|
||||
#include <documentmessage.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
|
||||
TextModifier *textModifier() const;
|
||||
void setTextModifier(TextModifier *textModifier);
|
||||
void setDocumentMessages(const QList<RewriterError> &errors, const QList<RewriterError> &warnings);
|
||||
void setDocumentMessages(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings);
|
||||
|
||||
protected:
|
||||
Model();
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "qmldesignercorelib_global.h"
|
||||
#include "exception.h"
|
||||
#include "abstractview.h"
|
||||
#include "rewritererror.h"
|
||||
#include "documentmessage.h"
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <QTimer>
|
||||
@@ -111,12 +111,12 @@ public:
|
||||
|
||||
Internal::ModelNodePositionStorage *positionStorage() const;
|
||||
|
||||
QList<RewriterError> warnings() const;
|
||||
QList<RewriterError> errors() const;
|
||||
QList<DocumentMessage> warnings() const;
|
||||
QList<DocumentMessage> errors() const;
|
||||
void clearErrorAndWarnings();
|
||||
void setErrors(const QList<RewriterError> &errors);
|
||||
void setWarnings(const QList<RewriterError> &warnings);
|
||||
void addError(const RewriterError &error);
|
||||
void setErrors(const QList<DocumentMessage> &errors);
|
||||
void setWarnings(const QList<DocumentMessage> &warnings);
|
||||
void addError(const DocumentMessage &error);
|
||||
|
||||
void enterErrorState(const QString &errorMessage);
|
||||
bool inErrorState() const { return !m_rewritingErrorMessage.isEmpty(); }
|
||||
@@ -173,7 +173,7 @@ protected: // functions
|
||||
void applyModificationGroupChanges();
|
||||
void applyChanges();
|
||||
void amendQmlText();
|
||||
void notifyErrorsAndWarnings(const QList<RewriterError> &errors);
|
||||
void notifyErrorsAndWarnings(const QList<DocumentMessage> &errors);
|
||||
|
||||
private: //variables
|
||||
TextModifier *m_textModifier = nullptr;
|
||||
@@ -185,8 +185,8 @@ private: //variables
|
||||
QScopedPointer<Internal::ModelNodePositionStorage> m_positionStorage;
|
||||
QScopedPointer<Internal::ModelToTextMerger> m_modelToTextMerger;
|
||||
QScopedPointer<Internal::TextToModelMerger> m_textToModelMerger;
|
||||
QList<RewriterError> m_errors;
|
||||
QList<RewriterError> m_warnings;
|
||||
QList<DocumentMessage> m_errors;
|
||||
QList<DocumentMessage> m_warnings;
|
||||
RewriterTransaction m_removeDefaultPropertyTransaction;
|
||||
QString m_rewritingErrorMessage;
|
||||
QString m_lastCorrectQmlSource;
|
||||
|
@@ -1269,7 +1269,7 @@ void NodeInstanceView::token(const TokenCommand &command)
|
||||
|
||||
void NodeInstanceView::debugOutput(const DebugOutputCommand & command)
|
||||
{
|
||||
RewriterError error(tr("Qt Quick emulation layer crashed."));
|
||||
DocumentMessage error(tr("Qt Quick emulation layer crashed."));
|
||||
if (command.instanceIds().isEmpty()) {
|
||||
emitDocumentMessage(command.text());
|
||||
} else {
|
||||
|
@@ -348,7 +348,7 @@ void AbstractView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStri
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractView::documentMessagesChanged(const QList<RewriterError> &/*errors*/, const QList<RewriterError> &/*warnings*/)
|
||||
void AbstractView::documentMessagesChanged(const QList<DocumentMessage> &/*errors*/, const QList<DocumentMessage> &/*warnings*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -577,10 +577,10 @@ QList<ModelNode> AbstractView::allModelNodes() const
|
||||
|
||||
void AbstractView::emitDocumentMessage(const QString &error)
|
||||
{
|
||||
emitDocumentMessage( { RewriterError(error) } );
|
||||
emitDocumentMessage( { DocumentMessage(error) } );
|
||||
}
|
||||
|
||||
void AbstractView::emitDocumentMessage(const QList<RewriterError> &errors, const QList<RewriterError> &warnings)
|
||||
void AbstractView::emitDocumentMessage(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
model()->d->setDocumentMessages(errors, warnings);
|
||||
}
|
||||
|
@@ -23,20 +23,20 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <rewritererror.h>
|
||||
#include <documentmessage.h>
|
||||
|
||||
#include <qmljs/parser/qmljsengine_p.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
RewriterError::RewriterError():
|
||||
DocumentMessage::DocumentMessage():
|
||||
m_type(NoError),
|
||||
m_line(-1),
|
||||
m_column(-1)
|
||||
{
|
||||
}
|
||||
|
||||
RewriterError::RewriterError(Exception *exception):
|
||||
DocumentMessage::DocumentMessage(Exception *exception):
|
||||
m_type(InternalError),
|
||||
m_line(exception->line()),
|
||||
m_column(-1),
|
||||
@@ -45,7 +45,7 @@ RewriterError::RewriterError(Exception *exception):
|
||||
{
|
||||
}
|
||||
|
||||
RewriterError::RewriterError(const QmlJS::DiagnosticMessage &qmlError, const QUrl &document):
|
||||
DocumentMessage::DocumentMessage(const QmlJS::DiagnosticMessage &qmlError, const QUrl &document):
|
||||
m_type(ParseError),
|
||||
m_line(qmlError.loc.startLine),
|
||||
m_column(qmlError.loc.startColumn),
|
||||
@@ -54,7 +54,7 @@ RewriterError::RewriterError(const QmlJS::DiagnosticMessage &qmlError, const QUr
|
||||
{
|
||||
}
|
||||
|
||||
RewriterError::RewriterError(const QString &shortDescription) :
|
||||
DocumentMessage::DocumentMessage(const QString &shortDescription) :
|
||||
m_type(ParseError),
|
||||
m_line(1),
|
||||
m_column(0),
|
||||
@@ -64,7 +64,7 @@ RewriterError::RewriterError(const QString &shortDescription) :
|
||||
}
|
||||
|
||||
|
||||
QString RewriterError::toString() const
|
||||
QString DocumentMessage::toString() const
|
||||
{
|
||||
QString str;
|
||||
|
@@ -174,7 +174,7 @@ QUrl ModelPrivate::fileUrl() const
|
||||
return m_fileUrl;
|
||||
}
|
||||
|
||||
void ModelPrivate::setDocumentMessages(const QList<RewriterError> &errors, const QList<RewriterError> &warnings)
|
||||
void ModelPrivate::setDocumentMessages(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
foreach (const QPointer<AbstractView> &view, m_viewList)
|
||||
view->documentMessagesChanged(errors, warnings);
|
||||
@@ -1948,7 +1948,7 @@ void Model::setTextModifier(TextModifier *textModifier)
|
||||
d->m_textModifier = textModifier;
|
||||
}
|
||||
|
||||
void Model::setDocumentMessages(const QList<RewriterError> &errors, const QList<RewriterError> &warnings)
|
||||
void Model::setDocumentMessages(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
d->setDocumentMessages(errors, warnings);
|
||||
}
|
||||
|
@@ -158,7 +158,7 @@ public:
|
||||
|
||||
void notifyCurrentStateChanged(const ModelNode &node);
|
||||
|
||||
void setDocumentMessages(const QList<RewriterError> &errors, const QList<RewriterError> &warnings);
|
||||
void setDocumentMessages(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings);
|
||||
|
||||
void notifyRewriterBeginTransaction();
|
||||
void notifyRewriterEndTransaction();
|
||||
|
@@ -428,7 +428,7 @@ void RewriterView::amendQmlText()
|
||||
emitCustomNotification(EndRewriterAmend);
|
||||
}
|
||||
|
||||
void RewriterView::notifyErrorsAndWarnings(const QList<RewriterError> &errors)
|
||||
void RewriterView::notifyErrorsAndWarnings(const QList<DocumentMessage> &errors)
|
||||
{
|
||||
if (m_setWidgetStatusCallback)
|
||||
m_setWidgetStatusCallback(errors.isEmpty());
|
||||
@@ -441,12 +441,12 @@ Internal::ModelNodePositionStorage *RewriterView::positionStorage() const
|
||||
return m_positionStorage.data();
|
||||
}
|
||||
|
||||
QList<RewriterError> RewriterView::warnings() const
|
||||
QList<DocumentMessage> RewriterView::warnings() const
|
||||
{
|
||||
return m_warnings;
|
||||
}
|
||||
|
||||
QList<RewriterError> RewriterView::errors() const
|
||||
QList<DocumentMessage> RewriterView::errors() const
|
||||
{
|
||||
return m_errors;
|
||||
}
|
||||
@@ -458,19 +458,19 @@ void RewriterView::clearErrorAndWarnings()
|
||||
notifyErrorsAndWarnings(m_errors);
|
||||
}
|
||||
|
||||
void RewriterView::setWarnings(const QList<RewriterError> &warnings)
|
||||
void RewriterView::setWarnings(const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
m_warnings = warnings;
|
||||
notifyErrorsAndWarnings(m_errors);
|
||||
}
|
||||
|
||||
void RewriterView::setErrors(const QList<RewriterError> &errors)
|
||||
void RewriterView::setErrors(const QList<DocumentMessage> &errors)
|
||||
{
|
||||
m_errors = errors;
|
||||
notifyErrorsAndWarnings(m_errors);
|
||||
}
|
||||
|
||||
void RewriterView::addError(const RewriterError &error)
|
||||
void RewriterView::addError(const DocumentMessage &error)
|
||||
{
|
||||
m_errors.append(error);
|
||||
notifyErrorsAndWarnings(m_errors);
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "texttomodelmerger.h"
|
||||
|
||||
#include "rewritererror.h"
|
||||
#include "documentmessage.h"
|
||||
#include "modelnodepositionstorage.h"
|
||||
#include "abstractproperty.h"
|
||||
#include "bindingproperty.h"
|
||||
@@ -886,7 +886,7 @@ void TextToModelMerger::setupUsedImports()
|
||||
m_rewriterView->model()->setUsedImports(usedImports);
|
||||
}
|
||||
|
||||
Document::MutablePtr TextToModelMerger::createParsedDocument(const QUrl &url, const QString &data, QList<RewriterError> *errors)
|
||||
Document::MutablePtr TextToModelMerger::createParsedDocument(const QUrl &url, const QString &data, QList<DocumentMessage> *errors)
|
||||
{
|
||||
const QString fileName = url.toLocalFile();
|
||||
|
||||
@@ -902,7 +902,7 @@ Document::MutablePtr TextToModelMerger::createParsedDocument(const QUrl &url, co
|
||||
if (!doc->isParsedCorrectly()) {
|
||||
if (errors) {
|
||||
foreach (const QmlJS::DiagnosticMessage &message, doc->diagnosticMessages())
|
||||
errors->append(RewriterError(message, QUrl::fromLocalFile(doc->fileName())));
|
||||
errors->append(DocumentMessage(message, QUrl::fromLocalFile(doc->fileName())));
|
||||
}
|
||||
return Document::MutablePtr();
|
||||
}
|
||||
@@ -930,8 +930,8 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
|
||||
try {
|
||||
Snapshot snapshot = m_rewriterView->textModifier()->qmljsSnapshot();
|
||||
|
||||
QList<RewriterError> errors;
|
||||
QList<RewriterError> warnings;
|
||||
QList<DocumentMessage> errors;
|
||||
QList<DocumentMessage> warnings;
|
||||
if (Document::MutablePtr doc = createParsedDocument(url, data, &errors)) {
|
||||
snapshot.insert(doc);
|
||||
m_document = doc;
|
||||
@@ -981,7 +981,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
|
||||
setActive(false);
|
||||
return true;
|
||||
} catch (Exception &e) {
|
||||
RewriterError error(&e);
|
||||
DocumentMessage error(&e);
|
||||
// Somehow, the error below gets eaten in upper levels, so printing the
|
||||
// exception info here for debugging purposes:
|
||||
qDebug() << "*** An exception occurred while reading the QML file:"
|
||||
@@ -1947,18 +1947,18 @@ void TextToModelMerger::setupComponent(const ModelNode &node)
|
||||
ModelNode(node).setNodeSource(result);
|
||||
}
|
||||
|
||||
void TextToModelMerger::collectLinkErrors(QList<RewriterError> *errors, const ReadingContext &ctxt)
|
||||
void TextToModelMerger::collectLinkErrors(QList<DocumentMessage> *errors, const ReadingContext &ctxt)
|
||||
{
|
||||
foreach (const QmlJS::DiagnosticMessage &diagnosticMessage, ctxt.diagnosticLinkMessages()) {
|
||||
errors->append(RewriterError(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
|
||||
errors->append(DocumentMessage(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
|
||||
}
|
||||
}
|
||||
|
||||
void TextToModelMerger::collectImportErrors(QList<RewriterError> *errors)
|
||||
void TextToModelMerger::collectImportErrors(QList<DocumentMessage> *errors)
|
||||
{
|
||||
if (m_rewriterView->model()->imports().isEmpty()) {
|
||||
const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found"));
|
||||
errors->append(RewriterError(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
|
||||
errors->append(DocumentMessage(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
|
||||
}
|
||||
|
||||
bool hasQtQuick = false;
|
||||
@@ -1970,16 +1970,16 @@ void TextToModelMerger::collectImportErrors(QList<RewriterError> *errors)
|
||||
} else {
|
||||
const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0),
|
||||
QCoreApplication::translate("QmlDesigner::TextToModelMerger", "Unsupported QtQuick version"));
|
||||
errors->append(RewriterError(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
|
||||
errors->append(DocumentMessage(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasQtQuick)
|
||||
errors->append(RewriterError(QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import for Qt Quick found.")));
|
||||
errors->append(DocumentMessage(QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import for Qt Quick found.")));
|
||||
}
|
||||
|
||||
void TextToModelMerger::collectSemanticErrorsAndWarnings(QList<RewriterError> *errors, QList<RewriterError> *warnings)
|
||||
void TextToModelMerger::collectSemanticErrorsAndWarnings(QList<DocumentMessage> *errors, QList<DocumentMessage> *warnings)
|
||||
{
|
||||
Check check(m_document, m_scopeChain->context());
|
||||
check.disableMessage(StaticAnalysis::ErrPrototypeCycle);
|
||||
@@ -2000,15 +2000,15 @@ void TextToModelMerger::collectSemanticErrorsAndWarnings(QList<RewriterError> *e
|
||||
foreach (const StaticAnalysis::Message &message, check()) {
|
||||
if (message.severity == Severity::Error) {
|
||||
if (message.type == StaticAnalysis::ErrUnknownComponent)
|
||||
warnings->append(RewriterError(message.toDiagnosticMessage(), fileNameUrl));
|
||||
warnings->append(DocumentMessage(message.toDiagnosticMessage(), fileNameUrl));
|
||||
else
|
||||
errors->append(RewriterError(message.toDiagnosticMessage(), fileNameUrl));
|
||||
errors->append(DocumentMessage(message.toDiagnosticMessage(), fileNameUrl));
|
||||
}
|
||||
if (message.severity == Severity::Warning) {
|
||||
if (message.type == StaticAnalysis::WarnAboutQtQuick1InsteadQtQuick2)
|
||||
errors->append(RewriterError(message.toDiagnosticMessage(), fileNameUrl));
|
||||
errors->append(DocumentMessage(message.toDiagnosticMessage(), fileNameUrl));
|
||||
else
|
||||
warnings->append(RewriterError(message.toDiagnosticMessage(), fileNameUrl));
|
||||
warnings->append(DocumentMessage(message.toDiagnosticMessage(), fileNameUrl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@
|
||||
namespace QmlDesigner {
|
||||
|
||||
class RewriterView;
|
||||
class RewriterError;
|
||||
class DocumentMessage;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -52,7 +52,7 @@ class TextToModelMerger
|
||||
TextToModelMerger &operator=(const TextToModelMerger&);
|
||||
|
||||
public:
|
||||
static QmlJS::Document::MutablePtr createParsedDocument(const QUrl &url, const QString &data, QList<RewriterError> *errors);
|
||||
static QmlJS::Document::MutablePtr createParsedDocument(const QUrl &url, const QString &data, QList<DocumentMessage> *errors);
|
||||
|
||||
TextToModelMerger(RewriterView *reWriterView);
|
||||
bool isActive() const;
|
||||
@@ -136,10 +136,10 @@ public:
|
||||
private:
|
||||
void setupCustomParserNode(const ModelNode &node);
|
||||
void setupComponent(const ModelNode &node);
|
||||
void collectLinkErrors(QList<RewriterError> *errors, const ReadingContext &ctxt);
|
||||
void collectImportErrors(QList<RewriterError> *errors);
|
||||
void collectSemanticErrorsAndWarnings(QList<RewriterError> *errors,
|
||||
QList<RewriterError> *warnings);
|
||||
void collectLinkErrors(QList<DocumentMessage> *errors, const ReadingContext &ctxt);
|
||||
void collectImportErrors(QList<DocumentMessage> *errors);
|
||||
void collectSemanticErrorsAndWarnings(QList<DocumentMessage> *errors,
|
||||
QList<DocumentMessage> *warnings);
|
||||
void populateQrcMapping(const QString &filePath);
|
||||
|
||||
static QString textAt(const QmlJS::Document::Ptr &doc,
|
||||
|
@@ -232,7 +232,7 @@ void DesignModeWidget::showTextEdit()
|
||||
m_centralTabWidget->setCurrentIndex(m_centralTabWidget->currentIndex() == 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
void DesignModeWidget::showWarningMessageBox(const QList<RewriterError> &warnings)
|
||||
void DesignModeWidget::showWarningMessageBox(const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
Q_ASSERT(!warnings.isEmpty());
|
||||
warningWidget()->setWarnings(warnings);
|
||||
|
@@ -81,7 +81,7 @@ public:
|
||||
void disableWidgets();
|
||||
void showTextEdit();
|
||||
|
||||
void showWarningMessageBox(const QList<RewriterError> &warnings);
|
||||
void showWarningMessageBox(const QList<DocumentMessage> &warnings);
|
||||
bool gotoCodeWasClicked();
|
||||
|
||||
CrumbleBar* crumbleBar() const;
|
||||
|
@@ -41,7 +41,7 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static QString errorToString(const RewriterError &error)
|
||||
static QString errorToString(const DocumentMessage &error)
|
||||
{
|
||||
return QString("Line: %1: %2").arg(error.line()).arg(error.description());
|
||||
}
|
||||
@@ -125,8 +125,8 @@ void DocumentWarningWidget::refreshContent()
|
||||
}
|
||||
|
||||
QString messageString;
|
||||
RewriterError message = m_messages.at(m_currentMessage);
|
||||
if (message.type() == RewriterError::ParseError) {
|
||||
DocumentMessage message = m_messages.at(m_currentMessage);
|
||||
if (message.type() == DocumentMessage::ParseError) {
|
||||
messageString += errorToString(message);
|
||||
m_navigateLabel->setText(generateNavigateLinks());
|
||||
m_navigateLabel->show();
|
||||
@@ -190,7 +190,7 @@ bool DocumentWarningWidget::gotoCodeWasClicked()
|
||||
return m_gotoCodeWasClicked;
|
||||
}
|
||||
|
||||
void DocumentWarningWidget::emitGotoCodeClicked(const RewriterError &message)
|
||||
void DocumentWarningWidget::emitGotoCodeClicked(const DocumentMessage &message)
|
||||
{
|
||||
m_gotoCodeWasClicked = true;
|
||||
emit gotoCodeClicked(message.url().toLocalFile(), message.line(), message.column() - 1);
|
||||
@@ -209,21 +209,21 @@ void DocumentWarningWidget::ignoreCheckBoxToggled(bool b)
|
||||
QmlDesignerPlugin::instance()->setSettings(settings);
|
||||
}
|
||||
|
||||
void DocumentWarningWidget::setErrors(const QList<RewriterError> &errors)
|
||||
void DocumentWarningWidget::setErrors(const QList<DocumentMessage> &errors)
|
||||
{
|
||||
Q_ASSERT(!errors.empty());
|
||||
m_mode = ErrorMode;
|
||||
setMessages(errors);
|
||||
}
|
||||
|
||||
void DocumentWarningWidget::setWarnings(const QList<RewriterError> &warnings)
|
||||
void DocumentWarningWidget::setWarnings(const QList<DocumentMessage> &warnings)
|
||||
{
|
||||
Q_ASSERT(!warnings.empty());
|
||||
m_mode = WarningMode;
|
||||
setMessages(warnings);
|
||||
}
|
||||
|
||||
void DocumentWarningWidget::setMessages(const QList<RewriterError> &messages)
|
||||
void DocumentWarningWidget::setMessages(const QList<DocumentMessage> &messages)
|
||||
{
|
||||
m_messages.clear();
|
||||
m_messages = messages;
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <utils/faketooltip.h>
|
||||
#include <rewritererror.h>
|
||||
#include <documentmessage.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
@@ -49,19 +49,19 @@ class DocumentWarningWidget : public Utils::FakeToolTip
|
||||
public:
|
||||
explicit DocumentWarningWidget(QWidget *parent);
|
||||
|
||||
void setErrors(const QList<RewriterError> &errors);
|
||||
void setWarnings(const QList<RewriterError> &warnings);
|
||||
void setErrors(const QList<DocumentMessage> &errors);
|
||||
void setWarnings(const QList<DocumentMessage> &warnings);
|
||||
|
||||
bool warningsEnabled() const;
|
||||
bool gotoCodeWasClicked();
|
||||
void emitGotoCodeClicked(const RewriterError &message);
|
||||
void emitGotoCodeClicked(const DocumentMessage &message);
|
||||
signals:
|
||||
void gotoCodeClicked(const QString filePath, int codeLine, int codeColumn);
|
||||
protected:
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
private:
|
||||
void setMessages(const QList<RewriterError> &messages);
|
||||
void setMessages(const QList<DocumentMessage> &messages);
|
||||
void moveToParentCenter();
|
||||
void refreshContent();
|
||||
QString generateNavigateLinks();
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
QLabel *m_navigateLabel;
|
||||
QCheckBox *m_ignoreWarningsCheckBox;
|
||||
QPushButton *m_continueButton;
|
||||
QList<RewriterError> m_messages;
|
||||
QList<DocumentMessage> m_messages;
|
||||
int m_currentMessage = 0;
|
||||
Mode m_mode = NoMode;
|
||||
bool m_gotoCodeWasClicked = false;
|
||||
|
@@ -272,7 +272,7 @@ Project {
|
||||
"include/qmlobjectnode.h",
|
||||
"include/qmlstate.h",
|
||||
"include/removebasestateexception.h",
|
||||
"include/rewritererror.h",
|
||||
"include/documentmessage.h",
|
||||
"include/rewriterview.h",
|
||||
"include/rewritingexception.h",
|
||||
"include/signalhandlerproperty.h",
|
||||
@@ -349,7 +349,7 @@ Project {
|
||||
"model/rewriteaction.h",
|
||||
"model/rewriteactioncompressor.cpp",
|
||||
"model/rewriteactioncompressor.h",
|
||||
"model/rewritererror.cpp",
|
||||
"model/documentmessage.cpp",
|
||||
"model/rewriterview.cpp",
|
||||
"model/signalhandlerproperty.cpp",
|
||||
"model/textmodifier.cpp",
|
||||
|
Reference in New Issue
Block a user