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 <invalidmodelnodeexception.h>
#include <invalidnodestateexception.h>
namespace QmlDesigner {

View File

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

View File

@@ -7,8 +7,13 @@ QT += script \
DEFINES += TEST_EXPORTS
INCLUDEPATH += $$PWD \
$$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 \
$$PWD/instances/nodeinstanceview.cpp \
$$PWD/model/rewriterview.cpp \
$$PWD/metainfo/metainfo.cpp \
$$PWD/metainfo/metainfoparser.cpp \
@@ -25,15 +30,12 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/pluginmanager/widgetpluginmanager.cpp \
$$PWD/pluginmanager/widgetpluginpath.cpp \
$$PWD/exceptions/exception.cpp \
$$PWD/exceptions/invalidnodeinstanceexception.cpp \
$$PWD/exceptions/invalidpropertyexception.cpp \
$$PWD/exceptions/invalidmodelnodeexception.cpp \
$$PWD/exceptions/invalidreparentingexception.cpp \
$$PWD/exceptions/invalidmetainfoexception.cpp \
$$PWD/exceptions/invalidargumentexception.cpp \
$$PWD/exceptions/noanchoringpossibleexception.cpp \
$$PWD/exceptions/notimplementedexception.cpp \
$$PWD/exceptions/invalidnodestateexception.cpp \
$$PWD/model/variantparser.cpp \
$$PWD/exceptions/invalidmodelstateexception.cpp \
$$PWD/exceptions/removebasestateexception.cpp \
@@ -73,43 +75,7 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/rewriteactioncompressor.cpp \
$$PWD/model/qmltextgenerator.cpp \
$$PWD/model/modelmerger.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
$$PWD/exceptions/rewritingexception.cpp
HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/abstractview.h \
@@ -132,8 +98,6 @@ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/pluginmanager/widgetpluginmanager.h \
$$PWD/pluginmanager/widgetpluginpath.h \
$$PWD/include/exception.h \
$$PWD/include/invalidnodeinstanceexception.h \
$$PWD/include/invalidmodelnodeexception.h \
$$PWD/include/invalidreparentingexception.h \
$$PWD/include/invalidmetainfoexception.h \
$$PWD/include/invalidargumentexception.h \
@@ -181,45 +145,8 @@ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/modelmerger.h \
$$PWD/include/mathutils.h \
$$PWD/include/customnotifications.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
$$PWD/include/rewritingexception.h
contains(CONFIG, plugin) {
# If core.pri has been included in the qmldesigner plugin
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 RemoveInstancesCommand;
class RemovePropertiesCommand;
class AddImportCommand;
class CompleteComponentCommand;
class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInstanceClientInterface
@@ -175,7 +174,6 @@ private: // functions
RemoveInstancesCommand createRemoveInstancesCommand(const QList<ModelNode> &nodeList) const;
RemoveInstancesCommand createRemoveInstancesCommand(const ModelNode &node) const;
RemovePropertiesCommand createRemovePropertiesCommand(const QList<AbstractProperty> &propertyList) const;
AddImportCommand createImportCommand(const Import &import);
void resetHorizontalAnchors(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/../include
HEADERS += $$PWD/../include/nodeinstance.h
HEADERS += $$PWD/nodeinstanceserverproxy.h
HEADERS += $$PWD/behaviornodeinstance.h
HEADERS += $$PWD/changeauxiliarycommand.h
HEADERS += $$PWD/informationnodeinstanceserver.h
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
SOURCES += $$PWD/nodeinstanceserverproxy.cpp
SOURCES += $$PWD/nodeinstance.cpp
SOURCES += $$PWD/nodeinstanceview.cpp

View File

@@ -37,6 +37,7 @@
#include <QProcess>
#include <QCoreApplication>
#include <QUuid>
#include <QFileInfo>
#include "propertyabstractcontainer.h"
#include "propertyvaluecontainer.h"
@@ -54,7 +55,6 @@
#include "reparentinstancescommand.h"
#include "changeidscommand.h"
#include "changestatecommand.h"
#include "addimportcommand.h"
#include "completecomponentcommand.h"
#include "changenodesourcecommand.h"
@@ -69,10 +69,25 @@
#include "synchronizecommand.h"
#include "nodeinstanceview.h"
#include "nodeinstanceclientproxy.h"
#include "import.h"
#include <QMessageBox>
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)
: NodeInstanceServerInterface(nodeInstanceView),
m_localServer(new QLocalServer(this)),
@@ -98,13 +113,19 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
#ifdef Q_OS_MACX
applicationPath += "/qmlpuppet.app/Contents/MacOS";
#endif
if (hasQtQuick1(nodeInstanceView)) {
applicationPath += "/qmlpuppet";
} else {
applicationPath += "/qml2puppet";
}
QByteArray envImportPath = qgetenv("QTCREATOR_QMLPUPPET_PATH");
if (!envImportPath.isEmpty()) {
applicationPath = envImportPath;
}
if (QFileInfo(applicationPath).exists()) {
m_qmlPuppetEditorProcess = new QProcess;
connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill()));
@@ -166,6 +187,10 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
}
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."));
}
}
NodeInstanceServerProxy::~NodeInstanceServerProxy()
@@ -449,11 +474,6 @@ void NodeInstanceServerProxy::changeState(const ChangeStateCommand &command)
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceServerProxy::addImport(const AddImportCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceServerProxy::completeComponent(const CompleteComponentCommand &command)
{
writeCommand(QVariant::fromValue(command));

View File

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

View File

@@ -74,7 +74,6 @@
#include "pixmapchangedcommand.h"
#include "informationchangedcommand.h"
#include "changestatecommand.h"
#include "addimportcommand.h"
#include "childrenchangedcommand.h"
#include "imagecontainer.h"
#include "statepreviewimagechangedcommand.h"
@@ -1005,11 +1004,6 @@ RemovePropertiesCommand NodeInstanceView::createRemovePropertiesCommand(const QL
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)
{
if (!model())

View File

@@ -4,29 +4,30 @@
**
** 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
**
** 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.
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, 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.
** Nokia at qt-info@nokia.com.
**
**************************************************************************/

View File

@@ -4,29 +4,30 @@
**
** 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
**
** 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.
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, 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.
** 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 <QString>
#include "commondefines.h"
namespace QmlDesigner {

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,11 +32,7 @@
#include "nodeinstanceserver.h"
#include <QGraphicsItem>
#include <private/qgraphicsitem_p.h>
#include <private/qgraphicsscene_p.h>
#include <QDeclarativeEngine>
#include <QDeclarativeView>
#include <QFileSystemWatcher>
#include <QUrl>
#include <QSet>
@@ -73,7 +69,6 @@
#include "commondefines.h"
#include "childrenchangeeventfilter.h"
#include "changestatecommand.h"
#include "addimportcommand.h"
#include "childrenchangedcommand.h"
#include "completecomponentcommand.h"
#include "componentcompletedcommand.h"
@@ -96,18 +91,16 @@ NodeInstanceServer::NodeInstanceServer(NodeInstanceClientInterface *nodeInstance
{
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*)));
}
NodeInstanceServer::~NodeInstanceServer()
{
delete m_declarativeView.data();
}
QList<ServerNodeInstance> NodeInstanceServer::createInstances(const QVector<InstanceContainer> &containerVector)
{
Q_ASSERT(m_declarativeView);
Q_ASSERT(declarativeView() || sgView());
QList<ServerNodeInstance> instanceList;
foreach (const InstanceContainer &instanceContainer, containerVector) {
ServerNodeInstance instance;
@@ -121,11 +114,7 @@ QList<ServerNodeInstance> NodeInstanceServer::createInstances(const QVector<Ins
instance.internalObject()->installEventFilter(childrenChangeEventFilter());
if (instanceContainer.instanceId() == 0) {
m_rootNodeInstance = instance;
QGraphicsObject *rootGraphicsObject = qobject_cast<QGraphicsObject*>(instance.internalObject());
if (rootGraphicsObject) {
m_declarativeView->scene()->addItem(rootGraphicsObject);
m_declarativeView->setSceneRect(rootGraphicsObject->boundingRect());
}
resizeCanvasSizeToRootItemSize();
}
foreach (QDeclarativeContext* context, allSubContextsForObject(instance.internalObject()))
@@ -235,7 +224,10 @@ void NodeInstanceServer::stopRenderTimer()
void NodeInstanceServer::createScene(const CreateSceneCommand &command)
{
initializeDeclarativeView();
initializeView(command.imports());
QUnifiedTimer::instance()->setSlowdownFactor(0.00001);
QUnifiedTimer::instance()->setSlowModeEnabled(true);
QList<ServerNodeInstance> instanceList = setupScene(command);
refreshBindings();
@@ -252,8 +244,6 @@ void NodeInstanceServer::clearScene(const ClearSceneCommand &/*command*/)
m_rootNodeInstance.makeInvalid();
m_changedPropertyList.clear();
m_fileUrl.clear();
delete m_declarativeView.data();
}
void NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
@@ -348,7 +338,7 @@ void NodeInstanceServer::changeNodeSource(const ChangeNodeSourceCommand &command
startRenderTimer();
}
void NodeInstanceServer::addImports(const QVector<AddImportContainer> &containerVector)
void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &containerVector)
{
foreach (const AddImportContainer &container, containerVector) {
QString importStatement = QString("import ");
@@ -387,9 +377,61 @@ void NodeInstanceServer::addImports(const QVector<AddImportContainer> &container
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)
@@ -451,14 +493,6 @@ void NodeInstanceServer::changeIds(const ChangeIdsCommand &command)
startRenderTimer();
}
QDeclarativeEngine *NodeInstanceServer::engine() const
{
if (m_declarativeView)
return m_declarativeView->engine();
return 0;
}
QDeclarativeContext *NodeInstanceServer::context() const
{
if (m_importComponentObject) {
@@ -468,14 +502,14 @@ QDeclarativeContext *NodeInstanceServer::context() const
}
if (engine())
return engine()->rootContext();
return rootContext();
return 0;
}
QDeclarativeView *NodeInstanceServer::delcarativeView() const
QDeclarativeContext *NodeInstanceServer::rootContext() const
{
return m_declarativeView.data();
return engine()->rootContext();
}
const QVector<NodeInstanceServer::InstancePropertyPair> NodeInstanceServer::changedPropertyList() const
@@ -525,12 +559,6 @@ QList<QObject*> NodeInstanceServer::allSubObjectsForObject(QObject *object)
return subChildren;
}
void NodeInstanceServer::refreshBindings()
{
static int counter = 0;
engine()->rootContext()->setContextProperty(QString("__%1").arg(counter++), 0); // refreshing bindings
}
void NodeInstanceServer::removeAllInstanceRelationships()
{
// prevent destroyed() signals calling back
@@ -666,7 +694,7 @@ void NodeInstanceServer::resetInstanceProperty(const PropertyAbstractContainer &
}
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())
engine()->rootContext()->setContextProperty(name, value);
rootContext()->setContextProperty(name, value);
}
}
@@ -923,6 +951,11 @@ QStringList NodeInstanceServer::imports() const
return m_importList;
}
void NodeInstanceServer::addImportString(const QString &import)
{
m_importList.append(import);
}
QObject *NodeInstanceServer::dummyContextObject() const
{
return m_dummyContextObject.data();
@@ -967,73 +1000,6 @@ PixmapChangedCommand NodeInstanceServer::createPixmapChangedCommand(const QList<
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)
{
QDeclarativeComponent component(engine(), qmlFileInfo.filePath());
@@ -1045,11 +1011,11 @@ void NodeInstanceServer::loadDummyDataFile(const QFileInfo& qmlFileInfo)
}
}
QVariant oldDummyDataObject = m_declarativeView->rootContext()->contextProperty(qmlFileInfo.completeBaseName());
QVariant oldDummyDataObject = rootContext()->contextProperty(qmlFileInfo.completeBaseName());
if (dummyData) {
qWarning() << "Loaded dummy data:" << qmlFileInfo.filePath();
m_declarativeView->rootContext()->setContextProperty(qmlFileInfo.completeBaseName(), dummyData);
rootContext()->setContextProperty(qmlFileInfo.completeBaseName(), dummyData);
dummyData->setParent(this);
m_dummyObjectList.append(DummyPair(qmlFileInfo.completeBaseName(), dummyData));
}
@@ -1105,7 +1071,7 @@ void NodeInstanceServer::loadDummyDataFiles(const QString& directory)
}
}
QStringList dummyDataDirectories(const QString& directoryPath)
QStringList NodeInstanceServer::dummyDataDirectories(const QString& directoryPath)
{
QStringList dummyDataDirectoryList;
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
class QFileSystemWatcher;
class QDeclarativeView;
class QSGView;
class QDeclarativeEngine;
class QGraphicsObject;
class QFileInfo;
@@ -89,7 +90,6 @@ public:
void removeProperties(const RemovePropertiesCommand &command);
void reparentInstances(const ReparentInstancesCommand &command);
void changeState(const ChangeStateCommand &command);
void addImport(const AddImportCommand &command);
void completeComponent(const CompleteComponentCommand &command);
void changeNodeSource(const ChangeNodeSourceCommand &command);
@@ -99,7 +99,7 @@ public:
ServerNodeInstance instanceForObject(QObject *object) const;
bool hasInstanceForObject(QObject *object) const;
QDeclarativeEngine *engine() const;
virtual QDeclarativeEngine *engine() const = 0;
QDeclarativeContext *context() const;
void removeAllInstanceRelationships();
@@ -131,7 +131,7 @@ public slots:
protected:
QList<ServerNodeInstance> createInstances(const QVector<InstanceContainer> &container);
void reparentInstances(const QVector<ReparentContainer> &containerVector);
void addImports(const QVector<AddImportContainer> &container);
void addImportString(const QString &import);
Internal::ChildrenChangeEventFilter *childrenChangeEventFilter();
void resetInstanceProperty(const PropertyAbstractContainer &propertyContainer);
@@ -147,9 +147,8 @@ protected:
void timerEvent(QTimerEvent *);
bool nonInstanceChildIsDirty(QGraphicsObject *graphicsObject) const;
virtual void collectItemChangesAndSendChangeCommands() = 0;
void resetAllItems();
ValuesChangedCommand createValuesChangedCommand(const QList<ServerNodeInstance> &instanceList) const;
ValuesChangedCommand createValuesChangedCommand(const QVector<InstancePropertyPair> &propertyList) const;
@@ -167,27 +166,38 @@ protected:
int renderTimerInterval() const;
void setSlowRenderTimerInterval(int timerInterval);
void initializeDeclarativeView();
QList<ServerNodeInstance> setupScene(const CreateSceneCommand &command);
virtual void initializeView(const QVector<AddImportContainer> &importVector) = 0;
virtual QList<ServerNodeInstance> setupScene(const CreateSceneCommand &command) = 0;
void loadDummyDataFiles(const QString& directory);
void loadDummyDataFile(const QFileInfo& fileInfo);
void loadDummyContextObjectFile(const QFileInfo& fileInfo);
QImage renderPreviewImage();
static QStringList dummyDataDirectories(const QString& directoryPath);
void setTimerId(int timerId);
int timerId() const;
QDeclarativeView *delcarativeView() const;
virtual QDeclarativeView *declarativeView() const = 0;
virtual QSGView *sgView() const = 0;
QDeclarativeContext *rootContext() const;
const QVector<InstancePropertyPair> changedPropertyList() const;
void clearChangedPropertyList();
void refreshBindings();
virtual void refreshBindings() = 0;
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);
static QList<QObject*> allSubObjectsForObject(QObject *object);
virtual void resizeCanvasSizeToRootItemSize() = 0;
private:
ServerNodeInstance m_rootNodeInstance;
ServerNodeInstance m_activeStateInstance;
@@ -197,7 +207,6 @@ private:
QList<QPair<QString, QWeakPointer<QObject> > > m_dummyObjectList;
QWeakPointer<QFileSystemWatcher> m_fileSystemWatcher;
QWeakPointer<QFileSystemWatcher> m_dummdataFileSystemWatcher;
QWeakPointer<QDeclarativeView> m_declarativeView;
QWeakPointer<Internal::ChildrenChangeEventFilter> m_childrenChangeEventFilter;
QUrl m_fileUrl;
NodeInstanceClientInterface *m_nodeInstanceClient;

