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>
67 class QQmlDebugConnection;
69 class QQmlDebugPropertyWatch;
70 class QQmlDebugObjectExpressionWatch;
71 class QQmlDebugEnginesQuery;
72 class QQmlDebugRootContextQuery;
73 class QQmlDebugObjectQuery;
74 class QQmlDebugExpressionQuery;
75 class QQmlDebugPropertyReference;
76 class QQmlDebugContextReference;
77 class QQmlDebugObjectReference;
78 class QQmlDebugFileReference;
79 class QQmlDebugEngineReference;
80 class QQmlEngineDebugPrivate;
81 class Q_QML_PRIVATE_EXPORT QQmlEngineDebug : public QObject
85 enum State { NotConnected, Unavailable, Enabled };
87 explicit QQmlEngineDebug(QQmlDebugConnection *, QObject * = 0);
92 QQmlDebugPropertyWatch *addWatch(const QQmlDebugPropertyReference &,
94 QQmlDebugWatch *addWatch(const QQmlDebugContextReference &, const QString &,
96 QQmlDebugObjectExpressionWatch *addWatch(const QQmlDebugObjectReference &, const QString &,
98 QQmlDebugWatch *addWatch(const QQmlDebugObjectReference &,
100 QQmlDebugWatch *addWatch(const QQmlDebugFileReference &,
101 QObject *parent = 0);
103 void removeWatch(QQmlDebugWatch *watch);
105 QQmlDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
106 QQmlDebugRootContextQuery *queryRootContexts(const QQmlDebugEngineReference &,
107 QObject *parent = 0);
108 QQmlDebugObjectQuery *queryObject(const QQmlDebugObjectReference &,
109 QObject *parent = 0);
110 QQmlDebugObjectQuery *queryObjectRecursive(const QQmlDebugObjectReference &,
111 QObject *parent = 0);
112 QQmlDebugExpressionQuery *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 stateChanged(State state);
126 Q_DECLARE_PRIVATE(QQmlEngineDebug)
129 class Q_QML_PRIVATE_EXPORT QQmlDebugWatch : public QObject
133 enum State { Waiting, Active, Inactive, Dead };
135 QQmlDebugWatch(QObject *);
139 int objectDebugId() const;
143 void stateChanged(QQmlDebugWatch::State);
144 //void objectChanged(int, const QQmlDebugObjectReference &);
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 QQmlEngineDebug;
152 friend class QQmlEngineDebugPrivate;
153 void setState(State);
156 QQmlEngineDebug *m_client;
160 class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyWatch : public QQmlDebugWatch
164 QQmlDebugPropertyWatch(QObject *parent);
166 QString name() const;
169 friend class QQmlEngineDebug;
173 class Q_QML_PRIVATE_EXPORT QQmlDebugObjectExpressionWatch : public QQmlDebugWatch
177 QQmlDebugObjectExpressionWatch(QObject *parent);
179 QString expression() const;
182 friend class QQmlEngineDebug;
188 class Q_QML_PRIVATE_EXPORT QQmlDebugQuery : public QObject
192 enum State { Waiting, Error, Completed };
195 bool isWaiting() const;
198 void stateChanged(QQmlDebugQuery::State);
201 QQmlDebugQuery(QObject *);
204 friend class QQmlEngineDebug;
205 friend class QQmlEngineDebugPrivate;
206 void setState(State);
210 class Q_QML_PRIVATE_EXPORT QQmlDebugFileReference
213 QQmlDebugFileReference();
214 QQmlDebugFileReference(const QQmlDebugFileReference &);
215 QQmlDebugFileReference &operator=(const QQmlDebugFileReference &);
218 void setUrl(const QUrl &);
219 int lineNumber() const;
220 void setLineNumber(int);
221 int columnNumber() const;
222 void setColumnNumber(int);
225 friend class QQmlEngineDebugPrivate;
231 class Q_QML_PRIVATE_EXPORT QQmlDebugEngineReference
234 QQmlDebugEngineReference();
235 QQmlDebugEngineReference(int);
236 QQmlDebugEngineReference(const QQmlDebugEngineReference &);
237 QQmlDebugEngineReference &operator=(const QQmlDebugEngineReference &);
240 QString name() const;
243 friend class QQmlEngineDebugPrivate;
248 class Q_QML_PRIVATE_EXPORT QQmlDebugObjectReference
251 QQmlDebugObjectReference();
252 QQmlDebugObjectReference(int);
253 QQmlDebugObjectReference(const QQmlDebugObjectReference &);
254 QQmlDebugObjectReference &operator=(const QQmlDebugObjectReference &);
257 QString className() const;
258 QString idString() const;
259 QString name() const;
261 QQmlDebugFileReference source() const;
262 int contextDebugId() const;
264 QList<QQmlDebugPropertyReference> properties() const;
265 QList<QQmlDebugObjectReference> children() const;
268 friend class QQmlEngineDebugPrivate;
273 QQmlDebugFileReference m_source;
274 int m_contextDebugId;
275 QList<QQmlDebugPropertyReference> m_properties;
276 QList<QQmlDebugObjectReference> m_children;
279 class Q_QML_PRIVATE_EXPORT QQmlDebugContextReference
282 QQmlDebugContextReference();
283 QQmlDebugContextReference(const QQmlDebugContextReference &);
284 QQmlDebugContextReference &operator=(const QQmlDebugContextReference &);
287 QString name() const;
289 QList<QQmlDebugObjectReference> objects() const;
290 QList<QQmlDebugContextReference> contexts() const;
293 friend class QQmlEngineDebugPrivate;
296 QList<QQmlDebugObjectReference> m_objects;
297 QList<QQmlDebugContextReference> m_contexts;
300 class Q_QML_PRIVATE_EXPORT QQmlDebugPropertyReference
303 QQmlDebugPropertyReference();
304 QQmlDebugPropertyReference(const QQmlDebugPropertyReference &);
305 QQmlDebugPropertyReference &operator=(const QQmlDebugPropertyReference &);
307 int objectDebugId() const;
308 QString name() const;
309 QVariant value() const;
310 QString valueTypeName() const;
311 QString binding() const;
312 bool hasNotifySignal() const;
315 friend class QQmlEngineDebugPrivate;
319 QString m_valueTypeName;
321 bool m_hasNotifySignal;
325 class Q_QML_PRIVATE_EXPORT QQmlDebugEnginesQuery : public QQmlDebugQuery
329 virtual ~QQmlDebugEnginesQuery();
330 QList<QQmlDebugEngineReference> engines() const;
332 friend class QQmlEngineDebug;
333 friend class QQmlEngineDebugPrivate;
334 QQmlDebugEnginesQuery(QObject *);
335 QQmlEngineDebug *m_client;
337 QList<QQmlDebugEngineReference> m_engines;
340 class Q_QML_PRIVATE_EXPORT QQmlDebugRootContextQuery : public QQmlDebugQuery
344 virtual ~QQmlDebugRootContextQuery();
345 QQmlDebugContextReference rootContext() const;
347 friend class QQmlEngineDebug;
348 friend class QQmlEngineDebugPrivate;
349 QQmlDebugRootContextQuery(QObject *);
350 QQmlEngineDebug *m_client;
352 QQmlDebugContextReference m_context;
355 class Q_QML_PRIVATE_EXPORT QQmlDebugObjectQuery : public QQmlDebugQuery
359 virtual ~QQmlDebugObjectQuery();
360 QQmlDebugObjectReference object() const;
362 friend class QQmlEngineDebug;
363 friend class QQmlEngineDebugPrivate;
364 QQmlDebugObjectQuery(QObject *);
365 QQmlEngineDebug *m_client;
367 QQmlDebugObjectReference m_object;
371 class Q_QML_PRIVATE_EXPORT QQmlDebugExpressionQuery : public QQmlDebugQuery
375 virtual ~QQmlDebugExpressionQuery();
376 QVariant expression() const;
377 QVariant result() const;
379 friend class QQmlEngineDebug;
380 friend class QQmlEngineDebugPrivate;
381 QQmlDebugExpressionQuery(QObject *);
382 QQmlEngineDebug *m_client;
390 Q_DECLARE_METATYPE(QQmlDebugEngineReference)
391 Q_DECLARE_METATYPE(QQmlDebugObjectReference)
392 Q_DECLARE_METATYPE(QQmlDebugContextReference)
393 Q_DECLARE_METATYPE(QQmlDebugPropertyReference)
397 #endif // QQMLENGINEDEBUG_H