1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
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>
67 class QDeclarativeDebugConnection;
68 class QDeclarativeDebugWatch;
69 class QDeclarativeDebugPropertyWatch;
70 class QDeclarativeDebugObjectExpressionWatch;
71 class QDeclarativeDebugEnginesQuery;
72 class QDeclarativeDebugRootContextQuery;
73 class QDeclarativeDebugObjectQuery;
74 class QDeclarativeDebugExpressionQuery;
75 class QDeclarativeDebugPropertyReference;
76 class QDeclarativeDebugContextReference;
77 class QDeclarativeDebugObjectReference;
78 class QDeclarativeDebugFileReference;
79 class QDeclarativeDebugEngineReference;
80 class QDeclarativeEngineDebugPrivate;
81 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeEngineDebug : public QObject
85 enum Status { NotConnected, Unavailable, Enabled };
87 explicit QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0);
88 ~QDeclarativeEngineDebug();
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;
198 void stateChanged(QDeclarativeDebugQuery::State);
201 QDeclarativeDebugQuery(QObject *);
204 friend class QDeclarativeEngineDebug;
205 friend class QDeclarativeEngineDebugPrivate;
206 void setState(State);
210 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugFileReference
213 QDeclarativeDebugFileReference();
214 QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &);
215 QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &);
218 void setUrl(const QUrl &);
219 int lineNumber() const;
220 void setLineNumber(int);
221 int columnNumber() const;
222 void setColumnNumber(int);
225 friend class QDeclarativeEngineDebugPrivate;
231 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEngineReference
234 QDeclarativeDebugEngineReference();
235 QDeclarativeDebugEngineReference(int);
236 QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &);
237 QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &);
240 QString name() const;
243 friend class QDeclarativeEngineDebugPrivate;
248 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectReference
251 QDeclarativeDebugObjectReference();
252 QDeclarativeDebugObjectReference(int);
253 QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &);
254 QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &);
257 QString className() const;
258 QString idString() const;
259 QString name() const;
261 QDeclarativeDebugFileReference source() const;
262 int contextDebugId() const;
264 QList<QDeclarativeDebugPropertyReference> properties() const;
265 QList<QDeclarativeDebugObjectReference> children() const;
268 friend class QDeclarativeEngineDebugPrivate;
273 QDeclarativeDebugFileReference m_source;
274 int m_contextDebugId;
275 QList<QDeclarativeDebugPropertyReference> m_properties;
276 QList<QDeclarativeDebugObjectReference> m_children;
279 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugContextReference
282 QDeclarativeDebugContextReference();
283 QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &);
284 QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &);
287 QString name() const;
289 QList<QDeclarativeDebugObjectReference> objects() const;
290 QList<QDeclarativeDebugContextReference> contexts() const;
293 friend class QDeclarativeEngineDebugPrivate;
296 QList<QDeclarativeDebugObjectReference> m_objects;
297 QList<QDeclarativeDebugContextReference> m_contexts;
300 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyReference
303 QDeclarativeDebugPropertyReference();
304 QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &);
305 QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &);
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 QDeclarativeEngineDebugPrivate;
319 QString m_valueTypeName;
321 bool m_hasNotifySignal;
325 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery
329 virtual ~QDeclarativeDebugEnginesQuery();
330 QList<QDeclarativeDebugEngineReference> engines() const;
332 friend class QDeclarativeEngineDebug;
333 friend class QDeclarativeEngineDebugPrivate;
334 QDeclarativeDebugEnginesQuery(QObject *);
335 QDeclarativeEngineDebug *m_client;
337 QList<QDeclarativeDebugEngineReference> m_engines;
340 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery
344 virtual ~QDeclarativeDebugRootContextQuery();
345 QDeclarativeDebugContextReference rootContext() const;
347 friend class QDeclarativeEngineDebug;
348 friend class QDeclarativeEngineDebugPrivate;
349 QDeclarativeDebugRootContextQuery(QObject *);
350 QDeclarativeEngineDebug *m_client;
352 QDeclarativeDebugContextReference m_context;
355 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery
359 virtual ~QDeclarativeDebugObjectQuery();
360 QDeclarativeDebugObjectReference object() const;
362 friend class QDeclarativeEngineDebug;
363 friend class QDeclarativeEngineDebugPrivate;
364 QDeclarativeDebugObjectQuery(QObject *);
365 QDeclarativeEngineDebug *m_client;
367 QDeclarativeDebugObjectReference m_object;
371 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery
375 virtual ~QDeclarativeDebugExpressionQuery();
376 QVariant expression() const;
377 QVariant result() const;
379 friend class QDeclarativeEngineDebug;
380 friend class QDeclarativeEngineDebugPrivate;
381 QDeclarativeDebugExpressionQuery(QObject *);
382 QDeclarativeEngineDebug *m_client;
390 Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference)
391 Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
392 Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
393 Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
397 #endif // QDECLARATIVEENGINEDEBUG_H