1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QDECLARATIVEENGINEDEBUG_H
43 #define QDECLARATIVEENGINEDEBUG_H
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.
56 #include <QtCore/qobject.h>
57 #include <QtCore/qurl.h>
58 #include <QtCore/qvariant.h>
60 #include <private/qdeclarativeglobal_p.h>
66 QT_MODULE(Declarative)
68 class QDeclarativeDebugConnection;
69 class QDeclarativeDebugWatch;
70 class QDeclarativeDebugPropertyWatch;
71 class QDeclarativeDebugObjectExpressionWatch;
72 class QDeclarativeDebugEnginesQuery;
73 class QDeclarativeDebugRootContextQuery;
74 class QDeclarativeDebugObjectQuery;
75 class QDeclarativeDebugExpressionQuery;
76 class QDeclarativeDebugPropertyReference;
77 class QDeclarativeDebugContextReference;
78 class QDeclarativeDebugObjectReference;
79 class QDeclarativeDebugFileReference;
80 class QDeclarativeDebugEngineReference;
81 class QDeclarativeEngineDebugPrivate;
82 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeEngineDebug : public QObject
86 enum Status { NotConnected, Unavailable, Enabled };
88 explicit QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0);
89 ~QDeclarativeEngineDebug();
91 Status status() const;
93 QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &,
95 QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &,
97 QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &,
99 QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &,
100 QObject *parent = 0);
101 QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &,
102 QObject *parent = 0);
104 void removeWatch(QDeclarativeDebugWatch *watch);
106 QDeclarativeDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
107 QDeclarativeDebugRootContextQuery *queryRootContexts(const QDeclarativeDebugEngineReference &,
108 QObject *parent = 0);
109 QDeclarativeDebugObjectQuery *queryObject(const QDeclarativeDebugObjectReference &,
110 QObject *parent = 0);
111 QDeclarativeDebugObjectQuery *queryObjectRecursive(const QDeclarativeDebugObjectReference &,
112 QObject *parent = 0);
113 QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId,
115 QObject *parent = 0);
116 bool setBindingForObject(int objectDebugId, const QString &propertyName,
117 const QVariant &bindingExpression, bool isLiteralValue,
118 QString source = QString(), int line = -1);
119 bool resetBindingForObject(int objectDebugId, const QString &propertyName);
120 bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
124 void statusChanged(Status status);
127 Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
130 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugWatch : public QObject
134 enum State { Waiting, Active, Inactive, Dead };
136 QDeclarativeDebugWatch(QObject *);
137 ~QDeclarativeDebugWatch();
140 int objectDebugId() const;
144 void stateChanged(QDeclarativeDebugWatch::State);
145 //void objectChanged(int, const QDeclarativeDebugObjectReference &);
146 //void valueChanged(int, const QVariant &);
148 // Server sends value as string if it is a user-type variant
149 void valueChanged(const QByteArray &name, const QVariant &value);
152 friend class QDeclarativeEngineDebug;
153 friend class QDeclarativeEngineDebugPrivate;
154 void setState(State);
157 QDeclarativeEngineDebug *m_client;
161 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch
165 QDeclarativeDebugPropertyWatch(QObject *parent);
167 QString name() const;
170 friend class QDeclarativeEngineDebug;
174 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch
178 QDeclarativeDebugObjectExpressionWatch(QObject *parent);
180 QString expression() const;
183 friend class QDeclarativeEngineDebug;
189 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugQuery : public QObject
193 enum State { Waiting, Error, Completed };
196 bool isWaiting() const;
199 void stateChanged(QDeclarativeDebugQuery::State);
202 QDeclarativeDebugQuery(QObject *);
205 friend class QDeclarativeEngineDebug;
206 friend class QDeclarativeEngineDebugPrivate;
207 void setState(State);
211 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugFileReference
214 QDeclarativeDebugFileReference();
215 QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &);
216 QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &);
219 void setUrl(const QUrl &);
220 int lineNumber() const;
221 void setLineNumber(int);
222 int columnNumber() const;
223 void setColumnNumber(int);
226 friend class QDeclarativeEngineDebugPrivate;
232 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEngineReference
235 QDeclarativeDebugEngineReference();
236 QDeclarativeDebugEngineReference(int);
237 QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &);
238 QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &);
241 QString name() const;
244 friend class QDeclarativeEngineDebugPrivate;
249 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectReference
252 QDeclarativeDebugObjectReference();
253 QDeclarativeDebugObjectReference(int);
254 QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &);
255 QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &);
258 QString className() const;
259 QString idString() const;
260 QString name() const;
262 QDeclarativeDebugFileReference source() const;
263 int contextDebugId() const;
265 QList<QDeclarativeDebugPropertyReference> properties() const;
266 QList<QDeclarativeDebugObjectReference> children() const;
269 friend class QDeclarativeEngineDebugPrivate;
274 QDeclarativeDebugFileReference m_source;
275 int m_contextDebugId;
276 QList<QDeclarativeDebugPropertyReference> m_properties;
277 QList<QDeclarativeDebugObjectReference> m_children;
280 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugContextReference
283 QDeclarativeDebugContextReference();
284 QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &);
285 QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &);
288 QString name() const;
290 QList<QDeclarativeDebugObjectReference> objects() const;
291 QList<QDeclarativeDebugContextReference> contexts() const;
294 friend class QDeclarativeEngineDebugPrivate;
297 QList<QDeclarativeDebugObjectReference> m_objects;
298 QList<QDeclarativeDebugContextReference> m_contexts;
301 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyReference
304 QDeclarativeDebugPropertyReference();
305 QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &);
306 QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &);
308 int objectDebugId() const;
309 QString name() const;
310 QVariant value() const;
311 QString valueTypeName() const;
312 QString binding() const;
313 bool hasNotifySignal() const;
316 friend class QDeclarativeEngineDebugPrivate;
320 QString m_valueTypeName;
322 bool m_hasNotifySignal;
326 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery
330 virtual ~QDeclarativeDebugEnginesQuery();
331 QList<QDeclarativeDebugEngineReference> engines() const;
333 friend class QDeclarativeEngineDebug;
334 friend class QDeclarativeEngineDebugPrivate;
335 QDeclarativeDebugEnginesQuery(QObject *);
336 QDeclarativeEngineDebug *m_client;
338 QList<QDeclarativeDebugEngineReference> m_engines;
341 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery
345 virtual ~QDeclarativeDebugRootContextQuery();
346 QDeclarativeDebugContextReference rootContext() const;
348 friend class QDeclarativeEngineDebug;
349 friend class QDeclarativeEngineDebugPrivate;
350 QDeclarativeDebugRootContextQuery(QObject *);
351 QDeclarativeEngineDebug *m_client;
353 QDeclarativeDebugContextReference m_context;
356 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery
360 virtual ~QDeclarativeDebugObjectQuery();
361 QDeclarativeDebugObjectReference object() const;
363 friend class QDeclarativeEngineDebug;
364 friend class QDeclarativeEngineDebugPrivate;
365 QDeclarativeDebugObjectQuery(QObject *);
366 QDeclarativeEngineDebug *m_client;
368 QDeclarativeDebugObjectReference m_object;
372 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery
376 virtual ~QDeclarativeDebugExpressionQuery();
377 QVariant expression() const;
378 QVariant result() const;
380 friend class QDeclarativeEngineDebug;
381 friend class QDeclarativeEngineDebugPrivate;
382 QDeclarativeDebugExpressionQuery(QObject *);
383 QDeclarativeEngineDebug *m_client;
391 Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference)
392 Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
393 Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
394 Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
398 #endif // QDECLARATIVEENGINEDEBUG_H