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);
90 Status status() const;
92 QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &,
94 QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &,
96 QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &,
98 QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &,
100 QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &,
101 QObject *parent = 0);
103 void removeWatch(QDeclarativeDebugWatch *watch);
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,
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);
123 void statusChanged(Status status);
126 Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
129 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugWatch : public QObject
133 enum State { Waiting, Active, Inactive, Dead };
135 QDeclarativeDebugWatch(QObject *);
136 ~QDeclarativeDebugWatch();
139 int objectDebugId() const;
143 void stateChanged(QDeclarativeDebugWatch::State);
144 //void objectChanged(int, const QDeclarativeDebugObjectReference &);
145 //void valueChanged(int, const QVariant &);
147 // Server sends value as string if it is a user-type variant
148 void valueChanged(const QByteArray &name, const QVariant &value);
151 friend class QDeclarativeEngineDebug;
152 friend class QDeclarativeEngineDebugPrivate;
153 void setState(State);
156 QDeclarativeEngineDebug *m_client;
160 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch
164 QDeclarativeDebugPropertyWatch(QObject *parent);
166 QString name() const;
169 friend class QDeclarativeEngineDebug;
173 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch
177 QDeclarativeDebugObjectExpressionWatch(QObject *parent);
179 QString expression() const;
182 friend class QDeclarativeEngineDebug;
188 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugQuery : public QObject
192 enum State { Waiting, Error, Completed };
195 bool isWaiting() const;
197 // bool waitUntilCompleted();
200 void stateChanged(QDeclarativeDebugQuery::State);
203 QDeclarativeDebugQuery(QObject *);
206 friend class QDeclarativeEngineDebug;
207 friend class QDeclarativeEngineDebugPrivate;
208 void setState(State);
212 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugFileReference
215 QDeclarativeDebugFileReference();
216 QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &);
217 QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &);
220 void setUrl(const QUrl &);
221 int lineNumber() const;
222 void setLineNumber(int);
223 int columnNumber() const;
224 void setColumnNumber(int);
227 friend class QDeclarativeEngineDebugPrivate;
233 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEngineReference
236 QDeclarativeDebugEngineReference();
237 QDeclarativeDebugEngineReference(int);
238 QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &);
239 QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &);
242 QString name() const;
245 friend class QDeclarativeEngineDebugPrivate;
250 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectReference
253 QDeclarativeDebugObjectReference();
254 QDeclarativeDebugObjectReference(int);
255 QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &);
256 QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &);
259 QString className() const;
260 QString idString() const;
261 QString name() const;
263 QDeclarativeDebugFileReference source() const;
264 int contextDebugId() const;
266 QList<QDeclarativeDebugPropertyReference> properties() const;
267 QList<QDeclarativeDebugObjectReference> children() const;
270 friend class QDeclarativeEngineDebugPrivate;
275 QDeclarativeDebugFileReference m_source;
276 int m_contextDebugId;
277 QList<QDeclarativeDebugPropertyReference> m_properties;
278 QList<QDeclarativeDebugObjectReference> m_children;
281 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugContextReference
284 QDeclarativeDebugContextReference();
285 QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &);
286 QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &);
289 QString name() const;
291 QList<QDeclarativeDebugObjectReference> objects() const;
292 QList<QDeclarativeDebugContextReference> contexts() const;
295 friend class QDeclarativeEngineDebugPrivate;
298 QList<QDeclarativeDebugObjectReference> m_objects;
299 QList<QDeclarativeDebugContextReference> m_contexts;
302 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyReference
305 QDeclarativeDebugPropertyReference();
306 QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &);
307 QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &);
309 int objectDebugId() const;
310 QString name() const;
311 QVariant value() const;
312 QString valueTypeName() const;
313 QString binding() const;
314 bool hasNotifySignal() const;
317 friend class QDeclarativeEngineDebugPrivate;
321 QString m_valueTypeName;
323 bool m_hasNotifySignal;
327 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery
331 virtual ~QDeclarativeDebugEnginesQuery();
332 QList<QDeclarativeDebugEngineReference> engines() const;
334 friend class QDeclarativeEngineDebug;
335 friend class QDeclarativeEngineDebugPrivate;
336 QDeclarativeDebugEnginesQuery(QObject *);
337 QDeclarativeEngineDebug *m_client;
339 QList<QDeclarativeDebugEngineReference> m_engines;
342 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery
346 virtual ~QDeclarativeDebugRootContextQuery();
347 QDeclarativeDebugContextReference rootContext() const;
349 friend class QDeclarativeEngineDebug;
350 friend class QDeclarativeEngineDebugPrivate;
351 QDeclarativeDebugRootContextQuery(QObject *);
352 QDeclarativeEngineDebug *m_client;
354 QDeclarativeDebugContextReference m_context;
357 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery
361 virtual ~QDeclarativeDebugObjectQuery();
362 QDeclarativeDebugObjectReference object() const;
364 friend class QDeclarativeEngineDebug;
365 friend class QDeclarativeEngineDebugPrivate;
366 QDeclarativeDebugObjectQuery(QObject *);
367 QDeclarativeEngineDebug *m_client;
369 QDeclarativeDebugObjectReference m_object;
373 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery
377 virtual ~QDeclarativeDebugExpressionQuery();
378 QVariant expression() const;
379 QVariant result() const;
381 friend class QDeclarativeEngineDebug;
382 friend class QDeclarativeEngineDebugPrivate;
383 QDeclarativeDebugExpressionQuery(QObject *);
384 QDeclarativeEngineDebug *m_client;
392 Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference)
393 Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
394 Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
395 Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
399 #endif // QDECLARATIVEENGINEDEBUG_H