OSDN Git Service

fc969b5e2e112c09208ec2abb5b228c9c2875199
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / designercore / instances / nodeinstanceclientproxy.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef NODEINSTANCECLIENTPROXY_H
35 #define NODEINSTANCECLIENTPROXY_H
36
37 #include "nodeinstanceclientinterface.h"
38
39 #include <QObject>
40 #include <QHash>
41 #include <QWeakPointer>
42
43 QT_BEGIN_NAMESPACE
44 class QLocalSocket;
45 QT_END_NAMESPACE
46
47 namespace QmlDesigner {
48
49 class NodeInstanceServerInterface;
50 class CreateSceneCommand;
51 class CreateInstancesCommand;
52 class ClearSceneCommand;
53 class ReparentInstancesCommand;
54 class ChangeFileUrlCommand;
55 class ChangeValuesCommand;
56 class ChangeBindingsCommand;
57 class ChangeIdsCommand;
58 class RemoveInstancesCommand;
59 class RemovePropertiesCommand;
60 class AddImportCommand;
61 class CompleteComponentCommand;
62 class ChangeStateCommand;
63
64 class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface
65 {
66     Q_OBJECT
67
68 public:
69     NodeInstanceClientProxy(QObject *parent = 0);
70
71     void informationChanged(const InformationChangedCommand &command);
72     void valuesChanged(const ValuesChangedCommand &command);
73     void pixmapChanged(const PixmapChangedCommand &command);
74     void childrenChanged(const ChildrenChangedCommand &command);
75     void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
76     void componentCompleted(const ComponentCompletedCommand &command);
77
78     void flush();
79     void synchronizeWithClientProcess();
80     qint64 bytesToWrite() const;
81
82 protected:
83     void writeCommand(const QVariant &command);
84     void dispatchCommand(const QVariant &command);
85     NodeInstanceServerInterface *nodeInstanceServer() const;
86
87     void createInstances(const CreateInstancesCommand &command);
88     void changeFileUrl(const ChangeFileUrlCommand &command);
89     void createScene(const CreateSceneCommand &command);
90     void clearScene(const ClearSceneCommand &command);
91     void removeInstances(const RemoveInstancesCommand &command);
92     void removeProperties(const RemovePropertiesCommand &command);
93     void changePropertyBindings(const ChangeBindingsCommand &command);
94     void changePropertyValues(const ChangeValuesCommand &command);
95     void reparentInstances(const ReparentInstancesCommand &command);
96     void changeIds(const ChangeIdsCommand &command);
97     void changeState(const ChangeStateCommand &command);
98     void addImport(const AddImportCommand &command);
99     void completeComponent(const CompleteComponentCommand &command);
100
101 private slots:
102     void readDataStream();
103
104 private:
105     QLocalSocket *m_socket;
106     NodeInstanceServerInterface *m_nodeInstanceServer;
107     quint32 m_blockSize;
108     int m_synchronizeId;
109 };
110
111 } // namespace QmlDesigner
112
113 #endif // NODEINSTANCECLIENTPROXY_H