QmlDesigner.NodeInstances: Support for Qt five scene graph

QmlPuppet only supported GraphicsView. There is now Qml2Puppet which is
supporting the new Qt Scene Graph.

Change-Id: Ia0a06639cf6852192e84f7bfc2bea60532890b08
Reviewed-on: http://codereview.qt.nokia.com/433
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
Marco Bubke
2011-06-09 15:50:48 +02:00
committed by Thomas Hartmann
parent 74f1c2e277
commit d103bb7a60
151 changed files with 3159 additions and 1178 deletions

View File

@@ -50,7 +50,6 @@
#include <cmath> #include <cmath>
#include <invalidmodelnodeexception.h> #include <invalidmodelnodeexception.h>
#include <invalidnodestateexception.h>
namespace QmlDesigner { namespace QmlDesigner {

View File

@@ -37,7 +37,6 @@
#include <invalididexception.h> #include <invalididexception.h>
#include <rewritingexception.h> #include <rewritingexception.h>
#include <invalidnodestateexception.h>
#include <variantproperty.h> #include <variantproperty.h>
#include <bindingproperty.h> #include <bindingproperty.h>

View File

@@ -7,8 +7,13 @@ QT += script \
DEFINES += TEST_EXPORTS DEFINES += TEST_EXPORTS
INCLUDEPATH += $$PWD \ INCLUDEPATH += $$PWD \
$$PWD/include $$PWD/include
include (instances/instances.pri)
include (../../../tools/qmlpuppet/interfaces/interfaces.pri)
include (../../../tools/qmlpuppet/commands/commands.pri)
include (../../../tools/qmlpuppet/container/container.pri)
SOURCES += $$PWD/model/abstractview.cpp \ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/instances/nodeinstanceview.cpp \
$$PWD/model/rewriterview.cpp \ $$PWD/model/rewriterview.cpp \
$$PWD/metainfo/metainfo.cpp \ $$PWD/metainfo/metainfo.cpp \
$$PWD/metainfo/metainfoparser.cpp \ $$PWD/metainfo/metainfoparser.cpp \
@@ -25,15 +30,12 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/pluginmanager/widgetpluginmanager.cpp \ $$PWD/pluginmanager/widgetpluginmanager.cpp \
$$PWD/pluginmanager/widgetpluginpath.cpp \ $$PWD/pluginmanager/widgetpluginpath.cpp \
$$PWD/exceptions/exception.cpp \ $$PWD/exceptions/exception.cpp \
$$PWD/exceptions/invalidnodeinstanceexception.cpp \
$$PWD/exceptions/invalidpropertyexception.cpp \ $$PWD/exceptions/invalidpropertyexception.cpp \
$$PWD/exceptions/invalidmodelnodeexception.cpp \ $$PWD/exceptions/invalidmodelnodeexception.cpp \
$$PWD/exceptions/invalidreparentingexception.cpp \ $$PWD/exceptions/invalidreparentingexception.cpp \
$$PWD/exceptions/invalidmetainfoexception.cpp \ $$PWD/exceptions/invalidmetainfoexception.cpp \
$$PWD/exceptions/invalidargumentexception.cpp \ $$PWD/exceptions/invalidargumentexception.cpp \
$$PWD/exceptions/noanchoringpossibleexception.cpp \
$$PWD/exceptions/notimplementedexception.cpp \ $$PWD/exceptions/notimplementedexception.cpp \
$$PWD/exceptions/invalidnodestateexception.cpp \
$$PWD/model/variantparser.cpp \ $$PWD/model/variantparser.cpp \
$$PWD/exceptions/invalidmodelstateexception.cpp \ $$PWD/exceptions/invalidmodelstateexception.cpp \
$$PWD/exceptions/removebasestateexception.cpp \ $$PWD/exceptions/removebasestateexception.cpp \
@@ -73,43 +75,7 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/rewriteactioncompressor.cpp \ $$PWD/model/rewriteactioncompressor.cpp \
$$PWD/model/qmltextgenerator.cpp \ $$PWD/model/qmltextgenerator.cpp \
$$PWD/model/modelmerger.cpp \ $$PWD/model/modelmerger.cpp \
$$PWD/exceptions/rewritingexception.cpp \ $$PWD/exceptions/rewritingexception.cpp
$$PWD/instances/declarativedesignercommunicationinterface.cpp \
$$PWD/instances/createinstancescommand.cpp \
$$PWD/instances/nodeinstanceserverinterface.cpp \
$$PWD/instances/nodeinstance.cpp \
$$PWD/instances/propertyvaluecontainer.cpp \
$$PWD/instances/childrenchangeeventfilter.cpp \
$$PWD/instances/propertybindingcontainer.cpp \
$$PWD/instances/propertyabstractcontainer.cpp \
$$PWD/instances/createscenecommand.cpp \
$$PWD/instances/instancecontainer.cpp \
$$PWD/instances/changefileurlcommand.cpp \
$$PWD/instances/clearscenecommand.cpp \
$$PWD/instances/reparentcontainer.cpp \
$$PWD/instances/reparentinstancescommand.cpp \
$$PWD/instances/changevaluescommand.cpp \
$$PWD/instances/changebindingscommand.cpp \
$$PWD/instances/changeidscommand.cpp \
$$PWD/instances/idcontainer.cpp \
$$PWD/instances/synchronizecommand.cpp \
$$PWD/instances/removeinstancescommand.cpp \
$$PWD/instances/removepropertiescommand.cpp \
$$PWD/instances/valueschangedcommand.cpp \
$$PWD/instances/pixmapchangedcommand.cpp \
$$PWD/instances/informationchangedcommand.cpp \
$$PWD/instances/informationcontainer.cpp \
$$PWD/instances/changestatecommand.cpp \
$$PWD/instances/nodeinstanceserverproxy.cpp \
$$PWD/instances/addimportcommand.cpp \
$$PWD/instances/childrenchangedcommand.cpp \
$$PWD/instances/statepreviewimagechangedcommand.cpp \
$$PWD/instances/imagecontainer.cpp \
$$PWD/instances/completecomponentcommand.cpp \
$$PWD/instances/componentcompletedcommand.cpp \
$$PWD/instances/changenodesourcecommand.cpp \
$$PWD/instances/changeauxiliarycommand.cpp \
$$PWD/instances/addimportcontainer.cpp
HEADERS += $$PWD/include/corelib_global.h \ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/abstractview.h \ $$PWD/include/abstractview.h \
@@ -132,8 +98,6 @@ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/pluginmanager/widgetpluginmanager.h \ $$PWD/pluginmanager/widgetpluginmanager.h \
$$PWD/pluginmanager/widgetpluginpath.h \ $$PWD/pluginmanager/widgetpluginpath.h \
$$PWD/include/exception.h \ $$PWD/include/exception.h \
$$PWD/include/invalidnodeinstanceexception.h \
$$PWD/include/invalidmodelnodeexception.h \
$$PWD/include/invalidreparentingexception.h \ $$PWD/include/invalidreparentingexception.h \
$$PWD/include/invalidmetainfoexception.h \ $$PWD/include/invalidmetainfoexception.h \
$$PWD/include/invalidargumentexception.h \ $$PWD/include/invalidargumentexception.h \
@@ -181,45 +145,8 @@ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/modelmerger.h \ $$PWD/include/modelmerger.h \
$$PWD/include/mathutils.h \ $$PWD/include/mathutils.h \
$$PWD/include/customnotifications.h \ $$PWD/include/customnotifications.h \
$$PWD/include/rewritingexception.h \ $$PWD/include/rewritingexception.h
$$PWD/instances/declarativedesignercommunicationinterface.h \
$$PWD/instances/createinstancescommand.h \
$$PWD/include/nodeinstanceserverinterface.h \
$$PWD/include/nodeinstance.h \
$$PWD/include/propertyvaluecontainer.h \
$$PWD/instances/childrenchangeeventfilter.h \
$$PWD/include/propertybindingcontainer.h \
$$PWD/include/propertyabstractcontainer.h \
$$PWD/instances/createscenecommand.h \
$$PWD/instances/instancecontainer.h \
$$PWD/instances/changefileurlcommand.h \
$$PWD/instances/clearscenecommand.h \
$$PWD/instances/reparentcontainer.h \
$$PWD/instances/reparentinstancescommand.h \
$$PWD/instances/synchronizecommand.h \
$$PWD/instances/changevaluescommand.h \
$$PWD/instances/changebindingscommand.h \
$$PWD/instances/changeidscommand.h \
$$PWD/instances/idcontainer.h \
$$PWD/instances/removeinstancescommand.h \
$$PWD/instances/removepropertiescommand.h \
$$PWD/include/nodeinstanceclientinterface.h \
$$PWD/instances/valueschangedcommand.h \
$$PWD/instances/pixmapchangedcommand.h \
$$PWD/instances/informationchangedcommand.h \
$$PWD/instances/informationcontainer.h \
$$PWD/include/commondefines.h \
$$PWD/instances/changestatecommand.h \
$$PWD/instances/nodeinstanceserverproxy.h \
$$PWD/instances/addimportcommand.h \
$$PWD/instances/childrenchangedcommand.h \
$$PWD/instances/statepreviewimagechangedcommand.h \
$$PWD/instances/imagecontainer.h \
$$PWD/instances/completecomponentcommand.h \
$$PWD/instances/componentcompletedcommand.h \
$$PWD/instances/changenodesourcecommand.h \
$$PWD/instances/changeauxiliarycommand.h \
$$PWD/instances/addimportcontainer.h
contains(CONFIG, plugin) { contains(CONFIG, plugin) {
# If core.pri has been included in the qmldesigner plugin # If core.pri has been included in the qmldesigner plugin
SOURCES += $$PWD/model/basetexteditmodifier.cpp SOURCES += $$PWD/model/basetexteditmodifier.cpp

View File

@@ -1,68 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "invalidnodestateexception.h"
/*!
\class QmlDesigner::InvalidNodeStateException
\ingroup CoreExceptions
\brief Exception for a invalid node states
/see NodeState
*/
namespace QmlDesigner {
/*!
\brief Constructor
\param line use the __LINE__ macro
\param function use the __FUNCTION__ or the Q_FUNC_INFO macro
\param file use the __FILE__ macro
*/
InvalidNodeStateException::InvalidNodeStateException(int line,
const QString &function,
const QString &file)
: Exception(line, function, file)
{
}
/*!
\brief Returns the type of this exception
\returns the type as a string
*/
QString InvalidNodeStateException::type() const
{
return "InvalidNodeStateException";
}
} // namespace QmlDesigner

View File

@@ -1,49 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "noanchoringpossibleexception.h"
namespace QmlDesigner {
NoAnchoringPossibleException::NoAnchoringPossibleException(int line,
const QString &function,
const QString &file)
: Exception(line,function, file)
{
}
QString NoAnchoringPossibleException::type() const
{
return "NoAnchoringPossibleException";
}
} // namespace QKinecticDesigner

View File

@@ -1,51 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef INVALIDNODEINSTANCEEXCEPTION_H
#define INVALIDNODEINSTANCEEXCEPTION_H
#include "exception.h"
namespace QmlDesigner {
class CORESHARED_EXPORT InvalidNodeInstanceException : public Exception
{
public:
InvalidNodeInstanceException(int line,
const QString &function,
const QString &file);
QString type() const;
};
}
#endif // INVALIDNODEINSTANCEEXCEPTION_H

View File

@@ -1,53 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef INVALIDNODESTATEEXCEPTION_H
#define INVALIDNODESTATEEXCEPTION_H
#include <exception.h>
namespace QmlDesigner {
class CORESHARED_EXPORT InvalidNodeStateException : public Exception
{
public:
InvalidNodeStateException(int line,
const QString &function,
const QString &file);
QString type() const;
};
} // namespace QmlDesigner
#endif // INVALIDNODESTATEEXCEPTION_H

View File

@@ -1,53 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef NOANCHORINGPOSSIBLEEXCEPTION_H
#define NOANCHORINGPOSSIBLEEXCEPTION_H
#include "exception.h"
namespace QmlDesigner {
class CORESHARED_EXPORT NoAnchoringPossibleException : public Exception
{
public:
NoAnchoringPossibleException(int line,
const QString &function,
const QString &file);
QString type() const;
};
} // namespace QKinecticDesigner
#endif // NOANCHORINGPOSSIBLEEXCEPTION_H

View File

@@ -68,7 +68,6 @@ class ChangeBindingsCommand;
class ChangeIdsCommand; class ChangeIdsCommand;
class RemoveInstancesCommand; class RemoveInstancesCommand;
class RemovePropertiesCommand; class RemovePropertiesCommand;
class AddImportCommand;
class CompleteComponentCommand; class CompleteComponentCommand;
class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInstanceClientInterface class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInstanceClientInterface
@@ -175,7 +174,6 @@ private: // functions
RemoveInstancesCommand createRemoveInstancesCommand(const QList<ModelNode> &nodeList) const; RemoveInstancesCommand createRemoveInstancesCommand(const QList<ModelNode> &nodeList) const;
RemoveInstancesCommand createRemoveInstancesCommand(const ModelNode &node) const; RemoveInstancesCommand createRemoveInstancesCommand(const ModelNode &node) const;
RemovePropertiesCommand createRemovePropertiesCommand(const QList<AbstractProperty> &propertyList) const; RemovePropertiesCommand createRemovePropertiesCommand(const QList<AbstractProperty> &propertyList) const;
AddImportCommand createImportCommand(const Import &import);
void resetHorizontalAnchors(const ModelNode &node); void resetHorizontalAnchors(const ModelNode &node);
void resetVerticalAnchors(const ModelNode &node); void resetVerticalAnchors(const ModelNode &node);

View File

@@ -1,66 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "addimportcommand.h"
namespace QmlDesigner {
AddImportCommand::AddImportCommand()
{
}
AddImportCommand::AddImportCommand(const AddImportContainer &container)
: m_importContainer(container)
{
}
AddImportContainer AddImportCommand::import() const
{
return m_importContainer;
}
QDataStream &operator<<(QDataStream &out, const AddImportCommand &command)
{
out << command.import();
return out;
}
QDataStream &operator>>(QDataStream &in, AddImportCommand &command)
{
in >> command.m_importContainer;
return in;
}
} // namespace QmlDesigner

View File

@@ -1,60 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef ADDIMPORTCOMMAND_H
#define ADDIMPORTCOMMAND_H
#include "addimportcontainer.h"
namespace QmlDesigner {
class AddImportCommand
{
friend QDataStream &operator>>(QDataStream &in, AddImportCommand &command);
public:
AddImportCommand();
AddImportCommand(const AddImportContainer &container);
AddImportContainer import() const;
private:
AddImportContainer m_importContainer;
};
QDataStream &operator<<(QDataStream &out, const AddImportCommand &command);
QDataStream &operator>>(QDataStream &in, AddImportCommand &command);
} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::AddImportCommand)
#endif // ADDIMPORTCOMMAND_H

View File

@@ -1,38 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "declarativedesignercommunicationinterface.h"
DeclarativeDesignerCommunicationInterface::DeclarativeDesignerCommunicationInterface(QObject *parent) :
QObject(parent)
{
}

View File

@@ -1,50 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef DECLARATIVEDESIGNERCOMMUNICATIONINTERFACE_H
#define DECLARATIVEDESIGNERCOMMUNICATIONINTERFACE_H
#include <QObject>
class DeclarativeDesignerCommunicationInterface : public QObject
{
Q_OBJECT
public:
explicit DeclarativeDesignerCommunicationInterface(QObject *parent = 0);
signals:
public slots:
};
#endif // DECLARATIVEDESIGNERCOMMUNICATIONINTERFACE_H

View File

@@ -1,109 +1,8 @@
INCLUDEPATH += $$PWD/ INCLUDEPATH += $$PWD/
INCLUDEPATH += $$PWD/../include
HEADERS += $$PWD/../include/nodeinstance.h
HEADERS += $$PWD/nodeinstanceserverproxy.h
HEADERS += $$PWD/behaviornodeinstance.h SOURCES += $$PWD/nodeinstanceserverproxy.cpp
HEADERS += $$PWD/changeauxiliarycommand.h SOURCES += $$PWD/nodeinstance.cpp
HEADERS += $$PWD/informationnodeinstanceserver.h SOURCES += $$PWD/nodeinstanceview.cpp
HEADERS += $$PWD/dummycontextobject.h
HEADERS += $$PWD/rendernodeinstanceserver.h
HEADERS += $$PWD/synchronizecommand.h
HEADERS += $$PWD/addimportcontainer.h
HEADERS += $$PWD/previewnodeinstanceserver.h
HEADERS += $$PWD/componentcompletedcommand.h
HEADERS += $$PWD//completecomponentcommand.h
HEADERS += $$PWDstatepreviewimagechangedcommand.h
HEADERS += $$PWD//imagecontainer.h
HEADERS += $$PWD/childrenchangedcommand.h
HEADERS += $$PWD/addimportcommand.h
HEADERS += $$PWD/changebindingscommand.h
HEADERS += $$PWD/changefileurlcommand.h
HEADERS += $$PWD/changeidscommand.h
HEADERS += $$PWD/changenodesourcecommand.h
HEADERS += $$PWD/changestatecommand.h
HEADERS += $$PWD/changevaluescommand.h
HEADERS += $$PWD/childrenchangeeventfilter.h
HEADERS += $$PWD/clearscenecommand.h
HEADERS += $$PWD/componentnodeinstance.h
HEADERS += $$PWD/createinstancescommand.h
HEADERS += $$PWD/createscenecommand.h
HEADERS += $$PWD/declarativedesignercommunicationinterface.h
HEADERS += $$PWD/dummynodeinstance.h
HEADERS += $$PWD/graphicsobjectnodeinstance.h
HEADERS += $$PWD/idcontainer.h
HEADERS += $$PWD/informationchangedcommand.h
HEADERS += $$PWD/informationcontainer.h
HEADERS += $$PWD/instancecontainer.h
HEADERS += $$PWD/nodeinstanceclientproxy.h
HEADERS += $$PWD/nodeinstancemetaobject.h
HEADERS += $$PWD/nodeinstanceserver.h
HEADERS += $$PWD/nodeinstancesignalspy.h
HEADERS += $$PWD/objectnodeinstance.h
HEADERS += $$PWD/pixmapchangedcommand.h
HEADERS += $$PWD/positionernodeinstance.h
HEADERS += $$PWD/qmlgraphicsitemnodeinstance.h
HEADERS += $$PWD/qmlpropertychangesnodeinstance.h
HEADERS += $$PWD/qmlstatenodeinstance.h
HEADERS += $$PWD/qmltransitionnodeinstance.h
HEADERS += $$PWD/removeinstancescommand.h
HEADERS += $$PWD/removepropertiescommand.h
HEADERS += $$PWD/reparentcontainer.h
HEADERS += $$PWD/reparentinstancescommand.h
HEADERS += $$PWD/servernodeinstance.h
HEADERS += $$PWD/valueschangedcommand.h
HEADERS += $$PWD/../include/nodeinstanceserverinterface.h
SOURCES += $$PWD/behaviornodeinstance.cpp
SOURCES += $$PWD/changeauxiliarycommand.cpp
SOURCES += $$PWD/informationnodeinstanceserver.cpp
SOURCES += $$PWD/dummycontextobject.cpp
SOURCES += $$PWD/rendernodeinstanceserver.cpp
SOURCES += $$PWD/synchronizecommand.cpp
SOURCES += $$PWD/addimportcontainer.cpp
SOURCES += $$PWD/previewnodeinstanceserver.cpp
SOURCES += $$PWD/componentcompletedcommand.cpp
SOURCES += $$PWD/completecomponentcommand.cpp
SOURCES += $$PWD/statepreviewimagechangedcommand.cpp
SOURCES += $$PWD/imagecontainer.cpp
SOURCES += $$PWD/childrenchangedcommand.cpp
SOURCES += $$PWD/addimportcommand.cpp
SOURCES += $$PWD/changebindingscommand.cpp
SOURCES += $$PWD/changefileurlcommand.cpp
SOURCES += $$PWD/changeidscommand.cpp
SOURCES += $$PWD/changenodesourcecommand.cpp
SOURCES += $$PWD/changestatecommand.cpp
SOURCES += $$PWD/changevaluescommand.cpp
SOURCES += $$PWD/childrenchangeeventfilter.cpp
SOURCES += $$PWD/clearscenecommand.cpp
SOURCES += $$PWD/componentnodeinstance.cpp
SOURCES += $$PWD/createinstancescommand.cpp
SOURCES += $$PWD/createscenecommand.cpp
SOURCES += $$PWD/declarativedesignercommunicationinterface.cpp
SOURCES += $$PWD/dummynodeinstance.cpp
SOURCES += $$PWD/graphicsobjectnodeinstance.cpp
SOURCES += $$PWD/idcontainer.cpp
SOURCES += $$PWD/informationchangedcommand.cpp
SOURCES += $$PWD/informationcontainer.cpp
SOURCES += $$PWD/instancecontainer.cpp
SOURCES += $$PWD/nodeinstanceclientproxy.cpp
SOURCES += $$PWD/nodeinstancemetaobject.cpp
SOURCES += $$PWD/nodeinstanceserver.cpp
SOURCES += $$PWD/nodeinstanceserverinterface.cpp
SOURCES += $$PWD/nodeinstancesignalspy.cpp
SOURCES += $$PWD/objectnodeinstance.cpp
SOURCES += $$PWD/pixmapchangedcommand.cpp
SOURCES += $$PWD/positionernodeinstance.cpp
SOURCES += $$PWD/propertyabstractcontainer.cpp
SOURCES += $$PWD/propertybindingcontainer.cpp
SOURCES += $$PWD/propertyvaluecontainer.cpp
SOURCES += $$PWD/qmlgraphicsitemnodeinstance.cpp
SOURCES += $$PWD/qmlpropertychangesnodeinstance.cpp
SOURCES += $$PWD/qmlstatenodeinstance.cpp
SOURCES += $$PWD/qmltransitionnodeinstance.cpp
SOURCES += $$PWD/removeinstancescommand.cpp
SOURCES += $$PWD/removepropertiescommand.cpp
SOURCES += $$PWD/reparentcontainer.cpp
SOURCES += $$PWD/reparentinstancescommand.cpp
SOURCES += $$PWD/servernodeinstance.cpp
SOURCES += $$PWD/valueschangedcommand.cpp

View File

@@ -37,6 +37,7 @@
#include <QProcess> #include <QProcess>
#include <QCoreApplication> #include <QCoreApplication>
#include <QUuid> #include <QUuid>
#include <QFileInfo>
#include "propertyabstractcontainer.h" #include "propertyabstractcontainer.h"
#include "propertyvaluecontainer.h" #include "propertyvaluecontainer.h"
@@ -54,7 +55,6 @@
#include "reparentinstancescommand.h" #include "reparentinstancescommand.h"
#include "changeidscommand.h" #include "changeidscommand.h"
#include "changestatecommand.h" #include "changestatecommand.h"
#include "addimportcommand.h"
#include "completecomponentcommand.h" #include "completecomponentcommand.h"
#include "changenodesourcecommand.h" #include "changenodesourcecommand.h"
@@ -69,10 +69,25 @@
#include "synchronizecommand.h" #include "synchronizecommand.h"
#include "nodeinstanceview.h" #include "nodeinstanceview.h"
#include "nodeinstanceclientproxy.h"
#include "import.h"
#include <QMessageBox>
namespace QmlDesigner { namespace QmlDesigner {
static bool hasQtQuick1(NodeInstanceView *nodeInstanceView)
{
if (nodeInstanceView && nodeInstanceView->model()) {
foreach (const Import &import ,nodeInstanceView->model()->imports()) {
if (import.url() == "QtQuick" && import.version().toDouble() < 2.0)
return true;
}
}
return false;
}
NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView, RunModus runModus) NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView, RunModus runModus)
: NodeInstanceServerInterface(nodeInstanceView), : NodeInstanceServerInterface(nodeInstanceView),
m_localServer(new QLocalServer(this)), m_localServer(new QLocalServer(this)),
@@ -98,74 +113,84 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
#ifdef Q_OS_MACX #ifdef Q_OS_MACX
applicationPath += "/qmlpuppet.app/Contents/MacOS"; applicationPath += "/qmlpuppet.app/Contents/MacOS";
#endif #endif
applicationPath += "/qmlpuppet";
if (hasQtQuick1(nodeInstanceView)) {
applicationPath += "/qmlpuppet";
} else {
applicationPath += "/qml2puppet";
}
QByteArray envImportPath = qgetenv("QTCREATOR_QMLPUPPET_PATH"); QByteArray envImportPath = qgetenv("QTCREATOR_QMLPUPPET_PATH");
if (!envImportPath.isEmpty()) { if (!envImportPath.isEmpty()) {
applicationPath = envImportPath; applicationPath = envImportPath;
} }
m_qmlPuppetEditorProcess = new QProcess; if (QFileInfo(applicationPath).exists()) {
connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); m_qmlPuppetEditorProcess = new QProcess;
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill())); connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty(); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill()));
if (fowardQmlpuppetOutput) bool fowardQmlpuppetOutput = !qgetenv("FORWARD_QMLPUPPET_OUTPUT").isEmpty();
m_qmlPuppetEditorProcess->setProcessChannelMode(QProcess::ForwardedChannels);
m_qmlPuppetEditorProcess->start(applicationPath, QStringList() << socketToken << "editormode" << "-graphicssystem raster");
if (runModus == NormalModus) {
m_qmlPuppetPreviewProcess = new QProcess;
connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetPreviewProcess.data(), SLOT(kill()));
if (fowardQmlpuppetOutput) if (fowardQmlpuppetOutput)
m_qmlPuppetPreviewProcess->setProcessChannelMode(QProcess::ForwardedChannels); m_qmlPuppetEditorProcess->setProcessChannelMode(QProcess::ForwardedChannels);
m_qmlPuppetPreviewProcess->start(applicationPath, QStringList() << socketToken << "previewmode" << "-graphicssystem raster"); m_qmlPuppetEditorProcess->start(applicationPath, QStringList() << socketToken << "editormode" << "-graphicssystem raster");
m_qmlPuppetRenderProcess = new QProcess; if (runModus == NormalModus) {
connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); m_qmlPuppetPreviewProcess = new QProcess;
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetRenderProcess.data(), SLOT(kill())); connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
if (fowardQmlpuppetOutput) connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetPreviewProcess.data(), SLOT(kill()));
m_qmlPuppetRenderProcess->setProcessChannelMode(QProcess::ForwardedChannels); if (fowardQmlpuppetOutput)
m_qmlPuppetRenderProcess->start(applicationPath, QStringList() << socketToken << "rendermode" << "-graphicssystem raster"); m_qmlPuppetPreviewProcess->setProcessChannelMode(QProcess::ForwardedChannels);
m_qmlPuppetPreviewProcess->start(applicationPath, QStringList() << socketToken << "previewmode" << "-graphicssystem raster");
} m_qmlPuppetRenderProcess = new QProcess;
connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetRenderProcess.data(), SLOT(kill()));
if (fowardQmlpuppetOutput)
m_qmlPuppetRenderProcess->setProcessChannelMode(QProcess::ForwardedChannels);
m_qmlPuppetRenderProcess->start(applicationPath, QStringList() << socketToken << "rendermode" << "-graphicssystem raster");
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(deleteLater())); }
m_qmlPuppetEditorProcess->waitForStarted(); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));
connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int)), m_qmlPuppetEditorProcess.data(),SLOT(deleteLater())); m_qmlPuppetEditorProcess->waitForStarted();
if (runModus == NormalModus) { connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int)), m_qmlPuppetEditorProcess.data(),SLOT(deleteLater()));
m_qmlPuppetPreviewProcess->waitForStarted();
connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int)), m_qmlPuppetPreviewProcess.data(),SLOT(deleteLater()));
m_qmlPuppetRenderProcess->waitForStarted(); if (runModus == NormalModus) {
connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int)), m_qmlPuppetRenderProcess.data(),SLOT(deleteLater())); m_qmlPuppetPreviewProcess->waitForStarted();
} connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int)), m_qmlPuppetPreviewProcess.data(),SLOT(deleteLater()));
if (!m_localServer->hasPendingConnections()) m_qmlPuppetRenderProcess->waitForStarted();
m_localServer->waitForNewConnection(-1); connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int)), m_qmlPuppetRenderProcess.data(),SLOT(deleteLater()));
}
m_firstSocket = m_localServer->nextPendingConnection();
connect(m_firstSocket.data(), SIGNAL(readyRead()), this, SLOT(readFirstDataStream()));
if (runModus == NormalModus) {
if (!m_localServer->hasPendingConnections())
m_localServer->waitForNewConnection(-1);
m_secondSocket = m_localServer->nextPendingConnection();
connect(m_secondSocket.data(), SIGNAL(readyRead()), this, SLOT(readSecondDataStream()));
if (!m_localServer->hasPendingConnections()) if (!m_localServer->hasPendingConnections())
m_localServer->waitForNewConnection(-1); m_localServer->waitForNewConnection(-1);
m_thirdSocket = m_localServer->nextPendingConnection(); m_firstSocket = m_localServer->nextPendingConnection();
connect(m_thirdSocket.data(), SIGNAL(readyRead()), this, SLOT(readThirdDataStream())); connect(m_firstSocket.data(), SIGNAL(readyRead()), this, SLOT(readFirstDataStream()));
if (runModus == NormalModus) {
if (!m_localServer->hasPendingConnections())
m_localServer->waitForNewConnection(-1);
m_secondSocket = m_localServer->nextPendingConnection();
connect(m_secondSocket.data(), SIGNAL(readyRead()), this, SLOT(readSecondDataStream()));
if (!m_localServer->hasPendingConnections())
m_localServer->waitForNewConnection(-1);
m_thirdSocket = m_localServer->nextPendingConnection();
connect(m_thirdSocket.data(), SIGNAL(readyRead()), this, SLOT(readThirdDataStream()));
}
m_localServer->close();
} else {
QMessageBox::warning(0, tr("Cannot find qml puppet"), tr("Qml Puppet is a process which runs in the backgound to render the the items. If QtCreator cannot find the puppet something with the installation is wrong."));
} }
m_localServer->close();
} }
NodeInstanceServerProxy::~NodeInstanceServerProxy() NodeInstanceServerProxy::~NodeInstanceServerProxy()
@@ -449,11 +474,6 @@ void NodeInstanceServerProxy::changeState(const ChangeStateCommand &command)
writeCommand(QVariant::fromValue(command)); writeCommand(QVariant::fromValue(command));
} }
void NodeInstanceServerProxy::addImport(const AddImportCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceServerProxy::completeComponent(const CompleteComponentCommand &command) void NodeInstanceServerProxy::completeComponent(const CompleteComponentCommand &command)
{ {
writeCommand(QVariant::fromValue(command)); writeCommand(QVariant::fromValue(command));

View File

@@ -69,7 +69,6 @@ public:
void reparentInstances(const ReparentInstancesCommand &command); void reparentInstances(const ReparentInstancesCommand &command);
void changeIds(const ChangeIdsCommand &command); void changeIds(const ChangeIdsCommand &command);
void changeState(const ChangeStateCommand &command); void changeState(const ChangeStateCommand &command);
void addImport(const AddImportCommand &command);
void completeComponent(const CompleteComponentCommand &command); void completeComponent(const CompleteComponentCommand &command);
void changeNodeSource(const ChangeNodeSourceCommand &command); void changeNodeSource(const ChangeNodeSourceCommand &command);

View File

@@ -74,7 +74,6 @@
#include "pixmapchangedcommand.h" #include "pixmapchangedcommand.h"
#include "informationchangedcommand.h" #include "informationchangedcommand.h"
#include "changestatecommand.h" #include "changestatecommand.h"
#include "addimportcommand.h"
#include "childrenchangedcommand.h" #include "childrenchangedcommand.h"
#include "imagecontainer.h" #include "imagecontainer.h"
#include "statepreviewimagechangedcommand.h" #include "statepreviewimagechangedcommand.h"
@@ -1005,11 +1004,6 @@ RemovePropertiesCommand NodeInstanceView::createRemovePropertiesCommand(const QL
return RemovePropertiesCommand(containerList); return RemovePropertiesCommand(containerList);
} }
AddImportCommand NodeInstanceView::createImportCommand(const Import &import)
{
return AddImportCommand(AddImportContainer(import.url(), import.file(), import.version(), import.alias(), import.importPaths()));
}
void NodeInstanceView::valuesChanged(const ValuesChangedCommand &command) void NodeInstanceView::valuesChanged(const ValuesChangedCommand &command)
{ {
if (!model()) if (!model())

View File

@@ -4,29 +4,30 @@
** **
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** **
** Contact: Nokia Corporation (info@qt.nokia.com) ** Contact: Nokia Corporation (qt-info@nokia.com)
** **
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
** **
** GNU Lesser General Public License Usage ** GNU Lesser General Public License Usage
** **
** This file may be used under the terms of the GNU Lesser General Public ** Alternatively, this file may be used under the terms of the GNU Lesser
** License version 2.1 as published by the Free Software Foundation and ** General Public License version 2.1 as published by the Free Software
** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Foundation and appearing in the file LICENSE.LGPL included in the
** Please review the following information to ensure the GNU Lesser General ** packaging of this file. Please review the following information to
** Public License version 2.1 requirements will be met: ** ensure the GNU Lesser General Public License version 2.1 requirements
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** **
** In addition, as a special exception, Nokia gives you certain additional ** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception ** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** **
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact ** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com. ** Nokia at qt-info@nokia.com.
** **
**************************************************************************/ **************************************************************************/

View File

@@ -4,29 +4,30 @@
** **
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** **
** Contact: Nokia Corporation (info@qt.nokia.com) ** Contact: Nokia Corporation (qt-info@nokia.com)
** **
** No Commercial Usage
**
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
** **
** GNU Lesser General Public License Usage ** GNU Lesser General Public License Usage
** **
** This file may be used under the terms of the GNU Lesser General Public ** Alternatively, this file may be used under the terms of the GNU Lesser
** License version 2.1 as published by the Free Software Foundation and ** General Public License version 2.1 as published by the Free Software
** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Foundation and appearing in the file LICENSE.LGPL included in the
** Please review the following information to ensure the GNU Lesser General ** packaging of this file. Please review the following information to
** Public License version 2.1 requirements will be met: ** ensure the GNU Lesser General Public License version 2.1 requirements
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
** **
** In addition, as a special exception, Nokia gives you certain additional ** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception ** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** **
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact ** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com. ** Nokia at qt-info@nokia.com.
** **
**************************************************************************/ **************************************************************************/

View File

@@ -0,0 +1,46 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/synchronizecommand.h
HEADERS += $$PWD/componentcompletedcommand.h
HEADERS += $$PWD/completecomponentcommand.h
HEADERS += $$PWD/statepreviewimagechangedcommand.h
HEADERS += $$PWD/childrenchangedcommand.h
HEADERS += $$PWD/changebindingscommand.h
HEADERS += $$PWD/changefileurlcommand.h
HEADERS += $$PWD/changeidscommand.h
HEADERS += $$PWD/changenodesourcecommand.h
HEADERS += $$PWD/changestatecommand.h
HEADERS += $$PWD/changevaluescommand.h
HEADERS += $$PWD/createscenecommand.h
HEADERS += $$PWD/clearscenecommand.h
HEADERS += $$PWD/createinstancescommand.h
HEADERS += $$PWD/informationchangedcommand.h
HEADERS += $$PWD/pixmapchangedcommand.h
HEADERS += $$PWD/removeinstancescommand.h
HEADERS += $$PWD/removepropertiescommand.h
HEADERS += $$PWD/reparentinstancescommand.h
HEADERS += $$PWD/valueschangedcommand.h
HEADERS += $$PWD/changeauxiliarycommand.h
SOURCES += $$PWD/synchronizecommand.cpp
SOURCES += $$PWD/componentcompletedcommand.cpp
SOURCES += $$PWD/completecomponentcommand.cpp
SOURCES += $$PWD/statepreviewimagechangedcommand.cpp
SOURCES += $$PWD/childrenchangedcommand.cpp
SOURCES += $$PWD/changebindingscommand.cpp
SOURCES += $$PWD/changefileurlcommand.cpp
SOURCES += $$PWD/changeidscommand.cpp
SOURCES += $$PWD/changenodesourcecommand.cpp
SOURCES += $$PWD/changestatecommand.cpp
SOURCES += $$PWD/changevaluescommand.cpp
SOURCES += $$PWD/informationchangedcommand.cpp
SOURCES += $$PWD/removeinstancescommand.cpp
SOURCES += $$PWD/removepropertiescommand.cpp
SOURCES += $$PWD/reparentinstancescommand.cpp
SOURCES += $$PWD/valueschangedcommand.cpp
SOURCES += $$PWD/clearscenecommand.cpp
SOURCES += $$PWD/createinstancescommand.cpp
SOURCES += $$PWD/createscenecommand.cpp
SOURCES += $$PWD/pixmapchangedcommand.cpp
SOURCES += $$PWD/changeauxiliarycommand.cpp

View File

@@ -0,0 +1,21 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/addimportcontainer.h
HEADERS += $$PWD/imagecontainer.h
HEADERS += $$PWD/idcontainer.h
HEADERS += $$PWD/informationcontainer.h
HEADERS += $$PWD/instancecontainer.h
HEADERS += $$PWD/reparentcontainer.h
HEADERS += $$PWD/propertyabstractcontainer.h
HEADERS += $$PWD/propertybindingcontainer.h
HEADERS += $$PWD/propertyvaluecontainer.h
SOURCES += $$PWD/addimportcontainer.cpp
SOURCES += $$PWD/imagecontainer.cpp
SOURCES += $$PWD/idcontainer.cpp
SOURCES += $$PWD/informationcontainer.cpp
SOURCES += $$PWD/instancecontainer.cpp
SOURCES += $$PWD/reparentcontainer.cpp
SOURCES += $$PWD/propertyabstractcontainer.cpp
SOURCES += $$PWD/propertybindingcontainer.cpp
SOURCES += $$PWD/propertyvaluecontainer.cpp

View File

@@ -38,8 +38,6 @@
#include <QVariant> #include <QVariant>
#include <QString> #include <QString>
#include "commondefines.h"
namespace QmlDesigner { namespace QmlDesigner {

View File

@@ -34,8 +34,6 @@
#include <private/qdeclarativebehavior_p.h> #include <private/qdeclarativebehavior_p.h>
#include "invalidnodeinstanceexception.h"
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal { namespace Internal {
@@ -49,8 +47,7 @@ BehaviorNodeInstance::Pointer BehaviorNodeInstance::create(QObject *object)
{ {
QDeclarativeBehavior* behavior = qobject_cast<QDeclarativeBehavior*>(object); QDeclarativeBehavior* behavior = qobject_cast<QDeclarativeBehavior*>(object);
if (behavior == 0) Q_ASSERT(behavior);
throw InvalidNodeInstanceException(__LINE__, __FUNCTION__, __FILE__);
Pointer instance(new BehaviorNodeInstance(behavior)); Pointer instance(new BehaviorNodeInstance(behavior));

View File

@@ -32,10 +32,11 @@
#include "componentnodeinstance.h" #include "componentnodeinstance.h"
#include <invalidnodeinstanceexception.h>
#include <QDeclarativeComponent> #include <QDeclarativeComponent>
#include <QDeclarativeContext> #include <QDeclarativeContext>
#include <QtDebug>
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal { namespace Internal {
@@ -55,8 +56,7 @@ ComponentNodeInstance::Pointer ComponentNodeInstance::create(QObject *object)
{ {
QDeclarativeComponent *component = qobject_cast<QDeclarativeComponent *>(object); QDeclarativeComponent *component = qobject_cast<QDeclarativeComponent *>(object);
if (component == 0) Q_ASSERT(component);
throw InvalidNodeInstanceException(__LINE__, __FUNCTION__, __FILE__);
Pointer instance(new ComponentNodeInstance(component)); Pointer instance(new ComponentNodeInstance(component));

View File

@@ -32,10 +32,6 @@
#include "dummynodeinstance.h" #include "dummynodeinstance.h"
#include <nodemetainfo.h>
#include <invalidnodeinstanceexception.h>
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal { namespace Internal {

View File

@@ -0,0 +1,34 @@
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/behaviornodeinstance.h
HEADERS += $$PWD/dummycontextobject.h
HEADERS += $$PWD/childrenchangeeventfilter.h
HEADERS += $$PWD/componentnodeinstance.h
HEADERS += $$PWD/dummynodeinstance.h
HEADERS += $$PWD/nodeinstanceclientproxy.h
HEADERS += $$PWD/nodeinstancemetaobject.h
HEADERS += $$PWD/nodeinstanceserver.h
HEADERS += $$PWD/nodeinstancesignalspy.h
HEADERS += $$PWD/objectnodeinstance.h
HEADERS += $$PWD/qmlpropertychangesnodeinstance.h
HEADERS += $$PWD/qmlstatenodeinstance.h
HEADERS += $$PWD/qmltransitionnodeinstance.h
HEADERS += $$PWD/servernodeinstance.h
SOURCES += $$PWD/behaviornodeinstance.cpp
SOURCES += $$PWD/dummycontextobject.cpp
SOURCES += $$PWD/childrenchangeeventfilter.cpp
SOURCES += $$PWD/componentnodeinstance.cpp
SOURCES += $$PWD/dummynodeinstance.cpp
SOURCES += $$PWD/nodeinstanceclientproxy.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

View File

@@ -37,9 +37,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QStringList> #include <QStringList>
#include "informationnodeinstanceserver.h" #include "nodeinstanceserverinterface.h"
#include "previewnodeinstanceserver.h"
#include "rendernodeinstanceserver.h"
#include "propertyabstractcontainer.h" #include "propertyabstractcontainer.h"
#include "propertyvaluecontainer.h" #include "propertyvaluecontainer.h"
@@ -57,7 +55,6 @@
#include "reparentinstancescommand.h" #include "reparentinstancescommand.h"
#include "changeidscommand.h" #include "changeidscommand.h"
#include "changestatecommand.h" #include "changestatecommand.h"
#include "addimportcommand.h"
#include "completecomponentcommand.h" #include "completecomponentcommand.h"
#include "synchronizecommand.h" #include "synchronizecommand.h"
@@ -80,14 +77,10 @@ NodeInstanceClientProxy::NodeInstanceClientProxy(QObject *parent)
m_lastReadCommandCounter(0), m_lastReadCommandCounter(0),
m_synchronizeId(-1) m_synchronizeId(-1)
{ {
if (QCoreApplication::arguments().at(2) == QLatin1String("previewmode")) { }
m_nodeInstanceServer = new PreviewNodeInstanceServer(this);
} else if (QCoreApplication::arguments().at(2) == QLatin1String("editormode")) {
m_nodeInstanceServer = new InformationNodeInstanceServer(this);
} else if (QCoreApplication::arguments().at(2) == QLatin1String("rendermode")) {
m_nodeInstanceServer = new RenderNodeInstanceServer(this);
}
void NodeInstanceClientProxy::initializeSocket()
{
m_socket = new QLocalSocket(this); m_socket = new QLocalSocket(this);
connect(m_socket, SIGNAL(readyRead()), this, SLOT(readDataStream())); connect(m_socket, SIGNAL(readyRead()), this, SLOT(readDataStream()));
connect(m_socket, SIGNAL(error(QLocalSocket::LocalSocketError)), QCoreApplication::instance(), SLOT(quit())); connect(m_socket, SIGNAL(error(QLocalSocket::LocalSocketError)), QCoreApplication::instance(), SLOT(quit()));
@@ -200,6 +193,11 @@ NodeInstanceServerInterface *NodeInstanceClientProxy::nodeInstanceServer() const
return m_nodeInstanceServer; return m_nodeInstanceServer;
} }
void NodeInstanceClientProxy::setNodeInstanceServer(NodeInstanceServerInterface *nodeInstanceServer)
{
m_nodeInstanceServer = nodeInstanceServer;
}
void NodeInstanceClientProxy::createInstances(const CreateInstancesCommand &command) void NodeInstanceClientProxy::createInstances(const CreateInstancesCommand &command)
{ {
nodeInstanceServer()->createInstances(command); nodeInstanceServer()->createInstances(command);
@@ -260,11 +258,6 @@ void NodeInstanceClientProxy::changeState(const ChangeStateCommand &command)
nodeInstanceServer()->changeState(command); nodeInstanceServer()->changeState(command);
} }
void NodeInstanceClientProxy::addImport(const AddImportCommand &command)
{
nodeInstanceServer()->addImport(command);
}
void NodeInstanceClientProxy::completeComponent(const CompleteComponentCommand &command) void NodeInstanceClientProxy::completeComponent(const CompleteComponentCommand &command)
{ {
nodeInstanceServer()->completeComponent(command); nodeInstanceServer()->completeComponent(command);
@@ -289,7 +282,6 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
static const int reparentInstancesCommandType = QMetaType::type("ReparentInstancesCommand"); static const int reparentInstancesCommandType = QMetaType::type("ReparentInstancesCommand");
static const int changeIdsCommandType = QMetaType::type("ChangeIdsCommand"); static const int changeIdsCommandType = QMetaType::type("ChangeIdsCommand");
static const int changeStateCommandType = QMetaType::type("ChangeStateCommand"); static const int changeStateCommandType = QMetaType::type("ChangeStateCommand");
static const int addImportCommandType = QMetaType::type("AddImportCommand");
static const int completeComponentCommandType = QMetaType::type("CompleteComponentCommand"); static const int completeComponentCommandType = QMetaType::type("CompleteComponentCommand");
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand"); static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand");
static const int changeNodeSourceCommandType = QMetaType::type("ChangeNodeSourceCommand"); static const int changeNodeSourceCommandType = QMetaType::type("ChangeNodeSourceCommand");
@@ -318,8 +310,6 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
changeIds(command.value<ChangeIdsCommand>()); changeIds(command.value<ChangeIdsCommand>());
else if (command.userType() == changeStateCommandType) else if (command.userType() == changeStateCommandType)
changeState(command.value<ChangeStateCommand>()); changeState(command.value<ChangeStateCommand>());
else if (command.userType() == addImportCommandType)
addImport(command.value<AddImportCommand>());
else if (command.userType() == completeComponentCommandType) else if (command.userType() == completeComponentCommandType)
completeComponent(command.value<CompleteComponentCommand>()); completeComponent(command.value<CompleteComponentCommand>());
else if (command.userType() == changeNodeSourceCommandType) else if (command.userType() == changeNodeSourceCommandType)

View File

@@ -57,11 +57,11 @@ class ChangeBindingsCommand;
class ChangeIdsCommand; class ChangeIdsCommand;
class RemoveInstancesCommand; class RemoveInstancesCommand;
class RemovePropertiesCommand; class RemovePropertiesCommand;
class AddImportCommand;
class CompleteComponentCommand; class CompleteComponentCommand;
class ChangeStateCommand; class ChangeStateCommand;
class ChangeNodeSourceCommand; class ChangeNodeSourceCommand;
class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface
{ {
Q_OBJECT Q_OBJECT
@@ -81,9 +81,11 @@ public:
qint64 bytesToWrite() const; qint64 bytesToWrite() const;
protected: protected:
void initializeSocket();
void writeCommand(const QVariant &command); void writeCommand(const QVariant &command);
void dispatchCommand(const QVariant &command); void dispatchCommand(const QVariant &command);
NodeInstanceServerInterface *nodeInstanceServer() const; NodeInstanceServerInterface *nodeInstanceServer() const;
void setNodeInstanceServer(NodeInstanceServerInterface *nodeInstanceServer);
void createInstances(const CreateInstancesCommand &command); void createInstances(const CreateInstancesCommand &command);
void changeFileUrl(const ChangeFileUrlCommand &command); void changeFileUrl(const ChangeFileUrlCommand &command);
@@ -97,7 +99,6 @@ protected:
void reparentInstances(const ReparentInstancesCommand &command); void reparentInstances(const ReparentInstancesCommand &command);
void changeIds(const ChangeIdsCommand &command); void changeIds(const ChangeIdsCommand &command);
void changeState(const ChangeStateCommand &command); void changeState(const ChangeStateCommand &command);
void addImport(const AddImportCommand &command);
void completeComponent(const CompleteComponentCommand &command); void completeComponent(const CompleteComponentCommand &command);
void changeNodeSource(const ChangeNodeSourceCommand &command); void changeNodeSource(const ChangeNodeSourceCommand &command);

View File

@@ -32,11 +32,7 @@
#include "nodeinstanceserver.h" #include "nodeinstanceserver.h"
#include <QGraphicsItem>
#include <private/qgraphicsitem_p.h>
#include <private/qgraphicsscene_p.h>
#include <QDeclarativeEngine> #include <QDeclarativeEngine>
#include <QDeclarativeView>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QUrl> #include <QUrl>
#include <QSet> #include <QSet>
@@ -73,7 +69,6 @@
#include "commondefines.h" #include "commondefines.h"
#include "childrenchangeeventfilter.h" #include "childrenchangeeventfilter.h"
#include "changestatecommand.h" #include "changestatecommand.h"
#include "addimportcommand.h"
#include "childrenchangedcommand.h" #include "childrenchangedcommand.h"
#include "completecomponentcommand.h" #include "completecomponentcommand.h"
#include "componentcompletedcommand.h" #include "componentcompletedcommand.h"
@@ -96,20 +91,18 @@ NodeInstanceServer::NodeInstanceServer(NodeInstanceClientInterface *nodeInstance
{ {
qmlRegisterType<DummyContextObject>("QmlDesigner", 1, 0, "DummyContextObject"); qmlRegisterType<DummyContextObject>("QmlDesigner", 1, 0, "DummyContextObject");
m_importList.append("import QtQuick 1.0\n");
connect(m_childrenChangeEventFilter.data(), SIGNAL(childrenChanged(QObject*)), this, SLOT(emitParentChanged(QObject*))); connect(m_childrenChangeEventFilter.data(), SIGNAL(childrenChanged(QObject*)), this, SLOT(emitParentChanged(QObject*)));
} }
NodeInstanceServer::~NodeInstanceServer() NodeInstanceServer::~NodeInstanceServer()
{ {
delete m_declarativeView.data();
} }
QList<ServerNodeInstance> NodeInstanceServer::createInstances(const QVector<InstanceContainer> &containerVector) QList<ServerNodeInstance> NodeInstanceServer::createInstances(const QVector<InstanceContainer> &containerVector)
{ {
Q_ASSERT(m_declarativeView); Q_ASSERT(declarativeView() || sgView());
QList<ServerNodeInstance> instanceList; QList<ServerNodeInstance> instanceList;
foreach(const InstanceContainer &instanceContainer, containerVector) { foreach (const InstanceContainer &instanceContainer, containerVector) {
ServerNodeInstance instance; ServerNodeInstance instance;
if (instanceContainer.nodeSourceType() == InstanceContainer::ComponentSource) { if (instanceContainer.nodeSourceType() == InstanceContainer::ComponentSource) {
instance = ServerNodeInstance::create(this, instanceContainer, ServerNodeInstance::WrapAsComponent); instance = ServerNodeInstance::create(this, instanceContainer, ServerNodeInstance::WrapAsComponent);
@@ -121,11 +114,7 @@ QList<ServerNodeInstance> NodeInstanceServer::createInstances(const QVector<Ins
instance.internalObject()->installEventFilter(childrenChangeEventFilter()); instance.internalObject()->installEventFilter(childrenChangeEventFilter());
if (instanceContainer.instanceId() == 0) { if (instanceContainer.instanceId() == 0) {
m_rootNodeInstance = instance; m_rootNodeInstance = instance;
QGraphicsObject *rootGraphicsObject = qobject_cast<QGraphicsObject*>(instance.internalObject()); resizeCanvasSizeToRootItemSize();
if (rootGraphicsObject) {
m_declarativeView->scene()->addItem(rootGraphicsObject);
m_declarativeView->setSceneRect(rootGraphicsObject->boundingRect());
}
} }
foreach (QDeclarativeContext* context, allSubContextsForObject(instance.internalObject())) foreach (QDeclarativeContext* context, allSubContextsForObject(instance.internalObject()))
@@ -235,7 +224,10 @@ void NodeInstanceServer::stopRenderTimer()
void NodeInstanceServer::createScene(const CreateSceneCommand &command) void NodeInstanceServer::createScene(const CreateSceneCommand &command)
{ {
initializeDeclarativeView(); initializeView(command.imports());
QUnifiedTimer::instance()->setSlowdownFactor(0.00001);
QUnifiedTimer::instance()->setSlowModeEnabled(true);
QList<ServerNodeInstance> instanceList = setupScene(command); QList<ServerNodeInstance> instanceList = setupScene(command);
refreshBindings(); refreshBindings();
@@ -252,8 +244,6 @@ void NodeInstanceServer::clearScene(const ClearSceneCommand &/*command*/)
m_rootNodeInstance.makeInvalid(); m_rootNodeInstance.makeInvalid();
m_changedPropertyList.clear(); m_changedPropertyList.clear();
m_fileUrl.clear(); m_fileUrl.clear();
delete m_declarativeView.data();
} }
void NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command) void NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
@@ -262,7 +252,7 @@ void NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
if (activeStateInstance().isValid()) if (activeStateInstance().isValid())
activeStateInstance().deactivateState(); activeStateInstance().deactivateState();
foreach(qint32 instanceId, command.instanceIds()) { foreach (qint32 instanceId, command.instanceIds()) {
removeInstanceRelationsip(instanceId); removeInstanceRelationsip(instanceId);
} }
@@ -276,7 +266,7 @@ void NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
void NodeInstanceServer::removeProperties(const RemovePropertiesCommand &command) void NodeInstanceServer::removeProperties(const RemovePropertiesCommand &command)
{ {
bool hasDynamicProperties = false; bool hasDynamicProperties = false;
foreach(const PropertyAbstractContainer &container, command.properties()) { foreach (const PropertyAbstractContainer &container, command.properties()) {
hasDynamicProperties |= container.isDynamic(); hasDynamicProperties |= container.isDynamic();
resetInstanceProperty(container); resetInstanceProperty(container);
} }
@@ -289,7 +279,7 @@ void NodeInstanceServer::removeProperties(const RemovePropertiesCommand &command
void NodeInstanceServer::reparentInstances(const QVector<ReparentContainer> &containerVector) void NodeInstanceServer::reparentInstances(const QVector<ReparentContainer> &containerVector)
{ {
foreach(const ReparentContainer &container, containerVector) { foreach (const ReparentContainer &container, containerVector) {
ServerNodeInstance instance = instanceForId(container.instanceId()); ServerNodeInstance instance = instanceForId(container.instanceId());
if (instance.isValid()) { if (instance.isValid()) {
instance.reparent(instanceForId(container.oldParentInstanceId()), container.oldParentProperty(), instanceForId(container.newParentInstanceId()), container.newParentProperty()); instance.reparent(instanceForId(container.oldParentInstanceId()), container.oldParentProperty(), instanceForId(container.newParentInstanceId()), container.newParentProperty());
@@ -324,7 +314,7 @@ void NodeInstanceServer::completeComponent(const CompleteComponentCommand &comma
{ {
QList<ServerNodeInstance> instanceList; QList<ServerNodeInstance> instanceList;
foreach(qint32 instanceId, command.instances()) { foreach (qint32 instanceId, command.instances()) {
if (hasInstanceForId(instanceId)) { if (hasInstanceForId(instanceId)) {
ServerNodeInstance instance = instanceForId(instanceId); ServerNodeInstance instance = instanceForId(instanceId);
instance.doComponentComplete(); instance.doComponentComplete();
@@ -348,7 +338,7 @@ void NodeInstanceServer::changeNodeSource(const ChangeNodeSourceCommand &command
startRenderTimer(); startRenderTimer();
} }
void NodeInstanceServer::addImports(const QVector<AddImportContainer> &containerVector) void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &containerVector)
{ {
foreach (const AddImportContainer &container, containerVector) { foreach (const AddImportContainer &container, containerVector) {
QString importStatement = QString("import "); QString importStatement = QString("import ");
@@ -375,7 +365,7 @@ void NodeInstanceServer::addImports(const QVector<AddImportContainer> &container
m_importComponent = new QDeclarativeComponent(engine(), 0); m_importComponent = new QDeclarativeComponent(engine(), 0);
QString componentString; QString componentString;
foreach(const QString &importStatement, m_importList) foreach (const QString &importStatement, m_importList)
componentString += QString("%1").arg(importStatement); componentString += QString("%1").arg(importStatement);
componentString += QString("Item {}\n"); componentString += QString("Item {}\n");
@@ -387,9 +377,61 @@ void NodeInstanceServer::addImports(const QVector<AddImportContainer> &container
qDebug() << "QmlDesigner.NodeInstances: import wrong: " << m_importComponent->errorString(); qDebug() << "QmlDesigner.NodeInstances: import wrong: " << m_importComponent->errorString();
} }
void NodeInstanceServer::addImport(const AddImportCommand &command) void NodeInstanceServer::setupFileUrl(const QUrl &fileUrl)
{ {
addImports(QVector<AddImportContainer>() << command.import()); if (fileUrl.isEmpty()) {
engine()->setBaseUrl(fileUrl);
m_fileUrl = fileUrl;
}
}
void NodeInstanceServer::setupDummyData(const QUrl &fileUrl)
{
if (!fileUrl.isEmpty()) {
QStringList dummyDataDirectoryList = dummyDataDirectories(QFileInfo(fileUrl.toLocalFile()).path());
foreach (const QString &dummyDataDirectory, dummyDataDirectoryList)
loadDummyDataFiles(dummyDataDirectory);
}
}
QList<ServerNodeInstance> NodeInstanceServer::setupInstances(const CreateSceneCommand &command)
{
QList<ServerNodeInstance> instanceList = createInstances(command.instances());
reparentInstances(command.reparentInstances());
foreach (const IdContainer &container, command.ids()) {
if (hasInstanceForId(container.instanceId()))
instanceForId(container.instanceId()).setId(container.id());
}
foreach (const PropertyValueContainer &container, command.valueChanges()) {
if (container.isDynamic())
setInstancePropertyVariant(container);
}
foreach (const PropertyValueContainer &container, command.valueChanges()) {
if (!container.isDynamic())
setInstancePropertyVariant(container);
}
foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
if (container.isDynamic())
setInstancePropertyBinding(container);
}
foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
if (!container.isDynamic())
setInstancePropertyBinding(container);
}
foreach (const PropertyValueContainer &container, command.auxiliaryChanges()) {
setInstanceAuxiliaryData(container);
}
foreach (ServerNodeInstance instance, instanceList)
instance.doComponentComplete();
return instanceList;
} }
void NodeInstanceServer::changeFileUrl(const ChangeFileUrlCommand &command) void NodeInstanceServer::changeFileUrl(const ChangeFileUrlCommand &command)
@@ -406,7 +448,7 @@ void NodeInstanceServer::changeFileUrl(const ChangeFileUrlCommand &command)
void NodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command) void NodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command)
{ {
bool hasDynamicProperties = false; bool hasDynamicProperties = false;
foreach(const PropertyValueContainer &container, command.valueChanges()) { foreach (const PropertyValueContainer &container, command.valueChanges()) {
hasDynamicProperties |= container.isDynamic(); hasDynamicProperties |= container.isDynamic();
setInstancePropertyVariant(container); setInstancePropertyVariant(container);
} }
@@ -429,7 +471,7 @@ void NodeInstanceServer::changeAuxiliaryValues(const ChangeAuxiliaryCommand &com
void NodeInstanceServer::changePropertyBindings(const ChangeBindingsCommand &command) void NodeInstanceServer::changePropertyBindings(const ChangeBindingsCommand &command)
{ {
bool hasDynamicProperties = false; bool hasDynamicProperties = false;
foreach(const PropertyBindingContainer &container, command.bindingChanges()) { foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
hasDynamicProperties |= container.isDynamic(); hasDynamicProperties |= container.isDynamic();
setInstancePropertyBinding(container); setInstancePropertyBinding(container);
} }
@@ -442,7 +484,7 @@ void NodeInstanceServer::changePropertyBindings(const ChangeBindingsCommand &com
void NodeInstanceServer::changeIds(const ChangeIdsCommand &command) void NodeInstanceServer::changeIds(const ChangeIdsCommand &command)
{ {
foreach(const IdContainer &container, command.ids()) { foreach (const IdContainer &container, command.ids()) {
if (hasInstanceForId(container.instanceId())) if (hasInstanceForId(container.instanceId()))
instanceForId(container.instanceId()).setId(container.id()); instanceForId(container.instanceId()).setId(container.id());
} }
@@ -451,14 +493,6 @@ void NodeInstanceServer::changeIds(const ChangeIdsCommand &command)
startRenderTimer(); startRenderTimer();
} }
QDeclarativeEngine *NodeInstanceServer::engine() const
{
if (m_declarativeView)
return m_declarativeView->engine();
return 0;
}
QDeclarativeContext *NodeInstanceServer::context() const QDeclarativeContext *NodeInstanceServer::context() const
{ {
if (m_importComponentObject) { if (m_importComponentObject) {
@@ -468,14 +502,14 @@ QDeclarativeContext *NodeInstanceServer::context() const
} }
if (engine()) if (engine())
return engine()->rootContext(); return rootContext();
return 0; return 0;
} }
QDeclarativeView *NodeInstanceServer::delcarativeView() const QDeclarativeContext *NodeInstanceServer::rootContext() const
{ {
return m_declarativeView.data(); return engine()->rootContext();
} }
const QVector<NodeInstanceServer::InstancePropertyPair> NodeInstanceServer::changedPropertyList() const const QVector<NodeInstanceServer::InstancePropertyPair> NodeInstanceServer::changedPropertyList() const
@@ -525,12 +559,6 @@ QList<QObject*> NodeInstanceServer::allSubObjectsForObject(QObject *object)
return subChildren; return subChildren;
} }
void NodeInstanceServer::refreshBindings()
{
static int counter = 0;
engine()->rootContext()->setContextProperty(QString("__%1").arg(counter++), 0); // refreshing bindings
}
void NodeInstanceServer::removeAllInstanceRelationships() void NodeInstanceServer::removeAllInstanceRelationships()
{ {
// prevent destroyed() signals calling back // prevent destroyed() signals calling back
@@ -601,7 +629,7 @@ void NodeInstanceServer::removeFilePropertyFromFileSystemWatcher(QObject *object
void NodeInstanceServer::refreshLocalFileProperty(const QString &path) void NodeInstanceServer::refreshLocalFileProperty(const QString &path)
{ {
if (m_fileSystemWatcherHash.contains(path)) { if (m_fileSystemWatcherHash.contains(path)) {
foreach(const ObjectPropertyPair &objectPropertyPair, m_fileSystemWatcherHash) { foreach (const ObjectPropertyPair &objectPropertyPair, m_fileSystemWatcherHash) {
QObject *object = objectPropertyPair.first.data(); QObject *object = objectPropertyPair.first.data();
QString propertyName = objectPropertyPair.second; QString propertyName = objectPropertyPair.second;
@@ -666,7 +694,7 @@ void NodeInstanceServer::resetInstanceProperty(const PropertyAbstractContainer &
} }
if (propertyContainer.isDynamic() && propertyContainer.instanceId() == 0 && engine()) if (propertyContainer.isDynamic() && propertyContainer.instanceId() == 0 && engine())
engine()->rootContext()->setContextProperty(name, QVariant()); rootContext()->setContextProperty(name, QVariant());
} }
} }
@@ -730,7 +758,7 @@ void NodeInstanceServer::setInstancePropertyVariant(const PropertyValueContainer
} }
if (valueContainer.isDynamic() && valueContainer.instanceId() == 0 && engine()) if (valueContainer.isDynamic() && valueContainer.instanceId() == 0 && engine())
engine()->rootContext()->setContextProperty(name, value); rootContext()->setContextProperty(name, value);
} }
} }
@@ -788,7 +816,7 @@ ChildrenChangedCommand NodeInstanceServer::createChildrenChangedCommand(const Se
{ {
QVector<qint32> instanceVector; QVector<qint32> instanceVector;
foreach(const ServerNodeInstance &instance, instanceList) foreach (const ServerNodeInstance &instance, instanceList)
instanceVector.append(instance.instanceId()); instanceVector.append(instance.instanceId());
return ChildrenChangedCommand(parentInstance.instanceId(), instanceVector); return ChildrenChangedCommand(parentInstance.instanceId(), instanceVector);
@@ -798,7 +826,7 @@ InformationChangedCommand NodeInstanceServer::createAllInformationChangedCommand
{ {
QVector<InformationContainer> informationVector; QVector<InformationContainer> informationVector;
foreach(const ServerNodeInstance &instance, instanceList) { foreach (const ServerNodeInstance &instance, instanceList) {
informationVector.append(InformationContainer(instance.instanceId(), Position, instance.position())); informationVector.append(InformationContainer(instance.instanceId(), Position, instance.position()));
informationVector.append(InformationContainer(instance.instanceId(), Transform, instance.transform())); informationVector.append(InformationContainer(instance.instanceId(), Transform, instance.transform()));
informationVector.append(InformationContainer(instance.instanceId(), SceneTransform, instance.sceneTransform())); informationVector.append(InformationContainer(instance.instanceId(), SceneTransform, instance.sceneTransform()));
@@ -878,8 +906,8 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QList<
{ {
QVector<PropertyValueContainer> valueVector; QVector<PropertyValueContainer> valueVector;
foreach(const ServerNodeInstance &instance, instanceList) { foreach (const ServerNodeInstance &instance, instanceList) {
foreach(const QString &propertyName, instance.propertyNames()) { foreach (const QString &propertyName, instance.propertyNames()) {
QVariant propertyValue = instance.property(propertyName); QVariant propertyValue = instance.property(propertyName);
if (supportedVariantType(propertyValue.type())) if (supportedVariantType(propertyValue.type()))
valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString())); valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString()));
@@ -908,7 +936,7 @@ ValuesChangedCommand NodeInstanceServer::createValuesChangedCommand(const QVecto
const QString propertyName = property.second; const QString propertyName = property.second;
const ServerNodeInstance instance = property.first; const ServerNodeInstance instance = property.first;
if( instance.isValid()) { if ( instance.isValid()) {
QVariant propertyValue = instance.property(propertyName); QVariant propertyValue = instance.property(propertyName);
if (supportedVariantType(propertyValue.type())) if (supportedVariantType(propertyValue.type()))
valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString())); valueVector.append(PropertyValueContainer(instance.instanceId(), propertyName, propertyValue, QString()));
@@ -923,6 +951,11 @@ QStringList NodeInstanceServer::imports() const
return m_importList; return m_importList;
} }
void NodeInstanceServer::addImportString(const QString &import)
{
m_importList.append(import);
}
QObject *NodeInstanceServer::dummyContextObject() const QObject *NodeInstanceServer::dummyContextObject() const
{ {
return m_dummyContextObject.data(); return m_dummyContextObject.data();
@@ -967,89 +1000,22 @@ PixmapChangedCommand NodeInstanceServer::createPixmapChangedCommand(const QList<
return PixmapChangedCommand(imageVector); return PixmapChangedCommand(imageVector);
} }
bool NodeInstanceServer::nonInstanceChildIsDirty(QGraphicsObject *graphicsObject) const
{
QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(graphicsObject);
if (d->dirtyChildren) {
foreach(QGraphicsItem *child, graphicsObject->childItems()) {
QGraphicsObject *childGraphicsObject = child->toGraphicsObject();
if (hasInstanceForObject(childGraphicsObject))
continue;
QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child);
if (childPrivate->dirty || nonInstanceChildIsDirty(childGraphicsObject))
return true;
}
}
return false;
}
void NodeInstanceServer::resetAllItems()
{
// m_declarativeView->scene()->update();
// m_declarativeView->viewport()->repaint();
static_cast<QGraphicsScenePrivate*>(QObjectPrivate::get(m_declarativeView->scene()))->processDirtyItemsEmitted = true;
foreach (QGraphicsItem *item, m_declarativeView->items())
static_cast<QGraphicsScenePrivate*>(QObjectPrivate::get(m_declarativeView->scene()))->resetDirtyItem(item);
}
void NodeInstanceServer::initializeDeclarativeView()
{
Q_ASSERT(!m_declarativeView.data());
m_declarativeView = new QDeclarativeView;
#ifndef Q_WS_MAC
m_declarativeView->setAttribute(Qt::WA_DontShowOnScreen, true);
#endif
m_declarativeView->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
m_declarativeView->show();
#ifdef Q_WS_MAC
m_declarativeView->setAttribute(Qt::WA_DontShowOnScreen, true);
#endif
QUnifiedTimer::instance()->setSlowdownFactor(0.00001);
QUnifiedTimer::instance()->setSlowModeEnabled(true);
}
QImage NodeInstanceServer::renderPreviewImage()
{
QSize size = rootNodeInstance().boundingRect().size().toSize();
size.scale(100, 100, Qt::KeepAspectRatio);
QImage image(size, QImage::Format_ARGB32);
image.fill(0xFFFFFFFF);
if (m_declarativeView) {
QPainter painter(&image);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::TextAntialiasing, true);
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
painter.setRenderHint(QPainter::HighQualityAntialiasing, true);
painter.setRenderHint(QPainter::NonCosmeticDefaultPen, true);
m_declarativeView->scene()->render(&painter, image.rect(), rootNodeInstance().boundingRect().toRect(), Qt::IgnoreAspectRatio);
}
return image;
}
void NodeInstanceServer::loadDummyDataFile(const QFileInfo& qmlFileInfo) void NodeInstanceServer::loadDummyDataFile(const QFileInfo& qmlFileInfo)
{ {
QDeclarativeComponent component(engine(), qmlFileInfo.filePath()); QDeclarativeComponent component(engine(), qmlFileInfo.filePath());
QObject *dummyData = component.create(); QObject *dummyData = component.create();
if(component.isError()) { if (component.isError()) {
QList<QDeclarativeError> errors = component.errors(); QList<QDeclarativeError> errors = component.errors();
foreach (const QDeclarativeError &error, errors) { foreach (const QDeclarativeError &error, errors) {
qWarning() << error; qWarning() << error;
} }
} }
QVariant oldDummyDataObject = m_declarativeView->rootContext()->contextProperty(qmlFileInfo.completeBaseName()); QVariant oldDummyDataObject = rootContext()->contextProperty(qmlFileInfo.completeBaseName());
if (dummyData) { if (dummyData) {
qWarning() << "Loaded dummy data:" << qmlFileInfo.filePath(); qWarning() << "Loaded dummy data:" << qmlFileInfo.filePath();
m_declarativeView->rootContext()->setContextProperty(qmlFileInfo.completeBaseName(), dummyData); rootContext()->setContextProperty(qmlFileInfo.completeBaseName(), dummyData);
dummyData->setParent(this); dummyData->setParent(this);
m_dummyObjectList.append(DummyPair(qmlFileInfo.completeBaseName(), dummyData)); m_dummyObjectList.append(DummyPair(qmlFileInfo.completeBaseName(), dummyData));
} }
@@ -1073,7 +1039,7 @@ void NodeInstanceServer::loadDummyContextObjectFile(const QFileInfo& qmlFileInfo
QDeclarativeComponent component(engine(), qmlFileInfo.filePath()); QDeclarativeComponent component(engine(), qmlFileInfo.filePath());
m_dummyContextObject = component.create(); m_dummyContextObject = component.create();
if(component.isError()) { if (component.isError()) {
QList<QDeclarativeError> errors = component.errors(); QList<QDeclarativeError> errors = component.errors();
foreach (const QDeclarativeError &error, errors) { foreach (const QDeclarativeError &error, errors) {
qWarning() << error; qWarning() << error;
@@ -1105,7 +1071,7 @@ void NodeInstanceServer::loadDummyDataFiles(const QString& directory)
} }
} }
QStringList dummyDataDirectories(const QString& directoryPath) QStringList NodeInstanceServer::dummyDataDirectories(const QString& directoryPath)
{ {
QStringList dummyDataDirectoryList; QStringList dummyDataDirectoryList;
QDir directory(directoryPath); QDir directory(directoryPath);
@@ -1120,64 +1086,6 @@ QStringList dummyDataDirectories(const QString& directoryPath)
} }
} }
QList<ServerNodeInstance> NodeInstanceServer::setupScene(const CreateSceneCommand &command)
{
if (!command.fileUrl().isEmpty()) {
engine()->setBaseUrl(command.fileUrl());
m_fileUrl = command.fileUrl();
}
addImports(command.imports());
if (!command.fileUrl().isEmpty()) {
QStringList dummyDataDirectoryList = dummyDataDirectories(QFileInfo(command.fileUrl().toLocalFile()).path());
foreach(const QString &dummyDataDirectory, dummyDataDirectoryList)
loadDummyDataFiles(dummyDataDirectory);
}
static_cast<QGraphicsScenePrivate*>(QObjectPrivate::get(m_declarativeView->scene()))->processDirtyItemsEmitted = true;
QList<ServerNodeInstance> instanceList = createInstances(command.instances());
reparentInstances(command.reparentInstances());
foreach (const IdContainer &container, command.ids()) {
if (hasInstanceForId(container.instanceId()))
instanceForId(container.instanceId()).setId(container.id());
}
foreach (const PropertyValueContainer &container, command.valueChanges()) {
if (container.isDynamic())
setInstancePropertyVariant(container);
}
foreach (const PropertyValueContainer &container, command.valueChanges()) {
if (!container.isDynamic())
setInstancePropertyVariant(container);
}
foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
if (container.isDynamic())
setInstancePropertyBinding(container);
}
foreach (const PropertyBindingContainer &container, command.bindingChanges()) {
if (!container.isDynamic())
setInstancePropertyBinding(container);
}
foreach (const PropertyValueContainer &container, command.auxiliaryChanges()) {
setInstanceAuxiliaryData(container);
}
foreach (ServerNodeInstance instance, instanceList)
instance.doComponentComplete();
m_declarativeView->scene()->setSceneRect(rootNodeInstance().boundingRect());
return instanceList;
}
} }

View File

@@ -44,6 +44,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QFileSystemWatcher; class QFileSystemWatcher;
class QDeclarativeView; class QDeclarativeView;
class QSGView;
class QDeclarativeEngine; class QDeclarativeEngine;
class QGraphicsObject; class QGraphicsObject;
class QFileInfo; class QFileInfo;
@@ -89,7 +90,6 @@ public:
void removeProperties(const RemovePropertiesCommand &command); void removeProperties(const RemovePropertiesCommand &command);
void reparentInstances(const ReparentInstancesCommand &command); void reparentInstances(const ReparentInstancesCommand &command);
void changeState(const ChangeStateCommand &command); void changeState(const ChangeStateCommand &command);
void addImport(const AddImportCommand &command);
void completeComponent(const CompleteComponentCommand &command); void completeComponent(const CompleteComponentCommand &command);
void changeNodeSource(const ChangeNodeSourceCommand &command); void changeNodeSource(const ChangeNodeSourceCommand &command);
@@ -99,7 +99,7 @@ public:
ServerNodeInstance instanceForObject(QObject *object) const; ServerNodeInstance instanceForObject(QObject *object) const;
bool hasInstanceForObject(QObject *object) const; bool hasInstanceForObject(QObject *object) const;
QDeclarativeEngine *engine() const; virtual QDeclarativeEngine *engine() const = 0;
QDeclarativeContext *context() const; QDeclarativeContext *context() const;
void removeAllInstanceRelationships(); void removeAllInstanceRelationships();
@@ -131,7 +131,7 @@ public slots:
protected: protected:
QList<ServerNodeInstance> createInstances(const QVector<InstanceContainer> &container); QList<ServerNodeInstance> createInstances(const QVector<InstanceContainer> &container);
void reparentInstances(const QVector<ReparentContainer> &containerVector); void reparentInstances(const QVector<ReparentContainer> &containerVector);
void addImports(const QVector<AddImportContainer> &container); void addImportString(const QString &import);
Internal::ChildrenChangeEventFilter *childrenChangeEventFilter(); Internal::ChildrenChangeEventFilter *childrenChangeEventFilter();
void resetInstanceProperty(const PropertyAbstractContainer &propertyContainer); void resetInstanceProperty(const PropertyAbstractContainer &propertyContainer);
@@ -147,9 +147,8 @@ protected:
void timerEvent(QTimerEvent *); void timerEvent(QTimerEvent *);
bool nonInstanceChildIsDirty(QGraphicsObject *graphicsObject) const;
virtual void collectItemChangesAndSendChangeCommands() = 0; virtual void collectItemChangesAndSendChangeCommands() = 0;
void resetAllItems();
ValuesChangedCommand createValuesChangedCommand(const QList<ServerNodeInstance> &instanceList) const; ValuesChangedCommand createValuesChangedCommand(const QList<ServerNodeInstance> &instanceList) const;
ValuesChangedCommand createValuesChangedCommand(const QVector<InstancePropertyPair> &propertyList) const; ValuesChangedCommand createValuesChangedCommand(const QVector<InstancePropertyPair> &propertyList) const;
@@ -167,27 +166,38 @@ protected:
int renderTimerInterval() const; int renderTimerInterval() const;
void setSlowRenderTimerInterval(int timerInterval); void setSlowRenderTimerInterval(int timerInterval);
void initializeDeclarativeView(); virtual void initializeView(const QVector<AddImportContainer> &importVector) = 0;
QList<ServerNodeInstance> setupScene(const CreateSceneCommand &command); virtual QList<ServerNodeInstance> setupScene(const CreateSceneCommand &command) = 0;
void loadDummyDataFiles(const QString& directory); void loadDummyDataFiles(const QString& directory);
void loadDummyDataFile(const QFileInfo& fileInfo); void loadDummyDataFile(const QFileInfo& fileInfo);
void loadDummyContextObjectFile(const QFileInfo& fileInfo); void loadDummyContextObjectFile(const QFileInfo& fileInfo);
QImage renderPreviewImage(); static QStringList dummyDataDirectories(const QString& directoryPath);
void setTimerId(int timerId); void setTimerId(int timerId);
int timerId() const; int timerId() const;
QDeclarativeView *delcarativeView() const; virtual QDeclarativeView *declarativeView() const = 0;
virtual QSGView *sgView() const = 0;
QDeclarativeContext *rootContext() const;
const QVector<InstancePropertyPair> changedPropertyList() const; const QVector<InstancePropertyPair> changedPropertyList() const;
void clearChangedPropertyList(); void clearChangedPropertyList();
void refreshBindings(); virtual void refreshBindings() = 0;
void setupDummysForContext(QDeclarativeContext *context); void setupDummysForContext(QDeclarativeContext *context);
void setupFileUrl(const QUrl &fileUrl);
void setupImports(const QVector<AddImportContainer> &container);
void setupDummyData(const QUrl &fileUrl);
QList<ServerNodeInstance> setupInstances(const CreateSceneCommand &command);
QList<QDeclarativeContext*> allSubContextsForObject(QObject *object); QList<QDeclarativeContext*> allSubContextsForObject(QObject *object);
static QList<QObject*> allSubObjectsForObject(QObject *object); static QList<QObject*> allSubObjectsForObject(QObject *object);
virtual void resizeCanvasSizeToRootItemSize() = 0;
private: private:
ServerNodeInstance m_rootNodeInstance; ServerNodeInstance m_rootNodeInstance;
ServerNodeInstance m_activeStateInstance; ServerNodeInstance m_activeStateInstance;
@@ -197,7 +207,6 @@ private:
QList<QPair<QString, QWeakPointer<QObject> > > m_dummyObjectList; QList<QPair<QString, QWeakPointer<QObject> > > m_dummyObjectList;
QWeakPointer<QFileSystemWatcher> m_fileSystemWatcher; QWeakPointer<QFileSystemWatcher> m_fileSystemWatcher;
QWeakPointer<QFileSystemWatcher> m_dummdataFileSystemWatcher; QWeakPointer<QFileSystemWatcher> m_dummdataFileSystemWatcher;
QWeakPointer<QDeclarativeView> m_declarativeView;
QWeakPointer<Internal::ChildrenChangeEventFilter> m_childrenChangeEventFilter; QWeakPointer<Internal::ChildrenChangeEventFilter> m_childrenChangeEventFilter;
QUrl m_fileUrl; QUrl m_fileUrl;
NodeInstanceClientInterface *m_nodeInstanceClient; NodeInstanceClientInterface *m_nodeInstanceClient;

View File

@@ -32,17 +32,7 @@
#include "objectnodeinstance.h" #include "objectnodeinstance.h"
#include "qmlgraphicsitemnodeinstance.h"
#include "graphicsobjectnodeinstance.h"
#include <invalidreparentingexception.h>
#include <invalidnodeinstanceexception.h>
#include <notimplementedexception.h>
#include <noanchoringpossibleexception.h>
#include <variantproperty.h>
#include <nodelistproperty.h>
#include <metainfo.h>
#include <QEvent> #include <QEvent>
#include <QGraphicsScene> #include <QGraphicsScene>
@@ -158,6 +148,11 @@ void ObjectNodeInstance::initializePropertyWatcher(const ObjectNodeInstance::Poi
m_signalSpy.setObjectNodeInstance(objectNodeInstance); m_signalSpy.setObjectNodeInstance(objectNodeInstance);
} }
void ObjectNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance)
{
initializePropertyWatcher(objectNodeInstance);
}
void ObjectNodeInstance::setId(const QString &id) void ObjectNodeInstance::setId(const QString &id)
{ {
if (!m_id.isEmpty() && context()) { if (!m_id.isEmpty() && context()) {
@@ -197,6 +192,11 @@ bool ObjectNodeInstance::isPositioner() const
return false; return false;
} }
bool ObjectNodeInstance::isSGItem() const
{
return false;
}
bool ObjectNodeInstance::equalGraphicsItem(QGraphicsItem * /*item*/) const bool ObjectNodeInstance::equalGraphicsItem(QGraphicsItem * /*item*/) const
{ {
return false; return false;
@@ -620,7 +620,7 @@ QList<ServerNodeInstance> ObjectNodeInstance::stateInstances() const
return QList<ServerNodeInstance>(); return QList<ServerNodeInstance>();
} }
void ObjectNodeInstance::setNodeSource(const QString &source) void ObjectNodeInstance::setNodeSource(const QString & /*source*/)
{ {
} }

View File

@@ -88,6 +88,7 @@ public:
NodeInstanceServer *nodeInstanceServer() const; NodeInstanceServer *nodeInstanceServer() const;
void setNodeInstanceServer(NodeInstanceServer *server); void setNodeInstanceServer(NodeInstanceServer *server);
virtual void initializePropertyWatcher(const Pointer &objectNodeInstance); virtual void initializePropertyWatcher(const Pointer &objectNodeInstance);
virtual void initialize(const Pointer &objectNodeInstance);
virtual void paint(QPainter *painter); virtual void paint(QPainter *painter);
virtual QImage renderImage() const; virtual QImage renderImage() const;
@@ -104,7 +105,7 @@ public:
virtual bool isGraphicsObject() const; virtual bool isGraphicsObject() const;
virtual bool isTransition() const; virtual bool isTransition() const;
virtual bool isPositioner() const; virtual bool isPositioner() const;
virtual bool isSGItem() const;
virtual bool equalGraphicsItem(QGraphicsItem *item) const; virtual bool equalGraphicsItem(QGraphicsItem *item) const;

Some files were not shown because too many files have changed in this diff Show More