forked from qt-creator/qt-creator
QmlDesigner: Add component complete feature
This notifies the views if the instance has be really instanced.
This commit is contained in:
@@ -435,6 +435,11 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const QString &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormEditorView::instancesCompleted(const QVector<ModelNode> &completedNodeList)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FormEditorView::customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
|
void FormEditorView::customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
|
||||||
{
|
{
|
||||||
if (identifier == "__start rewriter transaction__") {
|
if (identifier == "__start rewriter transaction__") {
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ public:
|
|||||||
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
||||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
|
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
|
|
||||||
double margins() const;
|
double margins() const;
|
||||||
double spacing() const;
|
double spacing() const;
|
||||||
void deActivateItemCreator();
|
void deActivateItemCreator();
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*pro
|
|||||||
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
|
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
|
||||||
void ComponentView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
|
void ComponentView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
|
||||||
void ComponentView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/) {};
|
void ComponentView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &/*propertyList*/) {};
|
||||||
|
void ComponentView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/) {}
|
||||||
|
|
||||||
|
|
||||||
void ComponentView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/,
|
void ComponentView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/,
|
||||||
@@ -170,7 +171,6 @@ void ComponentView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &/*newUrl*
|
|||||||
|
|
||||||
void ComponentView::nodeOrderChanged(const NodeListProperty &/*listProperty*/, const ModelNode & /*movedNode*/, int /*oldIndex*/) {}
|
void ComponentView::nodeOrderChanged(const NodeListProperty &/*listProperty*/, const ModelNode & /*movedNode*/, int /*oldIndex*/) {}
|
||||||
|
|
||||||
void ComponentView::importsChanged() {}
|
|
||||||
|
|
||||||
void ComponentView::auxiliaryDataChanged(const ModelNode &/*node*/, const QString &/*name*/, const QVariant &/*data*/) {}
|
void ComponentView::auxiliaryDataChanged(const ModelNode &/*node*/, const QString &/*name*/, const QVariant &/*data*/) {}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public:
|
|||||||
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
|
|
||||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> &lastSelectedNodeList);
|
const QList<ModelNode> &lastSelectedNodeList);
|
||||||
@@ -77,8 +78,6 @@ public:
|
|||||||
|
|
||||||
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
||||||
|
|
||||||
void importsChanged();
|
|
||||||
|
|
||||||
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
||||||
|
|
||||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ void DesignDocumentControllerView::instancePropertyChange(const QList<QPair<Mode
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesignDocumentControllerView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static QStringList arrayToStringList(const QByteArray &byteArray)
|
static QStringList arrayToStringList(const QByteArray &byteArray)
|
||||||
{
|
{
|
||||||
QString str(QString::fromLatin1(byteArray));
|
QString str(QString::fromLatin1(byteArray));
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
virtual void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
|
||||||
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
virtual void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
|
|
||||||
ModelNode insertModel(const ModelNode &modelNode)
|
ModelNode insertModel(const ModelNode &modelNode)
|
||||||
{ return m_modelMerger.insertModel(modelNode); }
|
{ return m_modelMerger.insertModel(modelNode); }
|
||||||
|
|||||||
@@ -198,6 +198,10 @@ void NavigatorView::instancePropertyChange(const QList<QPair<ModelNode, QString>
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NavigatorView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void NavigatorView::nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &node, int oldIndex)
|
void NavigatorView::nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &node, int oldIndex)
|
||||||
{
|
{
|
||||||
if (m_treeModel->isInTree(node))
|
if (m_treeModel->isInTree(node))
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public:
|
|||||||
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// void handleChangedItem(QStandardItem * item);
|
// void handleChangedItem(QStandardItem * item);
|
||||||
|
|||||||
@@ -119,7 +119,9 @@ SOURCES += $$PWD/model/abstractview.cpp \
|
|||||||
$$PWD/instances/addimportcommand.cpp \
|
$$PWD/instances/addimportcommand.cpp \
|
||||||
$$PWD/instances/childrenchangedcommand.cpp \
|
$$PWD/instances/childrenchangedcommand.cpp \
|
||||||
$$PWD/instances/statepreviewimagechangedcommand.cpp \
|
$$PWD/instances/statepreviewimagechangedcommand.cpp \
|
||||||
$$PWD/instances/imagecontainer.cpp
|
$$PWD/instances/imagecontainer.cpp \
|
||||||
|
$$PWD/instances/completecomponentcommand.cpp \
|
||||||
|
$$PWD/instances/componentcompletedcommand.cpp
|
||||||
HEADERS += $$PWD/include/corelib_global.h \
|
HEADERS += $$PWD/include/corelib_global.h \
|
||||||
$$PWD/include/abstractview.h \
|
$$PWD/include/abstractview.h \
|
||||||
$$PWD/include/nodeinstanceview.h \
|
$$PWD/include/nodeinstanceview.h \
|
||||||
@@ -237,7 +239,9 @@ HEADERS += $$PWD/include/corelib_global.h \
|
|||||||
$$PWD/instances/addimportcommand.h \
|
$$PWD/instances/addimportcommand.h \
|
||||||
$$PWD/instances/childrenchangedcommand.h \
|
$$PWD/instances/childrenchangedcommand.h \
|
||||||
$$PWD/instances/statepreviewimagechangedcommand.h \
|
$$PWD/instances/statepreviewimagechangedcommand.h \
|
||||||
$$PWD/instances/imagecontainer.h
|
$$PWD/instances/imagecontainer.h \
|
||||||
|
$$PWD/instances/completecomponentcommand.h \
|
||||||
|
$$PWD/instances/componentcompletedcommand.h
|
||||||
contains(CONFIG, plugin) {
|
contains(CONFIG, plugin) {
|
||||||
# If core.pri has been included in the qmldesigner plugin
|
# If core.pri has been included in the qmldesigner plugin
|
||||||
SOURCES += $$PWD/model/basetexteditmodifier.cpp
|
SOURCES += $$PWD/model/basetexteditmodifier.cpp
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ public:
|
|||||||
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
|
|
||||||
void emitInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void emitInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void emitInstancesCompleted(const QVector<ModelNode> &nodeList);
|
||||||
|
|
||||||
virtual void modelAttached(Model *model);
|
virtual void modelAttached(Model *model);
|
||||||
virtual void modelAboutToBeDetached(Model *model);
|
virtual void modelAboutToBeDetached(Model *model);
|
||||||
@@ -124,6 +125,8 @@ public:
|
|||||||
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) = 0;
|
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) = 0;
|
||||||
|
|
||||||
virtual void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList) = 0;
|
virtual void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList) = 0;
|
||||||
|
virtual void instancesCompleted(const QVector<ModelNode> &completedNodeList) = 0;
|
||||||
|
|
||||||
|
|
||||||
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> &lastSelectedNodeList) = 0;
|
const QList<ModelNode> &lastSelectedNodeList) = 0;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class PixmapChangedCommand;
|
|||||||
class InformationChangedCommand;
|
class InformationChangedCommand;
|
||||||
class ChildrenChangedCommand;
|
class ChildrenChangedCommand;
|
||||||
class StatePreviewImageChangedCommand;
|
class StatePreviewImageChangedCommand;
|
||||||
|
class ComponentCompletedCommand;
|
||||||
|
|
||||||
class NodeInstanceClientInterface
|
class NodeInstanceClientInterface
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,7 @@ public:
|
|||||||
virtual void pixmapChanged(const PixmapChangedCommand &command) = 0;
|
virtual void pixmapChanged(const PixmapChangedCommand &command) = 0;
|
||||||
virtual void childrenChanged(const ChildrenChangedCommand &command) = 0;
|
virtual void childrenChanged(const ChildrenChangedCommand &command) = 0;
|
||||||
virtual void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command) = 0;
|
virtual void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command) = 0;
|
||||||
|
virtual void componentCompleted(const ComponentCompletedCommand &command) = 0;
|
||||||
|
|
||||||
virtual void flush() {};
|
virtual void flush() {};
|
||||||
virtual qint64 bytesToWrite() const {return 0;}
|
virtual qint64 bytesToWrite() const {return 0;}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class RemoveInstancesCommand;
|
|||||||
class RemovePropertiesCommand;
|
class RemovePropertiesCommand;
|
||||||
class ChangeStateCommand;
|
class ChangeStateCommand;
|
||||||
class AddImportCommand;
|
class AddImportCommand;
|
||||||
|
class CompleteComponentCommand;
|
||||||
|
|
||||||
class NodeInstanceServerInterface : public QObject
|
class NodeInstanceServerInterface : public QObject
|
||||||
{
|
{
|
||||||
@@ -40,6 +41,7 @@ public:
|
|||||||
virtual void changeIds(const ChangeIdsCommand &command) = 0;
|
virtual void changeIds(const ChangeIdsCommand &command) = 0;
|
||||||
virtual void changeState(const ChangeStateCommand &command) = 0;
|
virtual void changeState(const ChangeStateCommand &command) = 0;
|
||||||
virtual void addImport(const AddImportCommand &command) = 0;
|
virtual void addImport(const AddImportCommand &command) = 0;
|
||||||
|
virtual void completeComponent(const CompleteComponentCommand &command) = 0;
|
||||||
|
|
||||||
virtual void setBlockUpdates(bool /*block*/) {}
|
virtual void setBlockUpdates(bool /*block*/) {}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class ChangeIdsCommand;
|
|||||||
class RemoveInstancesCommand;
|
class RemoveInstancesCommand;
|
||||||
class RemovePropertiesCommand;
|
class RemovePropertiesCommand;
|
||||||
class AddImportCommand;
|
class AddImportCommand;
|
||||||
|
class CompleteComponentCommand;
|
||||||
|
|
||||||
class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInstanceClientInterface
|
class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInstanceClientInterface
|
||||||
{
|
{
|
||||||
@@ -94,6 +95,7 @@ public:
|
|||||||
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
|
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
void importAdded(const Import &import);
|
void importAdded(const Import &import);
|
||||||
void importRemoved(const Import &import);
|
void importRemoved(const Import &import);
|
||||||
|
|
||||||
@@ -118,6 +120,7 @@ public:
|
|||||||
void informationChanged(const InformationChangedCommand &command);
|
void informationChanged(const InformationChangedCommand &command);
|
||||||
void childrenChanged(const ChildrenChangedCommand &command);
|
void childrenChanged(const ChildrenChangedCommand &command);
|
||||||
void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
|
void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
|
||||||
|
void componentCompleted(const ComponentCompletedCommand &command);
|
||||||
|
|
||||||
private: // functions
|
private: // functions
|
||||||
NodeInstance rootNodeInstance() const;
|
NodeInstance rootNodeInstance() const;
|
||||||
@@ -143,6 +146,8 @@ private: // functions
|
|||||||
CreateSceneCommand createCreateSceneCommand() const;
|
CreateSceneCommand createCreateSceneCommand() const;
|
||||||
ClearSceneCommand createClearSceneCommand() const;
|
ClearSceneCommand createClearSceneCommand() const;
|
||||||
CreateInstancesCommand createCreateInstancesCommand(const QList<NodeInstance> &instanceList) const;
|
CreateInstancesCommand createCreateInstancesCommand(const QList<NodeInstance> &instanceList) const;
|
||||||
|
CompleteComponentCommand createComponentCompleteCommand(const QList<NodeInstance> &instanceList) const;
|
||||||
|
ComponentCompletedCommand createComponentCompletedCommand(const QList<NodeInstance> &instanceList) const;
|
||||||
ReparentInstancesCommand createReparentInstancesCommand(const QList<NodeInstance> &instanceList) const;
|
ReparentInstancesCommand createReparentInstancesCommand(const QList<NodeInstance> &instanceList) const;
|
||||||
ReparentInstancesCommand createReparentInstancesCommand(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent) const;
|
ReparentInstancesCommand createReparentInstancesCommand(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent) const;
|
||||||
ChangeFileUrlCommand createChangeFileUrlCommand(const QUrl &fileUrl) const;
|
ChangeFileUrlCommand createChangeFileUrlCommand(const QUrl &fileUrl) const;
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ public:
|
|||||||
virtual void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
|
virtual void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
|
||||||
|
|
||||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
|
|
||||||
void nodeCreated(const ModelNode &createdNode);
|
void nodeCreated(const ModelNode &createdNode);
|
||||||
void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
|
void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ public:
|
|||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
|
|
||||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
|
|
||||||
void importAdded(const Import &import);
|
void importAdded(const Import &import);
|
||||||
void importRemoved(const Import &import);
|
void importRemoved(const Import &import);
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#include "completecomponentcommand.h"
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
CompleteComponentCommand::CompleteComponentCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CompleteComponentCommand::CompleteComponentCommand(const QVector<qint32> &container)
|
||||||
|
: m_instanceVector(container)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<qint32> CompleteComponentCommand::instances() const
|
||||||
|
{
|
||||||
|
return m_instanceVector;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CompleteComponentCommand &command)
|
||||||
|
{
|
||||||
|
out << command.instances();
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator>>(QDataStream &in, CompleteComponentCommand &command)
|
||||||
|
{
|
||||||
|
in >> command.m_instanceVector;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef COMPLETECOMPONENT_H
|
||||||
|
#define COMPLETECOMPONENT_H
|
||||||
|
|
||||||
|
#include <QMetaType>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
class CompleteComponentCommand
|
||||||
|
{
|
||||||
|
friend QDataStream &operator>>(QDataStream &in, CompleteComponentCommand &command);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CompleteComponentCommand();
|
||||||
|
CompleteComponentCommand(const QVector<qint32> &container);
|
||||||
|
|
||||||
|
QVector<qint32> instances() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVector<qint32> m_instanceVector;
|
||||||
|
};
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CompleteComponentCommand &command);
|
||||||
|
QDataStream &operator>>(QDataStream &in, CompleteComponentCommand &command);
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QmlDesigner::CompleteComponentCommand);
|
||||||
|
|
||||||
|
#endif // COMPLETECOMPONENT_H
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#include "componentcompletedcommand.h"
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
ComponentCompletedCommand::ComponentCompletedCommand()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentCompletedCommand::ComponentCompletedCommand(const QVector<qint32> &container)
|
||||||
|
: m_instanceVector(container)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<qint32> ComponentCompletedCommand::instances() const
|
||||||
|
{
|
||||||
|
return m_instanceVector;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command)
|
||||||
|
{
|
||||||
|
out << command.instances();
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command)
|
||||||
|
{
|
||||||
|
in >> command.m_instanceVector;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef COMPONENTCOMPLETEDCOMMAND_H
|
||||||
|
#define COMPONENTCOMPLETEDCOMMAND_H
|
||||||
|
#include <QMetaType>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
class ComponentCompletedCommand
|
||||||
|
{
|
||||||
|
friend QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command);
|
||||||
|
|
||||||
|
public:
|
||||||
|
ComponentCompletedCommand();
|
||||||
|
ComponentCompletedCommand(const QVector<qint32> &container);
|
||||||
|
|
||||||
|
QVector<qint32> instances() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVector<qint32> m_instanceVector;
|
||||||
|
};
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command);
|
||||||
|
QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command);
|
||||||
|
|
||||||
|
} // namespace QmlDesigner
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QmlDesigner::ComponentCompletedCommand);
|
||||||
|
|
||||||
|
#endif // COMPONENTCOMPLETEDCOMMAND_H
|
||||||
@@ -3,6 +3,8 @@ INCLUDEPATH += $$PWD/../include
|
|||||||
|
|
||||||
|
|
||||||
HEADERS += $$PWD/behaviornodeinstance.h
|
HEADERS += $$PWD/behaviornodeinstance.h
|
||||||
|
HEADERS += $$PWD/componentcompletedcommand.h
|
||||||
|
HEADERS += $$PWD//completecomponentcommand.h
|
||||||
HEADERS += $$PWDstatepreviewimagechangedcommand.h
|
HEADERS += $$PWDstatepreviewimagechangedcommand.h
|
||||||
HEADERS += $$PWD//imagecontainer.h
|
HEADERS += $$PWD//imagecontainer.h
|
||||||
HEADERS += $$PWD/childrenchangedcommand.h
|
HEADERS += $$PWD/childrenchangedcommand.h
|
||||||
@@ -45,6 +47,8 @@ HEADERS += $$PWD/../include/nodeinstanceserverinterface.h
|
|||||||
|
|
||||||
|
|
||||||
SOURCES += $$PWD/behaviornodeinstance.cpp
|
SOURCES += $$PWD/behaviornodeinstance.cpp
|
||||||
|
SOURCES += $$PWD/componentcompletedcommand.cpp
|
||||||
|
SOURCES += $$PWD/completecomponentcommand.cpp
|
||||||
SOURCES += $$PWD/statepreviewimagechangedcommand.cpp
|
SOURCES += $$PWD/statepreviewimagechangedcommand.cpp
|
||||||
SOURCES += $$PWD/imagecontainer.cpp
|
SOURCES += $$PWD/imagecontainer.cpp
|
||||||
SOURCES += $$PWD/childrenchangedcommand.cpp
|
SOURCES += $$PWD/childrenchangedcommand.cpp
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "changeidscommand.h"
|
#include "changeidscommand.h"
|
||||||
#include "changestatecommand.h"
|
#include "changestatecommand.h"
|
||||||
#include "addimportcommand.h"
|
#include "addimportcommand.h"
|
||||||
|
#include "completecomponentcommand.h"
|
||||||
|
|
||||||
#include "informationchangedcommand.h"
|
#include "informationchangedcommand.h"
|
||||||
#include "pixmapchangedcommand.h"
|
#include "pixmapchangedcommand.h"
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
#include "childrenchangedcommand.h"
|
#include "childrenchangedcommand.h"
|
||||||
#include "imagecontainer.h"
|
#include "imagecontainer.h"
|
||||||
#include "statepreviewimagechangedcommand.h"
|
#include "statepreviewimagechangedcommand.h"
|
||||||
|
#include "componentcompletedcommand.h"
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -83,6 +85,11 @@ void NodeInstanceClientProxy::statePreviewImagesChanged(const StatePreviewImageC
|
|||||||
writeCommand(QVariant::fromValue(command));
|
writeCommand(QVariant::fromValue(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeInstanceClientProxy::componentCompleted(const ComponentCompletedCommand &command)
|
||||||
|
{
|
||||||
|
writeCommand(QVariant::fromValue(command));
|
||||||
|
}
|
||||||
|
|
||||||
void NodeInstanceClientProxy::flush()
|
void NodeInstanceClientProxy::flush()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -142,6 +149,7 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
|
|||||||
static const int changeIdsCommandType = QMetaType::type("ChangeIdsCommand");
|
static const int changeIdsCommandType = QMetaType::type("ChangeIdsCommand");
|
||||||
static const int changeStateCommandType = QMetaType::type("ChangeStateCommand");
|
static const int changeStateCommandType = QMetaType::type("ChangeStateCommand");
|
||||||
static const int addImportCommandType = QMetaType::type("AddImportCommand");
|
static const int addImportCommandType = QMetaType::type("AddImportCommand");
|
||||||
|
static const int completeComponentCommandType = QMetaType::type("CompleteComponentCommand");
|
||||||
|
|
||||||
if (command.userType() == createInstancesCommandType)
|
if (command.userType() == createInstancesCommandType)
|
||||||
nodeInstanceServer()->createInstances(command.value<CreateInstancesCommand>());
|
nodeInstanceServer()->createInstances(command.value<CreateInstancesCommand>());
|
||||||
@@ -167,6 +175,8 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
|
|||||||
nodeInstanceServer()->changeState(command.value<ChangeStateCommand>());
|
nodeInstanceServer()->changeState(command.value<ChangeStateCommand>());
|
||||||
else if (command.userType() == addImportCommandType)
|
else if (command.userType() == addImportCommandType)
|
||||||
nodeInstanceServer()->addImport(command.value<AddImportCommand>());
|
nodeInstanceServer()->addImport(command.value<AddImportCommand>());
|
||||||
|
else if (command.userType() == completeComponentCommandType)
|
||||||
|
nodeInstanceServer()->completeComponent(command.value<CompleteComponentCommand>());
|
||||||
else
|
else
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public:
|
|||||||
void pixmapChanged(const PixmapChangedCommand &command);
|
void pixmapChanged(const PixmapChangedCommand &command);
|
||||||
void childrenChanged(const ChildrenChangedCommand &command);
|
void childrenChanged(const ChildrenChangedCommand &command);
|
||||||
void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
|
void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
|
||||||
|
void componentCompleted(const ComponentCompletedCommand &command);
|
||||||
|
|
||||||
void flush();
|
void flush();
|
||||||
qint64 bytesToWrite() const;
|
qint64 bytesToWrite() const;
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include "changestatecommand.h"
|
#include "changestatecommand.h"
|
||||||
#include "addimportcommand.h"
|
#include "addimportcommand.h"
|
||||||
#include "childrenchangedcommand.h"
|
#include "childrenchangedcommand.h"
|
||||||
|
#include "completecomponentcommand.h"
|
||||||
|
#include "componentcompletedcommand.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -76,8 +78,6 @@ void NodeInstanceServer::createInstances(const CreateInstancesCommand &command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.doComponentComplete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeInstanceClient()->valuesChanged(createValuesChangedCommand(instanceList));
|
nodeInstanceClient()->valuesChanged(createValuesChangedCommand(instanceList));
|
||||||
@@ -221,6 +221,17 @@ void NodeInstanceServer::changeState(const ChangeStateCommand &command)
|
|||||||
startRenderTimer();
|
startRenderTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeInstanceServer::completeComponent(const CompleteComponentCommand &command)
|
||||||
|
{
|
||||||
|
foreach(qint32 instanceId, command.instances()) {
|
||||||
|
if (hasInstanceForId(instanceId)) {
|
||||||
|
ServerNodeInstance instance = instanceForId(instanceId);
|
||||||
|
instance.doComponentComplete();
|
||||||
|
m_componentCompletedVector.append(instanceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NodeInstanceServer::addImport(const AddImportCommand &command)
|
void NodeInstanceServer::addImport(const AddImportCommand &command)
|
||||||
{
|
{
|
||||||
QString importStatement = QString("import ");
|
QString importStatement = QString("import ");
|
||||||
@@ -787,6 +798,10 @@ void NodeInstanceServer::findItemChangesAndSendChangeCommands()
|
|||||||
if (!parentChangedSet.isEmpty())
|
if (!parentChangedSet.isEmpty())
|
||||||
sendChildrenChangedCommand(parentChangedSet.toList());
|
sendChildrenChangedCommand(parentChangedSet.toList());
|
||||||
|
|
||||||
|
if (!m_componentCompletedVector.isEmpty())
|
||||||
|
nodeInstanceClient()->componentCompleted(ComponentCompletedCommand(m_componentCompletedVector));
|
||||||
|
m_componentCompletedVector.clear();
|
||||||
|
|
||||||
if (!dirtyInstanceSet.isEmpty())
|
if (!dirtyInstanceSet.isEmpty())
|
||||||
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(dirtyInstanceSet.toList()));
|
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(dirtyInstanceSet.toList()));
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
void reparentInstances(const ReparentInstancesCommand &command);
|
void reparentInstances(const ReparentInstancesCommand &command);
|
||||||
void changeState(const ChangeStateCommand &command);
|
void changeState(const ChangeStateCommand &command);
|
||||||
void addImport(const AddImportCommand &command);
|
void addImport(const AddImportCommand &command);
|
||||||
|
void completeComponent(const CompleteComponentCommand &command);
|
||||||
|
|
||||||
ServerNodeInstance instanceForId(qint32 id) const;
|
ServerNodeInstance instanceForId(qint32 id) const;
|
||||||
bool hasInstanceForId(qint32 id) const;
|
bool hasInstanceForId(qint32 id) const;
|
||||||
@@ -127,6 +128,7 @@ private:
|
|||||||
int m_timer;
|
int m_timer;
|
||||||
bool m_slowRenderTimer;
|
bool m_slowRenderTimer;
|
||||||
QVector<InstancePropertyPair> m_changedPropertyList;
|
QVector<InstancePropertyPair> m_changedPropertyList;
|
||||||
|
QVector<qint32> m_componentCompletedVector;
|
||||||
QStringList m_importList;
|
QStringList m_importList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "reparentinstancescommand.h"
|
#include "reparentinstancescommand.h"
|
||||||
#include "changeidscommand.h"
|
#include "changeidscommand.h"
|
||||||
#include "changestatecommand.h"
|
#include "changestatecommand.h"
|
||||||
|
#include "completecomponentcommand.h"
|
||||||
|
|
||||||
#include "informationchangedcommand.h"
|
#include "informationchangedcommand.h"
|
||||||
#include "pixmapchangedcommand.h"
|
#include "pixmapchangedcommand.h"
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
#include "childrenchangedcommand.h"
|
#include "childrenchangedcommand.h"
|
||||||
#include "imagecontainer.h"
|
#include "imagecontainer.h"
|
||||||
#include "statepreviewimagechangedcommand.h"
|
#include "statepreviewimagechangedcommand.h"
|
||||||
|
#include "componentcompletedcommand.h"
|
||||||
|
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -117,6 +119,12 @@ void NodeInstanceServerInterface::registerCommands()
|
|||||||
|
|
||||||
qRegisterMetaType<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
|
qRegisterMetaType<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
|
||||||
qRegisterMetaTypeStreamOperators<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
|
qRegisterMetaTypeStreamOperators<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
|
||||||
|
|
||||||
|
qRegisterMetaType<CompleteComponentCommand>("CompleteComponentCommand");
|
||||||
|
qRegisterMetaTypeStreamOperators<CompleteComponentCommand>("CompleteComponentCommand");
|
||||||
|
|
||||||
|
qRegisterMetaType<ComponentCompletedCommand>("ComponentCompletedCommand");
|
||||||
|
qRegisterMetaTypeStreamOperators<ComponentCompletedCommand>("ComponentCompletedCommand");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "changeidscommand.h"
|
#include "changeidscommand.h"
|
||||||
#include "changestatecommand.h"
|
#include "changestatecommand.h"
|
||||||
#include "addimportcommand.h"
|
#include "addimportcommand.h"
|
||||||
|
#include "completecomponentcommand.h"
|
||||||
|
|
||||||
#include "informationchangedcommand.h"
|
#include "informationchangedcommand.h"
|
||||||
#include "pixmapchangedcommand.h"
|
#include "pixmapchangedcommand.h"
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
#include "childrenchangedcommand.h"
|
#include "childrenchangedcommand.h"
|
||||||
#include "imagecontainer.h"
|
#include "imagecontainer.h"
|
||||||
#include "statepreviewimagechangedcommand.h"
|
#include "statepreviewimagechangedcommand.h"
|
||||||
|
#include "componentcompletedcommand.h"
|
||||||
|
|
||||||
#include "nodeinstanceview.h"
|
#include "nodeinstanceview.h"
|
||||||
#include "nodeinstanceclientproxy.h"
|
#include "nodeinstanceclientproxy.h"
|
||||||
@@ -78,6 +80,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
|
|||||||
static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand");
|
static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand");
|
||||||
static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand");
|
static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand");
|
||||||
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand");
|
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand");
|
||||||
|
static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand");
|
||||||
|
|
||||||
if (command.userType() == informationChangedCommandType)
|
if (command.userType() == informationChangedCommandType)
|
||||||
nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>());
|
nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>());
|
||||||
@@ -89,6 +92,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
|
|||||||
nodeInstanceClient()->childrenChanged(command.value<ChildrenChangedCommand>());
|
nodeInstanceClient()->childrenChanged(command.value<ChildrenChangedCommand>());
|
||||||
else if (command.userType() == statePreviewImageChangedCommandType)
|
else if (command.userType() == statePreviewImageChangedCommandType)
|
||||||
nodeInstanceClient()->statePreviewImagesChanged(command.value<StatePreviewImageChangedCommand>());
|
nodeInstanceClient()->statePreviewImagesChanged(command.value<StatePreviewImageChangedCommand>());
|
||||||
|
else if (command.userType() == componentCompletedCommandType)
|
||||||
|
nodeInstanceClient()->componentCompleted(command.value<ComponentCompletedCommand>());
|
||||||
else
|
else
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
@@ -213,4 +218,9 @@ void NodeInstanceServerProxy::addImport(const AddImportCommand &command)
|
|||||||
{
|
{
|
||||||
writeCommand(QVariant::fromValue(command));
|
writeCommand(QVariant::fromValue(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeInstanceServerProxy::completeComponent(const CompleteComponentCommand &command)
|
||||||
|
{
|
||||||
|
writeCommand(QVariant::fromValue(command));
|
||||||
|
}
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public:
|
|||||||
void changeIds(const ChangeIdsCommand &command);
|
void changeIds(const ChangeIdsCommand &command);
|
||||||
void changeState(const ChangeStateCommand &command);
|
void changeState(const ChangeStateCommand &command);
|
||||||
void addImport(const AddImportCommand &command);
|
void addImport(const AddImportCommand &command);
|
||||||
|
void completeComponent(const CompleteComponentCommand &command);
|
||||||
|
|
||||||
void setBlockUpdates(bool block);
|
void setBlockUpdates(bool block);
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,8 @@
|
|||||||
#include "childrenchangedcommand.h"
|
#include "childrenchangedcommand.h"
|
||||||
#include "imagecontainer.h"
|
#include "imagecontainer.h"
|
||||||
#include "statepreviewimagechangedcommand.h"
|
#include "statepreviewimagechangedcommand.h"
|
||||||
|
#include "completecomponentcommand.h"
|
||||||
|
#include "componentcompletedcommand.h"
|
||||||
|
|
||||||
#include "nodeinstanceserverproxy.h"
|
#include "nodeinstanceserverproxy.h"
|
||||||
|
|
||||||
@@ -144,6 +146,7 @@ void NodeInstanceView::modelAttached(Model *model)
|
|||||||
nodeInstanceServer()->addImport(createImportCommand(import));
|
nodeInstanceServer()->addImport(createImportCommand(import));
|
||||||
|
|
||||||
loadNodes(allModelNodes());
|
loadNodes(allModelNodes());
|
||||||
|
|
||||||
setBlockUpdates(false);
|
setBlockUpdates(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +179,7 @@ void NodeInstanceView::nodeCreated(const ModelNode &createdNode)
|
|||||||
NodeInstance instance = loadNode(createdNode);
|
NodeInstance instance = loadNode(createdNode);
|
||||||
nodeInstanceServer()->createInstances(createCreateInstancesCommand(QList<NodeInstance>() << instance));
|
nodeInstanceServer()->createInstances(createCreateInstancesCommand(QList<NodeInstance>() << instance));
|
||||||
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(createdNode.variantProperties()));
|
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(createdNode.variantProperties()));
|
||||||
|
nodeInstanceServer()->completeComponent(createComponentCompleteCommand(QList<NodeInstance>() << instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Notifing the view that a node was created.
|
/*! \brief Notifing the view that a node was created.
|
||||||
@@ -427,6 +431,10 @@ void NodeInstanceView::instancePropertyChange(const QList<QPair<ModelNode, QStri
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeInstanceView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void NodeInstanceView::importAdded(const Import &import)
|
void NodeInstanceView::importAdded(const Import &import)
|
||||||
{
|
{
|
||||||
nodeInstanceServer()->addImport(createImportCommand(import));
|
nodeInstanceServer()->addImport(createImportCommand(import));
|
||||||
@@ -456,17 +464,12 @@ void NodeInstanceView::loadNodes(const QList<ModelNode> &nodeList)
|
|||||||
bindingPropertyList.append(node.bindingProperties());
|
bindingPropertyList.append(node.bindingProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
// QListIterator<ModelNode> listIterator(nodeList);
|
|
||||||
// listIterator.toBack();
|
|
||||||
|
|
||||||
// while (listIterator.hasPrevious())
|
|
||||||
// instanceForNode(listIterator.previous()).doComponentComplete();
|
|
||||||
|
|
||||||
nodeInstanceServer()->createInstances(createCreateInstancesCommand(instanceList));
|
nodeInstanceServer()->createInstances(createCreateInstancesCommand(instanceList));
|
||||||
nodeInstanceServer()->reparentInstances(createReparentInstancesCommand(instanceList));
|
nodeInstanceServer()->reparentInstances(createReparentInstancesCommand(instanceList));
|
||||||
nodeInstanceServer()->changeIds(createChangeIdsCommand(instanceList));
|
nodeInstanceServer()->changeIds(createChangeIdsCommand(instanceList));
|
||||||
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(variantPropertyList));
|
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(variantPropertyList));
|
||||||
nodeInstanceServer()->changePropertyBindings(createChangeBindingCommand(bindingPropertyList));
|
nodeInstanceServer()->changePropertyBindings(createChangeBindingCommand(bindingPropertyList));
|
||||||
|
nodeInstanceServer()->completeComponent(createComponentCompleteCommand(instanceList));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeInstanceView::removeAllInstanceNodeRelationships()
|
void NodeInstanceView::removeAllInstanceNodeRelationships()
|
||||||
@@ -692,6 +695,28 @@ ClearSceneCommand NodeInstanceView::createClearSceneCommand() const
|
|||||||
return ClearSceneCommand();
|
return ClearSceneCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompleteComponentCommand NodeInstanceView::createComponentCompleteCommand(const QList<NodeInstance> &instanceList) const
|
||||||
|
{
|
||||||
|
QVector<qint32> containerList;
|
||||||
|
foreach(const NodeInstance &instance, instanceList) {
|
||||||
|
if (instance.instanceId() >= 0)
|
||||||
|
containerList.append(instance.instanceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return CompleteComponentCommand(containerList);
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentCompletedCommand NodeInstanceView::createComponentCompletedCommand(const QList<NodeInstance> &instanceList) const
|
||||||
|
{
|
||||||
|
QVector<qint32> containerList;
|
||||||
|
foreach(const NodeInstance &instance, instanceList) {
|
||||||
|
if (instance.instanceId() >= 0)
|
||||||
|
containerList.append(instance.instanceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ComponentCompletedCommand(containerList);
|
||||||
|
}
|
||||||
|
|
||||||
CreateInstancesCommand NodeInstanceView::createCreateInstancesCommand(const QList<NodeInstance> &instanceList) const
|
CreateInstancesCommand NodeInstanceView::createCreateInstancesCommand(const QList<NodeInstance> &instanceList) const
|
||||||
{
|
{
|
||||||
QVector<InstanceContainer> containerList;
|
QVector<InstanceContainer> containerList;
|
||||||
@@ -910,6 +935,23 @@ void NodeInstanceView::statePreviewImagesChanged(const StatePreviewImageChangedC
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeInstanceView::componentCompleted(const ComponentCompletedCommand &command)
|
||||||
|
{
|
||||||
|
if (!model())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QVector<ModelNode> nodeVector;
|
||||||
|
|
||||||
|
foreach(const qint32 &instanceId, command.instances()) {
|
||||||
|
if (hasModelNodeForInternalId(instanceId)) {
|
||||||
|
nodeVector.append(modelNodeForInternalId(instanceId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nodeVector.isEmpty())
|
||||||
|
emitInstancesCompleted(nodeVector);
|
||||||
|
}
|
||||||
|
|
||||||
void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
|
void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command)
|
||||||
{
|
{
|
||||||
if (!model())
|
if (!model())
|
||||||
|
|||||||
@@ -393,6 +393,12 @@ void AbstractView::emitInstancePropertyChange(const QList<QPair<ModelNode, QStri
|
|||||||
model()->m_d->notifyInstancePropertyChange(propertyList);
|
model()->m_d->notifyInstancePropertyChange(propertyList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractView::emitInstancesCompleted(const QVector<ModelNode> &nodeVector)
|
||||||
|
{
|
||||||
|
if (model() && nodeInstanceView() == this)
|
||||||
|
model()->m_d->notifyInstancesCompleted(nodeVector);
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractView::changeRootNodeType(const QString &type, int majorVersion, int minorVersion)
|
void AbstractView::changeRootNodeType(const QString &type, int majorVersion, int minorVersion)
|
||||||
{
|
{
|
||||||
Internal::WriteLocker locker(m_model.data());
|
Internal::WriteLocker locker(m_model.data());
|
||||||
|
|||||||
@@ -414,6 +414,35 @@ void ModelPrivate::notifyInstancePropertyChange(const QList<QPair<ModelNode, QSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelPrivate::notifyInstancesCompleted(const QVector<ModelNode> &nodeVector)
|
||||||
|
{
|
||||||
|
bool resetModel = false;
|
||||||
|
QString description;
|
||||||
|
|
||||||
|
QVector<Internal::InternalNode::Pointer> internalVector(toInternalNodeVector(nodeVector));
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (rewriterView())
|
||||||
|
rewriterView()->instancesCompleted(toModelNodeVector(internalVector, rewriterView()));
|
||||||
|
} catch (RewritingException &e) {
|
||||||
|
description = e.description();
|
||||||
|
resetModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
|
||||||
|
Q_ASSERT(view != 0);
|
||||||
|
view->instancesCompleted(toModelNodeVector(internalVector, view.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeInstanceView()) {
|
||||||
|
nodeInstanceView()->instancesCompleted(toModelNodeVector(internalVector, nodeInstanceView()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resetModel) {
|
||||||
|
resetModelByRewriter(description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
|
void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
|
||||||
{
|
{
|
||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
@@ -1026,6 +1055,15 @@ QList<ModelNode> ModelPrivate::toModelNodeList(const QList<InternalNode::Pointer
|
|||||||
return newNodeList;
|
return newNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<ModelNode> ModelPrivate::toModelNodeVector(const QVector<InternalNode::Pointer> &nodeVector, AbstractView *view) const
|
||||||
|
{
|
||||||
|
QVector<ModelNode> newNodeVector;
|
||||||
|
foreach (const Internal::InternalNode::Pointer &node, nodeVector)
|
||||||
|
newNodeVector.append(ModelNode(node, model(), view));
|
||||||
|
|
||||||
|
return newNodeVector;
|
||||||
|
}
|
||||||
|
|
||||||
QList<Internal::InternalNode::Pointer> ModelPrivate::toInternalNodeList(const QList<ModelNode> &nodeList) const
|
QList<Internal::InternalNode::Pointer> ModelPrivate::toInternalNodeList(const QList<ModelNode> &nodeList) const
|
||||||
{
|
{
|
||||||
QList<Internal::InternalNode::Pointer> newNodeList;
|
QList<Internal::InternalNode::Pointer> newNodeList;
|
||||||
@@ -1035,6 +1073,15 @@ QList<Internal::InternalNode::Pointer> ModelPrivate::toInternalNodeList(const QL
|
|||||||
return newNodeList;
|
return newNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<Internal::InternalNode::Pointer> ModelPrivate::toInternalNodeVector(const QVector<ModelNode> &nodeVector) const
|
||||||
|
{
|
||||||
|
QVector<Internal::InternalNode::Pointer> newNodeVector;
|
||||||
|
foreach (const ModelNode &node, nodeVector)
|
||||||
|
newNodeVector.append(node.internalNode());
|
||||||
|
|
||||||
|
return newNodeVector;
|
||||||
|
}
|
||||||
|
|
||||||
void ModelPrivate::changeSelectedNodes(const QList<InternalNode::Pointer> &newSelectedNodeList,
|
void ModelPrivate::changeSelectedNodes(const QList<InternalNode::Pointer> &newSelectedNodeList,
|
||||||
const QList<InternalNode::Pointer> &oldSelectedNodeList)
|
const QList<InternalNode::Pointer> &oldSelectedNodeList)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public:
|
|||||||
|
|
||||||
void notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
void notifyInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void notifyInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void notifyInstancesCompleted(const QVector<ModelNode> &nodeList);
|
||||||
|
|
||||||
|
|
||||||
void setSelectedNodes(const QList<InternalNodePointer> &selectedNodeList);
|
void setSelectedNodes(const QList<InternalNodePointer> &selectedNodeList);
|
||||||
@@ -207,6 +207,8 @@ private: //functions
|
|||||||
void removeNodeFromModel(const InternalNodePointer &node);
|
void removeNodeFromModel(const InternalNodePointer &node);
|
||||||
QList<InternalNodePointer> toInternalNodeList(const QList<ModelNode> &nodeList) const;
|
QList<InternalNodePointer> toInternalNodeList(const QList<ModelNode> &nodeList) const;
|
||||||
QList<ModelNode> toModelNodeList(const QList<InternalNodePointer> &nodeList, AbstractView *view) const;
|
QList<ModelNode> toModelNodeList(const QList<InternalNodePointer> &nodeList, AbstractView *view) const;
|
||||||
|
QVector<ModelNode> toModelNodeVector(const QVector<InternalNodePointer> &nodeVector, AbstractView *view) const;
|
||||||
|
QVector<InternalNodePointer> toInternalNodeVector(const QVector<ModelNode> &nodeVector) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Model *m_q;
|
Model *m_q;
|
||||||
|
|||||||
@@ -362,6 +362,9 @@ void QmlModelView::instancePropertyChange(const QList<QPair<ModelNode, QString>
|
|||||||
nodeInstancePropertyChanged(propertyPair.first, propertyPair.second);
|
nodeInstancePropertyChanged(propertyPair.first, propertyPair.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void QmlModelView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void QmlModelView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName)
|
void QmlModelView::nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName)
|
||||||
{
|
{
|
||||||
@@ -431,7 +434,7 @@ void QmlModelView::otherPropertyChanged(const QmlObjectNode &/*qmlObjectNode*/,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlModelView::stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState)
|
void QmlModelView::stateChanged(const QmlModelState &/*newQmlModelState*/, const QmlModelState &/*oldQmlModelState*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -385,6 +385,10 @@ void RewriterView::instancePropertyChange(const QList<QPair<ModelNode, QString>
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RewriterView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RewriterView::selectedNodesChanged(const QList<ModelNode> & /* selectedNodeList, */, const QList<ModelNode> & /*lastSelectedNodeList */)
|
void RewriterView::selectedNodesChanged(const QList<ModelNode> & /* selectedNodeList, */, const QList<ModelNode> & /*lastSelectedNodeList */)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -212,6 +212,14 @@ void ViewLogger::instancePropertyChange(const QList<QPair<ModelNode, QString> >
|
|||||||
m_output << time() << indent("property: ") << propertyPair.first << propertyPair.second << endl;
|
m_output << time() << indent("property: ") << propertyPair.first << propertyPair.second << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewLogger::instancesCompleted(const QVector<ModelNode> &completedNodeList)
|
||||||
|
{
|
||||||
|
m_output << time() << indent("instancesCompleted:") << endl;
|
||||||
|
|
||||||
|
foreach(const ModelNode &node, completedNodeList)
|
||||||
|
m_output << time() << indent("node: ") << node << endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
|
||||||
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList);
|
||||||
|
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
|
||||||
protected:
|
protected:
|
||||||
QString time() const;
|
QString time() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user