1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtQml module of the Qt Toolkit.
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.
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.
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.
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.
40 ****************************************************************************/
42 #ifndef QQMLENGINEDEBUG_H
43 #define QQMLENGINEDEBUG_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/qtqmlglobal_p.h>
62 class QQmlDebugConnection;
64 class QQmlDebugPropertyWatch;
65 class QQmlDebugObjectExpressionWatch;
66 class QQmlDebugEnginesQuery;
67 class QQmlDebugRootContextQuery;
68 class QQmlDebugObjectQuery;
69 class QQmlDebugExpressionQuery;
70 class QQmlDebugPropertyReference;
71 class QQmlDebugContextReference;
72 class QQmlDebugObjectReference;
73 class QQmlDebugFileReference;
74 class QQmlDebugEngineReference;
75 class QQmlEngineDebugPrivate;
76 class Q_QML_PRIVATE_EXPORT QQmlEngineDebug : public QObject
80 enum State { NotConnected, Unavailable, Enabled };
82 explicit QQmlEngineDebug(QQmlDebugConnection *, QObject * = 0);
87 QQmlDebugPropertyWatch *addWatch(const QQmlDebugPropertyReference &,
89 QQmlDebugWatch *addWatch(const QQmlDebugContextReference &, const QString &,
91 QQmlDebugObjectExpressionWatch *addWatch(const QQmlDebugObjectReference &, const QString &,
93 QQmlDebugWatch *addWatch(const QQmlDebugObjectReference &,
95 QQmlDebugWatch *addWatch(const QQmlDebugFileReference &,
98 void removeWatch(QQmlDebugWatch *watch);
100 QQmlDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
101 QQmlDebugRootContextQuery *queryRootContexts(const QQmlDebugEngineReference &,
102 QObject *parent = 0);
103 QQmlDebugObjectQuery *queryObject(const QQmlDebugObjectReference &,
104 QObject *parent = 0);
105 QQmlDebugObjectQuery *queryObjectRecursive(const QQmlDebugObjectReference &,
106 QObject *parent = 0);
107 QQmlDebugExpressionQuery *queryExpressionResult(int objectDebugId,
109 QObject *parent = 0);
110 bool setBindingForObject(int objectDebugId, const QString &propertyName,
111 const QVariant &bindingExpression, bool isLiteralValue,
112 QString source = QString(), int line = -1);
113 bool resetBindingForObject(int objectDebugId, const QString &propertyName);
114 bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
118 void stateChanged(State state);
121 Q_DECLARE_PRIVATE(QQmlEngineDebug)
124 class Q_QML_PRIVATE_EXPORT QQmlDebugWatch : public QObject
128 enum State { Waiting, Active, Inactive, Dead };
130 QQmlDebugWatch(QObject *);
134 int objectDebugId() const;
138 void stateChanged(QQmlDebugWatch::State);
139 //void objectChanged(int, const QQmlDebugObjectReference &);
140 //void valueChanged(int, const QVariant &);
142 // Server sends value as string if it is a user-type variant
143 void valueChanged(const QByteArray &name, const QVariant &value);
146 friend class QQmlEngineDebug;
147 friend class QQmlEngineDebugPrivate;
148 void setState(State);
151 QQmlEngineDebug *m_client;
155 class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyWatch : public QQmlDebugWatch
159 QQmlDebugPropertyWatch(QObject *parent);
161 QString name() const;
164 friend class QQmlEngineDebug;
168 class Q_QML_PRIVATE_EXPORT QQmlDebugObjectExpressionWatch : public QQmlDebugWatch
172 QQmlDebugObjectExpressionWatch(QObject *parent);
174 QString expression() const;
177 friend class QQmlEngineDebug;
183 class Q_QML_PRIVATE_EXPORT QQmlDebugQuery : public QObject
187 enum State { Waiting, Error, Completed };
190 bool isWaiting() const;
193 void stateChanged(QQmlDebugQuery::State);
196 QQmlDebugQuery(QObject *);
199 friend class QQmlEngineDebug;
200 friend class QQmlEngineDebugPrivate;
201 void setState(State);
205 class Q_QML_PRIVATE_EXPORT QQmlDebugFileReference
208 QQmlDebugFileReference();
209 QQmlDebugFileReference(const QQmlDebugFileReference &);
210 QQmlDebugFileReference &operator=(const QQmlDebugFileReference &);
213 void setUrl(const QUrl &);
214 int lineNumber() const;
215 void setLineNumber(int);
216 int columnNumber() const;
217 void setColumnNumber(int);
220 friend class QQmlEngineDebugPrivate;
226 class Q_QML_PRIVATE_EXPORT QQmlDebugEngineReference
229 QQmlDebugEngineReference();
230 QQmlDebugEngineReference(int);
231 QQmlDebugEngineReference(const QQmlDebugEngineReference &);
232 QQmlDebugEngineReference &operator=(const QQmlDebugEngineReference &);
235 QString name() const;
238 friend class QQmlEngineDebugPrivate;
243 class Q_QML_PRIVATE_EXPORT QQmlDebugObjectReference
246 QQmlDebugObjectReference();
247 QQmlDebugObjectReference(int);
248 QQmlDebugObjectReference(const QQmlDebugObjectReference &);
249 QQmlDebugObjectReference &operator=(const QQmlDebugObjectReference &);
252 QString className() const;
253 QString idString() const;
254 QString name() const;
256 QQmlDebugFileReference source() const;
257 int contextDebugId() const;
259 QList<QQmlDebugPropertyReference> properties() const;
260 QList<QQmlDebugObjectReference> children() const;
263 friend class QQmlEngineDebugPrivate;
268 QQmlDebugFileReference m_source;
269 int m_contextDebugId;
270 QList<QQmlDebugPropertyReference> m_properties;
271 QList<QQmlDebugObjectReference> m_children;
274 class Q_QML_PRIVATE_EXPORT QQmlDebugContextReference
277 QQmlDebugContextReference();
278 QQmlDebugContextReference(const QQmlDebugContextReference &);
279 QQmlDebugContextReference &operator=(const QQmlDebugContextReference &);
282 QString name() const;
284 QList<QQmlDebugObjectReference> objects() const;
285 QList<QQmlDebugContextReference> contexts() const;
288 friend class QQmlEngineDebugPrivate;
291 QList<QQmlDebugObjectReference> m_objects;
292 QList<QQmlDebugContextReference> m_contexts;
295 class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyReference
298 QQmlDebugPropertyReference();
299 QQmlDebugPropertyReference(const QQmlDebugPropertyReference &);
300 QQmlDebugPropertyReference &operator=(const QQmlDebugPropertyReference &);
302 int objectDebugId() const;
303 QString name() const;
304 QVariant value() const;
305 QString valueTypeName() const;
306 QString binding() const;
307 bool hasNotifySignal() const;
310 friend class QQmlEngineDebugPrivate;
314 QString m_valueTypeName;
316 bool m_hasNotifySignal;
320 class Q_QML_PRIVATE_EXPORT QQmlDebugEnginesQuery : public QQmlDebugQuery
324 virtual ~QQmlDebugEnginesQuery();
325 QList<QQmlDebugEngineReference> engines() const;
327 friend class QQmlEngineDebug;
328 friend class QQmlEngineDebugPrivate;
329 QQmlDebugEnginesQuery(QObject *);
330 QQmlEngineDebug *m_client;
332 QList<QQmlDebugEngineReference> m_engines;
335 class Q_QML_PRIVATE_EXPORT QQmlDebugRootContextQuery : public QQmlDebugQuery
339 virtual ~QQmlDebugRootContextQuery();
340 QQmlDebugContextReference rootContext() const;
342 friend class QQmlEngineDebug;
343 friend class QQmlEngineDebugPrivate;
344 QQmlDebugRootContextQuery(QObject *);
345 QQmlEngineDebug *m_client;
347 QQmlDebugContextReference m_context;
350 class Q_QML_PRIVATE_EXPORT QQmlDebugObjectQuery : public QQmlDebugQuery
354 virtual ~QQmlDebugObjectQuery();
355 QQmlDebugObjectReference object() const;
357 friend class QQmlEngineDebug;
358 friend class QQmlEngineDebugPrivate;
359 QQmlDebugObjectQuery(QObject *);
360 QQmlEngineDebug *m_client;
362 QQmlDebugObjectReference m_object;
366 class Q_QML_PRIVATE_EXPORT QQmlDebugExpressionQuery : public QQmlDebugQuery
370 virtual ~QQmlDebugExpressionQuery();
371 QVariant expression() const;
372 QVariant result() const;
374 friend class QQmlEngineDebug;
375 friend class QQmlEngineDebugPrivate;
376 QQmlDebugExpressionQuery(QObject *);
377 QQmlEngineDebug *m_client;
383 Q_DECLARE_METATYPE(QQmlDebugEngineReference)
384 Q_DECLARE_METATYPE(QQmlDebugObjectReference)
385 Q_DECLARE_METATYPE(QQmlDebugContextReference)
386 Q_DECLARE_METATYPE(QQmlDebugPropertyReference)
388 #endif // QQMLENGINEDEBUG_H