forked from qt-creator/qt-creator
QmlDesigner: modernize and beautify code
Change-Id: I937ce76ca96f4d2f3af2febd9448749f69513b02 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
@@ -26,24 +26,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmldesignercorelib_global.h"
|
#include "qmldesignercorelib_global.h"
|
||||||
#include "abstractview.h"
|
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include <modelnodepositionstorage.h>
|
#include "abstractview.h"
|
||||||
#include <QMap>
|
|
||||||
|
#include <QScopedPointer>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include <modelnode.h>
|
|
||||||
#include <QScopedPointer>
|
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
class DiagnosticMessage;
|
class DiagnosticMessage;
|
||||||
class LookupContext;
|
class LookupContext;
|
||||||
class Document;
|
class Document;
|
||||||
class ScopeChain;
|
class ScopeChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
class TextModifier;
|
class TextModifier;
|
||||||
@@ -140,8 +135,7 @@ public:
|
|||||||
void reactivateTextMofifierChangeSignals();
|
void reactivateTextMofifierChangeSignals();
|
||||||
void deactivateTextMofifierChangeSignals();
|
void deactivateTextMofifierChangeSignals();
|
||||||
|
|
||||||
Internal::ModelNodePositionStorage *positionStorage() const
|
Internal::ModelNodePositionStorage *positionStorage() const;
|
||||||
{ return m_positionStorage; }
|
|
||||||
|
|
||||||
QList<RewriterError> warnings() const;
|
QList<RewriterError> warnings() const;
|
||||||
QList<RewriterError> errors() const;
|
QList<RewriterError> errors() const;
|
||||||
@@ -201,19 +195,20 @@ protected: // functions
|
|||||||
void applyChanges();
|
void applyChanges();
|
||||||
|
|
||||||
private: //variables
|
private: //variables
|
||||||
|
TextModifier *m_textModifier = nullptr;
|
||||||
|
int transactionLevel = 0;
|
||||||
|
bool m_modificationGroupActive = false;
|
||||||
|
bool m_checkErrors = true;
|
||||||
|
|
||||||
DifferenceHandling m_differenceHandling;
|
DifferenceHandling m_differenceHandling;
|
||||||
bool m_modificationGroupActive;
|
QScopedPointer<Internal::ModelNodePositionStorage> m_positionStorage;
|
||||||
Internal::ModelNodePositionStorage *m_positionStorage;
|
|
||||||
QScopedPointer<Internal::ModelToTextMerger> m_modelToTextMerger;
|
QScopedPointer<Internal::ModelToTextMerger> m_modelToTextMerger;
|
||||||
QScopedPointer<Internal::TextToModelMerger> m_textToModelMerger;
|
QScopedPointer<Internal::TextToModelMerger> m_textToModelMerger;
|
||||||
TextModifier *m_textModifier;
|
|
||||||
QList<RewriterError> m_errors;
|
QList<RewriterError> m_errors;
|
||||||
QList<RewriterError> m_warnings;
|
QList<RewriterError> m_warnings;
|
||||||
int transactionLevel;
|
|
||||||
RewriterTransaction m_removeDefaultPropertyTransaction;
|
RewriterTransaction m_removeDefaultPropertyTransaction;
|
||||||
QString m_rewritingErrorMessage;
|
QString m_rewritingErrorMessage;
|
||||||
QString lastCorrectQmlSource;
|
QString lastCorrectQmlSource;
|
||||||
bool m_checkErrors;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //QmlDesigner
|
} //QmlDesigner
|
||||||
|
@@ -27,15 +27,15 @@
|
|||||||
#include "modelnodepositionrecalculator.h"
|
#include "modelnodepositionrecalculator.h"
|
||||||
#include "qmltextgenerator.h"
|
#include "qmltextgenerator.h"
|
||||||
#include "rewriteactioncompressor.h"
|
#include "rewriteactioncompressor.h"
|
||||||
#include "rewriterview.h"
|
|
||||||
|
|
||||||
#include <nodelistproperty.h>
|
#include <rewriterview.h>
|
||||||
|
#include <abstractproperty.h>
|
||||||
#include <nodeproperty.h>
|
#include <nodeproperty.h>
|
||||||
|
#include <nodeabstractproperty.h>
|
||||||
|
|
||||||
#include <qmljs/parser/qmljsengine_p.h>
|
#include <qmljs/parser/qmljsengine_p.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
enum {
|
enum {
|
||||||
DebugRewriteActions = 0
|
DebugRewriteActions = 0
|
||||||
|
@@ -25,15 +25,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qmldesignercorelib_global.h"
|
#include <abstractview.h>
|
||||||
#include <modelnode.h>
|
|
||||||
#include "abstractview.h"
|
|
||||||
#include "nodeabstractproperty.h"
|
|
||||||
#include "variantproperty.h"
|
|
||||||
#include "bindingproperty.h"
|
|
||||||
#include "rewriteaction.h"
|
#include "rewriteaction.h"
|
||||||
#include <filemanager/qmlrefactoring.h>
|
|
||||||
#include <QMap>
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
@@ -25,19 +25,19 @@
|
|||||||
|
|
||||||
#include "rewriterview.h"
|
#include "rewriterview.h"
|
||||||
|
|
||||||
|
#include "texttomodelmerger.h"
|
||||||
|
#include "modeltotextmerger.h"
|
||||||
|
|
||||||
|
#include <variantproperty.h>
|
||||||
|
#include <bindingproperty.h>
|
||||||
|
#include <rewritingexception.h>
|
||||||
|
#include <signalhandlerproperty.h>
|
||||||
#include <filemanager/astobjecttextextractor.h>
|
#include <filemanager/astobjecttextextractor.h>
|
||||||
#include <filemanager/objectlengthcalculator.h>
|
#include <filemanager/objectlengthcalculator.h>
|
||||||
#include <filemanager/firstdefinitionfinder.h>
|
#include <filemanager/firstdefinitionfinder.h>
|
||||||
#include <customnotifications.h>
|
#include <customnotifications.h>
|
||||||
|
#include <modelnodepositionstorage.h>
|
||||||
|
#include <modelnode.h>
|
||||||
#include "rewritingexception.h"
|
|
||||||
#include "texttomodelmerger.h"
|
|
||||||
#include "modelnodepositionstorage.h"
|
|
||||||
#include "modeltotextmerger.h"
|
|
||||||
#include "nodelistproperty.h"
|
|
||||||
#include "signalhandlerproperty.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <qmljs/parser/qmljsengine_p.h>
|
#include <qmljs/parser/qmljsengine_p.h>
|
||||||
|
|
||||||
@@ -119,19 +119,14 @@ QString RewriterError::toString() const
|
|||||||
RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *parent):
|
RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *parent):
|
||||||
AbstractView(parent),
|
AbstractView(parent),
|
||||||
m_differenceHandling(differenceHandling),
|
m_differenceHandling(differenceHandling),
|
||||||
m_modificationGroupActive(false),
|
|
||||||
m_positionStorage(new ModelNodePositionStorage),
|
m_positionStorage(new ModelNodePositionStorage),
|
||||||
m_modelToTextMerger(new Internal::ModelToTextMerger(this)),
|
m_modelToTextMerger(new Internal::ModelToTextMerger(this)),
|
||||||
m_textToModelMerger(new Internal::TextToModelMerger(this)),
|
m_textToModelMerger(new Internal::TextToModelMerger(this))
|
||||||
m_textModifier(0),
|
|
||||||
transactionLevel(0),
|
|
||||||
m_checkErrors(true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RewriterView::~RewriterView()
|
RewriterView::~RewriterView()
|
||||||
{
|
{
|
||||||
delete m_positionStorage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Internal::ModelToTextMerger *RewriterView::modelToTextMerger() const
|
Internal::ModelToTextMerger *RewriterView::modelToTextMerger() const
|
||||||
@@ -474,6 +469,11 @@ void RewriterView::applyChanges()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Internal::ModelNodePositionStorage *RewriterView::positionStorage() const
|
||||||
|
{
|
||||||
|
return m_positionStorage.data();
|
||||||
|
}
|
||||||
|
|
||||||
QList<RewriterError> RewriterView::warnings() const
|
QList<RewriterError> RewriterView::warnings() const
|
||||||
{
|
{
|
||||||
return m_warnings;
|
return m_warnings;
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "texttomodelmerger.h"
|
#include "texttomodelmerger.h"
|
||||||
|
|
||||||
|
#include "modelnodepositionstorage.h"
|
||||||
#include "abstractproperty.h"
|
#include "abstractproperty.h"
|
||||||
#include "bindingproperty.h"
|
#include "bindingproperty.h"
|
||||||
#include "filemanager/firstdefinitionfinder.h"
|
#include "filemanager/firstdefinitionfinder.h"
|
||||||
|
Reference in New Issue
Block a user