1/****************************************************************************
2**
3** Copyright (C) 2016 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:LGPL$
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 Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QQMLDEBUGSERVICEINTERFACES_P_H
41#define QQMLDEBUGSERVICEINTERFACES_P_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include <QtCore/qstring.h>
55#include <private/qtqmlglobal_p.h>
56#if QT_CONFIG(qml_debug)
57#include <private/qqmldebugservice_p.h>
58#endif
59#include <private/qqmldebugstatesdelegate_p.h>
60#include <private/qqmlboundsignal_p.h>
61
62#include <limits>
63
64QT_BEGIN_NAMESPACE
65
66class QWindow;
67class QQuickWindow;
68class QQmlTranslationBinding;
69
70#if !QT_CONFIG(qml_debug)
71
72class QV4DebugService
73{
74public:
75 void signalEmitted(const QString &) {}
76};
77
78class QQmlProfilerService
79{
80public:
81 void startProfiling(QJSEngine *engine, quint64 features = std::numeric_limits<quint64>::max())
82 {
83 Q_UNUSED(engine);
84 Q_UNUSED(features);
85 }
86
87 void stopProfiling(QJSEngine *) {}
88};
89
90class QQmlEngineDebugService
91{
92public:
93 void objectCreated(QJSEngine *, QObject *) {}
94 virtual void setStatesDelegate(QQmlDebugStatesDelegate *) {}
95};
96
97class QQmlInspectorService {
98public:
99 void addWindow(QQuickWindow *) {}
100 void setParentWindow(QQuickWindow *, QWindow *) {}
101 void removeWindow(QQuickWindow *) {}
102};
103
104class QDebugMessageService {};
105class QQmlEngineControlService {};
106class QQmlNativeDebugService {};
107class QQmlDebugTranslationService {
108public:
109 virtual QString foundElidedText(QObject *, const QString &, const QString &) {return {};}
110 virtual void foundTranslationBinding(QQmlTranslationBinding *, QObject *, QQmlContextData *) {}
111};
112
113#else
114
115class Q_QML_PRIVATE_EXPORT QV4DebugService : public QQmlDebugService
116{
117 Q_OBJECT
118public:
119 static const QString s_key;
120
121 virtual void signalEmitted(const QString &signal) = 0;
122
123protected:
124 friend class QQmlDebugConnector;
125
126 QV4DebugService(float version, QObject *parent = nullptr) :
127 QQmlDebugService(s_key, version, parent) {}
128};
129
130class QQmlAbstractProfilerAdapter;
131class Q_QML_PRIVATE_EXPORT QQmlProfilerService : public QQmlDebugService
132{
133 Q_OBJECT
134public:
135 static const QString s_key;
136
137 virtual void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) = 0;
138 virtual void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) = 0;
139
140 virtual void startProfiling(QJSEngine *engine,
141 quint64 features = std::numeric_limits<quint64>::max()) = 0;
142 virtual void stopProfiling(QJSEngine *engine) = 0;
143
144 virtual void dataReady(QQmlAbstractProfilerAdapter *profiler) = 0;
145
146protected:
147 friend class QQmlDebugConnector;
148
149 QQmlProfilerService(float version, QObject *parent = nullptr) :
150 QQmlDebugService(s_key, version, parent) {}
151};
152
153class Q_QML_PRIVATE_EXPORT QQmlEngineDebugService : public QQmlDebugService
154{
155 Q_OBJECT
156public:
157 static const QString s_key;
158
159 virtual void objectCreated(QJSEngine *engine, QObject *object) = 0;
160 virtual void setStatesDelegate(QQmlDebugStatesDelegate *) = 0;
161
162protected:
163 friend class QQmlDebugConnector;
164
165 QQmlEngineDebugService(float version, QObject *parent = nullptr) :
166 QQmlDebugService(s_key, version, parent) {}
167
168 QQmlBoundSignal *nextSignal(QQmlBoundSignal *prev) { return prev->m_nextSignal; }
169};
170
171class Q_QML_PRIVATE_EXPORT QQmlDebugTranslationService : public QQmlDebugService
172{
173 Q_OBJECT
174public:
175 static const QString s_key;
176
177 virtual QString foundElidedText(QObject *qQuickTextObject, const QString &layoutText, const QString &elideText) = 0;
178 virtual void foundTranslationBinding(QQmlTranslationBinding *binding, QObject *scopeObject, QQmlContextData *contextData) = 0;
179protected:
180 friend class QQmlDebugConnector;
181
182 QQmlDebugTranslationService(float version, QObject *parent = nullptr) :
183 QQmlDebugService(s_key, version, parent) {}
184
185};
186
187class Q_QML_PRIVATE_EXPORT QQmlInspectorService : public QQmlDebugService
188{
189 Q_OBJECT
190public:
191 static const QString s_key;
192
193 virtual void addWindow(QQuickWindow *) = 0;
194 virtual void setParentWindow(QQuickWindow *, QWindow *) = 0;
195 virtual void removeWindow(QQuickWindow *) = 0;
196
197protected:
198 friend class QQmlDebugConnector;
199
200 QQmlInspectorService(float version, QObject *parent = nullptr) :
201 QQmlDebugService(s_key, version, parent) {}
202};
203
204class Q_QML_PRIVATE_EXPORT QDebugMessageService : public QQmlDebugService
205{
206 Q_OBJECT
207public:
208 static const QString s_key;
209
210 virtual void synchronizeTime(const QElapsedTimer &otherTimer) = 0;
211
212protected:
213 friend class QQmlDebugConnector;
214
215 QDebugMessageService(float version, QObject *parent = nullptr) :
216 QQmlDebugService(s_key, version, parent) {}
217};
218
219class Q_QML_PRIVATE_EXPORT QQmlEngineControlService : public QQmlDebugService
220{
221 Q_OBJECT
222public:
223 static const QString s_key;
224
225protected:
226 friend class QQmlDebugConnector;
227
228 QQmlEngineControlService(float version, QObject *parent = nullptr) :
229 QQmlDebugService(s_key, version, parent) {}
230
231};
232
233class Q_QML_PRIVATE_EXPORT QQmlNativeDebugService : public QQmlDebugService
234{
235 Q_OBJECT
236public:
237 static const QString s_key;
238
239protected:
240 friend class QQmlDebugConnector;
241
242 QQmlNativeDebugService(float version, QObject *parent = nullptr)
243 : QQmlDebugService(s_key, version, parent) {}
244};
245
246#endif
247
248QT_END_NAMESPACE
249
250#endif // QQMLDEBUGSERVICEINTERFACES_P_H
251
252

source code of qtdeclarative/src/qml/debugger/qqmldebugserviceinterfaces_p.h