aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmlpuppetcommunication
diff options
context:
space:
mode:
authorMarco Bubke <[email protected]>2022-11-02 13:58:34 +0100
committerMarco Bubke <[email protected]>2022-11-09 12:29:38 +0000
commit63022d08ea8f9f04a75d301602e639b83b1b7396 (patch)
tree99fbbfeafcb1ad0b4600f5d63b8071678894e8a5 /src/libs/qmlpuppetcommunication
parentac526d326cab6f19955cec4e19c73bc309bd96c8 (diff)
QmlDesigner: QmlPuppet as standalone tool
The qmlpuppet is now a standalone tool. There is new a library too with the communication code. That is shared between the designer and the puppet. It's in a .cmake file so it can be included by the standalone tool if it is not part of a designer build. Task-number: QDS-5879 Change-Id: I2bc2a0b463fbb3e0c8c23d182abfd368cf87e968 Reviewed-by: Thomas Hartmann <[email protected]> Reviewed-by: <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
Diffstat (limited to 'src/libs/qmlpuppetcommunication')
-rw-r--r--src/libs/qmlpuppetcommunication/CMakeLists.txt1
-rw-r--r--src/libs/qmlpuppetcommunication/QmlPuppetCommunication.cmake87
-rw-r--r--src/libs/qmlpuppetcommunication/commands/captureddatacommand.h165
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.cpp15
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.h37
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changebindingscommand.cpp15
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changebindingscommand.h33
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changefileurlcommand.cpp16
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changefileurlcommand.h34
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changeidscommand.cpp15
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changeidscommand.h35
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changelanguagecommand.cpp15
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changelanguagecommand.h35
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.cpp51
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.h35
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.cpp24
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.h28
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changeselectioncommand.cpp47
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changeselectioncommand.h39
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changestatecommand.cpp44
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changestatecommand.h35
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changevaluescommand.cpp41
-rw-r--r--src/libs/qmlpuppetcommunication/commands/changevaluescommand.h35
-rw-r--r--src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.cpp77
-rw-r--r--src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.h41
-rw-r--r--src/libs/qmlpuppetcommunication/commands/clearscenecommand.cpp27
-rw-r--r--src/libs/qmlpuppetcommunication/commands/clearscenecommand.h23
-rw-r--r--src/libs/qmlpuppetcommunication/commands/completecomponentcommand.cpp42
-rw-r--r--src/libs/qmlpuppetcommunication/commands/completecomponentcommand.h34
-rw-r--r--src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.cpp56
-rw-r--r--src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.h36
-rw-r--r--src/libs/qmlpuppetcommunication/commands/createinstancescommand.cpp42
-rw-r--r--src/libs/qmlpuppetcommunication/commands/createinstancescommand.h34
-rw-r--r--src/libs/qmlpuppetcommunication/commands/createscenecommand.cpp27
-rw-r--r--src/libs/qmlpuppetcommunication/commands/createscenecommand.h133
-rw-r--r--src/libs/qmlpuppetcommunication/commands/debugoutputcommand.cpp65
-rw-r--r--src/libs/qmlpuppetcommunication/commands/debugoutputcommand.h47
-rw-r--r--src/libs/qmlpuppetcommunication/commands/endpuppetcommand.cpp27
-rw-r--r--src/libs/qmlpuppetcommunication/commands/endpuppetcommand.h23
-rw-r--r--src/libs/qmlpuppetcommunication/commands/informationchangedcommand.cpp57
-rw-r--r--src/libs/qmlpuppetcommunication/commands/informationchangedcommand.h38
-rw-r--r--src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp88
-rw-r--r--src/libs/qmlpuppetcommunication/commands/inputeventcommand.h58
-rw-r--r--src/libs/qmlpuppetcommunication/commands/nanotracecommand.cpp77
-rw-r--r--src/libs/qmlpuppetcommunication/commands/nanotracecommand.h55
-rw-r--r--src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.cpp55
-rw-r--r--src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.h36
-rw-r--r--src/libs/qmlpuppetcommunication/commands/puppetalivecommand.cpp25
-rw-r--r--src/libs/qmlpuppetcommunication/commands/puppetalivecommand.h27
-rw-r--r--src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.cpp33
-rw-r--r--src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.h42
-rw-r--r--src/libs/qmlpuppetcommunication/commands/removeinstancescommand.cpp42
-rw-r--r--src/libs/qmlpuppetcommunication/commands/removeinstancescommand.h36
-rw-r--r--src/libs/qmlpuppetcommunication/commands/removepropertiescommand.cpp41
-rw-r--r--src/libs/qmlpuppetcommunication/commands/removepropertiescommand.h35
-rw-r--r--src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.cpp52
-rw-r--r--src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.h36
-rw-r--r--src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.cpp43
-rw-r--r--src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.h35
-rw-r--r--src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.cpp71
-rw-r--r--src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.h63
-rw-r--r--src/libs/qmlpuppetcommunication/commands/scenecreatedcommand.h20
-rw-r--r--src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.cpp54
-rw-r--r--src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.h37
-rw-r--r--src/libs/qmlpuppetcommunication/commands/synchronizecommand.h58
-rw-r--r--src/libs/qmlpuppetcommunication/commands/tokencommand.cpp77
-rw-r--r--src/libs/qmlpuppetcommunication/commands/tokencommand.h43
-rw-r--r--src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.cpp52
-rw-r--r--src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.h38
-rw-r--r--src/libs/qmlpuppetcommunication/commands/valueschangedcommand.cpp181
-rw-r--r--src/libs/qmlpuppetcommunication/commands/valueschangedcommand.h66
-rw-r--r--src/libs/qmlpuppetcommunication/commands/view3dactioncommand.cpp79
-rw-r--r--src/libs/qmlpuppetcommunication/commands/view3dactioncommand.h41
-rw-r--r--src/libs/qmlpuppetcommunication/container/addimportcontainer.cpp90
-rw-r--r--src/libs/qmlpuppetcommunication/container/addimportcontainer.h41
-rw-r--r--src/libs/qmlpuppetcommunication/container/idcontainer.cpp54
-rw-r--r--src/libs/qmlpuppetcommunication/container/idcontainer.h36
-rw-r--r--src/libs/qmlpuppetcommunication/container/imagecontainer.cpp255
-rw-r--r--src/libs/qmlpuppetcommunication/container/imagecontainer.h44
-rw-r--r--src/libs/qmlpuppetcommunication/container/informationcontainer.cpp124
-rw-r--r--src/libs/qmlpuppetcommunication/container/informationcontainer.h53
-rw-r--r--src/libs/qmlpuppetcommunication/container/instancecontainer.cpp155
-rw-r--r--src/libs/qmlpuppetcommunication/container/instancecontainer.h80
-rw-r--r--src/libs/qmlpuppetcommunication/container/mockuptypecontainer.cpp63
-rw-r--r--src/libs/qmlpuppetcommunication/container/mockuptypecontainer.h52
-rw-r--r--src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.cpp75
-rw-r--r--src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.h44
-rw-r--r--src/libs/qmlpuppetcommunication/container/propertybindingcontainer.cpp81
-rw-r--r--src/libs/qmlpuppetcommunication/container/propertybindingcontainer.h42
-rw-r--r--src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.cpp134
-rw-r--r--src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.h54
-rw-r--r--src/libs/qmlpuppetcommunication/container/reparentcontainer.cpp98
-rw-r--r--src/libs/qmlpuppetcommunication/container/reparentcontainer.h44
-rw-r--r--src/libs/qmlpuppetcommunication/container/sharedmemory.h67
-rw-r--r--src/libs/qmlpuppetcommunication/container/sharedmemory_qt.cpp87
-rw-r--r--src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp464
-rw-r--r--src/libs/qmlpuppetcommunication/interfaces/commondefines.h41
-rw-r--r--src/libs/qmlpuppetcommunication/interfaces/nodeinstanceclientinterface.h48
-rw-r--r--src/libs/qmlpuppetcommunication/interfaces/nodeinstanceglobal.h62
-rw-r--r--src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.cpp133
-rw-r--r--src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.h74
-rw-r--r--src/libs/qmlpuppetcommunication/types/enumeration.h98
102 files changed, 6100 insertions, 0 deletions
diff --git a/src/libs/qmlpuppetcommunication/CMakeLists.txt b/src/libs/qmlpuppetcommunication/CMakeLists.txt
new file mode 100644
index 00000000000..a6b74f58e65
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/CMakeLists.txt
@@ -0,0 +1 @@
+include(QmlPuppetCommunication.cmake)
diff --git a/src/libs/qmlpuppetcommunication/QmlPuppetCommunication.cmake b/src/libs/qmlpuppetcommunication/QmlPuppetCommunication.cmake
new file mode 100644
index 00000000000..43cbc78af2d
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/QmlPuppetCommunication.cmake
@@ -0,0 +1,87 @@
+add_qtc_library(QmlPuppetCommunication STATIC
+ PROPERTIES AUTOUIC OFF
+ DEPENDS Qt5::Core Qt5::CorePrivate Qt5::Gui
+)
+
+extend_qtc_library(QmlPuppetCommunication
+ CONDITION TARGET Nanotrace
+ PUBLIC_DEPENDS Nanotrace
+)
+
+extend_qtc_library(QmlPuppetCommunication
+ PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/types
+ SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/types
+ SOURCES
+ enumeration.h
+)
+
+extend_qtc_library(QmlPuppetCommunication
+ PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/interfaces
+ SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/interfaces
+ SOURCES
+ commondefines.h
+ nodeinstanceclientinterface.h
+ nodeinstanceserverinterface.cpp nodeinstanceserverinterface.h
+ nodeinstanceglobal.h
+)
+
+extend_qtc_library(QmlPuppetCommunication
+ PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/container
+ SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/container
+ SOURCES
+ addimportcontainer.cpp addimportcontainer.h
+ idcontainer.cpp idcontainer.h
+ imagecontainer.cpp imagecontainer.h
+ informationcontainer.cpp informationcontainer.h
+ instancecontainer.cpp instancecontainer.h
+ mockuptypecontainer.cpp mockuptypecontainer.h
+ propertyabstractcontainer.cpp propertyabstractcontainer.h
+ propertybindingcontainer.cpp propertybindingcontainer.h
+ propertyvaluecontainer.cpp propertyvaluecontainer.h
+ reparentcontainer.cpp reparentcontainer.h
+ sharedmemory.h
+ $<IF:$<BOOL:${UNIX}>,sharedmemory_unix.cpp,sharedmemory_qt.cpp>
+)
+
+extend_qtc_library(QmlPuppetCommunication
+ PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/commands
+ SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/commands
+ SOURCES
+ captureddatacommand.h
+ changeauxiliarycommand.cpp changeauxiliarycommand.h
+ changebindingscommand.cpp changebindingscommand.h
+ changefileurlcommand.cpp changefileurlcommand.h
+ changeidscommand.cpp changeidscommand.h
+ changelanguagecommand.cpp changelanguagecommand.h
+ changenodesourcecommand.cpp changenodesourcecommand.h
+ changepreviewimagesizecommand.cpp changepreviewimagesizecommand.h
+ changeselectioncommand.cpp changeselectioncommand.h
+ changestatecommand.cpp changestatecommand.h
+ changevaluescommand.cpp changevaluescommand.h
+ childrenchangedcommand.cpp childrenchangedcommand.h
+ clearscenecommand.cpp clearscenecommand.h
+ completecomponentcommand.cpp completecomponentcommand.h
+ componentcompletedcommand.cpp componentcompletedcommand.h
+ createinstancescommand.cpp createinstancescommand.h
+ createscenecommand.cpp createscenecommand.h
+ debugoutputcommand.cpp debugoutputcommand.h
+ endpuppetcommand.cpp endpuppetcommand.h
+ informationchangedcommand.cpp informationchangedcommand.h
+ inputeventcommand.cpp inputeventcommand.h
+ nanotracecommand.cpp nanotracecommand.h
+ pixmapchangedcommand.cpp pixmapchangedcommand.h
+ puppetalivecommand.cpp puppetalivecommand.h
+ puppettocreatorcommand.cpp puppettocreatorcommand.h
+ removeinstancescommand.cpp removeinstancescommand.h
+ removepropertiescommand.cpp removepropertiescommand.h
+ removesharedmemorycommand.cpp removesharedmemorycommand.h
+ reparentinstancescommand.cpp reparentinstancescommand.h
+ requestmodelnodepreviewimagecommand.cpp requestmodelnodepreviewimagecommand.h
+ scenecreatedcommand.h
+ statepreviewimagechangedcommand.cpp statepreviewimagechangedcommand.h
+ synchronizecommand.h
+ tokencommand.cpp tokencommand.h
+ update3dviewstatecommand.cpp update3dviewstatecommand.h
+ valueschangedcommand.cpp valueschangedcommand.h
+ view3dactioncommand.cpp view3dactioncommand.h
+)
diff --git a/src/libs/qmlpuppetcommunication/commands/captureddatacommand.h b/src/libs/qmlpuppetcommunication/commands/captureddatacommand.h
new file mode 100644
index 00000000000..25f580e0b22
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/captureddatacommand.h
@@ -0,0 +1,165 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVariant>
+
+#include "imagecontainer.h"
+
+#include <vector>
+
+namespace QmlDesigner {
+
+template<typename Type>
+QDataStream &operator<<(QDataStream &out, const std::vector<Type> &vector)
+{
+ out << quint64(vector.size());
+
+ for (auto &&entry : vector)
+ out << entry;
+
+ return out;
+}
+
+template<typename Type>
+QDataStream &operator>>(QDataStream &in, std::vector<Type> &vector)
+{
+ vector.clear();
+
+ quint64 size;
+
+ in >> size;
+
+ vector.reserve(size);
+
+ for (quint64 i = 0; i < size; ++i) {
+ Type entry;
+
+ in >> entry;
+
+ vector.push_back(std::move(entry));
+ }
+
+ return in;
+}
+
+class CapturedDataCommand
+{
+public:
+ struct Property
+ {
+ Property() = default;
+ Property(QString key, QVariant value)
+ : key(std::move(key))
+ , value(std::move(value))
+ {}
+
+ friend QDataStream &operator<<(QDataStream &out, const Property &property)
+ {
+ out << property.key;
+ out << property.value;
+
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, Property &property)
+ {
+ in >> property.key;
+ in >> property.value;
+
+ return in;
+ }
+
+ QString key;
+ QVariant value;
+ };
+
+ struct NodeData
+ {
+ friend QDataStream &operator<<(QDataStream &out, const NodeData &data)
+ {
+ out << data.nodeId;
+ out << data.contentRect;
+ out << data.sceneTransform;
+ out << data.properties;
+
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, NodeData &data)
+ {
+ in >> data.nodeId;
+ in >> data.contentRect;
+ in >> data.sceneTransform;
+ in >> data.properties;
+
+ return in;
+ }
+
+ qint32 nodeId = -1;
+ QRectF contentRect;
+ QTransform sceneTransform;
+ std::vector<Property> properties;
+ };
+
+ struct StateData
+ {
+ friend QDataStream &operator<<(QDataStream &out, const StateData &data)
+ {
+ out << data.image;
+ out << data.nodeData;
+ out << data.nodeId;
+
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, StateData &data)
+ {
+ in >> data.image;
+ in >> data.nodeData;
+ in >> data.nodeId;
+
+ return in;
+ }
+
+ ImageContainer image;
+ std::vector<NodeData> nodeData;
+ qint32 nodeId = -1;
+ };
+
+ CapturedDataCommand() = default;
+
+ CapturedDataCommand(QVector<StateData> &&stateData)
+ : stateData{std::move(stateData)}
+ {}
+
+ CapturedDataCommand(QImage &&image)
+ : image{std::move(image)}
+ {}
+
+ friend QDataStream &operator<<(QDataStream &out, const CapturedDataCommand &command)
+ {
+ out << command.image;
+ out << command.stateData;
+
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, CapturedDataCommand &command)
+ {
+ in >> command.image;
+ in >> command.stateData;
+
+ return in;
+ }
+
+public:
+ QImage image;
+ QVector<StateData> stateData;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::CapturedDataCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.cpp b/src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.cpp
new file mode 100644
index 00000000000..1d61f21e89c
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changeauxiliarycommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QDebug operator <<(QDebug debug, const ChangeAuxiliaryCommand &command)
+{
+ return debug.nospace() << "ChangeAuxiliaryCommand(auxiliaryChanges: " << command.auxiliaryChanges << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.h b/src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.h
new file mode 100644
index 00000000000..a9264e606f3
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changeauxiliarycommand.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDataStream>
+#include <QDebug>
+#include <QMetaType>
+#include <QVector>
+
+#include "propertyvaluecontainer.h"
+
+namespace QmlDesigner {
+
+class ChangeAuxiliaryCommand
+{
+public:
+ friend QDataStream &operator>>(QDataStream &in, ChangeAuxiliaryCommand &command)
+ {
+ in >> command.auxiliaryChanges;
+ return in;
+ }
+
+ friend QDataStream &operator<<(QDataStream &out, const ChangeAuxiliaryCommand &command)
+ {
+ out << command.auxiliaryChanges;
+ return out;
+ }
+
+ friend QDebug operator <<(QDebug debug, const ChangeAuxiliaryCommand &command);
+
+ QVector<PropertyValueContainer> auxiliaryChanges;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeAuxiliaryCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changebindingscommand.cpp b/src/libs/qmlpuppetcommunication/commands/changebindingscommand.cpp
new file mode 100644
index 00000000000..b32456e70cc
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changebindingscommand.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changebindingscommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QDebug operator <<(QDebug debug, const ChangeBindingsCommand &command)
+{
+ return debug.nospace() << "PropertyValueContainer(bindingChanges: " << command.bindingChanges << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changebindingscommand.h b/src/libs/qmlpuppetcommunication/commands/changebindingscommand.h
new file mode 100644
index 00000000000..215e143b6f0
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changebindingscommand.h
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "propertybindingcontainer.h"
+
+namespace QmlDesigner {
+
+class ChangeBindingsCommand
+{
+public:
+ friend QDataStream &operator>>(QDataStream &in, ChangeBindingsCommand &command) {
+ in >> command.bindingChanges;
+ return in;
+ }
+
+ friend QDataStream &operator<<(QDataStream &out, const ChangeBindingsCommand &command) {
+ out << command.bindingChanges;
+ return out;
+ }
+
+ friend QDebug operator <<(QDebug debug, const ChangeBindingsCommand &command);
+
+ QVector<PropertyBindingContainer> bindingChanges;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeBindingsCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changefileurlcommand.cpp b/src/libs/qmlpuppetcommunication/commands/changefileurlcommand.cpp
new file mode 100644
index 00000000000..caada4abfb3
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changefileurlcommand.cpp
@@ -0,0 +1,16 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changefileurlcommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QDebug operator <<(QDebug debug, const ChangeFileUrlCommand &command)
+{
+ return debug.nospace() << "ChangeFileUrlCommand("
+ << "fileUrl: " << command.fileUrl << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changefileurlcommand.h b/src/libs/qmlpuppetcommunication/commands/changefileurlcommand.h
new file mode 100644
index 00000000000..aed7769d8e5
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changefileurlcommand.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <qmetatype.h>
+#include <QDataStream>
+#include <QUrl>
+
+namespace QmlDesigner {
+
+class ChangeFileUrlCommand
+{
+public:
+ friend QDataStream &operator>>(QDataStream &in, ChangeFileUrlCommand &command)
+ {
+ in >> command.fileUrl;
+ return in;
+ }
+
+ friend QDataStream &operator<<(QDataStream &out, const ChangeFileUrlCommand &command)
+ {
+ out << command.fileUrl;
+ return out;
+ }
+
+ friend QDebug operator <<(QDebug debug, const ChangeFileUrlCommand &command);
+
+ QUrl fileUrl;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeFileUrlCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changeidscommand.cpp b/src/libs/qmlpuppetcommunication/commands/changeidscommand.cpp
new file mode 100644
index 00000000000..6133ef3bb0e
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changeidscommand.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changeidscommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QDebug operator <<(QDebug debug, const ChangeIdsCommand &command)
+{
+ return debug.nospace() << "ChangeIdsCommand(ids: " << command.ids << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changeidscommand.h b/src/libs/qmlpuppetcommunication/commands/changeidscommand.h
new file mode 100644
index 00000000000..77f6392e548
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changeidscommand.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+#include <QDataStream>
+
+#include "idcontainer.h"
+
+namespace QmlDesigner {
+
+class ChangeIdsCommand
+{
+public:
+ friend QDataStream &operator>>(QDataStream &in, ChangeIdsCommand &command)
+ {
+ in >> command.ids;
+ return in;
+ }
+
+ friend QDataStream &operator<<(QDataStream &out, const ChangeIdsCommand &command)
+ {
+ out << command.ids;
+ return out;
+ }
+ friend QDebug operator <<(QDebug debug, const ChangeIdsCommand &command);
+
+ QVector<IdContainer> ids;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeIdsCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changelanguagecommand.cpp b/src/libs/qmlpuppetcommunication/commands/changelanguagecommand.cpp
new file mode 100644
index 00000000000..410db15222c
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changelanguagecommand.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changelanguagecommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QDebug operator<<(QDebug debug, const ChangeLanguageCommand &command)
+{
+ return debug.nospace() << "ChangeLanguageCommand(" << command.language << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changelanguagecommand.h b/src/libs/qmlpuppetcommunication/commands/changelanguagecommand.h
new file mode 100644
index 00000000000..e706e3238ae
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changelanguagecommand.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QString>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+class ChangeLanguageCommand
+{
+public:
+ ChangeLanguageCommand() = default;
+ ChangeLanguageCommand(QString language) : language(std::move(language)) {
+ }
+
+ friend QDataStream &operator<<(QDataStream &out, const ChangeLanguageCommand &command)
+ {
+ return out << command.language;
+ }
+ friend QDataStream &operator>>(QDataStream &in, ChangeLanguageCommand &command)
+ {
+ return in >> command.language;
+ }
+
+ friend QDebug operator<<(QDebug debug, const ChangeLanguageCommand &command);
+
+ QString language;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeLanguageCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.cpp b/src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.cpp
new file mode 100644
index 00000000000..338de4507a3
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.cpp
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changenodesourcecommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+ChangeNodeSourceCommand::ChangeNodeSourceCommand() = default;
+
+ChangeNodeSourceCommand::ChangeNodeSourceCommand(qint32 newInstanceId, const QString &newNodeSource)
+ : m_instanceId(newInstanceId), m_nodeSource(newNodeSource)
+{
+}
+
+qint32 ChangeNodeSourceCommand::instanceId() const
+{
+ return m_instanceId;
+}
+
+QString ChangeNodeSourceCommand::nodeSource() const
+{
+ return m_nodeSource;
+}
+
+QDataStream &operator<<(QDataStream &out, const ChangeNodeSourceCommand &command)
+{
+ out << command.instanceId();
+ out << command.nodeSource();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ChangeNodeSourceCommand &command)
+{
+ in >> command.m_instanceId;
+ in >> command.m_nodeSource;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const ChangeNodeSourceCommand &command)
+{
+ return debug.nospace() << "ReparentInstancesCommand("
+ << "instanceId: " << command.m_instanceId
+ << "nodeSource: " << command.m_nodeSource << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.h b/src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.h
new file mode 100644
index 00000000000..c62e8d9bd62
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changenodesourcecommand.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QString>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+class ChangeNodeSourceCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, ChangeNodeSourceCommand &command);
+ friend QDebug operator <<(QDebug debug, const ChangeNodeSourceCommand &command);
+
+public:
+ ChangeNodeSourceCommand();
+ explicit ChangeNodeSourceCommand(qint32 instanceId, const QString &nodeSource);
+ qint32 instanceId() const;
+ QString nodeSource() const;
+
+private:
+ qint32 m_instanceId;
+ QString m_nodeSource;
+};
+
+QDataStream &operator<<(QDataStream &out, const ChangeNodeSourceCommand &command);
+QDataStream &operator>>(QDataStream &in, ChangeNodeSourceCommand &command);
+
+QDebug operator <<(QDebug debug, const ChangeNodeSourceCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeNodeSourceCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.cpp b/src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.cpp
new file mode 100644
index 00000000000..00ce8506bd0
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.cpp
@@ -0,0 +1,24 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+#include "changepreviewimagesizecommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QDataStream &operator<<(QDataStream &out, const ChangePreviewImageSizeCommand &command)
+{
+ return out << command.size;
+}
+
+QDataStream &operator>>(QDataStream &in, ChangePreviewImageSizeCommand &command)
+{
+ return in >> command.size;
+}
+
+QDebug operator<<(QDebug debug, const ChangePreviewImageSizeCommand &command)
+{
+ return debug.nospace() << "ChangePreviewImageSizeCommand(" << command.size << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.h b/src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.h
new file mode 100644
index 00000000000..b47cc9c067b
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changepreviewimagesizecommand.h
@@ -0,0 +1,28 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+#pragma once
+
+#include <QMetaType>
+#include <QSize>
+
+namespace QmlDesigner {
+
+class ChangePreviewImageSizeCommand
+{
+public:
+ ChangePreviewImageSizeCommand() = default;
+ ChangePreviewImageSizeCommand(const QSize &size)
+ : size(size)
+ {}
+
+ friend QDataStream &operator<<(QDataStream &out, const ChangePreviewImageSizeCommand &command);
+ friend QDataStream &operator>>(QDataStream &in, ChangePreviewImageSizeCommand &command);
+ friend QDebug operator<<(QDebug debug, const ChangePreviewImageSizeCommand &command);
+
+public:
+ QSize size;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangePreviewImageSizeCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changeselectioncommand.cpp b/src/libs/qmlpuppetcommunication/commands/changeselectioncommand.cpp
new file mode 100644
index 00000000000..c2f4576bd64
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changeselectioncommand.cpp
@@ -0,0 +1,47 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changeselectioncommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+ChangeSelectionCommand::ChangeSelectionCommand() = default;
+
+ChangeSelectionCommand::ChangeSelectionCommand(const QVector<qint32> &idVector)
+ : m_instanceIdVector(idVector)
+{
+}
+
+QVector<qint32> ChangeSelectionCommand::instanceIds() const
+{
+ return m_instanceIdVector;
+}
+
+QDataStream &operator<<(QDataStream &out, const ChangeSelectionCommand &command)
+{
+ out << command.instanceIds();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ChangeSelectionCommand &command)
+{
+ in >> command.m_instanceIdVector;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const ChangeSelectionCommand &command)
+{
+ return debug.nospace() << "ChangeSelectionCommand(instanceIdVector: " << command.m_instanceIdVector << ")";
+}
+
+bool operator ==(const ChangeSelectionCommand &first, const ChangeSelectionCommand &second)
+{
+ return first.m_instanceIdVector == second.m_instanceIdVector;
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changeselectioncommand.h b/src/libs/qmlpuppetcommunication/commands/changeselectioncommand.h
new file mode 100644
index 00000000000..f041dda4308
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changeselectioncommand.h
@@ -0,0 +1,39 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+#include <QDataStream>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class ChangeSelectionCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, ChangeSelectionCommand &command);
+ friend QDebug operator <<(QDebug debug, const ChangeSelectionCommand &command);
+ friend bool operator ==(const ChangeSelectionCommand &first,
+ const ChangeSelectionCommand &second);
+
+public:
+ ChangeSelectionCommand();
+ explicit ChangeSelectionCommand(const QVector<qint32> &idVector);
+
+ QVector<qint32> instanceIds() const;
+
+private:
+ QVector<qint32> m_instanceIdVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const ChangeSelectionCommand &command);
+QDataStream &operator>>(QDataStream &in, ChangeSelectionCommand &command);
+bool operator ==(const ChangeSelectionCommand &first, const ChangeSelectionCommand &second);
+
+QDebug operator <<(QDebug debug, const ChangeSelectionCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeSelectionCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changestatecommand.cpp b/src/libs/qmlpuppetcommunication/commands/changestatecommand.cpp
new file mode 100644
index 00000000000..0f52f68750e
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changestatecommand.cpp
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changestatecommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+ChangeStateCommand::ChangeStateCommand()
+ : m_stateInstanceId(-1)
+{
+}
+
+ChangeStateCommand::ChangeStateCommand(qint32 stateInstanceId)
+ : m_stateInstanceId(stateInstanceId)
+{
+}
+
+qint32 ChangeStateCommand::stateInstanceId() const
+{
+ return m_stateInstanceId;
+}
+
+QDataStream &operator<<(QDataStream &out, const ChangeStateCommand &command)
+{
+ out << command.stateInstanceId();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ChangeStateCommand &command)
+{
+ in >> command.m_stateInstanceId;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const ChangeStateCommand &command)
+{
+ return debug.nospace() << "ChangeStateCommand(stateInstanceId: " << command.m_stateInstanceId << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changestatecommand.h b/src/libs/qmlpuppetcommunication/commands/changestatecommand.h
new file mode 100644
index 00000000000..1e76ee88e51
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changestatecommand.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "propertyvaluecontainer.h"
+
+namespace QmlDesigner {
+
+class ChangeStateCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, ChangeStateCommand &command);
+ friend QDebug operator <<(QDebug debug, const ChangeStateCommand &command);
+
+public:
+ ChangeStateCommand();
+ explicit ChangeStateCommand(qint32 stateInstanceId);
+
+ qint32 stateInstanceId() const;
+
+private:
+ qint32 m_stateInstanceId;
+};
+
+QDataStream &operator<<(QDataStream &out, const ChangeStateCommand &command);
+QDataStream &operator>>(QDataStream &in, ChangeStateCommand &command);
+
+QDebug operator <<(QDebug debug, const ChangeStateCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeStateCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/changevaluescommand.cpp b/src/libs/qmlpuppetcommunication/commands/changevaluescommand.cpp
new file mode 100644
index 00000000000..a55eea221ec
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changevaluescommand.cpp
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "changevaluescommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+ChangeValuesCommand::ChangeValuesCommand() = default;
+
+ChangeValuesCommand::ChangeValuesCommand(const QVector<PropertyValueContainer> &valueChangeVector)
+ : m_valueChangeVector (valueChangeVector)
+{
+}
+
+QVector<PropertyValueContainer> ChangeValuesCommand::valueChanges() const
+{
+ return m_valueChangeVector;
+}
+
+QDataStream &operator<<(QDataStream &out, const ChangeValuesCommand &command)
+{
+ out << command.valueChanges();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ChangeValuesCommand &command)
+{
+ in >> command.m_valueChangeVector;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const ChangeValuesCommand &command)
+{
+ return debug.nospace() << "ChangeValuesCommand(valueChanges: " << command.m_valueChangeVector << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/changevaluescommand.h b/src/libs/qmlpuppetcommunication/commands/changevaluescommand.h
new file mode 100644
index 00000000000..cab4effd475
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/changevaluescommand.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "propertyvaluecontainer.h"
+
+namespace QmlDesigner {
+
+class ChangeValuesCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, ChangeValuesCommand &command);
+ friend QDebug operator <<(QDebug debug, const ChangeValuesCommand &command);
+
+public:
+ ChangeValuesCommand();
+ explicit ChangeValuesCommand(const QVector<PropertyValueContainer> &valueChangeVector);
+
+ QVector<PropertyValueContainer> valueChanges() const;
+
+private:
+ QVector<PropertyValueContainer> m_valueChangeVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const ChangeValuesCommand &command);
+QDataStream &operator>>(QDataStream &in, ChangeValuesCommand &command);
+
+QDebug operator <<(QDebug debug, const ChangeValuesCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChangeValuesCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.cpp b/src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.cpp
new file mode 100644
index 00000000000..58b22cdf9bc
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.cpp
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "childrenchangedcommand.h"
+
+#include <QDebug>
+
+#include <algorithm>
+
+namespace QmlDesigner {
+
+ChildrenChangedCommand::ChildrenChangedCommand()
+ : m_parentInstanceId(-1)
+{
+}
+
+ChildrenChangedCommand::ChildrenChangedCommand(qint32 parentInstanceId, const QVector<qint32> &children, const QVector<InformationContainer> &informationVector)
+ : m_parentInstanceId(parentInstanceId),
+ m_childrenVector(children),
+ m_informationVector(informationVector)
+{
+}
+
+QVector<qint32> ChildrenChangedCommand::childrenInstances() const
+{
+ return m_childrenVector;
+}
+
+qint32 ChildrenChangedCommand::parentInstanceId() const
+{
+ return m_parentInstanceId;
+}
+
+QVector<InformationContainer> ChildrenChangedCommand::informations() const
+{
+ return m_informationVector;
+}
+
+void ChildrenChangedCommand::sort()
+{
+ std::sort(m_childrenVector.begin(), m_childrenVector.end());
+ std::sort(m_informationVector.begin(), m_informationVector.end());
+}
+
+QDataStream &operator<<(QDataStream &out, const ChildrenChangedCommand &command)
+{
+ out << command.parentInstanceId();
+ out << command.childrenInstances();
+ out << command.informations();
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ChildrenChangedCommand &command)
+{
+ in >> command.m_parentInstanceId;
+ in >> command.m_childrenVector;
+ in >> command.m_informationVector;
+
+ return in;
+}
+
+bool operator ==(const ChildrenChangedCommand &first, const ChildrenChangedCommand &second)
+{
+ return first.m_parentInstanceId == second.m_parentInstanceId
+ && first.m_childrenVector == second.m_childrenVector
+ && first.m_informationVector == second.m_informationVector;
+}
+
+QDebug operator <<(QDebug debug, const ChildrenChangedCommand &command)
+{
+ return debug.nospace() << "ChildrenChangedCommand("
+ << "parentInstanceId: " << command.parentInstanceId() << ", "
+ << "children: " << command.childrenInstances() << ", "
+ << "informations: " << command.informations() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.h b/src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.h
new file mode 100644
index 00000000000..fedcea393f0
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/childrenchangedcommand.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+#include "informationcontainer.h"
+
+namespace QmlDesigner {
+
+class ChildrenChangedCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, ChildrenChangedCommand &command);
+ friend bool operator ==(const ChildrenChangedCommand &first, const ChildrenChangedCommand &second);
+
+public:
+ ChildrenChangedCommand();
+ explicit ChildrenChangedCommand(qint32 parentInstanceId, const QVector<qint32> &childrenInstancesconst, const QVector<InformationContainer> &informationVector);
+
+ QVector<qint32> childrenInstances() const;
+ qint32 parentInstanceId() const;
+ QVector<InformationContainer> informations() const;
+
+ void sort();
+
+private:
+ qint32 m_parentInstanceId;
+ QVector<qint32> m_childrenVector;
+ QVector<InformationContainer> m_informationVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const ChildrenChangedCommand &command);
+QDataStream &operator>>(QDataStream &in, ChildrenChangedCommand &command);
+
+bool operator ==(const ChildrenChangedCommand &first, const ChildrenChangedCommand &second);
+QDebug operator <<(QDebug debug, const ChildrenChangedCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ChildrenChangedCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/clearscenecommand.cpp b/src/libs/qmlpuppetcommunication/commands/clearscenecommand.cpp
new file mode 100644
index 00000000000..cfc27ba6c51
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/clearscenecommand.cpp
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "clearscenecommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+ClearSceneCommand::ClearSceneCommand() = default;
+
+QDataStream &operator<<(QDataStream &out, const ClearSceneCommand &/*command*/)
+{
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ClearSceneCommand &/*command*/)
+{
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const ClearSceneCommand &/*command*/)
+{
+ return debug.nospace() << "ClearSceneCommand()";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/clearscenecommand.h b/src/libs/qmlpuppetcommunication/commands/clearscenecommand.h
new file mode 100644
index 00000000000..63374033adc
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/clearscenecommand.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <qmetatype.h>
+
+namespace QmlDesigner {
+
+class ClearSceneCommand
+{
+public:
+ ClearSceneCommand();
+};
+
+QDataStream &operator<<(QDataStream &out, const ClearSceneCommand &command);
+QDataStream &operator>>(QDataStream &in, ClearSceneCommand &command);
+
+QDebug operator <<(QDebug debug, const ClearSceneCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ClearSceneCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/completecomponentcommand.cpp b/src/libs/qmlpuppetcommunication/commands/completecomponentcommand.cpp
new file mode 100644
index 00000000000..85d134f269f
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/completecomponentcommand.cpp
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "completecomponentcommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+CompleteComponentCommand::CompleteComponentCommand() = default;
+
+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;
+}
+
+QDebug operator <<(QDebug debug, const CompleteComponentCommand &command)
+{
+ return debug.nospace() << "CompleteComponentCommand(instances: " << command.m_instanceVector << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/completecomponentcommand.h b/src/libs/qmlpuppetcommunication/commands/completecomponentcommand.h
new file mode 100644
index 00000000000..3da75408d6b
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/completecomponentcommand.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+class CompleteComponentCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, CompleteComponentCommand &command);
+ friend QDebug operator <<(QDebug debug, const CompleteComponentCommand &command);
+
+public:
+ CompleteComponentCommand();
+ explicit 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);
+
+QDebug operator <<(QDebug debug, const CompleteComponentCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::CompleteComponentCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.cpp b/src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.cpp
new file mode 100644
index 00000000000..82bde65a51c
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.cpp
@@ -0,0 +1,56 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "componentcompletedcommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+#include <algorithm>
+
+namespace QmlDesigner {
+
+ComponentCompletedCommand::ComponentCompletedCommand() = default;
+
+ComponentCompletedCommand::ComponentCompletedCommand(const QVector<qint32> &container)
+ : m_instanceVector(container)
+{
+}
+
+QVector<qint32> ComponentCompletedCommand::instances() const
+{
+ return m_instanceVector;
+}
+
+void ComponentCompletedCommand::sort()
+{
+ std::sort(m_instanceVector.begin(), m_instanceVector.end());
+}
+
+QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command)
+{
+ out << command.instances();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command)
+{
+ in >> command.m_instanceVector;
+
+ return in;
+}
+
+bool operator ==(const ComponentCompletedCommand &first, const ComponentCompletedCommand &second)
+{
+ return first.m_instanceVector == second.m_instanceVector;
+}
+
+QDebug operator <<(QDebug debug, const ComponentCompletedCommand &command)
+{
+ return debug.nospace() << "ComponentCompletedCommand(" << command.instances() << ")";
+
+}
+
+} // namespace QmlDesigner
+
diff --git a/src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.h b/src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.h
new file mode 100644
index 00000000000..86c492fa3b1
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/componentcompletedcommand.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+#include <QMetaType>
+#include <QVector>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+class ComponentCompletedCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command);
+ friend bool operator ==(const ComponentCompletedCommand &first, const ComponentCompletedCommand &second);
+
+public:
+ ComponentCompletedCommand();
+ explicit ComponentCompletedCommand(const QVector<qint32> &container);
+
+ QVector<qint32> instances() const;
+
+ void sort();
+
+private:
+ QVector<qint32> m_instanceVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command);
+QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command);
+
+bool operator ==(const ComponentCompletedCommand &first, const ComponentCompletedCommand &second);
+QDebug operator <<(QDebug debug, const ComponentCompletedCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ComponentCompletedCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/createinstancescommand.cpp b/src/libs/qmlpuppetcommunication/commands/createinstancescommand.cpp
new file mode 100644
index 00000000000..81c761461c9
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/createinstancescommand.cpp
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "createinstancescommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+CreateInstancesCommand::CreateInstancesCommand() = default;
+
+CreateInstancesCommand::CreateInstancesCommand(const QVector<InstanceContainer> &container)
+ : m_instanceVector(container)
+{
+}
+
+QVector<InstanceContainer> CreateInstancesCommand::instances() const
+{
+ return m_instanceVector;
+}
+
+QDataStream &operator<<(QDataStream &out, const CreateInstancesCommand &command)
+{
+ out << command.instances();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, CreateInstancesCommand &command)
+{
+ in >> command.m_instanceVector;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const CreateInstancesCommand &command)
+{
+ return debug.nospace() << "CreateInstancesCommand(" << command.instances() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/createinstancescommand.h b/src/libs/qmlpuppetcommunication/commands/createinstancescommand.h
new file mode 100644
index 00000000000..aff5c87a5ff
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/createinstancescommand.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class CreateInstancesCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, CreateInstancesCommand &command);
+
+public:
+ CreateInstancesCommand();
+ explicit CreateInstancesCommand(const QVector<InstanceContainer> &container);
+
+ QVector<InstanceContainer> instances() const;
+
+private:
+ QVector<InstanceContainer> m_instanceVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const CreateInstancesCommand &command);
+QDataStream &operator>>(QDataStream &in, CreateInstancesCommand &command);
+
+QDebug operator <<(QDebug debug, const CreateInstancesCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::CreateInstancesCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/createscenecommand.cpp b/src/libs/qmlpuppetcommunication/commands/createscenecommand.cpp
new file mode 100644
index 00000000000..18c35ff3e2e
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/createscenecommand.cpp
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "createscenecommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QDebug operator <<(QDebug debug, const CreateSceneCommand &command)
+{
+ return debug.nospace() << "CreateSceneCommand("
+ << "instances: " << command.instances << ", "
+ << "reparentInstances: " << command.reparentInstances << ", "
+ << "ids: " << command.ids << ", "
+ << "valueChanges: " << command.valueChanges << ", "
+ << "bindingChanges: " << command.bindingChanges << ", "
+ << "auxiliaryChanges: " << command.auxiliaryChanges << ", "
+ << "imports: " << command.imports << ", "
+ << "mockupTypes: " << command.mockupTypes << ", "
+ << "fileUrl: " << command.fileUrl << ", "
+ << "resourceUrl: " << command.resourceUrl << ", "
+ << "edit3dToolStates: " << command.edit3dToolStates << ", "
+ << "language: " << command.language << ")";
+}
+
+}
diff --git a/src/libs/qmlpuppetcommunication/commands/createscenecommand.h b/src/libs/qmlpuppetcommunication/commands/createscenecommand.h
new file mode 100644
index 00000000000..d2682e42531
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/createscenecommand.h
@@ -0,0 +1,133 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QSize>
+#include <QUrl>
+#include <QVector>
+#include <QList>
+#include <QColor>
+#include <qmetatype.h>
+
+#include "instancecontainer.h"
+#include "reparentcontainer.h"
+#include "idcontainer.h"
+#include "mockuptypecontainer.h"
+#include "propertyvaluecontainer.h"
+#include "propertybindingcontainer.h"
+#include "addimportcontainer.h"
+
+namespace QmlDesigner {
+
+class CreateSceneCommand
+{
+public:
+ CreateSceneCommand() = default;
+ explicit CreateSceneCommand(const QVector<InstanceContainer> &instanceContainer,
+ const QVector<ReparentContainer> &reparentContainer,
+ const QVector<IdContainer> &idVector,
+ const QVector<PropertyValueContainer> &valueChangeVector,
+ const QVector<PropertyBindingContainer> &bindingChangeVector,
+ const QVector<PropertyValueContainer> &auxiliaryChangeVector,
+ const QVector<AddImportContainer> &importVector,
+ const QVector<MockupTypeContainer> &mockupTypeVector,
+ const QUrl &fileUrl,
+ const QUrl &resourceUrl,
+ const QHash<QString, QVariantMap> &edit3dToolStates,
+ const QString &language,
+ QSize captureImageMinimumSize,
+ QSize captureImageMaximumSize,
+ qint32 stateInstanceId,
+ const QList<QColor> &edit3dBackgroundColor,
+ const QColor &edit3dGridColor)
+ : instances(instanceContainer)
+ , reparentInstances(reparentContainer)
+ , ids(idVector)
+ , valueChanges(valueChangeVector)
+ , bindingChanges(bindingChangeVector)
+ , auxiliaryChanges(auxiliaryChangeVector)
+ , imports(importVector)
+ , mockupTypes(mockupTypeVector)
+ , fileUrl(fileUrl)
+ , resourceUrl(resourceUrl)
+ , edit3dToolStates(edit3dToolStates)
+ , language(language)
+ , captureImageMinimumSize(captureImageMinimumSize)
+ , captureImageMaximumSize(captureImageMaximumSize)
+ , stateInstanceId{stateInstanceId}
+ , edit3dBackgroundColor{edit3dBackgroundColor}
+ , edit3dGridColor{edit3dGridColor}
+ {}
+
+ friend QDataStream &operator<<(QDataStream &out, const CreateSceneCommand &command)
+ {
+ out << command.instances;
+ out << command.reparentInstances;
+ out << command.ids;
+ out << command.valueChanges;
+ out << command.bindingChanges;
+ out << command.auxiliaryChanges;
+ out << command.imports;
+ out << command.mockupTypes;
+ out << command.fileUrl;
+ out << command.resourceUrl;
+ out << command.edit3dToolStates;
+ out << command.language;
+ out << command.stateInstanceId;
+ out << command.captureImageMinimumSize;
+ out << command.captureImageMaximumSize;
+ out << command.edit3dBackgroundColor;
+ out << command.edit3dGridColor;
+
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, CreateSceneCommand &command)
+ {
+ in >> command.instances;
+ in >> command.reparentInstances;
+ in >> command.ids;
+ in >> command.valueChanges;
+ in >> command.bindingChanges;
+ in >> command.auxiliaryChanges;
+ in >> command.imports;
+ in >> command.mockupTypes;
+ in >> command.fileUrl;
+ in >> command.resourceUrl;
+ in >> command.edit3dToolStates;
+ in >> command.language;
+ in >> command.stateInstanceId;
+ in >> command.captureImageMinimumSize;
+ in >> command.captureImageMaximumSize;
+ in >> command.edit3dBackgroundColor;
+ in >> command.edit3dGridColor;
+
+ return in;
+ }
+
+public:
+ QVector<InstanceContainer> instances;
+ QVector<ReparentContainer> reparentInstances;
+ QVector<IdContainer> ids;
+ QVector<PropertyValueContainer> valueChanges;
+ QVector<PropertyBindingContainer> bindingChanges;
+ QVector<PropertyValueContainer> auxiliaryChanges;
+ QVector<AddImportContainer> imports;
+ QVector<MockupTypeContainer> mockupTypes;
+ QUrl fileUrl;
+ QUrl resourceUrl;
+ QHash<QString, QVariantMap> edit3dToolStates;
+ QString language;
+ QSize captureImageMinimumSize;
+ QSize captureImageMaximumSize;
+ qint32 stateInstanceId = 0;
+ QList<QColor> edit3dBackgroundColor;
+ QColor edit3dGridColor;
+};
+
+QDebug operator<<(QDebug debug, const CreateSceneCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::CreateSceneCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/debugoutputcommand.cpp b/src/libs/qmlpuppetcommunication/commands/debugoutputcommand.cpp
new file mode 100644
index 00000000000..d247341dade
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/debugoutputcommand.cpp
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "debugoutputcommand.h"
+
+#include <QtDebug>
+
+namespace QmlDesigner {
+
+DebugOutputCommand::DebugOutputCommand() = default;
+
+DebugOutputCommand::DebugOutputCommand(const QString &text, DebugOutputCommand::Type type, const QVector<qint32> &instanceIds)
+ : m_instanceIds(instanceIds)
+ , m_text(text)
+ , m_type(type)
+{
+}
+
+qint32 DebugOutputCommand::type() const
+{
+ return m_type;
+}
+
+QString DebugOutputCommand::text() const
+{
+ return m_text;
+}
+
+QVector<qint32> DebugOutputCommand::instanceIds() const
+{
+ return m_instanceIds;
+}
+
+QDataStream &operator<<(QDataStream &out, const DebugOutputCommand &command)
+{
+ out << command.type();
+ out << command.text();
+ out << command.instanceIds();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command)
+{
+ in >> command.m_type;
+ in >> command.m_text;
+ in >> command.m_instanceIds;
+
+ return in;
+}
+
+bool operator ==(const DebugOutputCommand &first, const DebugOutputCommand &second)
+{
+ return first.m_type == second.m_type
+ && first.m_text == second.m_text;
+}
+
+QDebug operator <<(QDebug debug, const DebugOutputCommand &command)
+{
+ return debug.nospace() << "DebugOutputCommand("
+ << "type: " << command.type() << ", "
+ << "text: " << command.text() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/debugoutputcommand.h b/src/libs/qmlpuppetcommunication/commands/debugoutputcommand.h
new file mode 100644
index 00000000000..bcdde736bf0
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/debugoutputcommand.h
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QString>
+#include <QDataStream>
+#include <QVector>
+
+namespace QmlDesigner {
+
+class DebugOutputCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command);
+ friend bool operator ==(const DebugOutputCommand &first, const DebugOutputCommand &second);
+
+public:
+ enum Type {
+ DebugType,
+ WarningType,
+ ErrorType,
+ FatalType
+ };
+
+ DebugOutputCommand();
+ explicit DebugOutputCommand(const QString &text, Type type, const QVector<qint32> &instanceIds);
+
+ qint32 type() const;
+ QString text() const;
+ QVector<qint32> instanceIds() const;
+
+private:
+ QVector<qint32> m_instanceIds;
+ QString m_text;
+ quint32 m_type;
+};
+
+QDataStream &operator<<(QDataStream &out, const DebugOutputCommand &command);
+QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command);
+
+bool operator ==(const DebugOutputCommand &first, const DebugOutputCommand &second);
+QDebug operator <<(QDebug debug, const DebugOutputCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::DebugOutputCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/endpuppetcommand.cpp b/src/libs/qmlpuppetcommunication/commands/endpuppetcommand.cpp
new file mode 100644
index 00000000000..785130aa1b4
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/endpuppetcommand.cpp
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "endpuppetcommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+EndPuppetCommand::EndPuppetCommand() = default;
+
+QDataStream &operator<<(QDataStream &out, const EndPuppetCommand &/*command*/)
+{
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, EndPuppetCommand &/*command*/)
+{
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const EndPuppetCommand &/*command*/)
+{
+ return debug.nospace() << "EndPuppetCommand()";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/endpuppetcommand.h b/src/libs/qmlpuppetcommunication/commands/endpuppetcommand.h
new file mode 100644
index 00000000000..58cd1a1564c
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/endpuppetcommand.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <qmetatype.h>
+
+namespace QmlDesigner {
+
+class EndPuppetCommand
+{
+public:
+ EndPuppetCommand();
+};
+
+QDataStream &operator<<(QDataStream &out, const EndPuppetCommand &command);
+QDataStream &operator>>(QDataStream &in, EndPuppetCommand &command);
+
+QDebug operator <<(QDebug debug, const EndPuppetCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::EndPuppetCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/informationchangedcommand.cpp b/src/libs/qmlpuppetcommunication/commands/informationchangedcommand.cpp
new file mode 100644
index 00000000000..0111466a318
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/informationchangedcommand.cpp
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "informationchangedcommand.h"
+
+#include <QMetaType>
+#include <QtDebug>
+
+#include "propertyvaluecontainer.h"
+
+#include <algorithm>
+
+namespace QmlDesigner {
+
+InformationChangedCommand::InformationChangedCommand() = default;
+
+InformationChangedCommand::InformationChangedCommand(const QVector<InformationContainer> &informationVector)
+ : m_informationVector(informationVector)
+{
+}
+
+QVector<InformationContainer> InformationChangedCommand::informations() const
+{
+ return m_informationVector;
+}
+
+void InformationChangedCommand::sort()
+{
+ std::sort(m_informationVector.begin(), m_informationVector.end());
+}
+
+QDataStream &operator<<(QDataStream &out, const InformationChangedCommand &command)
+{
+ out << command.informations();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, InformationChangedCommand &command)
+{
+ in >> command.m_informationVector;
+
+ return in;
+}
+
+bool operator ==(const InformationChangedCommand &first, const InformationChangedCommand &second)
+{
+ return first.m_informationVector == second.m_informationVector;
+}
+
+QDebug operator <<(QDebug debug, const InformationChangedCommand &command)
+{
+ return debug.nospace() << "InformationChangedCommand(" << command.informations() << ")";
+}
+
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/informationchangedcommand.h b/src/libs/qmlpuppetcommunication/commands/informationchangedcommand.h
new file mode 100644
index 00000000000..348809a7ae9
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/informationchangedcommand.h
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "informationcontainer.h"
+
+namespace QmlDesigner {
+
+class InformationChangedCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, InformationChangedCommand &command);
+ friend bool operator ==(const InformationChangedCommand &first, const InformationChangedCommand &second);
+
+public:
+ InformationChangedCommand();
+ explicit InformationChangedCommand(const QVector<InformationContainer> &informationVector);
+
+ QVector<InformationContainer> informations() const;
+
+ void sort();
+
+private:
+ QVector<InformationContainer> m_informationVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const InformationChangedCommand &command);
+QDataStream &operator>>(QDataStream &in, InformationChangedCommand &command);
+
+bool operator ==(const InformationChangedCommand &first, const InformationChangedCommand &second);
+QDebug operator <<(QDebug debug, const InformationChangedCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::InformationChangedCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp
new file mode 100644
index 00000000000..e2547ebce75
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.cpp
@@ -0,0 +1,88 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "inputeventcommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+InputEventCommand::InputEventCommand() = default;
+
+InputEventCommand::InputEventCommand(QInputEvent *e)
+ : m_type(e->type()),
+ m_modifiers(e->modifiers())
+{
+ if (m_type == QEvent::Wheel) {
+ auto we = static_cast<QWheelEvent *>(e);
+#if QT_VERSION <= QT_VERSION_CHECK(5, 15, 0)
+ m_pos = we->pos();
+#else
+ m_pos = we->position().toPoint();
+#endif
+ m_buttons = we->buttons();
+ m_angleDelta = we->angleDelta().y();
+ } else if (m_type == QEvent::KeyPress || m_type == QEvent::KeyRelease) {
+ auto ke = static_cast<QKeyEvent *>(e);
+ m_key = ke->key();
+ m_count = ke->count();
+ m_autoRepeat = ke->isAutoRepeat();
+ } else {
+ auto me = static_cast<QMouseEvent *>(e);
+ m_pos = me->pos();
+ m_button = me->button();
+ m_buttons = me->buttons();
+ }
+}
+
+QDataStream &operator<<(QDataStream &out, const InputEventCommand &command)
+{
+ out << int(command.type());
+ out << command.pos();
+ out << int(command.button());
+ out << command.buttons();
+ out << command.modifiers();
+ out << command.angleDelta();
+ out << command.key();
+ out << command.count();
+ out << command.autoRepeat();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, InputEventCommand &command)
+{
+ int type;
+ int button;
+ in >> type;
+ command.m_type = (QEvent::Type)type;
+ in >> command.m_pos;
+ in >> button;
+ command.m_button = (Qt::MouseButton)button;
+ in >> command.m_buttons;
+ in >> command.m_modifiers;
+ in >> command.m_angleDelta;
+ in >> command.m_key;
+ in >> command.m_count;
+ in >> command.m_autoRepeat;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const InputEventCommand &command)
+{
+ return debug.nospace() << "InputEventCommand("
+ << "type: " << command.type() << ", "
+ << "pos: " << command.pos() << ", "
+ << "button: " << command.button() << ", "
+ << "buttons: " << command.buttons() << ", "
+ << "modifiers: " << command.modifiers() << ", "
+ << "angleDelta: " << command.angleDelta() << ", "
+ << "key: " << command.key() << ", "
+ << "count: " << command.count() << ", "
+ << "autoRepeat: " << command.autoRepeat() << ")";
+
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/inputeventcommand.h b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.h
new file mode 100644
index 00000000000..163d8b95216
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/inputeventcommand.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QtCore/qmetatype.h>
+#include <QtCore/qdatastream.h>
+#include <QtGui/qevent.h>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class InputEventCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, InputEventCommand &command);
+ friend QDebug operator <<(QDebug debug, const InputEventCommand &command);
+
+public:
+ InputEventCommand();
+ explicit InputEventCommand(QInputEvent *e);
+
+ QEvent::Type type() const { return m_type; }
+ QPoint pos() const { return m_pos; }
+ Qt::MouseButton button() const { return m_button; }
+ Qt::MouseButtons buttons() const { return m_buttons; }
+ Qt::KeyboardModifiers modifiers() const { return m_modifiers; }
+ int angleDelta() const { return m_angleDelta; }
+ int key() const { return m_key; }
+ int count() const { return m_count; }
+ bool autoRepeat() const { return m_autoRepeat; }
+
+private:
+ QEvent::Type m_type = QEvent::None;
+ Qt::KeyboardModifiers m_modifiers = Qt::NoModifier;
+
+ // Mouse events
+ QPoint m_pos;
+ Qt::MouseButton m_button = Qt::NoButton;
+ Qt::MouseButtons m_buttons = Qt::NoButton;
+
+ // Wheel events
+ int m_angleDelta = 0;
+
+ // Key events
+ int m_key = 0;
+ int m_count = 1;
+ bool m_autoRepeat = false;
+};
+
+QDataStream &operator<<(QDataStream &out, const InputEventCommand &command);
+QDataStream &operator>>(QDataStream &in, InputEventCommand &command);
+
+QDebug operator <<(QDebug debug, const InputEventCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::InputEventCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/nanotracecommand.cpp b/src/libs/qmlpuppetcommunication/commands/nanotracecommand.cpp
new file mode 100644
index 00000000000..346b93dd667
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/nanotracecommand.cpp
@@ -0,0 +1,77 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "nanotracecommand.h"
+
+namespace QmlDesigner {
+
+StartNanotraceCommand::StartNanotraceCommand(const QString &path)
+ : m_filePath(path)
+{ }
+
+QString StartNanotraceCommand::path() const
+{
+ return m_filePath;
+}
+
+QDataStream &operator<<(QDataStream &out, const StartNanotraceCommand &command)
+{
+ out << command.m_filePath;
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, StartNanotraceCommand &command)
+{
+ in >> command.m_filePath;
+ return in;
+}
+
+QDebug operator<<(QDebug debug, const StartNanotraceCommand &command)
+{
+ return debug.nospace() << "StartNanotraceCommand(" << command.m_filePath << ")";
+}
+
+
+QDataStream &operator<<(QDataStream &out, const EndNanotraceCommand &/*command*/)
+{
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, EndNanotraceCommand &/*command*/)
+{
+ return in;
+}
+
+QDebug operator<<(QDebug debug, const EndNanotraceCommand &/*command*/)
+{
+ return debug.nospace() << "EndNanotraceCommand()";
+}
+
+
+SyncNanotraceCommand::SyncNanotraceCommand(const QString &name)
+ : m_name(name)
+{ }
+
+QString SyncNanotraceCommand::name() const
+{
+ return m_name;
+}
+
+QDataStream &operator>>(QDataStream &in, SyncNanotraceCommand &command)
+{
+ in >> command.m_name;
+ return in;
+}
+
+QDataStream &operator<<(QDataStream &out, const SyncNanotraceCommand &command)
+{
+ out << command.m_name;
+ return out;
+}
+
+QDebug operator<<(QDebug debug, const SyncNanotraceCommand &command)
+{
+ return debug.nospace() << "SyncNanotraceCommand(" << command.m_name << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/nanotracecommand.h b/src/libs/qmlpuppetcommunication/commands/nanotracecommand.h
new file mode 100644
index 00000000000..57cd165f6e6
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/nanotracecommand.h
@@ -0,0 +1,55 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDataStream>
+#include <QDebug>
+#include <QMetaType>
+#include <QString>
+
+namespace QmlDesigner {
+
+class StartNanotraceCommand
+{
+public:
+ StartNanotraceCommand() = default;
+ StartNanotraceCommand(const QString &path);
+ QString path() const;
+ friend QDataStream &operator<<(QDataStream &out, const StartNanotraceCommand &command);
+ friend QDataStream &operator>>(QDataStream &in, StartNanotraceCommand &command);
+ friend QDebug operator <<(QDebug debug, const StartNanotraceCommand &command);
+private:
+ QString m_filePath;
+};
+
+
+class EndNanotraceCommand
+{
+public:
+ EndNanotraceCommand() = default;
+ friend QDataStream &operator<<(QDataStream &out, const EndNanotraceCommand &command);
+ friend QDataStream &operator>>(QDataStream &in, EndNanotraceCommand &command);
+ friend QDebug operator <<(QDebug debug, const EndNanotraceCommand &command);
+};
+
+
+class SyncNanotraceCommand
+{
+public:
+ SyncNanotraceCommand() = default;
+ SyncNanotraceCommand(const QString& name);
+ QString name() const;
+ friend QDataStream &operator>>(QDataStream &in, SyncNanotraceCommand &command);
+ friend QDataStream &operator<<(QDataStream &out, const SyncNanotraceCommand &command);
+ friend QDebug operator <<(QDebug debug, const SyncNanotraceCommand &command);
+private:
+ QString m_name;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::StartNanotraceCommand)
+Q_DECLARE_METATYPE(QmlDesigner::EndNanotraceCommand)
+Q_DECLARE_METATYPE(QmlDesigner::SyncNanotraceCommand)
+
diff --git a/src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.cpp b/src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.cpp
new file mode 100644
index 00000000000..16ce88d69bb
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "pixmapchangedcommand.h"
+
+#include <QDebug>
+
+#include <QVarLengthArray>
+
+#include <algorithm>
+
+namespace QmlDesigner {
+
+PixmapChangedCommand::PixmapChangedCommand() = default;
+
+PixmapChangedCommand::PixmapChangedCommand(const QVector<ImageContainer> &imageVector)
+ : m_imageVector(imageVector)
+{
+}
+
+QVector<ImageContainer> PixmapChangedCommand::images() const
+{
+ return m_imageVector;
+}
+
+void PixmapChangedCommand::sort()
+{
+ std::sort(m_imageVector.begin(), m_imageVector.end());
+}
+
+QDataStream &operator<<(QDataStream &out, const PixmapChangedCommand &command)
+{
+ out << command.images();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PixmapChangedCommand &command)
+{
+ in >> command.m_imageVector;
+
+ return in;
+}
+
+bool operator ==(const PixmapChangedCommand &first, const PixmapChangedCommand &second)
+{
+ return first.m_imageVector == second.m_imageVector;
+}
+
+QDebug operator <<(QDebug debug, const PixmapChangedCommand &command)
+{
+ return debug.nospace() << "PixmapChangedCommand(" << command.images() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.h b/src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.h
new file mode 100644
index 00000000000..249bf8714fd
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/pixmapchangedcommand.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include "imagecontainer.h"
+
+namespace QmlDesigner {
+
+class PixmapChangedCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, PixmapChangedCommand &command);
+ friend bool operator ==(const PixmapChangedCommand &first, const PixmapChangedCommand &second);
+
+public:
+ PixmapChangedCommand();
+ explicit PixmapChangedCommand(const QVector<ImageContainer> &imageVector);
+
+ QVector<ImageContainer> images() const;
+
+ void sort();
+
+private:
+ QVector<ImageContainer> m_imageVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const PixmapChangedCommand &command);
+QDataStream &operator>>(QDataStream &in, PixmapChangedCommand &command);
+
+bool operator ==(const PixmapChangedCommand &first, const PixmapChangedCommand &second);
+QDebug operator <<(QDebug debug, const PixmapChangedCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::PixmapChangedCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/puppetalivecommand.cpp b/src/libs/qmlpuppetcommunication/commands/puppetalivecommand.cpp
new file mode 100644
index 00000000000..0af289f2402
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/puppetalivecommand.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "puppetalivecommand.h"
+
+namespace QmlDesigner {
+
+PuppetAliveCommand::PuppetAliveCommand() = default;
+
+QDataStream &operator<<(QDataStream &out, const PuppetAliveCommand &/*command*/)
+{
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PuppetAliveCommand &/*command*/)
+{
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const PuppetAliveCommand &/*command*/)
+{
+ return debug.nospace() << "PuppetAliveCommand()";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/puppetalivecommand.h b/src/libs/qmlpuppetcommunication/commands/puppetalivecommand.h
new file mode 100644
index 00000000000..93741252dc1
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/puppetalivecommand.h
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+class PuppetAliveCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, PuppetAliveCommand &command);
+ friend QDebug operator <<(QDebug debug, const PuppetAliveCommand &command);
+
+public:
+ PuppetAliveCommand();
+};
+
+QDataStream &operator<<(QDataStream &out, const PuppetAliveCommand &command);
+QDataStream &operator>>(QDataStream &in, PuppetAliveCommand &command);
+
+QDebug operator <<(QDebug debug, const PuppetAliveCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::PuppetAliveCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.cpp b/src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.cpp
new file mode 100644
index 00000000000..1eb49b66ad3
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.cpp
@@ -0,0 +1,33 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "puppettocreatorcommand.h"
+
+namespace QmlDesigner {
+
+// A generic command that can hold a variant data from puppet to creator
+
+PuppetToCreatorCommand::PuppetToCreatorCommand(Type type, const QVariant &data)
+ : m_type(type)
+ , m_data(data)
+{
+
+}
+
+QDataStream &operator<<(QDataStream &out, const PuppetToCreatorCommand &command)
+{
+ out << qint32(command.type());
+ out << command.data();
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PuppetToCreatorCommand &command)
+{
+ qint32 type;
+ in >> type;
+ command.m_type = PuppetToCreatorCommand::Type(type);
+ in >> command.m_data;
+ return in;
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.h b/src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.h
new file mode 100644
index 00000000000..762054bb9b4
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/puppettocreatorcommand.h
@@ -0,0 +1,42 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <qmetatype.h>
+#include <QDataStream>
+#include <QVariant>
+
+namespace QmlDesigner {
+
+class PuppetToCreatorCommand
+{
+public:
+ enum Type {
+ Edit3DToolState,
+ Render3DView,
+ ActiveSceneChanged,
+ RenderModelNodePreviewImage,
+ Import3DSupport,
+ NodeAtPos,
+ None };
+
+ PuppetToCreatorCommand(Type type, const QVariant &data);
+ PuppetToCreatorCommand() = default;
+
+ Type type() const { return m_type; }
+ QVariant data() const { return m_data; }
+
+private:
+ Type m_type = None;
+ QVariant m_data;
+
+ friend QDataStream &operator>>(QDataStream &in, PuppetToCreatorCommand &command);
+};
+
+QDataStream &operator<<(QDataStream &out, const PuppetToCreatorCommand &command);
+QDataStream &operator>>(QDataStream &in, PuppetToCreatorCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::PuppetToCreatorCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/removeinstancescommand.cpp b/src/libs/qmlpuppetcommunication/commands/removeinstancescommand.cpp
new file mode 100644
index 00000000000..e47fa896542
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/removeinstancescommand.cpp
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "removeinstancescommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+RemoveInstancesCommand::RemoveInstancesCommand() = default;
+
+RemoveInstancesCommand::RemoveInstancesCommand(const QVector<qint32> &idVector)
+ : m_instanceIdVector(idVector)
+{
+}
+
+QVector<qint32> RemoveInstancesCommand::instanceIds() const
+{
+ return m_instanceIdVector;
+}
+
+QDataStream &operator<<(QDataStream &out, const RemoveInstancesCommand &command)
+{
+ out << command.instanceIds();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, RemoveInstancesCommand &command)
+{
+ in >> command.m_instanceIdVector;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const RemoveInstancesCommand &command)
+{
+ return debug.nospace() << "RemoveInstancesCommand(instanceIdVector: " << command.m_instanceIdVector << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/removeinstancescommand.h b/src/libs/qmlpuppetcommunication/commands/removeinstancescommand.h
new file mode 100644
index 00000000000..f0d547486bb
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/removeinstancescommand.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+#include <QDataStream>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class RemoveInstancesCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, RemoveInstancesCommand &command);
+ friend QDebug operator <<(QDebug debug, const RemoveInstancesCommand &command);
+
+public:
+ RemoveInstancesCommand();
+ explicit RemoveInstancesCommand(const QVector<qint32> &idVector);
+
+ QVector<qint32> instanceIds() const;
+
+private:
+ QVector<qint32> m_instanceIdVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const RemoveInstancesCommand &command);
+QDataStream &operator>>(QDataStream &in, RemoveInstancesCommand &command);
+
+QDebug operator <<(QDebug debug, const RemoveInstancesCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::RemoveInstancesCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/removepropertiescommand.cpp b/src/libs/qmlpuppetcommunication/commands/removepropertiescommand.cpp
new file mode 100644
index 00000000000..201d2241c9d
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/removepropertiescommand.cpp
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "removepropertiescommand.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+RemovePropertiesCommand::RemovePropertiesCommand() = default;
+
+RemovePropertiesCommand::RemovePropertiesCommand(const QVector<PropertyAbstractContainer> &properties)
+ : m_properties(properties)
+{
+}
+
+QVector<PropertyAbstractContainer> RemovePropertiesCommand::properties() const
+{
+ return m_properties;
+}
+
+QDataStream &operator<<(QDataStream &out, const RemovePropertiesCommand &command)
+{
+ out << command.properties();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, RemovePropertiesCommand &command)
+{
+ in >> command.m_properties;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const RemovePropertiesCommand &command)
+{
+ return debug.nospace() << "RemovePropertiesCommand(properties: " << command.m_properties << ")";
+}
+
+}
diff --git a/src/libs/qmlpuppetcommunication/commands/removepropertiescommand.h b/src/libs/qmlpuppetcommunication/commands/removepropertiescommand.h
new file mode 100644
index 00000000000..f643e9b10b8
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/removepropertiescommand.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "propertyabstractcontainer.h"
+
+namespace QmlDesigner {
+
+class RemovePropertiesCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, RemovePropertiesCommand &command);
+ friend QDebug operator <<(QDebug debug, const RemovePropertiesCommand &command);
+
+public:
+ RemovePropertiesCommand();
+ explicit RemovePropertiesCommand(const QVector<PropertyAbstractContainer> &properties);
+
+ QVector<PropertyAbstractContainer> properties() const;
+
+private:
+ QVector<PropertyAbstractContainer> m_properties;
+};
+
+QDataStream &operator<<(QDataStream &out, const RemovePropertiesCommand &command);
+QDataStream &operator>>(QDataStream &in, RemovePropertiesCommand &command);
+
+QDebug operator <<(QDebug debug, const RemovePropertiesCommand &command);
+
+}
+
+Q_DECLARE_METATYPE(QmlDesigner::RemovePropertiesCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.cpp b/src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.cpp
new file mode 100644
index 00000000000..0c865747a94
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.cpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "removesharedmemorycommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+RemoveSharedMemoryCommand::RemoveSharedMemoryCommand() = default;
+
+RemoveSharedMemoryCommand::RemoveSharedMemoryCommand(const QString &typeName, const QVector<qint32> &keyNumberVector)
+ : m_typeName(typeName),
+ m_keyNumberVector(keyNumberVector)
+{
+}
+
+QString RemoveSharedMemoryCommand::typeName() const
+{
+ return m_typeName;
+}
+
+QVector<qint32> RemoveSharedMemoryCommand::keyNumbers() const
+{
+ return m_keyNumberVector;
+}
+
+QDataStream &operator<<(QDataStream &out, const RemoveSharedMemoryCommand &command)
+{
+ out << command.typeName();
+ out << command.keyNumbers();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, RemoveSharedMemoryCommand &command)
+{
+ in >> command.m_typeName;
+ in >> command.m_keyNumberVector;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const RemoveSharedMemoryCommand &command)
+{
+ return debug.nospace() << "RemoveSharedMemoryCommand("
+ << "typeName: " << command.m_typeName
+ << "keyNumbers: " << command.m_keyNumberVector << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.h b/src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.h
new file mode 100644
index 00000000000..2a8303dcb50
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/removesharedmemorycommand.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QString>
+#include <QVector>
+
+namespace QmlDesigner {
+
+class RemoveSharedMemoryCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, RemoveSharedMemoryCommand &command);
+ friend QDebug operator <<(QDebug debug, const RemoveSharedMemoryCommand &command);
+
+public:
+ RemoveSharedMemoryCommand();
+ explicit RemoveSharedMemoryCommand(const QString &typeName, const QVector<qint32> &keyNumberVector);
+
+ QString typeName() const;
+ QVector<qint32> keyNumbers() const;
+
+private:
+ QString m_typeName;
+ QVector<qint32> m_keyNumberVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const RemoveSharedMemoryCommand &command);
+QDataStream &operator>>(QDataStream &in, RemoveSharedMemoryCommand &command);
+
+QDebug operator <<(QDebug debug, const RemoveSharedMemoryCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::RemoveSharedMemoryCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.cpp b/src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.cpp
new file mode 100644
index 00000000000..f681fb5ee23
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.cpp
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "reparentinstancescommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+ReparentInstancesCommand::ReparentInstancesCommand() = default;
+
+ReparentInstancesCommand::ReparentInstancesCommand(const QVector<ReparentContainer> &container)
+ : m_reparentInstanceVector(container)
+{
+}
+
+QVector<ReparentContainer> ReparentInstancesCommand::reparentInstances() const
+{
+ return m_reparentInstanceVector;
+}
+
+
+QDataStream &operator<<(QDataStream &out, const ReparentInstancesCommand &command)
+{
+ out << command.reparentInstances();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ReparentInstancesCommand &command)
+{
+ in >> command.m_reparentInstanceVector;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const ReparentInstancesCommand &command)
+{
+ return debug.nospace() << "ReparentInstancesCommand(reparentInstances: " << command.m_reparentInstanceVector << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.h b/src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.h
new file mode 100644
index 00000000000..f9f0a3458a3
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/reparentinstancescommand.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "reparentcontainer.h"
+
+namespace QmlDesigner {
+
+class ReparentInstancesCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, ReparentInstancesCommand &command);
+ friend QDebug operator <<(QDebug debug, const ReparentInstancesCommand &command);
+
+public:
+ ReparentInstancesCommand();
+ explicit ReparentInstancesCommand(const QVector<ReparentContainer> &container);
+
+ QVector<ReparentContainer> reparentInstances() const;
+
+private:
+ QVector<ReparentContainer> m_reparentInstanceVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const ReparentInstancesCommand &command);
+QDataStream &operator>>(QDataStream &in, ReparentInstancesCommand &command);
+
+QDebug operator <<(QDebug debug, const ReparentInstancesCommand &command);
+
+} //
+
+Q_DECLARE_METATYPE(QmlDesigner::ReparentInstancesCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.cpp b/src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.cpp
new file mode 100644
index 00000000000..07099717b58
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.cpp
@@ -0,0 +1,71 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "requestmodelnodepreviewimagecommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+RequestModelNodePreviewImageCommand::RequestModelNodePreviewImageCommand() = default;
+
+RequestModelNodePreviewImageCommand::RequestModelNodePreviewImageCommand(qint32 id, const QSize &size,
+ const QString &componentPath,
+ qint32 renderItemId)
+ : m_instanceId(id)
+ , m_size(size)
+ , m_componentPath(componentPath)
+ , m_renderItemId(renderItemId)
+{
+}
+
+qint32 RequestModelNodePreviewImageCommand::instanceId() const
+{
+ return m_instanceId;
+}
+
+QSize QmlDesigner::RequestModelNodePreviewImageCommand::size() const
+{
+ return m_size;
+}
+
+QString RequestModelNodePreviewImageCommand::componentPath() const
+{
+ return m_componentPath;
+}
+
+qint32 RequestModelNodePreviewImageCommand::renderItemId() const
+{
+ return m_renderItemId;
+}
+
+QDataStream &operator<<(QDataStream &out, const RequestModelNodePreviewImageCommand &command)
+{
+ out << int(command.instanceId());
+ out << command.size();
+ out << command.componentPath();
+ out << command.renderItemId();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command)
+{
+ in >> command.m_instanceId;
+ in >> command.m_size;
+ in >> command.m_componentPath;
+ in >> command.m_renderItemId;
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command)
+{
+ return debug.nospace() << "RequestModelNodePreviewImageCommand("
+ << "instanceId: " << command.instanceId() << ", "
+ << "size: " << command.size() << ", "
+ << "componentPath: " << command.componentPath() << ", "
+ << "renderItemId: " << command.renderItemId() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.h b/src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.h
new file mode 100644
index 00000000000..41dac0d1137
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/requestmodelnodepreviewimagecommand.h
@@ -0,0 +1,63 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QtCore/qmetatype.h>
+#include <QtCore/qdatastream.h>
+#include <QtGui/qevent.h>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class RequestModelNodePreviewImageCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command);
+ friend QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command);
+
+public:
+ RequestModelNodePreviewImageCommand();
+ explicit RequestModelNodePreviewImageCommand(qint32 id, const QSize &size,
+ const QString &componentPath, qint32 renderItemId);
+
+ qint32 instanceId() const;
+ QSize size() const;
+ QString componentPath() const;
+ qint32 renderItemId() const;
+
+private:
+ qint32 m_instanceId;
+ QSize m_size;
+ QString m_componentPath;
+ qint32 m_renderItemId;
+};
+
+inline bool operator==(const RequestModelNodePreviewImageCommand &first,
+ const RequestModelNodePreviewImageCommand &second)
+{
+ return first.instanceId() == second.instanceId()
+ && first.size() == second.size()
+ && first.componentPath() == second.componentPath()
+ && first.renderItemId() == second.renderItemId();
+}
+
+inline size_t qHash(const RequestModelNodePreviewImageCommand &key, size_t seed = 0)
+{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ return ::qHash(key.instanceId(), seed)
+ ^ ::qHash(std::make_pair(key.size().width(), key.size().height()), seed)
+ ^ ::qHash(key.componentPath(), seed) ^ ::qHash(key.renderItemId(), seed);
+#else
+ return qHashMulti(seed, key.instanceId(), key.size(), key.componentPath(), key.renderItemId());
+#endif
+}
+
+QDataStream &operator<<(QDataStream &out, const RequestModelNodePreviewImageCommand &command);
+QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command);
+
+QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::RequestModelNodePreviewImageCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/scenecreatedcommand.h b/src/libs/qmlpuppetcommunication/commands/scenecreatedcommand.h
new file mode 100644
index 00000000000..86ef8dddd91
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/scenecreatedcommand.h
@@ -0,0 +1,20 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+
+namespace QmlDesigner {
+
+class SceneCreatedCommand
+{
+public:
+ friend QDataStream &operator<<(QDataStream &out, const SceneCreatedCommand &) { return out; }
+
+ friend QDataStream &operator>>(QDataStream &in, SceneCreatedCommand &) { return in; }
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::SceneCreatedCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.cpp b/src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.cpp
new file mode 100644
index 00000000000..1f7e628613e
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.cpp
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "statepreviewimagechangedcommand.h"
+
+#include <QDebug>
+
+#include <algorithm>
+
+namespace QmlDesigner {
+
+StatePreviewImageChangedCommand::StatePreviewImageChangedCommand() = default;
+
+StatePreviewImageChangedCommand::StatePreviewImageChangedCommand(const QVector<ImageContainer> &imageVector)
+ : m_previewVector(imageVector)
+{
+}
+
+QVector<ImageContainer> StatePreviewImageChangedCommand::previews()const
+{
+ return m_previewVector;
+}
+
+void StatePreviewImageChangedCommand::sort()
+{
+ std::sort(m_previewVector.begin(), m_previewVector.end());
+}
+
+QDataStream &operator<<(QDataStream &out, const StatePreviewImageChangedCommand &command)
+{
+ out << command.previews();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, StatePreviewImageChangedCommand &command)
+{
+ in >> command.m_previewVector;
+
+ return in;
+}
+
+bool operator ==(const StatePreviewImageChangedCommand &first, const StatePreviewImageChangedCommand &second)
+{
+ return first.m_previewVector == second.m_previewVector;
+}
+
+QDebug operator <<(QDebug debug, const StatePreviewImageChangedCommand &command)
+{
+ return debug.nospace() << "StatePreviewImageChangedCommand(" << command.previews() << ")";
+
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.h b/src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.h
new file mode 100644
index 00000000000..f9179a23f9a
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/statepreviewimagechangedcommand.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+
+#include "imagecontainer.h"
+
+namespace QmlDesigner {
+
+class StatePreviewImageChangedCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, StatePreviewImageChangedCommand &command);
+ friend bool operator ==(const StatePreviewImageChangedCommand &first, const StatePreviewImageChangedCommand &second);
+
+public:
+ StatePreviewImageChangedCommand();
+ explicit StatePreviewImageChangedCommand(const QVector<ImageContainer> &imageVector);
+
+ QVector<ImageContainer> previews() const;
+
+ void sort();
+
+private:
+ QVector<ImageContainer> m_previewVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const StatePreviewImageChangedCommand &command);
+QDataStream &operator>>(QDataStream &in, StatePreviewImageChangedCommand &command);
+
+bool operator ==(const StatePreviewImageChangedCommand &first, const StatePreviewImageChangedCommand &second);
+QDebug operator <<(QDebug debug, const StatePreviewImageChangedCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::StatePreviewImageChangedCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/synchronizecommand.h b/src/libs/qmlpuppetcommunication/commands/synchronizecommand.h
new file mode 100644
index 00000000000..a881d8077cc
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/synchronizecommand.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDebug>
+#include <QMetaType>
+#include <QVector>
+
+namespace QmlDesigner {
+
+class SynchronizeCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, SynchronizeCommand &command);
+ friend bool operator ==(const SynchronizeCommand &first, const SynchronizeCommand &second);
+
+public:
+ SynchronizeCommand()
+ : m_synchronizeId(-1)
+ {}
+ explicit SynchronizeCommand(int synchronizeId)
+ : m_synchronizeId(synchronizeId)
+ {}
+
+ int synchronizeId() const { return m_synchronizeId; }
+
+ friend QDataStream &operator<<(QDataStream &out, const SynchronizeCommand &command)
+ {
+ out << command.synchronizeId();
+
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, SynchronizeCommand &command)
+ {
+ in >> command.m_synchronizeId;
+
+ return in;
+ }
+
+ friend bool operator==(const SynchronizeCommand &first, const SynchronizeCommand &second)
+ {
+ return first.m_synchronizeId == second.m_synchronizeId;
+ }
+
+ friend QDebug operator<<(QDebug debug, const SynchronizeCommand &command)
+ {
+ return debug.nospace() << "SynchronizeCommand(synchronizeId: " << command.synchronizeId()
+ << ")";
+ }
+
+private:
+ int m_synchronizeId;
+};
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::SynchronizeCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/tokencommand.cpp b/src/libs/qmlpuppetcommunication/commands/tokencommand.cpp
new file mode 100644
index 00000000000..3832e1d1fdd
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/tokencommand.cpp
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "tokencommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+#include <algorithm>
+
+namespace QmlDesigner {
+
+TokenCommand::TokenCommand()
+ : m_tokenNumber(-1)
+{
+}
+
+TokenCommand::TokenCommand(const QString &tokenName, qint32 tokenNumber, const QVector<qint32> &instanceIdVector)
+ : m_tokenName(tokenName),
+ m_tokenNumber(tokenNumber),
+ m_instanceIdVector(instanceIdVector)
+{
+}
+
+QString TokenCommand::tokenName() const
+{
+ return m_tokenName;
+}
+
+qint32 TokenCommand::tokenNumber() const
+{
+ return m_tokenNumber;
+}
+
+QVector<qint32> TokenCommand::instances() const
+{
+ return m_instanceIdVector;
+}
+
+void TokenCommand::sort()
+{
+ std::sort(m_instanceIdVector.begin(), m_instanceIdVector.end());
+}
+
+QDataStream &operator<<(QDataStream &out, const TokenCommand &command)
+{
+ out << command.tokenName();
+ out << command.tokenNumber();
+ out << command.instances();
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, TokenCommand &command)
+{
+ in >> command.m_tokenName;
+ in >> command.m_tokenNumber;
+ in >> command.m_instanceIdVector;
+
+ return in;
+}
+
+bool operator ==(const TokenCommand &first, const TokenCommand &second)
+{
+ return first.m_tokenName == second.m_tokenName
+ && first.m_tokenNumber == second.m_tokenNumber
+ && first.m_instanceIdVector == second.m_instanceIdVector;
+}
+
+QDebug operator <<(QDebug debug, const TokenCommand &command)
+{
+ return debug.nospace() << "TokenCommand("
+ << "tokenName: " << command.tokenName() << ", "
+ << "tokenNumber: " << command.tokenNumber() << ", "
+ << "instances: " << command.instances() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/tokencommand.h b/src/libs/qmlpuppetcommunication/commands/tokencommand.h
new file mode 100644
index 00000000000..4294967cb26
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/tokencommand.h
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+
+#include <QMetaType>
+#include <QVector>
+#include <QString>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+class TokenCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, TokenCommand &command);
+ friend bool operator ==(const TokenCommand &first, const TokenCommand &second);
+
+public:
+ TokenCommand();
+ explicit TokenCommand(const QString &tokenName, qint32 tokenNumber, const QVector<qint32> &instances);
+
+ QString tokenName() const;
+ qint32 tokenNumber() const;
+ QVector<qint32> instances() const;
+
+ void sort();
+
+private:
+ QString m_tokenName;
+ qint32 m_tokenNumber;
+ QVector<qint32> m_instanceIdVector;
+};
+
+QDataStream &operator<<(QDataStream &out, const TokenCommand &command);
+QDataStream &operator>>(QDataStream &in, TokenCommand &command);
+
+bool operator ==(const TokenCommand &first, const TokenCommand &second);
+QDebug operator <<(QDebug debug, const TokenCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::TokenCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.cpp b/src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.cpp
new file mode 100644
index 00000000000..83486a51956
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.cpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "update3dviewstatecommand.h"
+
+#include <QDebug>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+Update3dViewStateCommand::Update3dViewStateCommand(const QSize &size)
+ : m_size(size)
+ , m_type(Update3dViewStateCommand::SizeChange)
+{
+}
+
+QSize Update3dViewStateCommand::size() const
+{
+ return m_size;
+}
+
+Update3dViewStateCommand::Type Update3dViewStateCommand::type() const
+{
+ return m_type;
+}
+
+QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command)
+{
+ out << qint32(command.type());
+ out << command.size();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command)
+{
+ qint32 type;
+ in >> type;
+ command.m_type = Update3dViewStateCommand::Type(type);
+ in >> command.m_size;
+
+ return in;
+}
+
+QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command)
+{
+ return debug.nospace() << "Update3dViewStateCommand(type: "
+ << command.m_type << ","
+ << command.m_size << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.h b/src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.h
new file mode 100644
index 00000000000..e75763c58f7
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/update3dviewstatecommand.h
@@ -0,0 +1,38 @@
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QtCore/qsize.h>
+
+namespace QmlDesigner {
+
+class Update3dViewStateCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command);
+ friend QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
+
+public:
+ enum Type { SizeChange, Empty };
+
+ explicit Update3dViewStateCommand(const QSize &size);
+ Update3dViewStateCommand() = default;
+
+ QSize size() const;
+ Type type() const;
+
+private:
+ QSize m_size;
+
+ Type m_type = Empty;
+};
+
+QDataStream &operator<<(QDataStream &out, const Update3dViewStateCommand &command);
+QDataStream &operator>>(QDataStream &in, Update3dViewStateCommand &command);
+
+QDebug operator<<(QDebug debug, const Update3dViewStateCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::Update3dViewStateCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/valueschangedcommand.cpp b/src/libs/qmlpuppetcommunication/commands/valueschangedcommand.cpp
new file mode 100644
index 00000000000..21de2a79198
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/valueschangedcommand.cpp
@@ -0,0 +1,181 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "valueschangedcommand.h"
+
+#include "sharedmemory.h"
+
+#include <QCache>
+#include <QDebug>
+#include <QIODevice>
+
+#include <cstring>
+
+#include <algorithm>
+
+namespace QmlDesigner {
+
+// using cache as a container which deletes sharedmemory pointers at process exit
+using GlobalSharedMemoryContainer = QCache<qint32, SharedMemory>;
+Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
+
+ValuesChangedCommand::ValuesChangedCommand()
+ : m_keyNumber(0)
+{
+}
+
+ValuesChangedCommand::ValuesChangedCommand(const QVector<PropertyValueContainer> &valueChangeVector)
+ : m_valueChangeVector (valueChangeVector),
+ m_keyNumber(0)
+{
+}
+
+const QVector<PropertyValueContainer> ValuesChangedCommand::valueChanges() const
+{
+ return m_valueChangeVector;
+}
+
+quint32 ValuesChangedCommand::keyNumber() const
+{
+ return m_keyNumber;
+}
+
+void ValuesChangedCommand::removeSharedMemorys(const QVector<qint32> &keyNumberVector)
+{
+ for (qint32 keyNumber : keyNumberVector) {
+ SharedMemory *sharedMemory = globalSharedMemoryContainer()->take(keyNumber);
+ delete sharedMemory;
+ }
+}
+
+void ValuesChangedCommand::sort()
+{
+ std::sort(m_valueChangeVector.begin(), m_valueChangeVector.end());
+}
+
+static const QLatin1String valueKeyTemplateString("Values-%1");
+
+static SharedMemory *createSharedMemory(qint32 key, int byteCount)
+{
+ SharedMemory *sharedMemory = new SharedMemory(QString(valueKeyTemplateString).arg(key));
+
+ bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
+
+ if (sharedMemoryIsCreated) {
+ globalSharedMemoryContainer()->insert(key, sharedMemory);
+ return sharedMemory;
+ } else {
+ delete sharedMemory;
+ }
+
+ return nullptr;
+}
+
+QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command)
+{
+ static const bool dontUseSharedMemory = qEnvironmentVariableIsSet("DESIGNER_DONT_USE_SHARED_MEMORY");
+
+ QVector<PropertyValueContainer> propertyValueContainer = command.valueChanges();
+
+ if (command.transactionOption != ValuesChangedCommand::TransactionOption::None) {
+ PropertyValueContainer optionContainer(command.transactionOption);
+ propertyValueContainer.append(optionContainer);
+ }
+
+ if (!dontUseSharedMemory && propertyValueContainer.count() > 5) {
+ static quint32 keyCounter = 0;
+ ++keyCounter;
+ command.m_keyNumber = keyCounter;
+ QByteArray outDataStreamByteArray;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QDataStream temporaryOutDataStream(&outDataStreamByteArray, QIODevice::WriteOnly);
+#else
+ QDataStream temporaryOutDataStream(&outDataStreamByteArray, QDataStream::WriteOnly);
+#endif
+ temporaryOutDataStream.setVersion(QDataStream::Qt_4_8);
+
+ temporaryOutDataStream << propertyValueContainer;
+
+ SharedMemory *sharedMemory = createSharedMemory(keyCounter, outDataStreamByteArray.size());
+
+ if (sharedMemory) {
+ sharedMemory->lock();
+ std::memcpy(sharedMemory->data(), outDataStreamByteArray.constData(), sharedMemory->size());
+ sharedMemory->unlock();
+
+ out << command.keyNumber();
+ return out;
+ }
+ }
+
+ out << qint32(0);
+ out << propertyValueContainer;
+
+ return out;
+}
+
+void readSharedMemory(qint32 key, QVector<PropertyValueContainer> *valueChangeVector)
+{
+ SharedMemory sharedMemory(QString(valueKeyTemplateString).arg(key));
+ bool canAttach = sharedMemory.attach(QSharedMemory::ReadOnly);
+
+ if (canAttach) {
+ sharedMemory.lock();
+
+ QDataStream in(QByteArray::fromRawData(static_cast<const char*>(sharedMemory.constData()), sharedMemory.size()));
+ in.setVersion(QDataStream::Qt_4_8);
+ in >> *valueChangeVector;
+
+ sharedMemory.unlock();
+ sharedMemory.detach();
+ }
+}
+
+QDataStream &operator>>(QDataStream &in, ValuesChangedCommand &command)
+{
+ in >> command.m_keyNumber;
+
+ QVector<PropertyValueContainer> valueChangeVector;
+
+ if (command.keyNumber() > 0)
+ readSharedMemory(command.keyNumber(), &valueChangeVector);
+ else
+ in >> valueChangeVector;
+
+ // '-option-' is not a valid property name and indicates that we store the transaction option.
+ if (!valueChangeVector.isEmpty() && valueChangeVector.last().name() == "-option-") {
+ command.transactionOption =
+ static_cast<ValuesChangedCommand::TransactionOption>(valueChangeVector.last().instanceId());
+ valueChangeVector.removeLast();
+ }
+
+ command.m_valueChangeVector = valueChangeVector;
+
+ return in;
+}
+
+bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second)
+{
+ return first.m_valueChangeVector == second.m_valueChangeVector
+ && first.transactionOption == second.transactionOption;
+}
+
+QDebug operator <<(QDebug debug, const ValuesChangedCommand &command)
+{
+ return debug.nospace() << "ValuesChangedCommand("
+ << "keyNumber: " << command.keyNumber() << ", "
+ << command.valueChanges() << ")";
+}
+
+QDataStream &operator<<(QDataStream &out, const ValuesModifiedCommand &command)
+{
+ return out << static_cast<const ValuesChangedCommand &>(command);
+}
+
+QDataStream &operator>>(QDataStream &in, ValuesModifiedCommand &command)
+{
+ return in >> static_cast<ValuesChangedCommand &>(command);
+}
+
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/valueschangedcommand.h b/src/libs/qmlpuppetcommunication/commands/valueschangedcommand.h
new file mode 100644
index 00000000000..36a36439dce
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/valueschangedcommand.h
@@ -0,0 +1,66 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QVector>
+
+#include "propertyvaluecontainer.h"
+
+namespace QmlDesigner {
+
+class ValuesChangedCommand
+{
+ friend QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command);
+ friend QDataStream &operator>>(QDataStream &in, ValuesChangedCommand &command);
+ friend bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second);
+
+public:
+ enum TransactionOption { Start = 1, End = 2, None = 0 };
+ ValuesChangedCommand();
+ explicit ValuesChangedCommand(const QVector<PropertyValueContainer> &valueChangeVector);
+
+ const QVector<PropertyValueContainer> valueChanges() const;
+ quint32 keyNumber() const;
+
+ static void removeSharedMemorys(const QVector<qint32> &keyNumberVector);
+
+ void sort();
+ TransactionOption transactionOption = TransactionOption::None;
+
+private:
+ QVector<PropertyValueContainer> m_valueChangeVector;
+ mutable quint32 m_keyNumber;
+};
+
+QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command);
+QDataStream &operator>>(QDataStream &in, ValuesChangedCommand &command);
+
+bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second);
+QDebug operator <<(QDebug debug, const ValuesChangedCommand &instance);
+
+/* ValuesChangedCommand is used to notify that the values of a specific instatiated
+ * QObject changed.
+ * The ValuesModifiedCommand is used to notify that a user changed a QML property and
+ * that this property should be changed in the data model.
+ */
+
+class ValuesModifiedCommand : public ValuesChangedCommand
+{
+public:
+ ValuesModifiedCommand() = default;
+
+ explicit ValuesModifiedCommand(const QVector<PropertyValueContainer> &valueChangeVector)
+ : ValuesChangedCommand(valueChangeVector)
+ {}
+};
+
+QDataStream &operator<<(QDataStream &out, const ValuesModifiedCommand &command);
+QDataStream &operator>>(QDataStream &in, ValuesModifiedCommand &command);
+
+} // namespace QmlDesigner
+
+
+Q_DECLARE_METATYPE(QmlDesigner::ValuesModifiedCommand)
+Q_DECLARE_METATYPE(QmlDesigner::ValuesChangedCommand)
diff --git a/src/libs/qmlpuppetcommunication/commands/view3dactioncommand.cpp b/src/libs/qmlpuppetcommunication/commands/view3dactioncommand.cpp
new file mode 100644
index 00000000000..ee3c7da797c
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/view3dactioncommand.cpp
@@ -0,0 +1,79 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "view3dactioncommand.h"
+
+#include <QDebug>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+View3DActionCommand::View3DActionCommand(View3DActionType type, const QVariant &value)
+ : m_type(type)
+ , m_value(value)
+{
+}
+
+bool View3DActionCommand::isEnabled() const
+{
+ return m_value.toBool();
+}
+
+QVariant View3DActionCommand::value() const
+{
+ return m_value;
+}
+
+View3DActionType View3DActionCommand::type() const
+{
+ return m_type;
+}
+
+int View3DActionCommand::position() const
+{
+ bool ok = false;
+ int result = m_value.toInt(&ok);
+ if (!ok) {
+ qWarning() << "View3DActionCommand: returning a position that is not int; command type = "
+ << m_type;
+ }
+
+ return result;
+}
+
+QDataStream &operator<<(QDataStream &out, const View3DActionCommand &command)
+{
+ out << command.value();
+ out << command.type();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, View3DActionCommand &command)
+{
+ in >> command.m_value;
+ in >> command.m_type;
+
+ return in;
+}
+
+QDebug operator<<(QDebug debug, const View3DActionCommand &command)
+{
+ return debug.nospace() << "View3DActionCommand(type: "
+ << command.m_type << ","
+ << command.m_value << ")\n";
+}
+
+template<typename Enumeration>
+constexpr std::underlying_type_t<Enumeration> to_underlying(Enumeration enumeration) noexcept
+{
+ static_assert(std::is_enum_v<Enumeration>, "to_underlying expect an enumeration");
+ return static_cast<std::underlying_type_t<Enumeration>>(enumeration);
+}
+
+QDebug operator<<(QDebug debug, View3DActionType type)
+{
+ return debug.nospace() << to_underlying(type);
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/commands/view3dactioncommand.h b/src/libs/qmlpuppetcommunication/commands/view3dactioncommand.h
new file mode 100644
index 00000000000..946ea02f6c2
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/commands/view3dactioncommand.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <nodeinstanceglobal.h>
+
+#include <QMetaType>
+#include <QVariant>
+
+namespace QmlDesigner {
+
+class View3DActionCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, View3DActionCommand &command);
+ friend QDebug operator<<(QDebug debug, const View3DActionCommand &command);
+
+public:
+ View3DActionCommand(View3DActionType type, const QVariant &value);
+
+ View3DActionCommand() = default;
+
+ bool isEnabled() const;
+ QVariant value() const;
+ View3DActionType type() const;
+ int position() const;
+
+private:
+ View3DActionType m_type = View3DActionType::Empty;
+ QVariant m_value;
+};
+
+QDataStream &operator<<(QDataStream &out, const View3DActionCommand &command);
+QDataStream &operator>>(QDataStream &in, View3DActionCommand &command);
+
+QDebug operator<<(QDebug debug, const View3DActionCommand &command);
+QDebug operator<<(QDebug debug, View3DActionType type);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::View3DActionCommand)
diff --git a/src/libs/qmlpuppetcommunication/container/addimportcontainer.cpp b/src/libs/qmlpuppetcommunication/container/addimportcontainer.cpp
new file mode 100644
index 00000000000..eb36d656b04
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/addimportcontainer.cpp
@@ -0,0 +1,90 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "addimportcontainer.h"
+
+#include <QDebug>
+#include <QDataStream>
+
+namespace QmlDesigner {
+
+AddImportContainer::AddImportContainer() = default;
+
+AddImportContainer::AddImportContainer(const QUrl &url, const QString &fileName, const QString &version, const QString &alias, const QStringList &importPathList)
+ : m_url(url),
+ m_fileName(fileName),
+ m_version(version),
+ m_alias(alias),
+ m_importPathList(importPathList)
+{
+}
+
+QUrl AddImportContainer::url() const
+{
+ return m_url;
+}
+
+QString AddImportContainer::fileName() const
+{
+ return m_fileName;
+}
+
+QString AddImportContainer::version() const
+{
+ return m_version;
+}
+
+QString AddImportContainer::alias() const
+{
+ return m_alias;
+}
+
+QStringList AddImportContainer::importPaths() const
+{
+ return m_importPathList;
+}
+
+QDataStream &operator<<(QDataStream &out, const AddImportContainer &command)
+{
+ out << command.url();
+ out << command.fileName();
+ out << command.version();
+ out << command.alias();
+ out << command.importPaths();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, AddImportContainer &command)
+{
+ in >> command.m_url;
+ in >> command.m_fileName;
+ in >> command.m_version;
+ in >> command.m_alias;
+ in >> command.m_importPathList;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const AddImportContainer &container)
+{
+ debug.nospace() << "AddImportContainer(";
+
+ if (!container.url().isEmpty())
+ debug.nospace() << "url: " << container.url() << ", ";
+
+ if (!container.fileName().isEmpty())
+ debug.nospace() << "fileName: " << container.fileName() << ", ";
+
+ if (!container.version().isEmpty())
+ debug.nospace() << "version: " << container.version() << ", ";
+
+ if (!container.alias().isEmpty())
+ debug.nospace() << "alias: " << container.alias() << ", ";
+
+ debug.nospace() << "importPaths: " << container.importPaths();
+
+ return debug.nospace() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/addimportcontainer.h b/src/libs/qmlpuppetcommunication/container/addimportcontainer.h
new file mode 100644
index 00000000000..fadfbab44e7
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/addimportcontainer.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QUrl>
+#include <QString>
+#include <QStringList>
+
+namespace QmlDesigner {
+
+class AddImportContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, AddImportContainer &command);
+public:
+ AddImportContainer();
+ AddImportContainer(const QUrl &url, const QString &fileName, const QString &version, const QString &alias, const QStringList &mportPathList);
+
+ QUrl url() const;
+ QString fileName() const;
+ QString version() const;
+ QString alias() const;
+ QStringList importPaths() const;
+
+private:
+ QUrl m_url;
+ QString m_fileName;
+ QString m_version;
+ QString m_alias;
+ QStringList m_importPathList;
+};
+
+QDataStream &operator<<(QDataStream &out, const AddImportContainer &command);
+QDataStream &operator>>(QDataStream &in, AddImportContainer &command);
+
+QDebug operator <<(QDebug debug, const AddImportContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::AddImportContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/idcontainer.cpp b/src/libs/qmlpuppetcommunication/container/idcontainer.cpp
new file mode 100644
index 00000000000..f28c9e91e9d
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/idcontainer.cpp
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "idcontainer.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+IdContainer::IdContainer()
+ : m_instanceId(-1)
+{
+}
+
+IdContainer::IdContainer(qint32 instanceId, const QString &id)
+ : m_instanceId(instanceId),
+ m_id(id)
+{
+}
+
+qint32 IdContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+QString IdContainer::id() const
+{
+ return m_id;
+}
+
+QDataStream &operator<<(QDataStream &out, const IdContainer &container)
+{
+ out << container.instanceId();
+ out << container.id();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, IdContainer &container)
+{
+ in >> container.m_instanceId;
+ in >> container.m_id;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const IdContainer &container)
+{
+ return debug.nospace() << "IdContainer("
+ << "instanceId: " << container.instanceId() << ", "
+ << "id: " << container.id() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/idcontainer.h b/src/libs/qmlpuppetcommunication/container/idcontainer.h
new file mode 100644
index 00000000000..c9fade64c75
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/idcontainer.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDataStream>
+#include <qmetatype.h>
+#include <QString>
+
+
+namespace QmlDesigner {
+
+class IdContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, IdContainer &container);
+
+public:
+ IdContainer();
+ IdContainer(qint32 instanceId, const QString &id);
+
+ qint32 instanceId() const;
+ QString id() const;
+
+private:
+ qint32 m_instanceId;
+ QString m_id;
+};
+
+QDataStream &operator<<(QDataStream &out, const IdContainer &container);
+QDataStream &operator>>(QDataStream &in, IdContainer &container);
+
+QDebug operator <<(QDebug debug, const IdContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::IdContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/imagecontainer.cpp b/src/libs/qmlpuppetcommunication/container/imagecontainer.cpp
new file mode 100644
index 00000000000..d71ba4769ee
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/imagecontainer.cpp
@@ -0,0 +1,255 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "imagecontainer.h"
+
+#include "sharedmemory.h"
+#include <QCache>
+#include <QDebug>
+#include <QLoggingCategory>
+
+#include <cstring>
+
+#define QTC_ASSERT_STRINGIFY_HELPER(x) #x
+#define QTC_ASSERT_STRINGIFY(x) QTC_ASSERT_STRINGIFY_HELPER(x)
+#define QTC_ASSERT_STRING(cond) qDebug("SOFT ASSERT: \"" cond"\" in file " __FILE__ ", line " QTC_ASSERT_STRINGIFY(__LINE__))
+#define QTC_ASSERT(cond, action) if (cond) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)
+
+static Q_LOGGING_CATEGORY(imageContainerDebug, "qtc.imagecontainer.debug", QtDebugMsg)
+
+namespace QmlDesigner {
+
+// using cache as a container which deletes sharedmemory pointers at process exit
+using GlobalSharedMemoryContainer = QCache<qint32, SharedMemory>;
+Q_GLOBAL_STATIC_WITH_ARGS(GlobalSharedMemoryContainer, globalSharedMemoryContainer, (10000))
+
+ImageContainer::ImageContainer()
+ : m_instanceId(-1),
+ m_keyNumber(-2)
+{
+}
+
+ImageContainer::ImageContainer(qint32 instanceId, const QImage &image, qint32 keyNumber)
+ : m_image(image),
+ m_instanceId(instanceId),
+ m_keyNumber(keyNumber)
+{
+}
+
+qint32 ImageContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+QImage ImageContainer::image() const
+{
+ return m_image;
+}
+
+qint32 ImageContainer::keyNumber() const
+{
+ return m_keyNumber;
+}
+
+void ImageContainer::setImage(const QImage &image)
+{
+ QTC_ASSERT(m_image.isNull(), /**/);
+
+ m_image = image;
+}
+
+void ImageContainer::removeSharedMemorys(const QVector<qint32> &keyNumberVector)
+{
+ for (qint32 keyNumber : keyNumberVector) {
+ SharedMemory *sharedMemory = globalSharedMemoryContainer()->take(keyNumber);
+ delete sharedMemory;
+ }
+}
+
+static const QLatin1String imageKeyTemplateString("Image-%1");
+
+static SharedMemory *createSharedMemory(qint32 key, int byteCount)
+{
+ SharedMemory *sharedMemory = (*globalSharedMemoryContainer())[key];
+
+ if (sharedMemory == nullptr) {
+ sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key));
+ bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
+ if (sharedMemoryIsCreated) {
+ if (!globalSharedMemoryContainer()->insert(key, sharedMemory))
+ return nullptr;
+ } else {
+ delete sharedMemory;
+ sharedMemory = nullptr;
+ }
+ } else {
+ bool sharedMemoryIsAttached = sharedMemory->isAttached();
+ if (!sharedMemoryIsAttached)
+ sharedMemoryIsAttached = sharedMemory->attach();
+
+ bool sharedMemorySizeIsSmallerThanByteCount = sharedMemory->size() < byteCount;
+ bool sharedMemorySizeIsDoubleBiggerThanByteCount = sharedMemory->size() > (byteCount * 2);
+
+ if (!sharedMemoryIsAttached) {
+ sharedMemory->create(byteCount);
+ } else if (sharedMemorySizeIsSmallerThanByteCount || sharedMemorySizeIsDoubleBiggerThanByteCount) {
+ sharedMemory->detach();
+ sharedMemory->create(byteCount);
+ }
+
+ if (!sharedMemory->isAttached()) {
+ globalSharedMemoryContainer()->remove(key);
+ sharedMemory = nullptr;
+ }
+ }
+
+ return sharedMemory;
+}
+
+static void writeSharedMemory(SharedMemory *sharedMemory, const QImage &image)
+{
+ sharedMemory->lock();
+
+ qint32 headerData[6];
+ headerData[0] = qint32(image.sizeInBytes());
+ headerData[1] = image.bytesPerLine();
+ headerData[2] = image.size().width();
+ headerData[3] = image.size().height();
+ headerData[4] = image.format();
+ headerData[5] = image.devicePixelRatio() * 100;
+
+ std::memcpy(sharedMemory->data(), headerData, 24);
+ std::memcpy(reinterpret_cast<char*>(sharedMemory->data()) + 24, image.constBits(), image.sizeInBytes());
+ sharedMemory->unlock();
+}
+
+static void writeStream(QDataStream &out, const QImage &image)
+{
+ out << qint32(image.bytesPerLine());
+ out << image.size();
+ out << qint32(image.format());
+ out << qint32(image.sizeInBytes());
+ out << qint32(image.devicePixelRatio() * 100);
+ out.writeRawData(reinterpret_cast<const char*>(image.constBits()), image.sizeInBytes());
+}
+
+QDataStream &operator<<(QDataStream &out, const ImageContainer &container)
+{
+ const int extraDataSize = 24;
+ static const bool dontUseSharedMemory = qEnvironmentVariableIsSet("DESIGNER_DONT_USE_SHARED_MEMORY");
+
+ out << container.instanceId();
+ out << container.keyNumber();
+
+ const QImage image = container.image();
+
+ if (dontUseSharedMemory) {
+ out << qint32(0);
+ writeStream(out, image);
+ } else {
+ const qint32 totalSize = qint32(image.sizeInBytes()) + extraDataSize;
+ SharedMemory *sharedMemory = createSharedMemory(container.keyNumber(), totalSize);
+
+ out << qint32(sharedMemory != nullptr); // send if shared memory is used
+
+ if (sharedMemory)
+ writeSharedMemory(sharedMemory, image);
+ else
+ writeStream(out, image);
+ }
+
+ return out;
+}
+
+static void readSharedMemory(qint32 key, ImageContainer &container)
+{
+ SharedMemory sharedMemory(QString(imageKeyTemplateString).arg(key));
+
+ bool canAttach = sharedMemory.attach(QSharedMemory::ReadOnly);
+
+ if (canAttach && sharedMemory.size() >= 24)
+ {
+ sharedMemory.lock();
+ qint32 headerData[6];
+ std::memcpy(headerData, sharedMemory.constData(), 24);
+
+ qint32 byteCount = headerData[0];
+// qint32 bytesPerLine = headerData[1];
+ qint32 imageWidth = headerData[2];
+ qint32 imageHeight = headerData[3];
+ qint32 imageFormat = headerData[4];
+ qreal pixelRatio = headerData[5] / 100.0;
+
+ QImage image = QImage(imageWidth, imageHeight, QImage::Format(imageFormat));
+ image.setDevicePixelRatio(pixelRatio);
+
+ if (image.isNull())
+ qCInfo(imageContainerDebug()) << Q_FUNC_INFO << "Not able to create image:" << imageWidth << imageHeight << imageFormat;
+ else
+ std::memcpy(image.bits(), reinterpret_cast<const qint32*>(sharedMemory.constData()) + 6, byteCount);
+
+ container.setImage(image);
+
+ sharedMemory.unlock();
+ sharedMemory.detach();
+ }
+}
+
+static void readStream(QDataStream &in, ImageContainer &container)
+{
+ qint32 byteCount;
+ qint32 bytesPerLine;
+ QSize imageSize;
+ qint32 imageFormat;
+ qint32 pixelRatio;
+
+ in >> bytesPerLine;
+ in >> imageSize;
+ in >> imageFormat;
+ in >> byteCount;
+ in >> pixelRatio;
+
+ QImage image = QImage(imageSize, QImage::Format(imageFormat));
+
+ in.readRawData(reinterpret_cast<char*>(image.bits()), byteCount);
+ image.setDevicePixelRatio(pixelRatio / 100.0);
+
+ container.setImage(image);
+}
+
+QDataStream &operator>>(QDataStream &in, ImageContainer &container)
+{
+ qint32 sharedMemoryIsUsed;
+
+ in >> container.m_instanceId;
+ in >> container.m_keyNumber;
+ in >> sharedMemoryIsUsed;
+
+ if (sharedMemoryIsUsed) {
+ readSharedMemory(container.keyNumber(), container);
+ } else
+ readStream(in, container);
+
+ return in;
+}
+
+bool operator ==(const ImageContainer &first, const ImageContainer &second)
+{
+ return first.m_instanceId == second.m_instanceId
+ && first.m_image == second.m_image;
+}
+
+bool operator <(const ImageContainer &first, const ImageContainer &second)
+{
+ return first.m_instanceId < second.m_instanceId;
+}
+
+QDebug operator <<(QDebug debug, const ImageContainer &container)
+{
+ return debug.nospace() << "ImageContainer("
+ << "instanceId: " << container.instanceId() << ", "
+ << "size: " << container.image().size() << ")";
+}
+
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/imagecontainer.h b/src/libs/qmlpuppetcommunication/container/imagecontainer.h
new file mode 100644
index 00000000000..c6c101ca8c4
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/imagecontainer.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QImage>
+
+namespace QmlDesigner {
+
+class ImageContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, ImageContainer &container);
+ friend bool operator ==(const ImageContainer &first, const ImageContainer &second);
+ friend bool operator <(const ImageContainer &first, const ImageContainer &second);
+
+public:
+ ImageContainer();
+ ImageContainer(qint32 instanceId, const QImage &image, qint32 keyNumber);
+
+ qint32 instanceId() const;
+ QImage image() const;
+ qint32 keyNumber() const;
+
+ void setImage(const QImage &image);
+
+ static void removeSharedMemorys(const QVector<qint32> &keyNumberVector);
+
+private:
+ QImage m_image;
+ qint32 m_instanceId;
+ qint32 m_keyNumber;
+};
+
+QDataStream &operator<<(QDataStream &out, const ImageContainer &container);
+QDataStream &operator>>(QDataStream &in, ImageContainer &container);
+
+bool operator ==(const ImageContainer &first, const ImageContainer &second);
+bool operator <(const ImageContainer &first, const ImageContainer &second);
+QDebug operator <<(QDebug debug, const ImageContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::ImageContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/informationcontainer.cpp b/src/libs/qmlpuppetcommunication/container/informationcontainer.cpp
new file mode 100644
index 00000000000..7a518777191
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/informationcontainer.cpp
@@ -0,0 +1,124 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "informationcontainer.h"
+
+#include <QtDebug>
+
+namespace QmlDesigner {
+
+InformationContainer::InformationContainer()
+ : m_instanceId(-1),
+ m_name(NoName)
+{
+}
+
+InformationContainer::InformationContainer(qint32 instanceId,
+ InformationName name,
+ const QVariant &information,
+ const QVariant &secondInformation,
+ const QVariant &thirdInformation)
+ : m_instanceId(instanceId),
+ m_name(name),
+ m_information(information),
+ m_secondInformation(secondInformation),
+ m_thirdInformation(thirdInformation)
+{
+}
+
+qint32 InformationContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+InformationName InformationContainer::name() const
+{
+ return InformationName(m_name);
+}
+
+QVariant InformationContainer::information() const
+{
+ return m_information;
+}
+
+QVariant InformationContainer::secondInformation() const
+{
+ return m_secondInformation;
+}
+
+QVariant InformationContainer::thirdInformation() const
+{
+ return m_thirdInformation;
+}
+
+QDataStream &operator<<(QDataStream &out, const InformationContainer &container)
+{
+ out << container.instanceId();//
+ out << container.m_name;
+ out << container.information();
+ out << container.secondInformation();
+ out << container.thirdInformation();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, InformationContainer &container)
+{
+
+ in >> container.m_instanceId;
+ in >> container.m_name;
+ in >> container.m_information;
+ in >> container.m_secondInformation;
+ in >> container.m_thirdInformation;
+
+ return in;
+}
+
+bool operator ==(const InformationContainer &first, const InformationContainer &second)
+{
+ return first.m_instanceId == second.m_instanceId
+ && first.m_name == second.m_name
+ && first.m_information == second.m_information
+ && first.m_secondInformation == second.m_secondInformation
+ && first.m_thirdInformation == second.m_thirdInformation;
+}
+
+static bool isFirstLessThenSecond(const QVariant &first, const QVariant &second)
+{
+#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) || QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ if (first.userType() == second.userType()) {
+ if (first.canConvert<QByteArray>())
+ return first.value<QByteArray>() < second.value<QByteArray>();
+ }
+
+ return true;
+#else
+ return first < second;
+#endif
+}
+
+bool operator <(const InformationContainer &first, const InformationContainer &second)
+{
+ return (first.m_instanceId < second.m_instanceId)
+ || (first.m_instanceId == second.m_instanceId && first.m_name < second.m_name)
+ || (first.m_instanceId == second.m_instanceId && first.m_name == second.m_name
+ && isFirstLessThenSecond(first.m_information, second.m_information));
+}
+
+QDebug operator <<(QDebug debug, const InformationContainer &container)
+{
+ debug.nospace() << "InformationContainer("
+ << "instanceId: " << container.instanceId() << ", "
+ << "name: " << container.name() << ", "
+ << "information: " << container.information();
+
+ if (container.secondInformation().isValid())
+ debug.nospace() << ", " << "secondInformation: " << container.secondInformation();
+
+ if (container.thirdInformation().isValid())
+ debug.nospace() << ", " << "thirdInformation: " << container.thirdInformation();
+
+ return debug.nospace() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/informationcontainer.h b/src/libs/qmlpuppetcommunication/container/informationcontainer.h
new file mode 100644
index 00000000000..93c06560d26
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/informationcontainer.h
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDataStream>
+#include <QMetaType>
+#include <QVariant>
+#include <QString>
+
+#include "commondefines.h"
+
+namespace QmlDesigner {
+
+class InformationContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, InformationContainer &container);
+ friend QDataStream &operator<<(QDataStream &out, const InformationContainer &container);
+ friend bool operator ==(const InformationContainer &first, const InformationContainer &second);
+ friend bool operator <(const InformationContainer &first, const InformationContainer &second);
+
+public:
+ InformationContainer();
+ InformationContainer(qint32 instanceId,
+ InformationName name,
+ const QVariant &information,
+ const QVariant &secondInformation = QVariant(),
+ const QVariant &thirdInformation = QVariant());
+
+ qint32 instanceId() const;
+ InformationName name() const;
+ QVariant information() const;
+ QVariant secondInformation() const;
+ QVariant thirdInformation() const;
+
+private:
+ qint32 m_instanceId;
+ qint32 m_name;
+ QVariant m_information;
+ QVariant m_secondInformation;
+ QVariant m_thirdInformation;
+};
+
+QDataStream &operator<<(QDataStream &out, const InformationContainer &container);
+QDataStream &operator>>(QDataStream &in, InformationContainer &container);
+
+bool operator ==(const InformationContainer &first, const InformationContainer &second);
+bool operator <(const InformationContainer &first, const InformationContainer &second);
+QDebug operator <<(QDebug debug, const InformationContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::InformationContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/instancecontainer.cpp b/src/libs/qmlpuppetcommunication/container/instancecontainer.cpp
new file mode 100644
index 00000000000..5e5c688cc6e
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/instancecontainer.cpp
@@ -0,0 +1,155 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "instancecontainer.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+static TypeName properDelemitingOfType(const TypeName &typeName)
+{
+ TypeName convertedTypeName = typeName;
+ int lastIndex = typeName.lastIndexOf('.');
+ if (lastIndex > 0)
+ convertedTypeName[lastIndex] = '/';
+
+ return convertedTypeName;
+}
+
+InstanceContainer::InstanceContainer() = default;
+
+InstanceContainer::InstanceContainer(qint32 instanceId,
+ const TypeName &type,
+ int majorNumber,
+ int minorNumber,
+ const QString &componentPath,
+ const QString &nodeSource,
+ NodeSourceType nodeSourceType,
+ NodeMetaType metaType,
+ NodeFlags metaFlags)
+ : m_instanceId(instanceId)
+ ,m_type(properDelemitingOfType(type))
+ ,m_majorNumber(majorNumber)
+ ,m_minorNumber(minorNumber)
+ ,m_componentPath(componentPath)
+ ,m_nodeSource(nodeSource)
+ ,m_nodeSourceType(nodeSourceType)
+ ,m_metaType(metaType)
+ ,m_metaFlags(metaFlags)
+{
+}
+
+qint32 InstanceContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+TypeName InstanceContainer::type() const
+{
+ return m_type;
+}
+
+int InstanceContainer::majorNumber() const
+{
+ return m_majorNumber;
+}
+
+int InstanceContainer::minorNumber() const
+{
+ return m_minorNumber;
+}
+
+QString InstanceContainer::componentPath() const
+{
+ return m_componentPath;
+}
+
+QString InstanceContainer::nodeSource() const
+{
+ return m_nodeSource;
+}
+
+InstanceContainer::NodeSourceType InstanceContainer::nodeSourceType() const
+{
+ return static_cast<NodeSourceType>(m_nodeSourceType);
+}
+
+InstanceContainer::NodeMetaType InstanceContainer::metaType() const
+{
+ return static_cast<NodeMetaType>(m_metaType);
+}
+
+InstanceContainer::NodeFlags InstanceContainer::metaFlags() const
+{
+ return NodeFlags(m_metaFlags);
+}
+
+bool InstanceContainer::checkFlag(NodeFlag flag) const
+{
+ return NodeFlags(m_metaFlags).testFlag(flag);
+}
+
+QDataStream &operator<<(QDataStream &out, const InstanceContainer &container)
+{
+ out << container.instanceId();
+ out << container.type();
+ out << container.majorNumber();
+ out << container.minorNumber();
+ out << container.componentPath();
+ out << container.nodeSource();
+ out << qint32(container.nodeSourceType());
+ out << qint32(container.metaType());
+ out << qint32(container.metaFlags());
+
+ return out;
+}
+
+
+QDataStream &operator>>(QDataStream &in, InstanceContainer &container)
+{
+ in >> container.m_instanceId;
+ in >> container.m_type;
+ in >> container.m_majorNumber;
+ in >> container.m_minorNumber;
+ in >> container.m_componentPath;
+ in >> container.m_nodeSource;
+ in >> container.m_nodeSourceType;
+ in >> container.m_metaType;
+ in >> container.m_metaFlags;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const InstanceContainer &command)
+{
+ debug.nospace() << "InstanceContainer("
+ << "instanceId: " << command.instanceId() << ", "
+ << "type: " << command.type() << ", "
+ << "majorNumber: " << command.majorNumber() << ", "
+ << "minorNumber: " << command.minorNumber() << ", ";
+
+ if (!command.componentPath().isEmpty())
+ debug.nospace() << "componentPath: " << command.componentPath() << ", ";
+
+ if (!command.nodeSource().isEmpty())
+ debug.nospace() << "nodeSource: " << command.nodeSource() << ", ";
+
+ if (command.nodeSourceType() == InstanceContainer::NoSource)
+ debug.nospace() << "nodeSourceType: NoSource, ";
+ else if (command.nodeSourceType() == InstanceContainer::CustomParserSource)
+ debug.nospace() << "nodeSourceType: CustomParserSource, ";
+ else
+ debug.nospace() << "nodeSourceType: ComponentSource, ";
+
+ if (command.metaType() == InstanceContainer::ObjectMetaType)
+ debug.nospace() << "metatype: ObjectMetaType";
+ else
+ debug.nospace() << "metatype: ItemMetaType";
+
+ return debug.nospace() << ")";
+
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/instancecontainer.h b/src/libs/qmlpuppetcommunication/container/instancecontainer.h
new file mode 100644
index 00000000000..4d0218f2485
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/instancecontainer.h
@@ -0,0 +1,80 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <qmetatype.h>
+#include <QString>
+#include <QDataStream>
+
+#include "nodeinstanceglobal.h"
+
+namespace QmlDesigner {
+
+class InstanceContainer;
+
+QDataStream &operator<<(QDataStream &out, const InstanceContainer &container);
+QDataStream &operator>>(QDataStream &in, InstanceContainer &container);
+
+class InstanceContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, InstanceContainer &container);
+
+public:
+ enum NodeSourceType {
+ NoSource = 0,
+ CustomParserSource = 1,
+ ComponentSource = 2
+ };
+
+ enum NodeMetaType {
+ ObjectMetaType,
+ ItemMetaType
+ };
+
+ enum NodeFlag {
+ ParentTakesOverRendering = 1
+ };
+
+ Q_DECLARE_FLAGS(NodeFlags, NodeFlag)
+
+ InstanceContainer();
+ InstanceContainer(qint32 instanceId,
+ const TypeName &type,
+ int majorNumber,
+ int minorNumber,
+ const QString &componentPath,
+ const QString &nodeSource,
+ NodeSourceType nodeSourceType,
+ NodeMetaType metaType,
+ NodeFlags metaFlags);
+
+ qint32 instanceId() const;
+ TypeName type() const;
+ int majorNumber() const;
+ int minorNumber() const;
+ QString componentPath() const;
+ QString nodeSource() const;
+ NodeSourceType nodeSourceType() const;
+ NodeMetaType metaType() const;
+ bool checkFlag(NodeFlag flag) const;
+ NodeFlags metaFlags() const;
+
+private:
+ qint32 m_instanceId = -1;
+ TypeName m_type;
+ qint32 m_majorNumber = -1;
+ qint32 m_minorNumber = -1;
+ QString m_componentPath;
+ QString m_nodeSource;
+ qint32 m_nodeSourceType = 0;
+ qint32 m_metaType = 0;
+ qint32 m_metaFlags = 0;
+};
+
+QDebug operator <<(QDebug debug, const InstanceContainer &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::InstanceContainer)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QmlDesigner::InstanceContainer::NodeFlags)
diff --git a/src/libs/qmlpuppetcommunication/container/mockuptypecontainer.cpp b/src/libs/qmlpuppetcommunication/container/mockuptypecontainer.cpp
new file mode 100644
index 00000000000..b4e7218f792
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/mockuptypecontainer.cpp
@@ -0,0 +1,63 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "mockuptypecontainer.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+QmlDesigner::MockupTypeContainer::MockupTypeContainer() = default;
+
+QmlDesigner::MockupTypeContainer::MockupTypeContainer(const QmlDesigner::TypeName &type,
+ const QString &importUri,
+ int majorVersion,
+ int minorVersion, bool isItem)
+ : m_typeName(type)
+ ,m_importUri(importUri)
+ ,m_majorVersion(majorVersion)
+ ,m_minorVersion(minorVersion)
+ ,m_isItem(isItem)
+{
+
+}
+
+QString MockupTypeContainer::importUri() const
+{
+ return m_importUri;
+}
+
+QDataStream &operator<<(QDataStream &out, const MockupTypeContainer &container)
+{
+ out << container.typeName();
+ out << container.importUri();
+ out << container.majorVersion();
+ out << container.minorVersion();
+ out << container.isItem();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, MockupTypeContainer &container)
+{
+ in >> container.m_typeName;
+ in >> container.m_importUri;
+ in >> container.m_majorVersion;
+ in >> container.m_minorVersion;
+ in >> container.m_isItem;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const MockupTypeContainer &container)
+{
+ return debug.nospace() << "MockupTypeContainer("
+ << "typeName: " << container.typeName() << ", "
+ << "importUri: " << container.importUri() << ", "
+ << "majorVersion: " << container.majorVersion() << ", "
+ << "minorVersion: " << container.minorVersion() << ", "
+ << "isItem: " << container.isItem() << ")";
+}
+
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/mockuptypecontainer.h b/src/libs/qmlpuppetcommunication/container/mockuptypecontainer.h
new file mode 100644
index 00000000000..8294b8a845b
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/mockuptypecontainer.h
@@ -0,0 +1,52 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <qmetatype.h>
+#include <QString>
+#include <QDataStream>
+
+#include "nodeinstanceglobal.h"
+
+namespace QmlDesigner {
+
+class MockupTypeContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, MockupTypeContainer &container);
+
+public:
+ MockupTypeContainer();
+ MockupTypeContainer(const TypeName &type, const QString &importUri, int majorVersion, int minorVersion, bool isItem);
+
+ TypeName typeName() const
+ { return m_typeName; }
+
+ QString importUri() const;
+
+ int majorVersion() const
+ { return m_majorVersion; }
+
+ int minorVersion() const
+ { return m_minorVersion; }
+
+ bool isItem() const
+ { return m_isItem; }
+
+private:
+ TypeName m_typeName;
+ QString m_importUri;
+ int m_majorVersion = -1;
+ int m_minorVersion = -1;
+ bool m_isItem = false;
+};
+
+
+QDataStream &operator<<(QDataStream &out, const MockupTypeContainer &container);
+QDataStream &operator>>(QDataStream &in, MockupTypeContainer &container);
+
+QDebug operator <<(QDebug debug, const MockupTypeContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::MockupTypeContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.cpp b/src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.cpp
new file mode 100644
index 00000000000..1879bd0a0e7
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.cpp
@@ -0,0 +1,75 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "propertyabstractcontainer.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+PropertyAbstractContainer::PropertyAbstractContainer()
+ : m_instanceId(-1)
+{
+}
+
+PropertyAbstractContainer::PropertyAbstractContainer(qint32 instanceId, const PropertyName &name, const TypeName &dynamicTypeName)
+ : m_instanceId(instanceId),
+ m_name(name),
+ m_dynamicTypeName(dynamicTypeName)
+{
+}
+
+qint32 PropertyAbstractContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+PropertyName PropertyAbstractContainer::name() const
+{
+ return m_name;
+}
+
+bool PropertyAbstractContainer::isDynamic() const
+{
+ return !m_dynamicTypeName.isEmpty();
+}
+
+TypeName PropertyAbstractContainer::dynamicTypeName() const
+{
+ return m_dynamicTypeName;
+}
+
+QDataStream &operator<<(QDataStream &out, const PropertyAbstractContainer &container)
+{
+ out << container.instanceId();
+ out << container.name();
+ out << container.dynamicTypeName();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PropertyAbstractContainer &container)
+{
+ in >> container.m_instanceId;
+ in >> container.m_name;
+ in >> container.m_dynamicTypeName;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const PropertyAbstractContainer &container)
+{
+ debug.nospace() << "PropertyAbstractContainer("
+ << "instanceId: " << container.instanceId() << ", "
+ << "name: " << container.name();
+
+ if (!container.dynamicTypeName().isEmpty())
+ debug.nospace() << ", " << "dynamicTypeName: " << container.dynamicTypeName();
+
+ debug.nospace() << ")";
+
+ return debug;
+}
+
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.h b/src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.h
new file mode 100644
index 00000000000..e0f62e19373
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/propertyabstractcontainer.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDataStream>
+#include <qmetatype.h>
+#include <QString>
+
+#include "nodeinstanceglobal.h"
+
+namespace QmlDesigner {
+
+class PropertyAbstractContainer;
+
+QDataStream &operator<<(QDataStream &out, const PropertyAbstractContainer &container);
+QDataStream &operator>>(QDataStream &in, PropertyAbstractContainer &container);
+
+class PropertyAbstractContainer
+{
+
+ friend QDataStream &operator<<(QDataStream &out, const PropertyAbstractContainer &container);
+ friend QDataStream &operator>>(QDataStream &in, PropertyAbstractContainer &container);
+ friend QDebug operator <<(QDebug debug, const PropertyAbstractContainer &container);
+public:
+ PropertyAbstractContainer();
+ PropertyAbstractContainer(qint32 instanceId, const PropertyName &name, const TypeName &dynamicTypeName);
+
+ qint32 instanceId() const;
+ PropertyName name() const;
+ bool isDynamic() const;
+ TypeName dynamicTypeName() const;
+
+private:
+ qint32 m_instanceId;
+ PropertyName m_name;
+ TypeName m_dynamicTypeName;
+};
+
+QDebug operator <<(QDebug debug, const PropertyAbstractContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::PropertyAbstractContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/propertybindingcontainer.cpp b/src/libs/qmlpuppetcommunication/container/propertybindingcontainer.cpp
new file mode 100644
index 00000000000..ecb498f260b
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/propertybindingcontainer.cpp
@@ -0,0 +1,81 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "propertybindingcontainer.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+PropertyBindingContainer::PropertyBindingContainer()
+ : m_instanceId(-1)
+{
+}
+
+PropertyBindingContainer::PropertyBindingContainer(qint32 instanceId, const PropertyName &name, const QString &expression, const TypeName &dynamicTypeName)
+ : m_instanceId(instanceId),
+ m_name(name),
+ m_expression(expression),
+ m_dynamicTypeName(dynamicTypeName)
+{
+}
+
+qint32 PropertyBindingContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+PropertyName PropertyBindingContainer::name() const
+{
+ return m_name;
+}
+
+QString PropertyBindingContainer::expression() const
+{
+ return m_expression;
+}
+
+bool PropertyBindingContainer::isDynamic() const
+{
+ return !m_dynamicTypeName.isEmpty();
+}
+
+TypeName PropertyBindingContainer::dynamicTypeName() const
+{
+ return m_dynamicTypeName;
+}
+
+QDataStream &operator<<(QDataStream &out, const PropertyBindingContainer &container)
+{
+ out << container.instanceId();
+ out << container.name();
+ out << container.expression();
+ out << container.dynamicTypeName();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PropertyBindingContainer &container)
+{
+ in >> container.m_instanceId;
+ in >> container.m_name;
+ in >> container.m_expression;
+ in >> container.m_dynamicTypeName;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const PropertyBindingContainer &container)
+{
+ debug.nospace() << "PropertyBindingContainer("
+ << "instanceId: " << container.instanceId() << ", "
+ << "name: " << container.name() << ", "
+ << "expression: " << container.expression();
+
+ if (!container.dynamicTypeName().isEmpty())
+ debug.nospace() << ", " << "dynamicTypeName: " << container.dynamicTypeName();
+
+ return debug.nospace() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/propertybindingcontainer.h b/src/libs/qmlpuppetcommunication/container/propertybindingcontainer.h
new file mode 100644
index 00000000000..11e4afc8f99
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/propertybindingcontainer.h
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDataStream>
+#include <qmetatype.h>
+#include <QString>
+
+#include "nodeinstanceglobal.h"
+
+namespace QmlDesigner {
+
+class PropertyBindingContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, PropertyBindingContainer &container);
+
+public:
+ PropertyBindingContainer();
+ PropertyBindingContainer(qint32 instanceId, const PropertyName &name, const QString &expression, const TypeName &dynamicTypeName);
+
+ qint32 instanceId() const;
+ PropertyName name() const;
+ QString expression() const;
+ bool isDynamic() const;
+ TypeName dynamicTypeName() const;
+
+private:
+ qint32 m_instanceId;
+ PropertyName m_name;
+ QString m_expression;
+ TypeName m_dynamicTypeName;
+};
+
+QDataStream &operator<<(QDataStream &out, const PropertyBindingContainer &container);
+QDataStream &operator>>(QDataStream &in, PropertyBindingContainer &container);
+
+QDebug operator <<(QDebug debug, const PropertyBindingContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::PropertyBindingContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.cpp b/src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.cpp
new file mode 100644
index 00000000000..160267a21d1
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.cpp
@@ -0,0 +1,134 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "propertyvaluecontainer.h"
+
+#include <QtDebug>
+
+namespace QmlDesigner {
+
+PropertyValueContainer::PropertyValueContainer()
+ : m_instanceId(-1)
+{
+}
+
+PropertyValueContainer::PropertyValueContainer(qint32 instanceId,
+ const PropertyName &name,
+ const QVariant &value,
+ const TypeName &dynamicTypeName,
+ AuxiliaryDataType auxiliaryDataType)
+ : m_instanceId(instanceId)
+ , m_name(name)
+ , m_value(value)
+ , m_dynamicTypeName(dynamicTypeName)
+ , m_auxiliaryDataType{auxiliaryDataType}
+{
+}
+
+PropertyValueContainer::PropertyValueContainer(qint32 option)
+ : m_instanceId(option),
+ m_name("-option-")
+{
+// '-option-' is not a valid property name and indicates that we store the transaction option.
+}
+
+qint32 PropertyValueContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+PropertyName PropertyValueContainer::name() const
+{
+ return m_name;
+}
+
+QVariant PropertyValueContainer::value() const
+{
+ return m_value;
+}
+
+bool PropertyValueContainer::isDynamic() const
+{
+ return !m_dynamicTypeName.isEmpty();
+}
+
+TypeName PropertyValueContainer::dynamicTypeName() const
+{
+ return m_dynamicTypeName;
+}
+
+// The reflection flag indicates that a property change notification
+// is reflected. This means that the notification is the reaction to a
+// property change original done by the puppet itself.
+// In the Qt5InformationNodeInstanceServer such notification are
+// therefore ignored.
+
+void PropertyValueContainer::setReflectionFlag(bool b)
+{
+ m_isReflected = b;
+}
+
+bool PropertyValueContainer::isReflected() const
+{
+ return m_isReflected;
+}
+
+AuxiliaryDataType PropertyValueContainer::auxiliaryDataType() const
+{
+ return m_auxiliaryDataType;
+}
+
+QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container)
+{
+ out << container.m_instanceId;
+ out << container.m_name;
+ out << container.m_value;
+ out << container.m_dynamicTypeName;
+ out << container.m_isReflected;
+ out << container.m_auxiliaryDataType;
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PropertyValueContainer &container)
+{
+ in >> container.m_instanceId;
+ in >> container.m_name;
+ in >> container.m_value;
+ in >> container.m_dynamicTypeName;
+ in >> container.m_isReflected;
+ in >> container.m_auxiliaryDataType;
+
+ return in;
+}
+
+bool operator ==(const PropertyValueContainer &first, const PropertyValueContainer &second)
+{
+ return first.m_instanceId == second.m_instanceId && first.m_name == second.m_name
+ && first.m_value == second.m_value && first.m_dynamicTypeName == second.m_dynamicTypeName
+ && first.m_isReflected == second.m_isReflected
+ && first.m_auxiliaryDataType == second.m_auxiliaryDataType;
+}
+
+bool operator <(const PropertyValueContainer &first, const PropertyValueContainer &second)
+{
+ return (first.m_instanceId < second.m_instanceId)
+ || (first.m_instanceId == second.m_instanceId && first.m_name < second.m_name);
+}
+
+QDebug operator <<(QDebug debug, const PropertyValueContainer &container)
+{
+ debug.nospace() << "PropertyValueContainer("
+ << "instanceId: " << container.instanceId() << ", "
+ << "name: " << container.name() << ", "
+ << "value: " << container.value();
+
+ if (!container.dynamicTypeName().isEmpty())
+ debug.nospace() << ", " << "dynamicTypeName: " << container.dynamicTypeName();
+
+ debug.nospace() << ")";
+
+ return debug;
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.h b/src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.h
new file mode 100644
index 00000000000..c9d03ad9e8a
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/propertyvaluecontainer.h
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QDataStream>
+#include <QMetaType>
+#include <QVariant>
+#include <QString>
+
+#include "nodeinstanceglobal.h"
+
+namespace QmlDesigner {
+
+class PropertyValueContainer
+{
+public:
+ PropertyValueContainer();
+ PropertyValueContainer(qint32 instanceId,
+ const PropertyName &name,
+ const QVariant &value,
+ const TypeName &dynamicTypeName,
+ AuxiliaryDataType auxiliaryDataType = AuxiliaryDataType::None);
+ PropertyValueContainer(qint32 option);
+
+ qint32 instanceId() const;
+ PropertyName name() const;
+ QVariant value() const;
+ bool isDynamic() const;
+ TypeName dynamicTypeName() const;
+ void setReflectionFlag(bool b);
+ bool isReflected() const;
+ AuxiliaryDataType auxiliaryDataType() const;
+
+ friend QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container);
+ friend QDataStream &operator>>(QDataStream &in, PropertyValueContainer &container);
+ friend bool operator==(const PropertyValueContainer &first,
+ const PropertyValueContainer &second);
+ friend bool operator<(const PropertyValueContainer &first, const PropertyValueContainer &second);
+
+private:
+ qint32 m_instanceId;
+ PropertyName m_name;
+ QVariant m_value;
+ TypeName m_dynamicTypeName;
+ AuxiliaryDataType m_auxiliaryDataType = AuxiliaryDataType::None;
+ bool m_isReflected = false;
+};
+
+QDebug operator <<(QDebug debug, const PropertyValueContainer &container);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::PropertyValueContainer)
diff --git a/src/libs/qmlpuppetcommunication/container/reparentcontainer.cpp b/src/libs/qmlpuppetcommunication/container/reparentcontainer.cpp
new file mode 100644
index 00000000000..77206f1f9a1
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/reparentcontainer.cpp
@@ -0,0 +1,98 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "reparentcontainer.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+ReparentContainer::ReparentContainer()
+ : m_instanceId(-1),
+ m_oldParentInstanceId(-1),
+ m_newParentInstanceId(-1)
+{
+}
+
+ReparentContainer::ReparentContainer(qint32 instanceId,
+ qint32 oldParentInstanceId,
+ const PropertyName &oldParentProperty,
+ qint32 newParentInstanceId,
+ const PropertyName &newParentProperty)
+ : m_instanceId(instanceId),
+ m_oldParentInstanceId(oldParentInstanceId),
+ m_oldParentProperty(oldParentProperty),
+ m_newParentInstanceId(newParentInstanceId),
+ m_newParentProperty(newParentProperty)
+{
+}
+
+qint32 ReparentContainer::instanceId() const
+{
+ return m_instanceId;
+}
+
+qint32 ReparentContainer::oldParentInstanceId() const
+{
+ return m_oldParentInstanceId;
+}
+
+PropertyName ReparentContainer::oldParentProperty() const
+{
+ return m_oldParentProperty;
+}
+
+qint32 ReparentContainer::newParentInstanceId() const
+{
+ return m_newParentInstanceId;
+}
+
+PropertyName ReparentContainer::newParentProperty() const
+{
+ return m_newParentProperty;
+}
+
+QDataStream &operator<<(QDataStream &out, const ReparentContainer &container)
+{
+ out << container.instanceId();
+ out << container.oldParentInstanceId();
+ out << container.oldParentProperty();
+ out << container.newParentInstanceId();
+ out << container.newParentProperty();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, ReparentContainer &container)
+{
+ in >> container.m_instanceId;
+ in >> container.m_oldParentInstanceId;
+ in >> container.m_oldParentProperty;
+ in >> container.m_newParentInstanceId;
+ in >> container.m_newParentProperty;
+
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const ReparentContainer &container)
+{
+ debug.nospace() << "ReparentContainer("
+ << "instanceId: " << container.instanceId();
+
+ if (container.oldParentInstanceId() >= 0)
+ debug.nospace() << ", " << "oldParentInstanceId: " << container.oldParentInstanceId();
+
+ if (container.oldParentProperty().isEmpty())
+ debug.nospace() << ", " << "oldParentProperty: " << container.oldParentProperty();
+
+ if (container.newParentInstanceId() >= 0)
+ debug.nospace() << ", " << "newParentInstanceId: " << container.newParentInstanceId();
+
+ if (container.newParentProperty().isEmpty())
+ debug.nospace() << ", " << "newParentProperty: " << container.newParentProperty();
+
+ return debug.nospace() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/reparentcontainer.h b/src/libs/qmlpuppetcommunication/container/reparentcontainer.h
new file mode 100644
index 00000000000..e49f973fb99
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/reparentcontainer.h
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <qmetatype.h>
+#include <QString>
+#include <QDataStream>
+
+#include "nodeinstanceglobal.h"
+
+namespace QmlDesigner {
+
+class ReparentContainer
+{
+ friend QDataStream &operator>>(QDataStream &in, ReparentContainer &container);
+public:
+ ReparentContainer();
+ ReparentContainer(qint32 instanceId,
+ qint32 oldParentInstanceId,
+ const PropertyName &oldParentProperty,
+ qint32 newParentInstanceId,
+ const PropertyName &newParentProperty);
+
+ qint32 instanceId() const;
+ qint32 oldParentInstanceId() const;
+ PropertyName oldParentProperty() const;
+ qint32 newParentInstanceId() const;
+ PropertyName newParentProperty() const;
+
+private:
+ qint32 m_instanceId;
+ qint32 m_oldParentInstanceId;
+ PropertyName m_oldParentProperty;
+ qint32 m_newParentInstanceId;
+ PropertyName m_newParentProperty;
+};
+
+QDataStream &operator<<(QDataStream &out, const ReparentContainer &container);
+QDataStream &operator>>(QDataStream &in, ReparentContainer &container);
+
+QDebug operator <<(QDebug debug, const ReparentContainer &container);
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/sharedmemory.h b/src/libs/qmlpuppetcommunication/container/sharedmemory.h
new file mode 100644
index 00000000000..1c5da3454a3
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/sharedmemory.h
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QSharedMemory>
+#include <QSystemSemaphore>
+
+namespace QmlDesigner {
+
+class SharedMemory
+{
+ friend class SharedMemoryLocker;
+public:
+ SharedMemory();
+ SharedMemory(const QString &key);
+ ~SharedMemory();
+
+ void setKey(const QString &key);
+ QString key() const;
+
+ bool create(int size, QSharedMemory::AccessMode mode = QSharedMemory::ReadWrite);
+ int size() const;
+
+ bool attach(QSharedMemory::AccessMode mode = QSharedMemory::ReadWrite);
+ bool isAttached() const;
+ bool detach();
+
+ void *data();
+ const void* constData() const;
+ const void *data() const;
+
+ bool lock();
+ bool unlock();
+
+ QSharedMemory::SharedMemoryError error() const;
+ QString errorString() const;
+
+protected:
+#ifdef Q_OS_UNIX
+ bool initKeyInternal();
+ void cleanHandleInternal();
+ bool createInternal(QSharedMemory::AccessMode mode, size_t size);
+ bool attachInternal(QSharedMemory::AccessMode mode);
+ bool detachInternal();
+ int handle();
+
+ void setErrorString(const QString &function);
+#endif
+private:
+#ifndef Q_OS_UNIX
+ QSharedMemory m_sharedMemory;
+#else
+ void *m_memory;
+ size_t m_size;
+ QString m_key;
+ QByteArray m_nativeKey;
+ QSharedMemory::SharedMemoryError m_error;
+ QString m_errorString;
+ QSystemSemaphore m_systemSemaphore;
+ bool m_lockedByMe;
+ int m_fileHandle;
+ bool m_createdByMe;
+#endif
+};
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/sharedmemory_qt.cpp b/src/libs/qmlpuppetcommunication/container/sharedmemory_qt.cpp
new file mode 100644
index 00000000000..4165e865176
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/sharedmemory_qt.cpp
@@ -0,0 +1,87 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "sharedmemory.h"
+
+namespace QmlDesigner {
+
+SharedMemory::SharedMemory() = default;
+
+SharedMemory::SharedMemory(const QString &key)
+ : m_sharedMemory(key)
+{
+}
+
+SharedMemory::~SharedMemory() = default;
+
+void SharedMemory::setKey(const QString &key)
+{
+ m_sharedMemory.setKey(key);
+}
+
+QString SharedMemory::key() const
+{
+ return m_sharedMemory.key();
+}
+
+bool SharedMemory::create(int size, QSharedMemory::AccessMode mode)
+{
+ return m_sharedMemory.create(size, mode);
+}
+
+int SharedMemory::size() const
+{
+ return m_sharedMemory.size();
+}
+
+bool SharedMemory::attach(QSharedMemory::AccessMode mode)
+{
+ return m_sharedMemory.attach(mode);
+}
+
+bool SharedMemory::isAttached() const
+{
+ return m_sharedMemory.isAttached();
+}
+
+bool SharedMemory::detach()
+{
+ return m_sharedMemory.detach();
+}
+
+void *SharedMemory::data()
+{
+ return m_sharedMemory.data();
+}
+
+const void *SharedMemory::constData() const
+{
+ return m_sharedMemory.constData();
+}
+
+const void *SharedMemory::data() const
+{
+ return m_sharedMemory.data();
+}
+
+bool SharedMemory::lock()
+{
+ return m_sharedMemory.lock();
+}
+
+bool SharedMemory::unlock()
+{
+ return m_sharedMemory.unlock();
+}
+
+QSharedMemory::SharedMemoryError SharedMemory::error() const
+{
+ return m_sharedMemory.error();
+}
+
+QString SharedMemory::errorString() const
+{
+ return m_sharedMemory.errorString();
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp b/src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp
new file mode 100644
index 00000000000..317aa646b13
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp
@@ -0,0 +1,464 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "sharedmemory.h"
+#include <qdir.h>
+#include <qcryptographichash.h>
+
+#include "qplatformdefs.h"
+
+#include <errno.h>
+
+#include <sys/mman.h>
+#include <sys/stat.h> /* For mode constants */
+#include <fcntl.h> /* For O_* constants */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef Q_OS_OSX
+#include <sys/posix_shm.h>
+#endif
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <private/qcore_unix_p.h>
+
+namespace QmlDesigner {
+
+class SharedMemoryLocker
+{
+public:
+ SharedMemoryLocker(SharedMemory *sharedMemory) : m_sharedMemory(sharedMemory)
+ {
+ Q_ASSERT(m_sharedMemory);
+ }
+
+ ~SharedMemoryLocker()
+ {
+ if (m_sharedMemory)
+ m_sharedMemory->unlock();
+ }
+
+ bool tryLocker(const QString &function) {
+ if (!m_sharedMemory)
+ return false;
+
+ if (m_sharedMemory->lock())
+ return true;
+
+ m_sharedMemory->m_errorString = QStringLiteral("%1: unable to lock").arg(function);
+ m_sharedMemory->m_error = QSharedMemory::LockError;
+ m_sharedMemory = nullptr;
+ return false;
+ }
+
+private:
+ SharedMemory *m_sharedMemory;
+};
+
+static QByteArray makePlatformSafeKey(const QString &key)
+{
+ if (key.isEmpty())
+ return QByteArray();
+ QByteArray data(QCryptographicHash::hash(key.toLatin1(), QCryptographicHash::Sha1).toBase64());
+
+ data = data.replace('+', '-');
+ data = data.replace('/', '_');
+
+ data.truncate(31); // OS X is only supporting 31 byte long names
+
+ return data;
+}
+
+
+SharedMemory::SharedMemory()
+ : m_memory(nullptr),
+ m_size(0),
+ m_error(QSharedMemory::NoError),
+ m_systemSemaphore(QString()),
+ m_lockedByMe(false),
+ m_fileHandle(-1),
+ m_createdByMe(false)
+{
+}
+
+SharedMemory::SharedMemory(const QString &key)
+ : m_memory(nullptr),
+ m_size(0),
+ m_error(QSharedMemory::NoError),
+ m_systemSemaphore(QString()),
+ m_lockedByMe(false),
+ m_fileHandle(-1),
+ m_createdByMe(false)
+{
+ setKey(key);
+}
+
+SharedMemory::~SharedMemory()
+{
+ if (m_memory) {
+ munmap(m_memory, m_size);
+ m_memory = nullptr;
+ m_size = 0;
+ }
+
+ if (m_fileHandle != -1) {
+ close(m_fileHandle);
+ cleanHandleInternal();
+ if (m_createdByMe)
+ shm_unlink(m_nativeKey);
+ }
+
+ setKey(QString());
+}
+
+void SharedMemory::setKey(const QString &key)
+{
+ if (key == m_key && makePlatformSafeKey(key) == m_nativeKey)
+ return;
+
+ if (isAttached())
+ detach();
+
+ m_key = key;
+ m_nativeKey = makePlatformSafeKey(key);
+}
+
+QString SharedMemory::key() const
+{
+ return m_key;
+}
+
+bool SharedMemory::create(int size, QSharedMemory::AccessMode mode)
+{
+ if (!initKeyInternal())
+ return false;
+
+
+ m_systemSemaphore.setKey(m_key, 1, QSystemSemaphore::Create);
+
+
+ QString function = QLatin1String("SharedMemory::create");
+
+ SharedMemoryLocker lock(this);
+ if (!m_key.isNull() && !lock.tryLocker(function))
+ return false;
+
+ if (size <= 0) {
+ m_error = QSharedMemory::InvalidSize;
+ m_errorString = QStringLiteral("%1: create size is less then 0").arg(function);
+ return false;
+ }
+
+ return createInternal(mode, size_t(size));
+}
+
+int SharedMemory::size() const
+{
+ return int(m_size);
+}
+
+bool SharedMemory::attach(QSharedMemory::AccessMode mode)
+{
+ if (isAttached() || !initKeyInternal())
+ return false;
+
+ SharedMemoryLocker lock(this);
+ if (!m_key.isNull() && !lock.tryLocker(QStringLiteral("SharedMemory::attach")))
+ return false;
+
+ if (isAttached() || !handle())
+ return false;
+
+ return attachInternal(mode);
+}
+
+
+bool SharedMemory::isAttached() const
+{
+ return m_memory != nullptr;
+}
+
+bool SharedMemory::detach()
+{
+ if (!isAttached())
+ return false;
+
+ SharedMemoryLocker lock(this);
+ if (!m_key.isNull() && !lock.tryLocker(QStringLiteral("SharedMemory::detach")))
+ return false;
+
+ return detachInternal();
+}
+
+void *SharedMemory::data()
+{
+ return m_memory;
+}
+
+const void* SharedMemory::constData() const
+{
+ return m_memory;
+}
+
+const void *SharedMemory::data() const
+{
+ return m_memory;
+}
+
+bool SharedMemory::lock()
+{
+ if (m_lockedByMe) {
+ qWarning("SharedMemory::lock: already locked");
+ return true;
+ }
+ if (m_systemSemaphore.acquire()) {
+ m_lockedByMe = true;
+ return true;
+ }
+ QString function = QStringLiteral("SharedMemory::lock");
+ m_errorString = QStringLiteral("%1: unable to lock").arg(function);
+ m_error = QSharedMemory::LockError;
+ return false;
+}
+
+bool SharedMemory::unlock()
+{
+ if (!m_lockedByMe)
+ return false;
+ m_lockedByMe = false;
+ if (m_systemSemaphore.release())
+ return true;
+ QString function = QStringLiteral("SharedMemory::unlock");
+ m_errorString = QStringLiteral("%1: unable to unlock").arg(function);
+ m_error = QSharedMemory::LockError;
+ return false;
+}
+
+QSharedMemory::SharedMemoryError SharedMemory::error() const
+{
+ return m_error;
+}
+
+QString SharedMemory::errorString() const
+{
+ return m_errorString;
+}
+
+void SharedMemory::setErrorString(const QString &function)
+{
+ // EINVAL is handled in functions so they can give better error strings
+ switch (errno) {
+ case EACCES:
+ m_errorString = QStringLiteral("%1: permission denied").arg(function);
+ m_error = QSharedMemory::PermissionDenied;
+ break;
+ case EEXIST:
+ m_errorString = QStringLiteral("%1: already exists").arg(function);
+ m_error = QSharedMemory::AlreadyExists;
+ break;
+ case ENOENT:
+ m_errorString = QStringLiteral("%1: doesn't exist").arg(function);
+ m_error = QSharedMemory::NotFound;
+ break;
+ case EMFILE:
+ case ENOMEM:
+ case ENOSPC:
+ m_errorString = QStringLiteral("%1: out of resources").arg(function);
+ m_error = QSharedMemory::OutOfResources;
+ break;
+ default:
+ m_errorString = QStringLiteral("%1: unknown error %2")
+ .arg(function).arg(QString::fromLocal8Bit(strerror(errno)));
+ m_error = QSharedMemory::UnknownError;
+ }
+}
+
+bool SharedMemory::initKeyInternal()
+{
+ cleanHandleInternal();
+
+ m_systemSemaphore.setKey(QString(), 1);
+ m_systemSemaphore.setKey(m_key, 1);
+ if (m_systemSemaphore.error() != QSystemSemaphore::NoError) {
+ m_errorString = QStringLiteral("SharedMemoryPrivate::initKey: unable to set key on lock");
+ switch (m_systemSemaphore.error()) {
+ case QSystemSemaphore::PermissionDenied:
+ m_error = QSharedMemory::PermissionDenied;
+ break;
+ case QSystemSemaphore::KeyError:
+ m_error = QSharedMemory::KeyError;
+ break;
+ case QSystemSemaphore::AlreadyExists:
+ m_error = QSharedMemory::AlreadyExists;
+ break;
+ case QSystemSemaphore::NotFound:
+ m_error = QSharedMemory::NotFound;
+ break;
+ case QSystemSemaphore::OutOfResources:
+ m_error = QSharedMemory::OutOfResources;
+ break;
+ case QSystemSemaphore::UnknownError:
+ default:
+ m_error = QSharedMemory::UnknownError;
+ break;
+ }
+
+ return false;
+ }
+
+ m_errorString.clear();
+ m_error = QSharedMemory::NoError;
+ return true;
+}
+
+int SharedMemory::handle()
+{
+ return m_fileHandle;
+}
+
+void SharedMemory::cleanHandleInternal()
+{
+ m_fileHandle = -1;
+}
+
+bool SharedMemory::createInternal(QSharedMemory::AccessMode mode, size_t size)
+{
+ detachInternal();
+
+#ifdef Q_OS_OSX
+ if (m_fileHandle > -1 && m_createdByMe) {
+ close(m_fileHandle);
+ shm_unlink(m_nativeKey.constData());
+ m_fileHandle = -1;
+ }
+#endif
+
+ if (m_fileHandle == -1) {
+ int permission = mode == QSharedMemory::ReadOnly ? O_RDONLY : O_RDWR;
+ m_fileHandle = shm_open(m_nativeKey.constData(), O_CREAT | permission, 0666);
+
+ if (m_fileHandle == -1) {
+ switch (errno) {
+ case EINVAL:
+ m_errorString = QStringLiteral("QSharedMemory::create: key is not invalid");
+ m_error = QSharedMemory::KeyError;
+ break;
+ case EMFILE:
+ m_errorString = QStringLiteral("QSharedMemory::create: maximum file limit reached");
+ m_error = QSharedMemory::UnknownError;
+ break;
+ case ENAMETOOLONG:
+ m_errorString = QStringLiteral("QSharedMemory::create: key is to long");
+ m_error = QSharedMemory::KeyError;
+ break;
+ default:
+ setErrorString(QStringLiteral("SharedMemory::create"));
+ }
+ return false;
+ }
+
+ m_createdByMe = true;
+ }
+
+ struct stat statBuffer;
+ if (fstat(m_fileHandle, &statBuffer) == -1)
+ return false;
+ size_t fileSize = size_t(statBuffer.st_size);
+
+ if (fileSize < size) {
+ int returnValue = ftruncate(m_fileHandle, ssize_t(size));
+ if (returnValue == -1) {
+ switch (errno) {
+ case EFBIG:
+ m_errorString = QStringLiteral("QSharedMemory::create: size is to large");
+ m_error = QSharedMemory::InvalidSize;
+ break;
+ default:
+ setErrorString(QStringLiteral("SharedMemory::create"));
+ }
+
+ close(m_fileHandle);
+ shm_unlink(m_nativeKey.constData());
+ m_fileHandle = -1;
+ m_size = 0;
+
+ return false;
+ }
+ }
+
+ int protection = mode == QSharedMemory::ReadOnly ? PROT_READ : PROT_WRITE;
+ m_memory = mmap(nullptr, size, protection, MAP_SHARED, m_fileHandle, 0);
+
+ if (m_memory == MAP_FAILED) {
+ close(m_fileHandle);
+ shm_unlink(m_nativeKey.constData());
+ m_memory = nullptr;
+ m_fileHandle = -1;
+ m_size = 0;
+
+ return false;
+ }
+
+ m_size = size;
+
+ return true;
+}
+
+bool SharedMemory::attachInternal(QSharedMemory::AccessMode mode)
+{
+ if (m_fileHandle == -1) {
+ int permission = mode == QSharedMemory::ReadOnly ? O_RDONLY : O_RDWR;
+ m_fileHandle = shm_open(m_nativeKey.constData(), permission, 0666);
+ if (m_fileHandle == -1) {
+ switch (errno) {
+ case EINVAL:
+ m_errorString = QStringLiteral("QSharedMemory::attach: key is invalid");
+ m_error = QSharedMemory::KeyError;
+ break;
+ case EMFILE:
+ m_errorString = QStringLiteral("QSharedMemory::attach: maximum file limit reached");
+ m_error = QSharedMemory::UnknownError;
+ break;
+ case ENAMETOOLONG:
+ m_errorString = QStringLiteral("QSharedMemory::attach: key is to long");
+ m_error = QSharedMemory::KeyError;
+ break;
+ default:
+ setErrorString(QStringLiteral("SharedMemory::attach"));
+ }
+ return false;
+ }
+ }
+
+ struct stat statBuffer;
+ if (fstat(m_fileHandle, &statBuffer) == -1)
+ return false;
+ size_t size = size_t(statBuffer.st_size);
+
+ int protection = mode == QSharedMemory::ReadOnly ? PROT_READ : PROT_WRITE;
+ m_memory = mmap(nullptr, size, protection, MAP_SHARED, m_fileHandle, 0);
+
+ if (m_memory == MAP_FAILED) {
+ m_memory = nullptr;
+
+ return false;
+ }
+
+ m_size = size;
+
+ return true;
+}
+
+bool SharedMemory::detachInternal()
+{
+ if (m_memory) {
+ munmap(m_memory, m_size);
+ m_memory = nullptr;
+ m_size = 0;
+ }
+
+ return false;
+}
+
+} // namespace QmlDesigner
diff --git a/src/libs/qmlpuppetcommunication/interfaces/commondefines.h b/src/libs/qmlpuppetcommunication/interfaces/commondefines.h
new file mode 100644
index 00000000000..7909c097b05
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/interfaces/commondefines.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QMetaType>
+#include <QPair>
+
+namespace QmlDesigner {
+
+enum InformationName
+{
+ NoName,
+ NoInformationChange = NoName,
+ AllStates,
+ Size,
+ BoundingRect,
+ Transform,
+ HasAnchor,
+ Anchor,
+ InstanceTypeForProperty,
+ PenWidth,
+ Position,
+ IsInLayoutable,
+ SceneTransform,
+ IsResizable,
+ IsMovable,
+ IsAnchoredByChildren,
+ IsAnchoredBySibling,
+ HasContent,
+ HasBindingForProperty,
+ ContentTransform,
+ ContentItemTransform,
+ ContentItemBoundingRect,
+ MoveView,
+ ShowView,
+ ResizeView,
+ HideView
+};
+
+}
diff --git a/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceclientinterface.h b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceclientinterface.h
new file mode 100644
index 00000000000..01d2ac8a2e7
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceclientinterface.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QtGlobal>
+
+namespace QmlDesigner {
+
+class ValuesChangedCommand;
+class ValuesModifiedCommand;
+class PixmapChangedCommand;
+class InformationChangedCommand;
+class ChildrenChangedCommand;
+class StatePreviewImageChangedCommand;
+class ComponentCompletedCommand;
+class TokenCommand;
+class RemoveSharedMemoryCommand;
+class DebugOutputCommand;
+class PuppetAliveCommand;
+class ChangeSelectionCommand;
+class PuppetToCreatorCommand;
+class CapturedDataCommand;
+class SceneCreatedCommand;
+
+class NodeInstanceClientInterface
+{
+public:
+ virtual void informationChanged(const InformationChangedCommand &command) = 0;
+ virtual void valuesChanged(const ValuesChangedCommand &command) = 0;
+ virtual void valuesModified(const ValuesModifiedCommand &command) = 0;
+ virtual void pixmapChanged(const PixmapChangedCommand &command) = 0;
+ virtual void childrenChanged(const ChildrenChangedCommand &command) = 0;
+ virtual void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command) = 0;
+ virtual void componentCompleted(const ComponentCompletedCommand &command) = 0;
+ virtual void token(const TokenCommand &command) = 0;
+ virtual void debugOutput(const DebugOutputCommand &command) = 0;
+ virtual void selectionChanged(const ChangeSelectionCommand &command) = 0;
+ virtual void handlePuppetToCreatorCommand(const PuppetToCreatorCommand &command) = 0;
+ virtual void capturedData(const CapturedDataCommand &command) = 0;
+ virtual void sceneCreated(const SceneCreatedCommand &command) = 0;
+
+ virtual void flush() {}
+ virtual void synchronizeWithClientProcess() {}
+ virtual qint64 bytesToWrite() const {return 0;}
+};
+
+}
diff --git a/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceglobal.h b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceglobal.h
new file mode 100644
index 00000000000..968a9bef0f9
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceglobal.h
@@ -0,0 +1,62 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QByteArray>
+#include <QList>
+
+#include <vector>
+
+namespace QmlDesigner {
+
+using PropertyName = QByteArray;
+using PropertyNameList = QList<PropertyName>;
+using PropertyNames = std::vector<PropertyName>;
+using TypeName = QByteArray;
+
+enum class AuxiliaryDataType {
+ None,
+ Temporary,
+ Document,
+ NodeInstancePropertyOverwrite,
+ NodeInstanceAuxiliary
+};
+
+enum class View3DActionType {
+ Empty,
+ MoveTool,
+ ScaleTool,
+ RotateTool,
+ FitToView,
+ AlignCamerasToView,
+ AlignViewToCamera,
+ SelectionModeToggle,
+ CameraToggle,
+ OrientationToggle,
+ EditLightToggle,
+ ShowGrid,
+ ShowSelectionBox,
+ ShowIconGizmo,
+ ShowCameraFrustum,
+ ShowParticleEmitter,
+ Edit3DParticleModeToggle,
+ ParticlesPlay,
+ ParticlesRestart,
+ ParticlesSeek,
+ SelectBackgroundColor,
+ SelectGridColor,
+ ResetBackgroundColor,
+ SyncBackgroundColor,
+ GetNodeAtPos
+};
+
+constexpr bool isNanotraceEnabled()
+{
+#ifdef NANOTRACE_ENABLED
+ return true;
+#else
+ return false;
+#endif
+}
+}
diff --git a/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.cpp b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.cpp
new file mode 100644
index 00000000000..110db565276
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.cpp
@@ -0,0 +1,133 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#include "nodeinstanceserverinterface.h"
+#include <qmetatype.h>
+
+#include "addimportcontainer.h"
+#include "captureddatacommand.h"
+#include "changeauxiliarycommand.h"
+#include "changebindingscommand.h"
+#include "changefileurlcommand.h"
+#include "changeidscommand.h"
+#include "changelanguagecommand.h"
+#include "changenodesourcecommand.h"
+#include "changepreviewimagesizecommand.h"
+#include "changeselectioncommand.h"
+#include "changestatecommand.h"
+#include "changevaluescommand.h"
+#include "childrenchangedcommand.h"
+#include "clearscenecommand.h"
+#include "completecomponentcommand.h"
+#include "componentcompletedcommand.h"
+#include "createinstancescommand.h"
+#include "createscenecommand.h"
+#include "debugoutputcommand.h"
+#include "endpuppetcommand.h"
+#include "imagecontainer.h"
+#include "informationchangedcommand.h"
+#include "inputeventcommand.h"
+#include "instancecontainer.h"
+#include "nanotracecommand.h"
+#include "pixmapchangedcommand.h"
+#include "propertyabstractcontainer.h"
+#include "propertybindingcontainer.h"
+#include "propertyvaluecontainer.h"
+#include "puppetalivecommand.h"
+#include "puppettocreatorcommand.h"
+#include "removeinstancescommand.h"
+#include "removepropertiescommand.h"
+#include "removesharedmemorycommand.h"
+#include "reparentinstancescommand.h"
+#include "scenecreatedcommand.h"
+#include "statepreviewimagechangedcommand.h"
+#include "synchronizecommand.h"
+#include "tokencommand.h"
+#include "update3dviewstatecommand.h"
+#include "valueschangedcommand.h"
+#include "view3dactioncommand.h"
+#include "requestmodelnodepreviewimagecommand.h"
+
+#include <enumeration.h>
+
+namespace QmlDesigner {
+
+static bool isRegistered = false;
+
+NodeInstanceServerInterface::NodeInstanceServerInterface(QObject *parent) :
+ QObject(parent)
+{
+ registerCommands();
+}
+
+template<typename T>
+inline void registerCommand(const char *typeName)
+{
+ qRegisterMetaType<T>(typeName);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ qRegisterMetaTypeStreamOperators<T>(typeName);
+#endif
+}
+
+void NodeInstanceServerInterface::registerCommands()
+{
+ if (isRegistered)
+ return;
+
+ isRegistered = true;
+
+ registerCommand<CreateInstancesCommand>("CreateInstancesCommand");
+ registerCommand<ClearSceneCommand>("ClearSceneCommand");
+ registerCommand<CreateSceneCommand>("CreateSceneCommand");
+ registerCommand<Update3dViewStateCommand>("Update3dViewStateCommand");
+ registerCommand<ChangeBindingsCommand>("ChangeBindingsCommand");
+ registerCommand<ChangeValuesCommand>("ChangeValuesCommand");
+ registerCommand<ChangeFileUrlCommand>("ChangeFileUrlCommand");
+ registerCommand<ChangeStateCommand>("ChangeStateCommand");
+ registerCommand<RemoveInstancesCommand>("RemoveInstancesCommand");
+ registerCommand<ChangeSelectionCommand>("ChangeSelectionCommand");
+ registerCommand<RemovePropertiesCommand>("RemovePropertiesCommand");
+ registerCommand<ReparentInstancesCommand>("ReparentInstancesCommand");
+ registerCommand<ChangeIdsCommand>("ChangeIdsCommand");
+ registerCommand<PropertyAbstractContainer>("PropertyAbstractContainer");
+ registerCommand<InformationChangedCommand>("InformationChangedCommand");
+ registerCommand<ValuesChangedCommand>("ValuesChangedCommand");
+ registerCommand<ValuesModifiedCommand>("ValuesModifiedCommand");
+ registerCommand<PixmapChangedCommand>("PixmapChangedCommand");
+ registerCommand<InformationContainer>("InformationContainer");
+ registerCommand<PropertyValueContainer>("PropertyValueContainer");
+ registerCommand<PropertyBindingContainer>("PropertyBindingContainer");
+ registerCommand<PropertyAbstractContainer>("PropertyAbstractContainer");
+ registerCommand<InstanceContainer>("InstanceContainer");
+ registerCommand<IdContainer>("IdContainer");
+ registerCommand<ChildrenChangedCommand>("ChildrenChangedCommand");
+ registerCommand<ImageContainer>("ImageContainer");
+ registerCommand<StatePreviewImageChangedCommand>("StatePreviewImageChangedCommand");
+ registerCommand<CompleteComponentCommand>("CompleteComponentCommand");
+ registerCommand<ComponentCompletedCommand>("ComponentCompletedCommand");
+ registerCommand<AddImportContainer>("AddImportContainer");
+ registerCommand<SynchronizeCommand>("SynchronizeCommand");
+ registerCommand<ChangeNodeSourceCommand>("ChangeNodeSourceCommand");
+ registerCommand<ChangeAuxiliaryCommand>("ChangeAuxiliaryCommand");
+ registerCommand<TokenCommand>("TokenCommand");
+ registerCommand<RemoveSharedMemoryCommand>("RemoveSharedMemoryCommand");
+ registerCommand<EndPuppetCommand>("EndPuppetCommand");
+ registerCommand<DebugOutputCommand>("DebugOutputCommand");
+ registerCommand<Enumeration>("Enumeration");
+ registerCommand<PuppetAliveCommand>("PuppetAliveCommand");
+ registerCommand<PuppetToCreatorCommand>("PuppetToCreatorCommand");
+ registerCommand<InputEventCommand>("InputEventCommand");
+ registerCommand<View3DActionCommand>("View3DActionCommand");
+ registerCommand<RequestModelNodePreviewImageCommand>("RequestModelNodePreviewImageCommand");
+ registerCommand<QPair<int, int>>("QPairIntInt");
+ registerCommand<QList<QColor>>("QColorList");
+ registerCommand<ChangeLanguageCommand>("ChangeLanguageCommand");
+ registerCommand<ChangePreviewImageSizeCommand>("ChangePreviewImageSizeCommand");
+ registerCommand<CapturedDataCommand>("CapturedDataCommand");
+ registerCommand<SceneCreatedCommand>("SceneCreatedCommand");
+ registerCommand<StartNanotraceCommand>("StartNanotraceCommand");
+ registerCommand<EndNanotraceCommand>("EndNanotraceCommand");
+ registerCommand<SyncNanotraceCommand>("SyncNanotraceCommand");
+}
+
+}
diff --git a/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.h b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.h
new file mode 100644
index 00000000000..94e35176fd1
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/interfaces/nodeinstanceserverinterface.h
@@ -0,0 +1,74 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QObject>
+
+namespace QmlDesigner {
+
+class PropertyAbstractContainer;
+class PropertyBindingContainer;
+class PropertyValueContainer;
+
+class Update3dViewStateCommand;
+class ChangeFileUrlCommand;
+class ChangeValuesCommand;
+class ChangeBindingsCommand;
+class ChangeAuxiliaryCommand;
+class CreateSceneCommand;
+class CreateInstancesCommand;
+class ClearSceneCommand;
+class ReparentInstancesCommand;
+class ChangeIdsCommand;
+class RemoveInstancesCommand;
+class RemovePropertiesCommand;
+class ChangeStateCommand;
+class CompleteComponentCommand;
+class ChangeNodeSourceCommand;
+class TokenCommand;
+class RemoveSharedMemoryCommand;
+class ChangeSelectionCommand;
+class InputEventCommand;
+class View3DActionCommand;
+class RequestModelNodePreviewImageCommand;
+class ChangeLanguageCommand;
+class ChangePreviewImageSizeCommand;
+
+class NodeInstanceServerInterface : public QObject
+{
+ Q_OBJECT
+public:
+ explicit NodeInstanceServerInterface(QObject *parent = nullptr);
+
+ virtual void createInstances(const CreateInstancesCommand &command) = 0;
+ virtual void changeFileUrl(const ChangeFileUrlCommand &command) = 0;
+ virtual void createScene(const CreateSceneCommand &command) = 0;
+ virtual void clearScene(const ClearSceneCommand &command) = 0;
+ virtual void update3DViewState(const Update3dViewStateCommand &command) = 0;
+ virtual void removeInstances(const RemoveInstancesCommand &command) = 0;
+ virtual void removeProperties(const RemovePropertiesCommand &command) = 0;
+ virtual void changePropertyBindings(const ChangeBindingsCommand &command) = 0;
+ virtual void changePropertyValues(const ChangeValuesCommand &command) = 0;
+ virtual void changeAuxiliaryValues(const ChangeAuxiliaryCommand &command) = 0;
+ virtual void reparentInstances(const ReparentInstancesCommand &command) = 0;
+ virtual void changeIds(const ChangeIdsCommand &command) = 0;
+ virtual void changeState(const ChangeStateCommand &command) = 0;
+ virtual void completeComponent(const CompleteComponentCommand &command) = 0;
+ virtual void changeNodeSource(const ChangeNodeSourceCommand &command) = 0;
+ virtual void token(const TokenCommand &command) = 0;
+ virtual void removeSharedMemory(const RemoveSharedMemoryCommand &command) = 0;
+ virtual void changeSelection(const ChangeSelectionCommand &command) = 0;
+ virtual void inputEvent(const InputEventCommand &command) = 0;
+ virtual void view3DAction(const View3DActionCommand &command) = 0;
+ virtual void requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command) = 0;
+ virtual void changeLanguage(const ChangeLanguageCommand &command) = 0;
+ virtual void changePreviewImageSize(const ChangePreviewImageSizeCommand &command) = 0;
+ virtual void dispatchCommand(const QVariant &) {}
+
+ virtual void benchmark(const QString &) {}
+
+ static void registerCommands();
+};
+
+}
diff --git a/src/libs/qmlpuppetcommunication/types/enumeration.h b/src/libs/qmlpuppetcommunication/types/enumeration.h
new file mode 100644
index 00000000000..85d353d80da
--- /dev/null
+++ b/src/libs/qmlpuppetcommunication/types/enumeration.h
@@ -0,0 +1,98 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include <QByteArray>
+#include <QDataStream>
+#include <QMetaType>
+#include <QVariant>
+
+#include <QString>
+#include <QList>
+#include <QtDebug>
+
+namespace QmlDesigner {
+
+using EnumerationName = QByteArray;
+
+class Enumeration
+{
+ friend bool operator ==(const Enumeration &first, const Enumeration &second);
+ friend bool operator <(const Enumeration &first, const Enumeration &second);
+ friend QDataStream &operator>>(QDataStream &in, Enumeration &enumeration);
+
+public:
+ Enumeration() = default;
+ Enumeration(const EnumerationName &enumerationName)
+ : m_enumerationName(enumerationName)
+ {
+ }
+ Enumeration(const QString &enumerationName)
+ : m_enumerationName(enumerationName.toUtf8())
+ {
+ }
+ Enumeration(const QString &scope, const QString &name)
+ {
+ QString enumerationString = scope + QLatin1Char('.') + name;
+ m_enumerationName = enumerationString.toUtf8();
+ }
+
+ EnumerationName scope() const
+ {
+ return m_enumerationName.split('.').constFirst();
+ }
+ EnumerationName name() const
+ {
+ return m_enumerationName.split('.').last();
+ }
+ EnumerationName toEnumerationName() const
+ {
+ return m_enumerationName;
+ }
+ QString toString() const
+ {
+ return QString::fromUtf8(m_enumerationName);
+ }
+ QString nameToString() const
+ {
+ return QString::fromUtf8(name());
+ }
+
+private:
+ EnumerationName m_enumerationName;
+};
+
+inline QDataStream &operator<<(QDataStream &out, const Enumeration &enumeration){
+ out << enumeration.toEnumerationName();
+ return out;
+}
+
+inline QDataStream &operator>>(QDataStream &in, Enumeration &enumeration)
+{
+ in >> enumeration.m_enumerationName;
+ return in;
+}
+
+
+inline bool operator==(const Enumeration &first, const Enumeration &second)
+{
+ return first.m_enumerationName == second.m_enumerationName;
+}
+
+inline bool operator<(const Enumeration &first, const Enumeration &second)
+{
+ return first.m_enumerationName < second.m_enumerationName;
+}
+
+inline QDebug operator <<(QDebug debug, const Enumeration &enumeration)
+{
+ debug.nospace() << "Enumeration("
+ << enumeration.toString()
+ << ")";
+ return debug;
+}
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::Enumeration)