Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / declarative / debugger / qdeclarativeenginedebug_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QDECLARATIVEENGINEDEBUG_H
43 #define QDECLARATIVEENGINEDEBUG_H
44
45 //
46 //  W A R N I N G
47 //  -------------
48 //
49 // This file is not part of the Qt API.  It exists purely as an
50 // implementation detail.  This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55
56 #include <QtCore/qobject.h>
57 #include <QtCore/qurl.h>
58 #include <QtCore/qvariant.h>
59
60 #include <private/qdeclarativeglobal_p.h>
61
62 QT_BEGIN_HEADER
63
64 QT_BEGIN_NAMESPACE
65
66
67 class QDeclarativeDebugConnection;
68 class QDeclarativeDebugWatch;
69 class QDeclarativeDebugPropertyWatch;
70 class QDeclarativeDebugObjectExpressionWatch;
71 class QDeclarativeDebugEnginesQuery;
72 class QDeclarativeDebugRootContextQuery;
73 class QDeclarativeDebugObjectQuery;
74 class QDeclarativeDebugExpressionQuery;
75 class QDeclarativeDebugPropertyReference;
76 class QDeclarativeDebugContextReference;
77 class QDeclarativeDebugObjectReference;
78 class QDeclarativeDebugFileReference;
79 class QDeclarativeDebugEngineReference;
80 class QDeclarativeEngineDebugPrivate;
81 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeEngineDebug : public QObject
82 {
83     Q_OBJECT
84 public:
85     enum Status { NotConnected, Unavailable, Enabled };
86
87     explicit QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0);
88     ~QDeclarativeEngineDebug();
89
90     Status status() const;
91
92     QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &,
93                                              QObject *parent = 0);
94     QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &,
95                                      QObject *parent = 0);
96     QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &,
97                                                      QObject *parent = 0);
98     QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &,
99                                      QObject *parent = 0);
100     QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &,
101                                      QObject *parent = 0);
102
103     void removeWatch(QDeclarativeDebugWatch *watch);
104
105     QDeclarativeDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
106     QDeclarativeDebugRootContextQuery *queryRootContexts(const QDeclarativeDebugEngineReference &,
107                                                          QObject *parent = 0);
108     QDeclarativeDebugObjectQuery *queryObject(const QDeclarativeDebugObjectReference &,
109                                               QObject *parent = 0);
110     QDeclarativeDebugObjectQuery *queryObjectRecursive(const QDeclarativeDebugObjectReference &,
111                                                        QObject *parent = 0);
112     QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId,
113                                                             const QString &expr,
114                                                             QObject *parent = 0);
115     bool setBindingForObject(int objectDebugId, const QString &propertyName,
116                              const QVariant &bindingExpression, bool isLiteralValue,
117                              QString source = QString(), int line = -1);
118     bool resetBindingForObject(int objectDebugId, const QString &propertyName);
119     bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
120
121 Q_SIGNALS:
122     void newObjects();
123     void statusChanged(Status status);
124
125 private:
126     Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
127 };
128
129 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugWatch : public QObject
130 {
131     Q_OBJECT
132 public:
133     enum State { Waiting, Active, Inactive, Dead };
134
135     QDeclarativeDebugWatch(QObject *);
136     ~QDeclarativeDebugWatch();
137
138     int queryId() const;
139     int objectDebugId() const;
140     State state() const;
141
142 Q_SIGNALS:
143     void stateChanged(QDeclarativeDebugWatch::State);
144     //void objectChanged(int, const QDeclarativeDebugObjectReference &);
145     //void valueChanged(int, const QVariant &);
146
147     // Server sends value as string if it is a user-type variant
148     void valueChanged(const QByteArray &name, const QVariant &value);
149
150 private:
151     friend class QDeclarativeEngineDebug;
152     friend class QDeclarativeEngineDebugPrivate;
153     void setState(State);
154     State m_state;
155     int m_queryId;
156     QDeclarativeEngineDebug *m_client;
157     int m_objectDebugId;
158 };
159
160 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch
161 {
162     Q_OBJECT
163 public:
164     QDeclarativeDebugPropertyWatch(QObject *parent);
165
166     QString name() const;
167
168 private:
169     friend class QDeclarativeEngineDebug;
170     QString m_name;
171 };
172
173 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch
174 {
175     Q_OBJECT
176 public:
177     QDeclarativeDebugObjectExpressionWatch(QObject *parent);
178
179     QString expression() const;
180
181 private:
182     friend class QDeclarativeEngineDebug;
183     QString m_expr;
184     int m_debugId;
185 };
186
187
188 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugQuery : public QObject
189 {
190     Q_OBJECT
191 public:
192     enum State { Waiting, Error, Completed };
193
194     State state() const;
195     bool isWaiting() const;
196
197 Q_SIGNALS:
198     void stateChanged(QDeclarativeDebugQuery::State);
199
200 protected:
201     QDeclarativeDebugQuery(QObject *);
202
203 private:
204     friend class QDeclarativeEngineDebug;
205     friend class QDeclarativeEngineDebugPrivate;
206     void setState(State);
207     State m_state;
208 };
209
210 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugFileReference 
211 {
212 public:
213     QDeclarativeDebugFileReference();
214     QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &);
215     QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &);
216
217     QUrl url() const;
218     void setUrl(const QUrl &);
219     int lineNumber() const;
220     void setLineNumber(int);
221     int columnNumber() const;
222     void setColumnNumber(int);
223
224 private:
225     friend class QDeclarativeEngineDebugPrivate;
226     QUrl m_url;
227     int m_lineNumber;
228     int m_columnNumber;
229 };
230
231 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEngineReference
232 {
233 public:
234     QDeclarativeDebugEngineReference();
235     QDeclarativeDebugEngineReference(int);
236     QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &);
237     QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &);
238
239     int debugId() const;
240     QString name() const;
241
242 private:
243     friend class QDeclarativeEngineDebugPrivate;
244     int m_debugId;
245     QString m_name;
246 };
247
248 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectReference
249 {
250 public:
251     QDeclarativeDebugObjectReference();
252     QDeclarativeDebugObjectReference(int);
253     QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &);
254     QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &);
255
256     int debugId() const;
257     QString className() const;
258     QString idString() const;
259     QString name() const;
260
261     QDeclarativeDebugFileReference source() const;
262     int contextDebugId() const;
263
264     QList<QDeclarativeDebugPropertyReference> properties() const;
265     QList<QDeclarativeDebugObjectReference> children() const;
266
267 private:
268     friend class QDeclarativeEngineDebugPrivate;
269     int m_debugId;
270     QString m_class;
271     QString m_idString;
272     QString m_name;
273     QDeclarativeDebugFileReference m_source;
274     int m_contextDebugId;
275     QList<QDeclarativeDebugPropertyReference> m_properties;
276     QList<QDeclarativeDebugObjectReference> m_children;
277 };
278
279 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugContextReference
280 {
281 public:
282     QDeclarativeDebugContextReference();
283     QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &);
284     QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &);
285
286     int debugId() const;
287     QString name() const;
288
289     QList<QDeclarativeDebugObjectReference> objects() const;
290     QList<QDeclarativeDebugContextReference> contexts() const;
291
292 private:
293     friend class QDeclarativeEngineDebugPrivate;
294     int m_debugId;
295     QString m_name;
296     QList<QDeclarativeDebugObjectReference> m_objects;
297     QList<QDeclarativeDebugContextReference> m_contexts;
298 };
299
300 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyReference
301 {
302 public:
303     QDeclarativeDebugPropertyReference();
304     QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &);
305     QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &);
306
307     int objectDebugId() const;
308     QString name() const;
309     QVariant value() const;
310     QString valueTypeName() const;
311     QString binding() const;
312     bool hasNotifySignal() const;
313
314 private:
315     friend class QDeclarativeEngineDebugPrivate;
316     int m_objectDebugId;
317     QString m_name;
318     QVariant m_value;
319     QString m_valueTypeName;
320     QString m_binding;
321     bool m_hasNotifySignal;
322 };
323
324
325 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery
326 {
327     Q_OBJECT
328 public:
329     virtual ~QDeclarativeDebugEnginesQuery();
330     QList<QDeclarativeDebugEngineReference> engines() const;
331 private:
332     friend class QDeclarativeEngineDebug;
333     friend class QDeclarativeEngineDebugPrivate;
334     QDeclarativeDebugEnginesQuery(QObject *);
335     QDeclarativeEngineDebug *m_client;
336     int m_queryId;
337     QList<QDeclarativeDebugEngineReference> m_engines;
338 };
339
340 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery
341 {
342     Q_OBJECT
343 public:
344     virtual ~QDeclarativeDebugRootContextQuery();
345     QDeclarativeDebugContextReference rootContext() const;
346 private:
347     friend class QDeclarativeEngineDebug;
348     friend class QDeclarativeEngineDebugPrivate;
349     QDeclarativeDebugRootContextQuery(QObject *);
350     QDeclarativeEngineDebug *m_client;
351     int m_queryId;
352     QDeclarativeDebugContextReference m_context;
353 };
354
355 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery
356 {
357     Q_OBJECT
358 public:
359     virtual ~QDeclarativeDebugObjectQuery();
360     QDeclarativeDebugObjectReference object() const;
361 private:
362     friend class QDeclarativeEngineDebug;
363     friend class QDeclarativeEngineDebugPrivate;
364     QDeclarativeDebugObjectQuery(QObject *);
365     QDeclarativeEngineDebug *m_client;
366     int m_queryId;
367     QDeclarativeDebugObjectReference m_object;
368
369 };
370
371 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery
372 {
373     Q_OBJECT
374 public:
375     virtual ~QDeclarativeDebugExpressionQuery();
376     QVariant expression() const;
377     QVariant result() const;
378 private:
379     friend class QDeclarativeEngineDebug;
380     friend class QDeclarativeEngineDebugPrivate;
381     QDeclarativeDebugExpressionQuery(QObject *);
382     QDeclarativeEngineDebug *m_client;
383     int m_queryId;
384     QVariant m_expr;
385     QVariant m_result;
386 };
387
388 QT_END_NAMESPACE
389
390 Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference)
391 Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
392 Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
393 Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
394
395 QT_END_HEADER
396
397 #endif // QDECLARATIVEENGINEDEBUG_H