| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | /**************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-07-06 15:48:52 +00:00
										 |  |  | ** This file is part of Qt Creator | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-01-26 18:33:46 +01:00
										 |  |  | ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-07-19 12:26:56 +02:00
										 |  |  | ** Contact: http://www.qt-project.org/
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-07-06 15:48:52 +00:00
										 |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-07-06 15:48:52 +00:00
										 |  |  | ** 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.
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-07-06 15:48:52 +00:00
										 |  |  | ** 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. | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-07-06 15:48:52 +00:00
										 |  |  | ** Other Usage | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-07-06 15:48:52 +00:00
										 |  |  | ** Alternatively, this file may be used in accordance with the terms and | 
					
						
							|  |  |  | ** conditions contained in a signed written agreement between you and Nokia. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | **************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "qt5rendernodeinstanceserver.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | #include <QQuickItem>
 | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | #include "servernodeinstance.h"
 | 
					
						
							|  |  |  | #include "childrenchangeeventfilter.h"
 | 
					
						
							|  |  |  | #include "propertyabstractcontainer.h"
 | 
					
						
							|  |  |  | #include "propertybindingcontainer.h"
 | 
					
						
							|  |  |  | #include "propertyvaluecontainer.h"
 | 
					
						
							|  |  |  | #include "instancecontainer.h"
 | 
					
						
							|  |  |  | #include "createinstancescommand.h"
 | 
					
						
							|  |  |  | #include "changefileurlcommand.h"
 | 
					
						
							|  |  |  | #include "clearscenecommand.h"
 | 
					
						
							|  |  |  | #include "reparentinstancescommand.h"
 | 
					
						
							|  |  |  | #include "changevaluescommand.h"
 | 
					
						
							|  |  |  | #include "changebindingscommand.h"
 | 
					
						
							|  |  |  | #include "changeidscommand.h"
 | 
					
						
							|  |  |  | #include "removeinstancescommand.h"
 | 
					
						
							|  |  |  | #include "nodeinstanceclientinterface.h"
 | 
					
						
							|  |  |  | #include "removepropertiescommand.h"
 | 
					
						
							|  |  |  | #include "valueschangedcommand.h"
 | 
					
						
							|  |  |  | #include "informationchangedcommand.h"
 | 
					
						
							|  |  |  | #include "pixmapchangedcommand.h"
 | 
					
						
							|  |  |  | #include "commondefines.h"
 | 
					
						
							|  |  |  | #include "childrenchangeeventfilter.h"
 | 
					
						
							|  |  |  | #include "changestatecommand.h"
 | 
					
						
							|  |  |  | #include "childrenchangedcommand.h"
 | 
					
						
							|  |  |  | #include "completecomponentcommand.h"
 | 
					
						
							|  |  |  | #include "componentcompletedcommand.h"
 | 
					
						
							|  |  |  | #include "createscenecommand.h"
 | 
					
						
							| 
									
										
										
										
											2011-08-31 18:19:45 +02:00
										 |  |  | #include "sgitemnodeinstance.h"
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  | #include "removesharedmemorycommand.h"
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "dummycontextobject.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-31 18:27:41 +02:00
										 |  |  | #include <designersupport.h>
 | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | namespace QmlDesigner { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Qt5RenderNodeInstanceServer::Qt5RenderNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : | 
					
						
							|  |  |  |     Qt5NodeInstanceServer(nodeInstanceClient) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |     Internal::QuickItemNodeInstance::createEffectItem(true); | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  |     static bool inFunction = false; | 
					
						
							|  |  |  |     if (!inFunction) { | 
					
						
							|  |  |  |         inFunction = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |         if (quickView() && nodeInstanceClient()->bytesToWrite() < 10000) { | 
					
						
							|  |  |  |             foreach (QQuickItem *item, allItems()) { | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  |                 if (item && hasInstanceForObject(item)) { | 
					
						
							|  |  |  |                     ServerNodeInstance instance = instanceForObject(item); | 
					
						
							| 
									
										
										
										
											2011-08-31 14:28:48 +02:00
										 |  |  |                     if (DesignerSupport::isDirty(item, DesignerSupport::ContentUpdateMask)) | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  |                         m_dirtyInstanceSet.insert(instance); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             clearChangedPropertyList(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-31 18:22:26 +02:00
										 |  |  |             if (!m_dirtyInstanceSet.isEmpty()) { | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  |                 nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(m_dirtyInstanceSet.toList())); | 
					
						
							|  |  |  |                 m_dirtyInstanceSet.clear(); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-25 20:51:29 +02:00
										 |  |  |             resetAllItems(); | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |             slowDownRenderTimer(); | 
					
						
							|  |  |  |             nodeInstanceClient()->flush(); | 
					
						
							|  |  |  |             nodeInstanceClient()->synchronizeWithClientProcess(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         inFunction = false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-21 15:05:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | void Qt5RenderNodeInstanceServer::createScene(const CreateSceneCommand &command) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-08-29 20:51:43 +02:00
										 |  |  |     Qt5NodeInstanceServer::createScene(command); | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<ServerNodeInstance> instanceList; | 
					
						
							|  |  |  |     foreach (const InstanceContainer &container, command.instances()) { | 
					
						
							|  |  |  |         ServerNodeInstance instance = instanceForId(container.instanceId()); | 
					
						
							|  |  |  |         if (instance.isValid()) { | 
					
						
							|  |  |  |             instanceList.append(instance); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(instanceList)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Qt5RenderNodeInstanceServer::clearScene(const ClearSceneCommand &command) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-08-29 20:51:43 +02:00
										 |  |  |     Qt5NodeInstanceServer::clearScene(command); | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_dirtyInstanceSet.clear(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Qt5RenderNodeInstanceServer::completeComponent(const CompleteComponentCommand &command) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-08-29 20:51:43 +02:00
										 |  |  |     Qt5NodeInstanceServer::completeComponent(command); | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<ServerNodeInstance> instanceList; | 
					
						
							|  |  |  |     foreach (qint32 instanceId, command.instances()) { | 
					
						
							|  |  |  |         ServerNodeInstance instance = instanceForId(instanceId); | 
					
						
							|  |  |  |         if (instance.isValid()) { | 
					
						
							|  |  |  |             instanceList.append(instance); | 
					
						
							| 
									
										
										
										
											2011-08-29 20:51:43 +02:00
										 |  |  |             m_dirtyInstanceSet.insert(instance); | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(instanceList)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | void QmlDesigner::Qt5RenderNodeInstanceServer::removeSharedMemory(const QmlDesigner::RemoveSharedMemoryCommand &command) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (command.typeName() == "Image") | 
					
						
							| 
									
										
										
										
											2012-09-19 15:57:22 +02:00
										 |  |  |         ImageContainer::removeSharedMemorys(command.keyNumbers()); | 
					
						
							| 
									
										
										
										
											2012-09-11 15:11:34 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-09 15:50:48 +02:00
										 |  |  | } // namespace QmlDesigner
 |