Commit 237d1731 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Rename instanceForNode in instanceForModelNode

Change-Id: I182d5b557f5770816059897e746709d054ecac51
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent b756be03
......@@ -122,7 +122,7 @@ public:
void actualStateChanged(const ModelNode &node);
QList<NodeInstance> instances() const;
NodeInstance instanceForNode(const ModelNode &node) const ;
NodeInstance instanceForModelNode(const ModelNode &node) const ;
bool hasInstanceForNode(const ModelNode &node) const;
NodeInstance instanceForId(qint32 id);
......
......@@ -161,7 +161,7 @@ void NodeInstanceView::modelAttached(Model *model)
ModelNode stateNode = actualStateNode();
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) {
NodeInstance newStateInstance = instanceForNode(stateNode);
NodeInstance newStateInstance = instanceForModelNode(stateNode);
activateState(newStateInstance);
}
......@@ -205,7 +205,7 @@ void NodeInstanceView::restartProcess()
ModelNode stateNode = actualStateNode();
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) {
NodeInstance newStateInstance = instanceForNode(stateNode);
NodeInstance newStateInstance = instanceForModelNode(stateNode);
activateState(newStateInstance);
}
}
......@@ -404,7 +404,7 @@ void NodeInstanceView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &newUrl
void NodeInstanceView::nodeIdChanged(const ModelNode& node, const QString& /*newId*/, const QString& /*oldId*/)
{
if (hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
nodeInstanceServer()->changeIds(createChangeIdsCommand(QList<NodeInstance>() << instance));
}
}
......@@ -417,12 +417,12 @@ void NodeInstanceView::nodeOrderChanged(const NodeListProperty & listProperty,
qint32 containerInstanceId = -1;
ModelNode containerNode = listProperty.parentModelNode();
if (hasInstanceForNode(containerNode))
containerInstanceId = instanceForNode(containerNode).instanceId();
containerInstanceId = instanceForModelNode(containerNode).instanceId();
foreach (const ModelNode &node, listProperty.toModelNodeList()) {
qint32 instanceId = -1;
if (hasInstanceForNode(node)) {
instanceId = instanceForNode(node).instanceId();
instanceId = instanceForModelNode(node).instanceId();
ReparentContainer container(instanceId, containerInstanceId, propertyName, containerInstanceId, propertyName);
containerList.append(container);
}
......@@ -493,7 +493,7 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node, const Propert
{
if ((node.isRootNode() && (name == "width" || name == "height")) || name.endsWith(PropertyName("@NodeInstance"))) {
if (hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
QVariant value = data;
if (value.isValid()) {
PropertyValueContainer container(instance.instanceId(), name, value, TypeName());
......@@ -523,7 +523,7 @@ void NodeInstanceView::customNotification(const AbstractView *view, const QStrin
void NodeInstanceView::nodeSourceChanged(const ModelNode &node, const QString & newNodeSource)
{
if (hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
ChangeNodeSourceCommand changeNodeSourceCommand(instance.instanceId(), newNodeSource);
nodeInstanceServer()->changeNodeSource(changeNodeSourceCommand);
}
......@@ -541,7 +541,7 @@ void NodeInstanceView::rewriterEndTransaction()
void NodeInstanceView::actualStateChanged(const ModelNode &node)
{
NodeInstance newStateInstance = instanceForNode(node);
NodeInstance newStateInstance = instanceForModelNode(node);
if (newStateInstance.isValid() && node.metaInfo().isSubclassOf("QtQuick.State", 1, 0))
nodeInstanceView()->activateState(newStateInstance);
......@@ -576,7 +576,7 @@ QList<NodeInstance> NodeInstanceView::instances() const
\returns NodeStance for ModelNode.
\see NodeInstance
*/
NodeInstance NodeInstanceView::instanceForNode(const ModelNode &node) const
NodeInstance NodeInstanceView::instanceForModelNode(const ModelNode &node) const
{
Q_ASSERT(node.isValid());
Q_ASSERT(m_nodeInstanceHash.contains(node));
......@@ -657,7 +657,7 @@ void NodeInstanceView::insertInstanceRelationships(const NodeInstance &instance)
void NodeInstanceView::removeInstanceNodeRelationship(const ModelNode &node)
{
Q_ASSERT(m_nodeInstanceHash.contains(node));
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
m_nodeInstanceHash.remove(node);
instance.makeInvalid();
}
......@@ -759,7 +759,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
variantPropertyList.append(node.variantProperties());
bindingPropertyList.append(node.bindingProperties());
if (node.isValid() && hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
QHashIterator<PropertyName, QVariant> auxiliaryIterator(node.auxiliaryData());
while (auxiliaryIterator.hasNext()) {
auxiliaryIterator.next();
......@@ -795,7 +795,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
foreach (const NodeInstance &instance, instanceList) {
if (instance.modelNode().hasParentProperty()) {
NodeAbstractProperty parentProperty = instance.modelNode().parentProperty();
ReparentContainer container(instance.instanceId(), -1, PropertyName(), instanceForNode(parentProperty.parentModelNode()).instanceId(), parentProperty.name());
ReparentContainer container(instance.instanceId(), -1, PropertyName(), instanceForModelNode(parentProperty.parentModelNode()).instanceId(), parentProperty.name());
reparentContainerList.append(container);
}
}
......@@ -813,7 +813,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
foreach (const VariantProperty &property, variantPropertyList) {
ModelNode node = property.parentModelNode();
if (node.isValid() && hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
PropertyValueContainer container(instance.instanceId(), property.name(), property.value(), property.dynamicTypeName());
valueContainerList.append(container);
}
......@@ -823,7 +823,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
foreach (const BindingProperty &property, bindingPropertyList) {
ModelNode node = property.parentModelNode();
if (node.isValid() && hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
PropertyBindingContainer container(instance.instanceId(), property.name(), property.expression(), property.dynamicTypeName());
bindingContainerList.append(container);
}
......@@ -894,7 +894,7 @@ ReparentInstancesCommand NodeInstanceView::createReparentInstancesCommand(const
foreach (const NodeInstance &instance, instanceList) {
if (instance.modelNode().hasParentProperty()) {
NodeAbstractProperty parentProperty = instance.modelNode().parentProperty();
ReparentContainer container(instance.instanceId(), -1, PropertyName(), instanceForNode(parentProperty.parentModelNode()).instanceId(), parentProperty.name());
ReparentContainer container(instance.instanceId(), -1, PropertyName(), instanceForModelNode(parentProperty.parentModelNode()).instanceId(), parentProperty.name());
containerList.append(container);
}
}
......@@ -910,14 +910,14 @@ ReparentInstancesCommand NodeInstanceView::createReparentInstancesCommand(const
qint32 oldParentInstanceId = -1;
if (newPropertyParent.isValid() && hasInstanceForNode(newPropertyParent.parentModelNode()))
newParentInstanceId = instanceForNode(newPropertyParent.parentModelNode()).instanceId();
newParentInstanceId = instanceForModelNode(newPropertyParent.parentModelNode()).instanceId();
if (oldPropertyParent.isValid() && hasInstanceForNode(oldPropertyParent.parentModelNode()))
oldParentInstanceId = instanceForNode(oldPropertyParent.parentModelNode()).instanceId();
oldParentInstanceId = instanceForModelNode(oldPropertyParent.parentModelNode()).instanceId();
ReparentContainer container(instanceForNode(node).instanceId(), oldParentInstanceId, oldPropertyParent.name(), newParentInstanceId, newPropertyParent.name());
ReparentContainer container(instanceForModelNode(node).instanceId(), oldParentInstanceId, oldPropertyParent.name(), newParentInstanceId, newPropertyParent.name());
containerList.append(container);
......@@ -936,7 +936,7 @@ ChangeValuesCommand NodeInstanceView::createChangeValueCommand(const QList<Varia
foreach (const VariantProperty &property, propertyList) {
ModelNode node = property.parentModelNode();
if (node.isValid() && hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
PropertyValueContainer container(instance.instanceId(), property.name(), property.value(), property.dynamicTypeName());
containerList.append(container);
}
......@@ -953,7 +953,7 @@ ChangeBindingsCommand NodeInstanceView::createChangeBindingCommand(const QList<B
foreach (const BindingProperty &property, propertyList) {
ModelNode node = property.parentModelNode();
if (node.isValid() && hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
PropertyBindingContainer container(instance.instanceId(), property.name(), property.expression(), property.dynamicTypeName());
containerList.append(container);
}
......@@ -984,7 +984,7 @@ RemoveInstancesCommand NodeInstanceView::createRemoveInstancesCommand(const QLis
QVector<qint32> idList;
foreach (const ModelNode &node, nodeList) {
if (node.isValid() && hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
if (instance.instanceId() >= 0)
idList.append(instance.instanceId());
......@@ -999,7 +999,7 @@ RemoveInstancesCommand NodeInstanceView::createRemoveInstancesCommand(const Mode
QVector<qint32> idList;
if (node.isValid() && hasInstanceForNode(node))
idList.append(instanceForNode(node).instanceId());
idList.append(instanceForModelNode(node).instanceId());
return RemoveInstancesCommand(idList);
}
......@@ -1011,7 +1011,7 @@ RemovePropertiesCommand NodeInstanceView::createRemovePropertiesCommand(const QL
foreach (const AbstractProperty &property, propertyList) {
ModelNode node = property.parentModelNode();
if (node.isValid() && hasInstanceForNode(node)) {
NodeInstance instance = instanceForNode(node);
NodeInstance instance = instanceForModelNode(node);
PropertyAbstractContainer container(instance.instanceId(), property.name(), property.dynamicTypeName());
containerList.append(container);
}
......
......@@ -74,7 +74,7 @@ bool QmlModelNodeFacade::isValidQmlModelNodeFacade(const ModelNode &modelNode)
&& qmlModelView()
&& qmlModelView()->nodeInstanceView()
&& qmlModelView()->nodeInstanceView()->hasInstanceForNode(modelNode)
&& qmlModelView()->nodeInstanceView()->instanceForNode(modelNode).isValid();
&& qmlModelView()->nodeInstanceView()->instanceForModelNode(modelNode).isValid();
}
bool QmlModelNodeFacade::isRootNode() const
......
......@@ -404,7 +404,7 @@ bool QmlObjectNode::isAncestorOf(const QmlObjectNode &objectNode) const
QVariant QmlObjectNode::instanceValue(const ModelNode &modelNode, const PropertyName &name)
{
Q_ASSERT(modelNode.view()->nodeInstanceView()->hasInstanceForNode(modelNode));
return modelNode.view()->nodeInstanceView()->instanceForNode(modelNode).property(name);
return modelNode.view()->nodeInstanceView()->instanceForModelNode(modelNode).property(name);
}
QString QmlObjectNode::generateTranslatableText(const QString &text)
......@@ -428,7 +428,7 @@ bool QmlObjectNode::instanceHasBinding(const PropertyName &name) const
NodeInstance QmlObjectNode::nodeInstance() const
{
return qmlModelView()->nodeInstanceView()->instanceForNode(modelNode());
return qmlModelView()->nodeInstanceView()->instanceForModelNode(modelNode());
}
QmlObjectNode QmlObjectNode::nodeForInstance(const NodeInstance &instance) const
......
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