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;
68
69#if !QT_CONFIG(qml_debug)
70
71class QV4DebugService
72{
73public:
74 void signalEmitted(const QString &) {}
75};
76
77class QQmlProfilerService
78{
79public:
80 void startProfiling(QJSEngine *engine, quint64 features = std::numeric_limits<quint64>::max())
81 {
82 Q_UNUSED(engine);
83 Q_UNUSED(features);
84 }
85
86 void stopProfiling(QJSEngine *) {}
87};
88
89class QQmlEngineDebugService
90{
91public:
92 void objectCreated(QJSEngine *, QObject *) {}
93 virtual void setStatesDelegate(QQmlDebugStatesDelegate *) {}
94};
95
96class QQmlInspectorService {
97public:
98 void addWindow(QQuickWindow *) {}
99 void setParentWindow(QQuickWindow *, QWindow *) {}
100 void removeWindow(QQuickWindow *) {}
101};
102
103class QDebugMessageService {};
104class QQmlEngineControlService {};
105class QQmlNativeDebugService {};
106
107#else
108
109class Q_QML_PRIVATE_EXPORT QV4DebugService : public QQmlDebugService
110{
111 Q_OBJECT
112public:
113 static const QString s_key;
114
115 virtual void signalEmitted(const QString &signal) = 0;
116
117protected:
118 friend class QQmlDebugConnector;
119
120 QV4DebugService(float version, QObject *parent = nullptr) :
121 QQmlDebugService(s_key, version, parent) {}
122};
123
124class QQmlAbstractProfilerAdapter;
125class Q_QML_PRIVATE_EXPORT QQmlProfilerService : public QQmlDebugService
126{
127 Q_OBJECT
128public:
129 static const QString s_key;
130
131 virtual void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) = 0;
132 virtual void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) = 0;
133
134 virtual void startProfiling(QJSEngine *engine,
135 quint64 features = std::numeric_limits<quint64>::max()) = 0;
136 virtual void stopProfiling(QJSEngine *engine) = 0;
137
138 virtual void dataReady(QQmlAbstractProfilerAdapter *profiler) = 0;
139
140protected:
141 friend class QQmlDebugConnector;
142
143 QQmlProfilerService(float version, QObject *parent = nullptr) :
144 QQmlDebugService(s_key, version, parent) {}
145};
146
147class Q_QML_PRIVATE_EXPORT QQmlEngineDebugService : public QQmlDebugService
148{
149 Q_OBJECT
150public:
151 static const QString s_key;
152
153 virtual void objectCreated(QJSEngine *engine, QObject *object) = 0;
154 virtual void setStatesDelegate(QQmlDebugStatesDelegate *) = 0;
155
156protected:
157 friend class QQmlDebugConnector;
158
159 QQmlEngineDebugService(float version, QObject *parent = nullptr) :
160 QQmlDebugService(s_key, version, parent) {}
161
162 QQmlBoundSignal *nextSignal(QQmlBoundSignal *prev) { return prev->m_nextSignal; }
163};
164
165class Q_QML_PRIVATE_EXPORT QQmlInspectorService : public QQmlDebugService
166{
167 Q_OBJECT
168public:
169 static const QString s_key;
170
171 virtual void addWindow(QQuickWindow *) = 0;
172 virtual void setParentWindow(QQuickWindow *, QWindow *) = 0;
173 virtual void removeWindow(QQuickWindow *) = 0;
174
175protected:
176 friend class QQmlDebugConnector;
177
178 QQmlInspectorService(float version, QObject *parent = nullptr) :
179 QQmlDebugService(s_key, version, parent) {}
180};
181
182class Q_QML_PRIVATE_EXPORT QDebugMessageService : public QQmlDebugService
183{
184 Q_OBJECT
185public:
186 static const QString s_key;
187
188 virtual void synchronizeTime(const QElapsedTimer &otherTimer) = 0;
189
190protected:
191 friend class QQmlDebugConnector;
192
193 QDebugMessageService(float version, QObject *parent = nullptr) :
194 QQmlDebugService(s_key, version, parent) {}
195};
196
197class Q_QML_PRIVATE_EXPORT QQmlEngineControlService : public QQmlDebugService
198{
199 Q_OBJECT
200public:
201 static const QString s_key;
202
203protected:
204 friend class QQmlDebugConnector;
205
206 QQmlEngineControlService(float version, QObject *parent = nullptr) :
207 QQmlDebugService(s_key, version, parent) {}
208
209};
210
211class Q_QML_PRIVATE_EXPORT QQmlNativeDebugService : public QQmlDebugService
212{
213 Q_OBJECT
214public:
215 static const QString s_key;
216
217protected:
218 friend class QQmlDebugConnector;
219
220 QQmlNativeDebugService(float version, QObject *parent = nullptr)
221 : QQmlDebugService(s_key, version, parent) {}
222};
223
224#endif
225
226QT_END_NAMESPACE
227
228#endif // QQMLDEBUGSERVICEINTERFACES_P_H
229
230