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