Commit f35d7147 authored by Tim Jenssen's avatar Tim Jenssen Committed by Tim Jenssen

QmlDesigner: use list initialization

Change-Id: Iecc075d82c5b26589a6201a3b1adb04f59c92db0
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
parent 791e8af5
...@@ -85,7 +85,7 @@ void ModelToTextMerger::propertiesChanged(const QList<AbstractProperty>& propert ...@@ -85,7 +85,7 @@ void ModelToTextMerger::propertiesChanged(const QList<AbstractProperty>& propert
ModelNode containedModelNode; ModelNode containedModelNode;
const int indentDepth = m_rewriterView->textModifier()->indentDepth(); const int indentDepth = m_rewriterView->textModifier()->indentDepth();
const QString propertyTextValue = QmlTextGenerator(getPropertyOrder(), const QString propertyTextValue = QmlTextGenerator(propertyOrder(),
indentDepth)(property); indentDepth)(property);
switch (propertyChange) { switch (propertyChange) {
...@@ -162,14 +162,14 @@ void ModelToTextMerger::nodeReparented(const ModelNode &node, const NodeAbstract ...@@ -162,14 +162,14 @@ void ModelToTextMerger::nodeReparented(const ModelNode &node, const NodeAbstract
switch (propertyChange) { switch (propertyChange) {
case AbstractView::PropertiesAdded: case AbstractView::PropertiesAdded:
schedule(new AddPropertyRewriteAction(newPropertyParent, schedule(new AddPropertyRewriteAction(newPropertyParent,
QmlTextGenerator(getPropertyOrder())(node), QmlTextGenerator(propertyOrder())(node),
propertyType(newPropertyParent), propertyType(newPropertyParent),
node)); node));
break; break;
case AbstractView::NoAdditionalChanges: case AbstractView::NoAdditionalChanges:
schedule(new ChangePropertyRewriteAction(newPropertyParent, schedule(new ChangePropertyRewriteAction(newPropertyParent,
QmlTextGenerator(getPropertyOrder())(node), QmlTextGenerator(propertyOrder())(node),
propertyType(newPropertyParent), propertyType(newPropertyParent),
node)); node));
break; break;
...@@ -212,7 +212,7 @@ void ModelToTextMerger::applyChanges() ...@@ -212,7 +212,7 @@ void ModelToTextMerger::applyChanges()
return; return;
dumpRewriteActions(QStringLiteral("Before compression")); dumpRewriteActions(QStringLiteral("Before compression"));
RewriteActionCompressor compress(getPropertyOrder()); RewriteActionCompressor compress(propertyOrder());
compress(m_rewriteActions); compress(m_rewriteActions);
dumpRewriteActions(QStringLiteral("After compression")); dumpRewriteActions(QStringLiteral("After compression"));
...@@ -241,7 +241,7 @@ void ModelToTextMerger::applyChanges() ...@@ -241,7 +241,7 @@ void ModelToTextMerger::applyChanges()
ModelNodePositionRecalculator positionRecalculator(m_rewriterView->positionStorage(), m_rewriterView->positionStorage()->modelNodes()); ModelNodePositionRecalculator positionRecalculator(m_rewriterView->positionStorage(), m_rewriterView->positionStorage()->modelNodes());
positionRecalculator.connectTo(textModifier); positionRecalculator.connectTo(textModifier);
QmlRefactoring refactoring(tmpDocument, *textModifier, getPropertyOrder()); QmlRefactoring refactoring(tmpDocument, *textModifier, propertyOrder());
textModifier->deactivateChangeSignals(); textModifier->deactivateChangeSignals();
textModifier->startGroup(); textModifier->startGroup();
...@@ -348,31 +348,27 @@ QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractPrope ...@@ -348,31 +348,27 @@ QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractPrope
return (QmlRefactoring::PropertyType) -1; return (QmlRefactoring::PropertyType) -1;
} }
PropertyNameList ModelToTextMerger::m_propertyOrder; PropertyNameList ModelToTextMerger::propertyOrder()
PropertyNameList ModelToTextMerger::getPropertyOrder()
{ {
if (m_propertyOrder.isEmpty()) { static const PropertyNameList properties = {
m_propertyOrder PropertyName("id"),
<< PropertyName("id") PropertyName("name"),
<< PropertyName("name") PropertyName("target"),
<< PropertyName("target") PropertyName("property"),
<< PropertyName("property") PropertyName("x"),
<< PropertyName("x") PropertyName("y"),
<< PropertyName("y") PropertyName("width"),
<< PropertyName("width") PropertyName("height"),
<< PropertyName("height") PropertyName("position"),
<< PropertyName("position") PropertyName("color"),
<< PropertyName("color") PropertyName("radius"),
<< PropertyName("radius") PropertyName("text"),
<< PropertyName("text") PropertyName(),
<< PropertyName() PropertyName("states"),
<< PropertyName("states") PropertyName("transitions")
<< PropertyName("transitions") };
;
}
return m_propertyOrder; return properties;
} }
bool ModelToTextMerger::isInHierarchy(const AbstractProperty &property) { bool ModelToTextMerger::isInHierarchy(const AbstractProperty &property) {
......
...@@ -37,7 +37,6 @@ namespace Internal { ...@@ -37,7 +37,6 @@ namespace Internal {
class ModelToTextMerger class ModelToTextMerger
{ {
typedef AbstractView::PropertyChangeFlags PropertyChangeFlags; typedef AbstractView::PropertyChangeFlags PropertyChangeFlags;
static PropertyNameList m_propertyOrder;
public: public:
ModelToTextMerger(RewriterView *reWriterView); ModelToTextMerger(RewriterView *reWriterView);
...@@ -75,7 +74,7 @@ protected: ...@@ -75,7 +74,7 @@ protected:
{ return m_rewriteActions; } { return m_rewriteActions; }
static QmlDesigner::QmlRefactoring::PropertyType propertyType(const AbstractProperty &property, const QString &textValue = QString()); static QmlDesigner::QmlRefactoring::PropertyType propertyType(const AbstractProperty &property, const QString &textValue = QString());
static PropertyNameList getPropertyOrder(); static PropertyNameList propertyOrder();
static bool isInHierarchy(const AbstractProperty &property); static bool isInHierarchy(const AbstractProperty &property);
......
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