1/****************************************************************************
2**
3** Copyright (C) 2018 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtQml module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef QQMLENGINEDEBUGCLIENT_H
30#define QQMLENGINEDEBUGCLIENT_H
31
32//
33// W A R N I N G
34// -------------
35//
36// This file is not part of the Qt API. It exists purely as an
37// implementation detail. This header file may change from version to
38// version without notice, or even be removed.
39//
40// We mean it.
41//
42
43#include <private/qqmldebugclient_p.h>
44#include <private/qpacket_p.h>
45
46#include <QtCore/qurl.h>
47#include <QtCore/qvariant.h>
48
49QT_BEGIN_NAMESPACE
50
51struct QQmlEngineDebugPropertyReference
52{
53 qint32 objectDebugId = -1;
54 QString name;
55 QVariant value;
56 QString valueTypeName;
57 QString binding;
58 bool hasNotifySignal = false;
59};
60
61struct QQmlEngineDebugFileReference
62{
63 QUrl url;
64 qint32 lineNumber = -1;
65 qint32 columnNumber = -1;
66};
67
68struct QQmlEngineDebugObjectReference
69{
70 qint32 debugId = -1;
71 QString className;
72 QString idString;
73 QString name;
74 QQmlEngineDebugFileReference source;
75 qint32 contextDebugId = -1;
76 QList<QQmlEngineDebugPropertyReference> properties;
77 QList<QQmlEngineDebugObjectReference> children;
78};
79
80struct QQmlEngineDebugContextReference
81{
82 qint32 debugId = -1;
83 QString name;
84 QList<QQmlEngineDebugObjectReference> objects;
85 QList<QQmlEngineDebugContextReference> contexts;
86};
87
88struct QQmlEngineDebugEngineReference
89{
90 qint32 debugId = -1;
91 QString name;
92};
93
94class QQmlEngineDebugClientPrivate;
95class QQmlEngineDebugClient : public QQmlDebugClient
96{
97 Q_OBJECT
98 Q_DECLARE_PRIVATE(QQmlEngineDebugClient)
99
100public:
101 explicit QQmlEngineDebugClient(QQmlDebugConnection *conn);
102
103 qint32 addWatch(const QQmlEngineDebugPropertyReference &,
104 bool *success);
105 qint32 addWatch(const QQmlEngineDebugContextReference &, const QString &,
106 bool *success);
107 qint32 addWatch(const QQmlEngineDebugObjectReference &, const QString &,
108 bool *success);
109 qint32 addWatch(const QQmlEngineDebugObjectReference &,
110 bool *success);
111 qint32 addWatch(const QQmlEngineDebugFileReference &,
112 bool *success);
113
114 void removeWatch(qint32 watch, bool *success);
115
116 qint32 queryAvailableEngines(bool *success);
117 qint32 queryRootContexts(const QQmlEngineDebugEngineReference &,
118 bool *success);
119 qint32 queryObject(const QQmlEngineDebugObjectReference &,
120 bool *success);
121 qint32 queryObjectsForLocation(const QString &file,
122 qint32 lineNumber, qint32 columnNumber, bool *success);
123 qint32 queryObjectRecursive(const QQmlEngineDebugObjectReference &,
124 bool *success);
125 qint32 queryObjectsForLocationRecursive(const QString &file,
126 qint32 lineNumber, qint32 columnNumber, bool *success);
127 qint32 queryExpressionResult(qint32 objectDebugId,
128 const QString &expr,
129 bool *success);
130 qint32 queryExpressionResultBC(qint32 objectDebugId,
131 const QString &expr,
132 bool *success);
133 qint32 setBindingForObject(qint32 objectDebugId, const QString &propertyName,
134 const QVariant &bindingExpression,
135 bool isLiteralValue,
136 const QString &source, qint32 line, bool *success);
137 qint32 resetBindingForObject(qint32 objectDebugId,
138 const QString &propertyName, bool *success);
139 qint32 setMethodBody(qint32 objectDebugId, const QString &methodName,
140 const QString &methodBody, bool *success);
141
142 qint32 getId();
143
144 void decode(QPacket &ds, QQmlEngineDebugContextReference &);
145 void decode(QPacket &ds, QQmlEngineDebugObjectReference &, bool simple);
146 void decode(QPacket &ds, QList<QQmlEngineDebugObjectReference> &o, bool simple);
147
148 QList<QQmlEngineDebugEngineReference> engines() const;
149 QQmlEngineDebugContextReference rootContext() const;
150 QQmlEngineDebugObjectReference object() const;
151 QList<QQmlEngineDebugObjectReference> objects() const;
152 QVariant resultExpr() const;
153 bool valid() const;
154
155signals:
156 void newObject(qint32 objectId);
157 void valueChanged(QByteArray,QVariant);
158 void result();
159
160protected:
161 void messageReceived(const QByteArray &) override;
162};
163
164QT_END_NAMESPACE
165
166Q_DECLARE_METATYPE(QQmlEngineDebugObjectReference)
167
168#endif // QQMLENGINEDEBUGCLIENT_H
169

source code of qtdeclarative/src/qmldebug/qqmlenginedebugclient_p.h