forked from qt-creator/qt-creator
QmlDesigner: Test mode for qml puppet streams
Change-Id: I93128c60892900d6b4728569b84efb0ed835b51f Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -58,6 +58,12 @@ QVector<InformationContainer> ChildrenChangedCommand::informations() const
|
||||
return m_informationVector;
|
||||
}
|
||||
|
||||
void ChildrenChangedCommand::sort()
|
||||
{
|
||||
qSort(m_childrenVector);
|
||||
qSort(m_informationVector);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const ChildrenChangedCommand &command)
|
||||
{
|
||||
out << command.parentInstanceId();
|
||||
@@ -75,4 +81,11 @@ QDataStream &operator>>(QDataStream &in, ChildrenChangedCommand &command)
|
||||
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;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -39,6 +39,8 @@ 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);
|
||||
@@ -47,6 +49,8 @@ public:
|
||||
qint32 parentInstanceId() const;
|
||||
QVector<InformationContainer> informations() const;
|
||||
|
||||
void sort();
|
||||
|
||||
private:
|
||||
qint32 m_parentInstanceId;
|
||||
QVector<qint32> m_childrenVector;
|
||||
@@ -56,6 +60,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const ChildrenChangedCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, ChildrenChangedCommand &command);
|
||||
|
||||
bool operator ==(const ChildrenChangedCommand &first, const ChildrenChangedCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::ChildrenChangedCommand)
|
||||
|
@@ -47,6 +47,11 @@ QVector<qint32> ComponentCompletedCommand::instances() const
|
||||
return m_instanceVector;
|
||||
}
|
||||
|
||||
void ComponentCompletedCommand::sort()
|
||||
{
|
||||
qSort(m_instanceVector);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command)
|
||||
{
|
||||
out << command.instances();
|
||||
@@ -61,5 +66,10 @@ QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command)
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const ComponentCompletedCommand &first, const ComponentCompletedCommand &second)
|
||||
{
|
||||
return first.m_instanceVector == second.m_instanceVector;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
|
@@ -38,6 +38,7 @@ namespace QmlDesigner {
|
||||
class ComponentCompletedCommand
|
||||
{
|
||||
friend QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command);
|
||||
friend bool operator ==(const ComponentCompletedCommand &first, const ComponentCompletedCommand &second);
|
||||
|
||||
public:
|
||||
ComponentCompletedCommand();
|
||||
@@ -45,6 +46,8 @@ public:
|
||||
|
||||
QVector<qint32> instances() const;
|
||||
|
||||
void sort();
|
||||
|
||||
private:
|
||||
QVector<qint32> m_instanceVector;
|
||||
};
|
||||
@@ -52,6 +55,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const ComponentCompletedCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, ComponentCompletedCommand &command);
|
||||
|
||||
bool operator ==(const ComponentCompletedCommand &first, const ComponentCompletedCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::ComponentCompletedCommand)
|
||||
|
@@ -68,4 +68,10 @@ QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command)
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const DebugOutputCommand &first, const DebugOutputCommand &second)
|
||||
{
|
||||
return first.m_type == second.m_type
|
||||
&& second.m_text == second.m_text;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -39,6 +39,7 @@ namespace QmlDesigner {
|
||||
class DebugOutputCommand
|
||||
{
|
||||
friend QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command);
|
||||
friend bool operator ==(const DebugOutputCommand &first, const DebugOutputCommand &second);
|
||||
|
||||
public:
|
||||
enum Type {
|
||||
@@ -62,6 +63,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const DebugOutputCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command);
|
||||
|
||||
bool operator ==(const DebugOutputCommand &first, const DebugOutputCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::DebugOutputCommand)
|
||||
|
@@ -49,6 +49,11 @@ QVector<InformationContainer> InformationChangedCommand::informations() const
|
||||
return m_informationVector;
|
||||
}
|
||||
|
||||
void InformationChangedCommand::sort()
|
||||
{
|
||||
qSort(m_informationVector);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const InformationChangedCommand &command)
|
||||
{
|
||||
out << command.informations();
|
||||
@@ -63,4 +68,9 @@ QDataStream &operator>>(QDataStream &in, InformationChangedCommand &command)
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const InformationChangedCommand &first, const InformationChangedCommand &second)
|
||||
{
|
||||
return first.m_informationVector == second.m_informationVector;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -41,6 +41,7 @@ namespace QmlDesigner {
|
||||
class InformationChangedCommand
|
||||
{
|
||||
friend QDataStream &operator>>(QDataStream &in, InformationChangedCommand &command);
|
||||
friend bool operator ==(const InformationChangedCommand &first, const InformationChangedCommand &second);
|
||||
|
||||
public:
|
||||
InformationChangedCommand();
|
||||
@@ -48,6 +49,8 @@ public:
|
||||
|
||||
QVector<InformationContainer> informations() const;
|
||||
|
||||
void sort();
|
||||
|
||||
private:
|
||||
QVector<InformationContainer> m_informationVector;
|
||||
};
|
||||
@@ -55,6 +58,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const InformationChangedCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, InformationChangedCommand &command);
|
||||
|
||||
bool operator ==(const InformationChangedCommand &first, const InformationChangedCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::InformationChangedCommand)
|
||||
|
@@ -49,6 +49,11 @@ QVector<ImageContainer> PixmapChangedCommand::images() const
|
||||
return m_imageVector;
|
||||
}
|
||||
|
||||
void PixmapChangedCommand::sort()
|
||||
{
|
||||
qSort(m_imageVector);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const PixmapChangedCommand &command)
|
||||
{
|
||||
out << command.images();
|
||||
@@ -63,4 +68,9 @@ QDataStream &operator>>(QDataStream &in, PixmapChangedCommand &command)
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const PixmapChangedCommand &first, const PixmapChangedCommand &second)
|
||||
{
|
||||
return first.m_imageVector == second.m_imageVector;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -38,12 +38,16 @@ 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;
|
||||
};
|
||||
@@ -51,6 +55,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const PixmapChangedCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, PixmapChangedCommand &command);
|
||||
|
||||
bool operator ==(const PixmapChangedCommand &first, const PixmapChangedCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::PixmapChangedCommand)
|
||||
|
@@ -45,6 +45,11 @@ QVector<ImageContainer> StatePreviewImageChangedCommand::previews()const
|
||||
return m_previewVector;
|
||||
}
|
||||
|
||||
void StatePreviewImageChangedCommand::sort()
|
||||
{
|
||||
qSort(m_previewVector);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const StatePreviewImageChangedCommand &command)
|
||||
{
|
||||
out << command.previews();
|
||||
@@ -58,4 +63,10 @@ QDataStream &operator>>(QDataStream &in, StatePreviewImageChangedCommand &comman
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const StatePreviewImageChangedCommand &first, const StatePreviewImageChangedCommand &second)
|
||||
{
|
||||
return first.m_previewVector == second.m_previewVector;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -39,12 +39,16 @@ 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;
|
||||
};
|
||||
@@ -52,6 +56,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const StatePreviewImageChangedCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, StatePreviewImageChangedCommand &command);
|
||||
|
||||
bool operator ==(const StatePreviewImageChangedCommand &first, const StatePreviewImageChangedCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::StatePreviewImageChangedCommand)
|
||||
|
@@ -61,5 +61,9 @@ QDataStream &operator>>(QDataStream &in, SynchronizeCommand &command)
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const SynchronizeCommand &first, const SynchronizeCommand &second)
|
||||
{
|
||||
return first.m_synchronizeId == second.m_synchronizeId;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -40,6 +40,7 @@ namespace QmlDesigner {
|
||||
class SynchronizeCommand
|
||||
{
|
||||
friend QDataStream &operator>>(QDataStream &in, SynchronizeCommand &command);
|
||||
friend bool operator ==(const SynchronizeCommand &first, const SynchronizeCommand &second);
|
||||
|
||||
public:
|
||||
SynchronizeCommand();
|
||||
@@ -54,6 +55,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const SynchronizeCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, SynchronizeCommand &command);
|
||||
|
||||
bool operator ==(const SynchronizeCommand &first, const SynchronizeCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::SynchronizeCommand)
|
||||
|
@@ -60,6 +60,11 @@ QVector<qint32> TokenCommand::instances() const
|
||||
return m_instanceIdVector;
|
||||
}
|
||||
|
||||
void TokenCommand::sort()
|
||||
{
|
||||
qSort(m_instanceIdVector);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const TokenCommand &command)
|
||||
{
|
||||
out << command.tokenName();
|
||||
@@ -77,5 +82,11 @@ QDataStream &operator>>(QDataStream &in, TokenCommand &command)
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const TokenCommand &first, const TokenCommand &second)
|
||||
{
|
||||
return first.m_tokenNumber == second.m_tokenNumber
|
||||
&& first.m_tokenNumber == second.m_tokenNumber
|
||||
&& first.m_instanceIdVector == second.m_instanceIdVector;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -41,6 +41,7 @@ namespace QmlDesigner {
|
||||
class TokenCommand
|
||||
{
|
||||
friend QDataStream &operator>>(QDataStream &in, TokenCommand &command);
|
||||
friend bool operator ==(const TokenCommand &first, const TokenCommand &second);
|
||||
|
||||
public:
|
||||
TokenCommand();
|
||||
@@ -50,6 +51,8 @@ public:
|
||||
qint32 tokenNumber() const;
|
||||
QVector<qint32> instances() const;
|
||||
|
||||
void sort();
|
||||
|
||||
private:
|
||||
QString m_tokenName;
|
||||
qint32 m_tokenNumber;
|
||||
@@ -59,6 +62,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const TokenCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, TokenCommand &command);
|
||||
|
||||
bool operator ==(const TokenCommand &first, const TokenCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::TokenCommand)
|
||||
|
@@ -67,6 +67,11 @@ void ValuesChangedCommand::removeSharedMemorys(const QVector<qint32> &keyNumberV
|
||||
}
|
||||
}
|
||||
|
||||
void ValuesChangedCommand::sort()
|
||||
{
|
||||
qSort(m_valueChangeVector);
|
||||
}
|
||||
|
||||
static const QLatin1String valueKeyTemplateString("Values-%1");
|
||||
|
||||
static QSharedMemory *createSharedMemory(qint32 key, int byteCount)
|
||||
@@ -142,4 +147,9 @@ QDataStream &operator>>(QDataStream &in, ValuesChangedCommand &command)
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second)
|
||||
{
|
||||
return first.m_valueChangeVector == second.m_valueChangeVector;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -41,6 +41,7 @@ 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:
|
||||
ValuesChangedCommand();
|
||||
@@ -51,6 +52,8 @@ public:
|
||||
|
||||
static void removeSharedMemorys(const QVector<qint32> &keyNumberVector);
|
||||
|
||||
void sort();
|
||||
|
||||
private:
|
||||
QVector<PropertyValueContainer> m_valueChangeVector;
|
||||
mutable quint32 m_keyNumber;
|
||||
@@ -59,6 +62,8 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command);
|
||||
QDataStream &operator>>(QDataStream &in, ValuesChangedCommand &command);
|
||||
|
||||
bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::ValuesChangedCommand)
|
||||
|
@@ -231,4 +231,15 @@ QDataStream &operator>>(QDataStream &in, ImageContainer &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;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -38,6 +38,9 @@ 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);
|
||||
@@ -59,6 +62,9 @@ private:
|
||||
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);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::ImageContainer)
|
||||
|
@@ -98,4 +98,30 @@ QDataStream &operator>>(QDataStream &in, InformationContainer &container)
|
||||
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 operator <(const QVariant &first, const QVariant &second)
|
||||
{
|
||||
if (first.userType() == second.userType()) {
|
||||
if (first.canConvert<QByteArray>())
|
||||
return first.value<QByteArray>() < second.value<QByteArray>();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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 && first.m_information < second.m_information);
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -43,6 +43,8 @@ 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();
|
||||
@@ -69,6 +71,9 @@ private:
|
||||
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);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::InformationContainer)
|
||||
|
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "propertyvaluecontainer.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
PropertyValueContainer::PropertyValueContainer()
|
||||
@@ -89,4 +91,19 @@ QDataStream &operator>>(QDataStream &in, PropertyValueContainer &container)
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -42,6 +42,8 @@ namespace QmlDesigner {
|
||||
class PropertyValueContainer
|
||||
{
|
||||
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);
|
||||
|
||||
public:
|
||||
PropertyValueContainer();
|
||||
@@ -63,6 +65,9 @@ private:
|
||||
QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container);
|
||||
QDataStream &operator>>(QDataStream &in, PropertyValueContainer &container);
|
||||
|
||||
bool operator ==(const PropertyValueContainer &first, const PropertyValueContainer &second);
|
||||
bool operator <(const PropertyValueContainer &first, const PropertyValueContainer &second);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::PropertyValueContainer)
|
||||
|
@@ -33,6 +33,9 @@
|
||||
#include <QVariant>
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "nodeinstanceserverinterface.h"
|
||||
|
||||
@@ -72,37 +75,116 @@ namespace QmlDesigner {
|
||||
|
||||
NodeInstanceClientProxy::NodeInstanceClientProxy(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_inputIoDevice(0),
|
||||
m_outputIoDevice(0),
|
||||
m_nodeInstanceServer(0),
|
||||
m_blockSize(0),
|
||||
m_writeCommandCounter(0),
|
||||
m_lastReadCommandCounter(0),
|
||||
m_synchronizeId(-1)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::initializeSocket()
|
||||
{
|
||||
m_socket = new QLocalSocket(this);
|
||||
connect(m_socket, SIGNAL(readyRead()), this, SLOT(readDataStream()));
|
||||
connect(m_socket, SIGNAL(error(QLocalSocket::LocalSocketError)), QCoreApplication::instance(), SLOT(quit()));
|
||||
connect(m_socket, SIGNAL(disconnected()), QCoreApplication::instance(), SLOT(quit()));
|
||||
m_socket->connectToServer(QCoreApplication::arguments().at(1), QIODevice::ReadWrite | QIODevice::Unbuffered);
|
||||
m_socket->waitForConnected(-1);
|
||||
QLocalSocket *localSocket = new QLocalSocket(this);
|
||||
connect(localSocket, SIGNAL(readyRead()), this, SLOT(readDataStream()));
|
||||
connect(localSocket, SIGNAL(error(QLocalSocket::LocalSocketError)), QCoreApplication::instance(), SLOT(quit()));
|
||||
connect(localSocket, SIGNAL(disconnected()), QCoreApplication::instance(), SLOT(quit()));
|
||||
localSocket->connectToServer(QCoreApplication::arguments().at(1), QIODevice::ReadWrite | QIODevice::Unbuffered);
|
||||
localSocket->waitForConnected(-1);
|
||||
|
||||
m_inputIoDevice = localSocket;
|
||||
m_outputIoDevice = localSocket;
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::initializeCapturedStream(const QString &fileName)
|
||||
{
|
||||
m_inputIoDevice = new QFile(fileName, this);
|
||||
bool inputStreamCanBeOpened = m_inputIoDevice->open(QIODevice::ReadOnly);
|
||||
if (!inputStreamCanBeOpened) {
|
||||
qDebug() << "Input stream file cannot be opened: " << fileName;
|
||||
QCoreApplication::exit(-1);
|
||||
}
|
||||
|
||||
if (QCoreApplication::arguments().count() == 3) {
|
||||
QFileInfo inputFileInfo(fileName);
|
||||
m_outputIoDevice = new QFile(inputFileInfo.path()+ "/" + inputFileInfo.baseName() + ".commandcontrolstream", this);
|
||||
bool outputStreamCanBeOpened = m_outputIoDevice->open(QIODevice::WriteOnly);
|
||||
if (!outputStreamCanBeOpened) {
|
||||
qDebug() << "Output stream file cannot be opened";
|
||||
QCoreApplication::exit(-1);
|
||||
}
|
||||
} else if (QCoreApplication::arguments().count() == 4) {
|
||||
m_controlStream.setFileName(QCoreApplication::arguments().at(3));
|
||||
bool controlStreamCanBeOpened = m_controlStream.open(QIODevice::ReadOnly);
|
||||
if (!controlStreamCanBeOpened) {
|
||||
qDebug() << "Control stream file cannot be opened";
|
||||
QCoreApplication::exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool compareCommands(const QVariant &command, const QVariant &controlCommand)
|
||||
{
|
||||
static const int informationChangedCommandType = QMetaType::type("InformationChangedCommand");
|
||||
static const int valuesChangedCommandType = QMetaType::type("ValuesChangedCommand");
|
||||
static const int pixmapChangedCommandType = QMetaType::type("PixmapChangedCommand");
|
||||
static const int childrenChangedCommandType = QMetaType::type("ChildrenChangedCommand");
|
||||
static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand");
|
||||
static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand");
|
||||
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand");
|
||||
static const int tokenCommandType = QMetaType::type("TokenCommand");
|
||||
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
|
||||
|
||||
if (command.userType() == controlCommand.userType()) {
|
||||
if (command.userType() == informationChangedCommandType)
|
||||
return command.value<InformationChangedCommand>() == controlCommand.value<InformationChangedCommand>();
|
||||
else if (command.userType() == valuesChangedCommandType)
|
||||
return command.value<ValuesChangedCommand>() == controlCommand.value<ValuesChangedCommand>();
|
||||
else if (command.userType() == pixmapChangedCommandType)
|
||||
return command.value<PixmapChangedCommand>() == controlCommand.value<PixmapChangedCommand>();
|
||||
else if (command.userType() == childrenChangedCommandType)
|
||||
return command.value<ChildrenChangedCommand>() == controlCommand.value<ChildrenChangedCommand>();
|
||||
else if (command.userType() == statePreviewImageChangedCommandType)
|
||||
return command.value<StatePreviewImageChangedCommand>() == controlCommand.value<StatePreviewImageChangedCommand>();
|
||||
else if (command.userType() == componentCompletedCommandType)
|
||||
return command.value<ComponentCompletedCommand>() == controlCommand.value<ComponentCompletedCommand>();
|
||||
else if (command.userType() == synchronizeCommandType)
|
||||
return command.value<SynchronizeCommand>() == controlCommand.value<SynchronizeCommand>();
|
||||
else if (command.userType() == tokenCommandType)
|
||||
return command.value<TokenCommand>() == controlCommand.value<TokenCommand>();
|
||||
else if (command.userType() == debugOutputCommandType)
|
||||
return command.value<DebugOutputCommand>() == controlCommand.value<DebugOutputCommand>();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::writeCommand(const QVariant &command)
|
||||
{
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
out << quint32(0);
|
||||
out << quint32(m_writeCommandCounter);
|
||||
m_writeCommandCounter++;
|
||||
out << command;
|
||||
out.device()->seek(0);
|
||||
out << quint32(block.size() - sizeof(quint32));
|
||||
if (m_controlStream.isReadable()) {
|
||||
static quint32 readCommandCounter = 0;
|
||||
static quint32 blockSize = 0;
|
||||
|
||||
m_socket->write(block);
|
||||
QVariant controlCommand = readCommandFromIOStream(&m_controlStream, &readCommandCounter, &blockSize);
|
||||
|
||||
if (!compareCommands(command, controlCommand)) {
|
||||
qDebug() << "Commands differ!";
|
||||
QCoreApplication::exit(-1);
|
||||
}
|
||||
} else if (m_outputIoDevice) {
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
out.setVersion(QDataStream::Qt_4_8);
|
||||
out << quint32(0);
|
||||
out << quint32(m_writeCommandCounter);
|
||||
m_writeCommandCounter++;
|
||||
out << command;
|
||||
out.device()->seek(0);
|
||||
out << quint32(block.size() - sizeof(quint32));
|
||||
|
||||
m_outputIoDevice->write(block);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::informationChanged(const InformationChangedCommand &command)
|
||||
@@ -159,44 +241,60 @@ void NodeInstanceClientProxy::synchronizeWithClientProcess()
|
||||
|
||||
qint64 NodeInstanceClientProxy::bytesToWrite() const
|
||||
{
|
||||
return m_socket->bytesToWrite();
|
||||
return m_inputIoDevice->bytesToWrite();
|
||||
}
|
||||
|
||||
QVariant NodeInstanceClientProxy::readCommandFromIOStream(QIODevice *ioDevice, quint32 *readCommandCounter, quint32 *blockSize)
|
||||
{
|
||||
|
||||
|
||||
|
||||
QDataStream in(ioDevice);
|
||||
in.setVersion(QDataStream::Qt_4_8);
|
||||
|
||||
if (*blockSize == 0) {
|
||||
in >> *blockSize;
|
||||
}
|
||||
|
||||
if (ioDevice->bytesAvailable() < *blockSize)
|
||||
return QVariant();
|
||||
|
||||
quint32 commandCounter;
|
||||
in >> commandCounter;
|
||||
bool commandLost = !((commandCounter == 0 && *readCommandCounter == 0) || (*readCommandCounter + 1 == commandCounter));
|
||||
if (commandLost)
|
||||
qDebug() << "client command lost: " << *readCommandCounter << commandCounter;
|
||||
*readCommandCounter = commandCounter;
|
||||
|
||||
QVariant command;
|
||||
in >> command;
|
||||
*blockSize = 0;
|
||||
|
||||
if (in.status() != QDataStream::Ok) {
|
||||
qWarning() << "Stream is no ok!!!";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
void NodeInstanceClientProxy::readDataStream()
|
||||
{
|
||||
QList<QVariant> commandList;
|
||||
|
||||
while (!m_socket->atEnd()) {
|
||||
if (m_socket->bytesAvailable() < int(sizeof(quint32)))
|
||||
while (!m_inputIoDevice->atEnd()) {
|
||||
if (m_inputIoDevice->bytesAvailable() < int(sizeof(quint32)))
|
||||
break;
|
||||
|
||||
QDataStream in(m_socket);
|
||||
in.setVersion(QDataStream::Qt_4_8);
|
||||
static quint32 readCommandCounter = 0;
|
||||
static quint32 blockSize = 0;
|
||||
|
||||
if (m_blockSize == 0) {
|
||||
in >> m_blockSize;
|
||||
}
|
||||
QVariant command = readCommandFromIOStream(m_inputIoDevice, &readCommandCounter, &blockSize);
|
||||
|
||||
if (m_socket->bytesAvailable() < m_blockSize)
|
||||
if (command.isValid())
|
||||
commandList.append(command);
|
||||
else
|
||||
break;
|
||||
|
||||
quint32 commandCounter;
|
||||
in >> commandCounter;
|
||||
bool commandLost = !((m_lastReadCommandCounter == 0 && commandCounter == 0) || (m_lastReadCommandCounter + 1 == commandCounter));
|
||||
if (commandLost)
|
||||
qDebug() << "client command lost: " << m_lastReadCommandCounter << commandCounter;
|
||||
m_lastReadCommandCounter = commandCounter;
|
||||
|
||||
QVariant command;
|
||||
in >> command;
|
||||
m_blockSize = 0;
|
||||
|
||||
if (in.status() != QDataStream::Ok) {
|
||||
qWarning() << "Stream is no ok!!!";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
commandList.append(command);
|
||||
}
|
||||
|
||||
foreach (const QVariant &command, commandList) {
|
||||
@@ -295,6 +393,15 @@ void NodeInstanceClientProxy::redirectToken(const TokenCommand &command)
|
||||
|
||||
void NodeInstanceClientProxy::redirectToken(const EndPuppetCommand & /*command*/)
|
||||
{
|
||||
if (m_outputIoDevice && m_outputIoDevice->isOpen())
|
||||
m_outputIoDevice->close();
|
||||
|
||||
if (m_inputIoDevice && m_inputIoDevice->isOpen())
|
||||
m_inputIoDevice->close();
|
||||
|
||||
if (m_controlStream.isOpen())
|
||||
m_controlStream.close();
|
||||
|
||||
qDebug() << "End Process: " << QCoreApplication::applicationPid();
|
||||
QCoreApplication::exit();
|
||||
}
|
||||
|
@@ -35,9 +35,11 @@
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
#include <QWeakPointer>
|
||||
#include <QFile>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLocalSocket;
|
||||
class QIODevice;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner {
|
||||
@@ -82,6 +84,7 @@ public:
|
||||
|
||||
protected:
|
||||
void initializeSocket();
|
||||
void initializeCapturedStream(const QString &fileName);
|
||||
void writeCommand(const QVariant &command);
|
||||
void dispatchCommand(const QVariant &command);
|
||||
NodeInstanceServerInterface *nodeInstanceServer() const;
|
||||
@@ -104,16 +107,18 @@ protected:
|
||||
void removeSharedMemory(const RemoveSharedMemoryCommand &command);
|
||||
void redirectToken(const TokenCommand &command);
|
||||
void redirectToken(const EndPuppetCommand &command);
|
||||
static QVariant readCommandFromIOStream(QIODevice *ioDevice, quint32 *readCommandCounter, quint32 *blockSize);
|
||||
|
||||
private slots:
|
||||
protected slots:
|
||||
void readDataStream();
|
||||
|
||||
private:
|
||||
QLocalSocket *m_socket;
|
||||
QFile m_controlStream;
|
||||
QIODevice *m_inputIoDevice;
|
||||
QIODevice *m_outputIoDevice;
|
||||
NodeInstanceServerInterface *m_nodeInstanceServer;
|
||||
quint32 m_blockSize;
|
||||
quint32 m_writeCommandCounter;
|
||||
quint32 m_lastReadCommandCounter;
|
||||
int m_synchronizeId;
|
||||
};
|
||||
|
||||
|
@@ -59,7 +59,6 @@ public:
|
||||
virtual void flush() {};
|
||||
virtual void synchronizeWithClientProcess() {}
|
||||
virtual qint64 bytesToWrite() const {return 0;}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ namespace QmlDesigner {
|
||||
typedef QByteArray PropertyName;
|
||||
typedef QList<PropertyName> PropertyNameList;
|
||||
typedef QByteArray TypeName;
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEINSTANCEGLOBAL_H
|
||||
|
@@ -1,7 +1,8 @@
|
||||
INCLUDEPATH += $$PWD/
|
||||
|
||||
HEADERS += $$PWD/qt5nodeinstanceserver.h
|
||||
HEADERS += $$PWD//graphicalnodeinstance.h
|
||||
HEADERS += $$PWD/qt5testnodeinstanceserver.h
|
||||
HEADERS += $$PWD/graphicalnodeinstance.h
|
||||
HEADERS += $$PWD/qt5informationnodeinstanceserver.h
|
||||
HEADERS += $$PWD/qt5rendernodeinstanceserver.h
|
||||
HEADERS += $$PWD/qt5previewnodeinstanceserver.h
|
||||
@@ -26,26 +27,27 @@ HEADERS += $$PWD/quickwindownodeinstance.h
|
||||
HEADERS += $$PWD/layoutnodeinstance.h
|
||||
|
||||
SOURCES += $$PWD/qt5nodeinstanceserver.cpp
|
||||
SOURCES += $$PWD/qt5testnodeinstanceserver.cpp
|
||||
SOURCES += $$PWD/graphicalnodeinstance.cpp
|
||||
SOURCES += $$PWD/qt5informationnodeinstanceserver.cpp
|
||||
SOURCES += $$PWD/qt5rendernodeinstanceserver.cpp
|
||||
SOURCES += $$PWD/qt5previewnodeinstanceserver.cpp
|
||||
SOURCES += $$PWD/qt5nodeinstanceclientproxy.cpp
|
||||
SOURCES += $$PWD/quickitemnodeinstance.cpp
|
||||
SOURCES += $$PWD/behaviornodeinstance.cpp
|
||||
SOURCES += $$PWD/dummycontextobject.cpp
|
||||
SOURCES += $$PWD/childrenchangeeventfilter.cpp
|
||||
SOURCES += $$PWD/componentnodeinstance.cpp
|
||||
SOURCES += $$PWD/dummynodeinstance.cpp
|
||||
SOURCES += $$PWD/nodeinstancemetaobject.cpp
|
||||
SOURCES += $$PWD/nodeinstanceserver.cpp
|
||||
SOURCES += $$PWD/nodeinstancesignalspy.cpp
|
||||
SOURCES += $$PWD/objectnodeinstance.cpp
|
||||
SOURCES += $$PWD/qmlpropertychangesnodeinstance.cpp
|
||||
SOURCES += $$PWD/qmlstatenodeinstance.cpp
|
||||
SOURCES += $$PWD/qmltransitionnodeinstance.cpp
|
||||
SOURCES += $$PWD/servernodeinstance.cpp
|
||||
SOURCES += $$PWD/anchorchangesnodeinstance.cpp
|
||||
SOURCES += $$PWD/behaviornodeinstance.cpp
|
||||
SOURCES += $$PWD/dummycontextobject.cpp
|
||||
SOURCES += $$PWD/childrenchangeeventfilter.cpp
|
||||
SOURCES += $$PWD/componentnodeinstance.cpp
|
||||
SOURCES += $$PWD/dummynodeinstance.cpp
|
||||
SOURCES += $$PWD/nodeinstancemetaobject.cpp
|
||||
SOURCES += $$PWD/nodeinstanceserver.cpp
|
||||
SOURCES += $$PWD/nodeinstancesignalspy.cpp
|
||||
SOURCES += $$PWD/objectnodeinstance.cpp
|
||||
SOURCES += $$PWD/qmlpropertychangesnodeinstance.cpp
|
||||
SOURCES += $$PWD/qmlstatenodeinstance.cpp
|
||||
SOURCES += $$PWD/qmltransitionnodeinstance.cpp
|
||||
SOURCES += $$PWD/servernodeinstance.cpp
|
||||
SOURCES += $$PWD/anchorchangesnodeinstance.cpp
|
||||
SOURCES += $$PWD/positionernodeinstance.cpp
|
||||
SOURCES += $$PWD/quickwindownodeinstance.cpp
|
||||
SOURCES += $$PWD/layoutnodeinstance.cpp
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "qt5informationnodeinstanceserver.h"
|
||||
#include "qt5previewnodeinstanceserver.h"
|
||||
#include "qt5rendernodeinstanceserver.h"
|
||||
#include "qt5testnodeinstanceserver.h"
|
||||
|
||||
#include <designersupport.h>
|
||||
|
||||
@@ -43,15 +44,22 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
|
||||
NodeInstanceClientProxy(parent)
|
||||
{
|
||||
DesignerSupport::activateDesignerWindowManager();
|
||||
if (QCoreApplication::arguments().at(2) == QLatin1String("previewmode")) {
|
||||
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
|
||||
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");
|
||||
setNodeInstanceServer(new Qt5TestNodeInstanceServer(this));
|
||||
initializeCapturedStream(QCoreApplication::arguments().at(2));
|
||||
readDataStream();
|
||||
QCoreApplication::exit();
|
||||
} else if (QCoreApplication::arguments().at(2) == QLatin1String("previewmode")) {
|
||||
setNodeInstanceServer(new Qt5PreviewNodeInstanceServer(this));
|
||||
initializeSocket();
|
||||
} else if (QCoreApplication::arguments().at(2) == QLatin1String("editormode")) {
|
||||
setNodeInstanceServer(new Qt5InformationNodeInstanceServer(this));
|
||||
initializeSocket();
|
||||
} else if (QCoreApplication::arguments().at(2) == QLatin1String("rendermode")) {
|
||||
setNodeInstanceServer(new Qt5RenderNodeInstanceServer(this));
|
||||
initializeSocket();
|
||||
}
|
||||
|
||||
initializeSocket();
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -0,0 +1,364 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qt5testnodeinstanceserver.h"
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QQuickView>
|
||||
|
||||
#include "servernodeinstance.h"
|
||||
#include "childrenchangeeventfilter.h"
|
||||
#include "propertyabstractcontainer.h"
|
||||
#include "propertybindingcontainer.h"
|
||||
#include "propertyvaluecontainer.h"
|
||||
#include "instancecontainer.h"
|
||||
#include "createinstancescommand.h"
|
||||
#include "changefileurlcommand.h"
|
||||
#include "clearscenecommand.h"
|
||||
#include "reparentinstancescommand.h"
|
||||
#include "changevaluescommand.h"
|
||||
#include "changebindingscommand.h"
|
||||
#include "changeidscommand.h"
|
||||
#include "removeinstancescommand.h"
|
||||
#include "nodeinstanceclientinterface.h"
|
||||
#include "removepropertiescommand.h"
|
||||
#include "valueschangedcommand.h"
|
||||
#include "informationchangedcommand.h"
|
||||
#include "pixmapchangedcommand.h"
|
||||
#include "commondefines.h"
|
||||
#include "changestatecommand.h"
|
||||
#include "childrenchangedcommand.h"
|
||||
#include "completecomponentcommand.h"
|
||||
#include "componentcompletedcommand.h"
|
||||
#include "createscenecommand.h"
|
||||
#include "tokencommand.h"
|
||||
#include "removesharedmemorycommand.h"
|
||||
#include "changeauxiliarycommand.h"
|
||||
#include "changenodesourcecommand.h"
|
||||
|
||||
#include "dummycontextobject.h"
|
||||
|
||||
#include <designersupport.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Qt5TestNodeInstanceServer::Qt5TestNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient)
|
||||
: Qt5NodeInstanceServer(nodeInstanceClient)
|
||||
{
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::createInstances(const CreateInstancesCommand &command)
|
||||
{
|
||||
createInstances(command.instances());
|
||||
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::changeFileUrl(const ChangeFileUrlCommand &command)
|
||||
{
|
||||
setupFileUrl(command.fileUrl());
|
||||
|
||||
refreshBindings();
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command)
|
||||
{
|
||||
bool hasDynamicProperties = false;
|
||||
foreach (const PropertyValueContainer &container, command.valueChanges()) {
|
||||
hasDynamicProperties |= container.isDynamic();
|
||||
setInstancePropertyVariant(container);
|
||||
}
|
||||
|
||||
if (hasDynamicProperties)
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::changePropertyBindings(const ChangeBindingsCommand &command)
|
||||
{
|
||||
bool hasDynamicProperties = false;
|
||||
foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
|
||||
hasDynamicProperties |= container.isDynamic();
|
||||
setInstancePropertyBinding(container);
|
||||
}
|
||||
|
||||
if (hasDynamicProperties)
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::changeAuxiliaryValues(const ChangeAuxiliaryCommand &command)
|
||||
{
|
||||
foreach (const PropertyValueContainer &container, command.auxiliaryChanges()) {
|
||||
setInstanceAuxiliaryData(container);
|
||||
}
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::changeIds(const ChangeIdsCommand &command)
|
||||
{
|
||||
foreach (const IdContainer &container, command.ids()) {
|
||||
if (hasInstanceForId(container.instanceId()))
|
||||
instanceForId(container.instanceId()).setId(container.id());
|
||||
}
|
||||
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::createScene(const CreateSceneCommand &command)
|
||||
{
|
||||
Qt5NodeInstanceServer::createScene(command);
|
||||
|
||||
stopRenderTimer();
|
||||
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::clearScene(const ClearSceneCommand &command)
|
||||
{
|
||||
Qt5NodeInstanceServer::clearScene(command);
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
|
||||
{
|
||||
ServerNodeInstance oldState = activeStateInstance();
|
||||
if (activeStateInstance().isValid())
|
||||
activeStateInstance().deactivateState();
|
||||
|
||||
foreach (qint32 instanceId, command.instanceIds()) {
|
||||
removeInstanceRelationsip(instanceId);
|
||||
}
|
||||
|
||||
if (oldState.isValid())
|
||||
oldState.activateState();
|
||||
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::removeProperties(const RemovePropertiesCommand &command)
|
||||
{
|
||||
bool hasDynamicProperties = false;
|
||||
foreach (const PropertyAbstractContainer &container, command.properties()) {
|
||||
hasDynamicProperties |= container.isDynamic();
|
||||
resetInstanceProperty(container);
|
||||
}
|
||||
|
||||
if (hasDynamicProperties)
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
|
||||
{
|
||||
foreach (const ReparentContainer &container, command.reparentInstances()) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instance.reparent(instanceForId(container.oldParentInstanceId()), container.oldParentProperty(), instanceForId(container.newParentInstanceId()), container.newParentProperty());
|
||||
}
|
||||
}
|
||||
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::changeState(const ChangeStateCommand &command)
|
||||
{
|
||||
if (hasInstanceForId(command.stateInstanceId())) {
|
||||
if (activeStateInstance().isValid())
|
||||
activeStateInstance().deactivateState();
|
||||
ServerNodeInstance instance = instanceForId(command.stateInstanceId());
|
||||
instance.activateState();
|
||||
} else {
|
||||
if (activeStateInstance().isValid())
|
||||
activeStateInstance().deactivateState();
|
||||
}
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::completeComponent(const CompleteComponentCommand &command)
|
||||
{
|
||||
QList<ServerNodeInstance> instanceList;
|
||||
|
||||
foreach (qint32 instanceId, command.instances()) {
|
||||
if (hasInstanceForId(instanceId)) {
|
||||
ServerNodeInstance instance = instanceForId(instanceId);
|
||||
instance.doComponentComplete();
|
||||
instanceList.append(instance);
|
||||
}
|
||||
}
|
||||
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::changeNodeSource(const ChangeNodeSourceCommand &command)
|
||||
{
|
||||
if (hasInstanceForId(command.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(command.instanceId());
|
||||
if (instance.isValid())
|
||||
instance.setNodeSource(command.nodeSource());
|
||||
}
|
||||
|
||||
refreshBindings();
|
||||
|
||||
collectItemChangesAndSendChangeCommands();
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::removeSharedMemory(const RemoveSharedMemoryCommand &command)
|
||||
{
|
||||
if (command.typeName() == "Values")
|
||||
ValuesChangedCommand::removeSharedMemorys(command.keyNumbers());
|
||||
}
|
||||
|
||||
void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeCommands()
|
||||
{
|
||||
DesignerSupport::polishItems(quickView());
|
||||
|
||||
QSet<ServerNodeInstance> informationChangedInstanceSet;
|
||||
QVector<InstancePropertyPair> propertyChangedList;
|
||||
QSet<ServerNodeInstance> parentChangedSet;
|
||||
|
||||
if (quickView()) {
|
||||
foreach (QQuickItem *item, allItems()) {
|
||||
if (item && hasInstanceForObject(item)) {
|
||||
ServerNodeInstance instance = instanceForObject(item);
|
||||
|
||||
if (isDirtyRecursiveForNonInstanceItems(item))
|
||||
informationChangedInstanceSet.insert(instance);
|
||||
|
||||
|
||||
if (DesignerSupport::isDirty(item, DesignerSupport::ParentChanged)) {
|
||||
parentChangedSet.insert(instance);
|
||||
informationChangedInstanceSet.insert(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const InstancePropertyPair& property, changedPropertyList()) {
|
||||
const ServerNodeInstance instance = property.first;
|
||||
const QString propertyName = property.second;
|
||||
|
||||
if (instance.isValid()) {
|
||||
if (propertyName.contains("anchors"))
|
||||
informationChangedInstanceSet.insert(instance);
|
||||
|
||||
propertyChangedList.append(property);
|
||||
}
|
||||
}
|
||||
|
||||
resetAllItems();
|
||||
clearChangedPropertyList();
|
||||
|
||||
if (!informationChangedInstanceSet.isEmpty()) {
|
||||
InformationChangedCommand command = createAllInformationChangedCommand(informationChangedInstanceSet.toList());
|
||||
command.sort();
|
||||
nodeInstanceClient()->informationChanged(command);
|
||||
}
|
||||
if (!propertyChangedList.isEmpty()) {
|
||||
ValuesChangedCommand command = createValuesChangedCommand(propertyChangedList);
|
||||
command.sort();
|
||||
nodeInstanceClient()->valuesChanged(command);
|
||||
}
|
||||
|
||||
if (!parentChangedSet.isEmpty())
|
||||
sendChildrenChangedCommand(parentChangedSet.toList());
|
||||
}
|
||||
}
|
||||
|
||||
void Qt5TestNodeInstanceServer::sendChildrenChangedCommand(const QList<ServerNodeInstance> childList)
|
||||
{
|
||||
QSet<ServerNodeInstance> parentSet;
|
||||
QList<ServerNodeInstance> noParentList;
|
||||
|
||||
foreach (const ServerNodeInstance &child, childList) {
|
||||
if (!child.hasParent()) {
|
||||
noParentList.append(child);
|
||||
} else {
|
||||
ServerNodeInstance parent = child.parent();
|
||||
if (parent.isValid()) {
|
||||
parentSet.insert(parent);
|
||||
} else {
|
||||
noParentList.append(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const ServerNodeInstance &parent, parentSet) {
|
||||
ChildrenChangedCommand command = createChildrenChangedCommand(parent, parent.childItems());
|
||||
command.sort();
|
||||
nodeInstanceClient()->childrenChanged(command);
|
||||
}
|
||||
|
||||
if (!noParentList.isEmpty()) {
|
||||
ChildrenChangedCommand command = createChildrenChangedCommand(ServerNodeInstance(), noParentList);
|
||||
command.sort();
|
||||
nodeInstanceClient()->childrenChanged(command);
|
||||
}
|
||||
}
|
||||
|
||||
bool Qt5TestNodeInstanceServer::isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const
|
||||
{
|
||||
static DesignerSupport::DirtyType informationsDirty = DesignerSupport::DirtyType(DesignerSupport::TransformUpdateMask
|
||||
| DesignerSupport::ContentUpdateMask
|
||||
| DesignerSupport::Visible
|
||||
| DesignerSupport::ZValue
|
||||
| DesignerSupport::OpacityValue);
|
||||
|
||||
if (DesignerSupport::isDirty(item, informationsDirty))
|
||||
return true;
|
||||
|
||||
foreach (QQuickItem *childItem, item->childItems()) {
|
||||
if (!hasInstanceForObject(childItem)) {
|
||||
if (DesignerSupport::isDirty(childItem, informationsDirty))
|
||||
return true;
|
||||
else if (isDirtyRecursiveForNonInstanceItems(childItem))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
@@ -0,0 +1,70 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef QMLDESIGNER_QT5TESTNODEINSTANCESERVER_H
|
||||
#define QMLDESIGNER_QT5TESTNODEINSTANCESERVER_H
|
||||
|
||||
#include "qt5nodeinstanceserver.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class Qt5TestNodeInstanceServer : public Qt5NodeInstanceServer
|
||||
{
|
||||
public:
|
||||
Qt5TestNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient);
|
||||
|
||||
|
||||
void createInstances(const CreateInstancesCommand &command);
|
||||
void changeFileUrl(const ChangeFileUrlCommand &command);
|
||||
void changePropertyValues(const ChangeValuesCommand &command);
|
||||
void changePropertyBindings(const ChangeBindingsCommand &command);
|
||||
void changeAuxiliaryValues(const ChangeAuxiliaryCommand &command);
|
||||
void changeIds(const ChangeIdsCommand &command);
|
||||
void createScene(const CreateSceneCommand &command);
|
||||
void clearScene(const ClearSceneCommand &command);
|
||||
void removeInstances(const RemoveInstancesCommand &command);
|
||||
void removeProperties(const RemovePropertiesCommand &command);
|
||||
void reparentInstances(const ReparentInstancesCommand &command);
|
||||
void changeState(const ChangeStateCommand &command);
|
||||
void completeComponent(const CompleteComponentCommand &command);
|
||||
void changeNodeSource(const ChangeNodeSourceCommand &command);
|
||||
void removeSharedMemory(const RemoveSharedMemoryCommand &command);
|
||||
|
||||
using Qt5NodeInstanceServer::createInstances;
|
||||
|
||||
protected:
|
||||
void collectItemChangesAndSendChangeCommands() Q_DECL_OVERRIDE;
|
||||
void sendChildrenChangedCommand(const QList<ServerNodeInstance> childList);
|
||||
bool isDirtyRecursiveForNonInstanceItems(QQuickItem *item) const;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
#endif // QMLDESIGNER_QT5TESTNODEINSTANCESERVER_H
|
@@ -446,7 +446,7 @@ QPair<PropertyName, ServerNodeInstance> ServerNodeInstance::anchor(const Propert
|
||||
return m_nodeInstance->anchor(name);
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const ServerNodeInstance &instance)
|
||||
QDebug operator <<(QDebug debug, const ServerNodeInstance &instance)
|
||||
{
|
||||
if (instance.isValid()) {
|
||||
debug.nospace() << "ServerNodeInstance("
|
||||
@@ -466,11 +466,17 @@ uint qHash(const ServerNodeInstance &instance)
|
||||
return ::qHash(instance.instanceId());
|
||||
}
|
||||
|
||||
bool operator==(const ServerNodeInstance &first, const ServerNodeInstance &second)
|
||||
bool operator ==(const ServerNodeInstance &first, const ServerNodeInstance &second)
|
||||
{
|
||||
return first.instanceId() == second.instanceId();
|
||||
}
|
||||
|
||||
bool operator <(const ServerNodeInstance &first, const ServerNodeInstance &second)
|
||||
{
|
||||
return first.instanceId() < second.instanceId();
|
||||
}
|
||||
|
||||
|
||||
bool ServerNodeInstance::isWrappingThisObject(QObject *object) const
|
||||
{
|
||||
return internalObject() && internalObject() == object;
|
||||
|
@@ -55,6 +55,7 @@ class Qt4NodeInstanceServer;
|
||||
class Qt4PreviewNodeInstanceServer;
|
||||
class Qt5NodeInstanceServer;
|
||||
class Qt5PreviewNodeInstanceServer;
|
||||
class Qt5TestNodeInstanceServer;
|
||||
class InstanceContainer;
|
||||
|
||||
namespace Internal {
|
||||
@@ -73,6 +74,7 @@ class ServerNodeInstance
|
||||
friend class Qt4PreviewNodeInstanceServer;
|
||||
friend class Qt5NodeInstanceServer;
|
||||
friend class Qt5PreviewNodeInstanceServer;
|
||||
friend class Qt5TestNodeInstanceServer;
|
||||
friend class QHash<qint32, ServerNodeInstance>;
|
||||
friend uint qHash(const ServerNodeInstance &instance);
|
||||
friend bool operator==(const ServerNodeInstance &first, const ServerNodeInstance &second);
|
||||
@@ -209,8 +211,9 @@ private: // variables
|
||||
};
|
||||
|
||||
uint qHash(const ServerNodeInstance &instance);
|
||||
bool operator==(const ServerNodeInstance &first, const ServerNodeInstance &second);
|
||||
QDebug operator<<(QDebug debug, const ServerNodeInstance &instance);
|
||||
bool operator ==(const ServerNodeInstance &first, const ServerNodeInstance &second);
|
||||
bool operator <(const ServerNodeInstance &first, const ServerNodeInstance &second);
|
||||
QDebug operator <<(QDebug debug, const ServerNodeInstance &instance);
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::ServerNodeInstance)
|
||||
|
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (application.arguments().count() < 4) {
|
||||
if (application.arguments().at(1) != "--readcapturedstream" && application.arguments().count() < 4) {
|
||||
qDebug() << "Wrong argument count: " << application.arguments().count();
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user