View File

@@ -32,17 +32,7 @@
#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 <QGraphicsScene>
@@ -158,6 +148,11 @@ void ObjectNodeInstance::initializePropertyWatcher(const ObjectNodeInstance::Poi
m_signalSpy.setObjectNodeInstance(objectNodeInstance);
}
void ObjectNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance)
{
initializePropertyWatcher(objectNodeInstance);
}
void ObjectNodeInstance::setId(const QString &id)
{
if (!m_id.isEmpty() && context()) {
@@ -197,6 +192,11 @@ bool ObjectNodeInstance::isPositioner() const
return false;
}
bool ObjectNodeInstance::isSGItem() const
{
return false;
}
bool ObjectNodeInstance::equalGraphicsItem(QGraphicsItem * /*item*/) const
{
return false;
@@ -620,7 +620,7 @@ QList<ServerNodeInstance> ObjectNodeInstance::stateInstances() const
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;
void setNodeInstanceServer(NodeInstanceServer *server);
virtual void initializePropertyWatcher(const Pointer &objectNodeInstance);
virtual void initialize(const Pointer &objectNodeInstance);
virtual void paint(QPainter *painter);
virtual QImage renderImage() const;
@@ -104,7 +105,7 @@ public:
virtual bool isGraphicsObject() const;
virtual bool isTransition() const;
virtual bool isPositioner() const;
virtual bool isSGItem() const;
virtual bool equalGraphicsItem(QGraphicsItem *item) const;

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