| 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 | |
| 64 | QT_BEGIN_NAMESPACE |
| 65 | |
| 66 | class QWindow; |
| 67 | class QQuickWindow; |
| 68 | class QQmlTranslationBinding; |
| 69 | |
| 70 | #if !QT_CONFIG(qml_debug) |
| 71 | |
| 72 | class QV4DebugService |
| 73 | { |
| 74 | public: |
| 75 | void signalEmitted(const QString &) {} |
| 76 | }; |
| 77 | |
| 78 | class QQmlProfilerService |
| 79 | { |
| 80 | public: |
| 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 | |
| 90 | class QQmlEngineDebugService |
| 91 | { |
| 92 | public: |
| 93 | void objectCreated(QJSEngine *, QObject *) {} |
| 94 | virtual void setStatesDelegate(QQmlDebugStatesDelegate *) {} |
| 95 | }; |
| 96 | |
| 97 | class QQmlInspectorService { |
| 98 | public: |
| 99 | void addWindow(QQuickWindow *) {} |
| 100 | void setParentWindow(QQuickWindow *, QWindow *) {} |
| 101 | void removeWindow(QQuickWindow *) {} |
| 102 | }; |
| 103 | |
| 104 | class QDebugMessageService {}; |
| 105 | class QQmlEngineControlService {}; |
| 106 | class QQmlNativeDebugService {}; |
| 107 | class QQmlDebugTranslationService { |
| 108 | public: |
| 109 | virtual QString foundElidedText(QObject *, const QString &, const QString &) {return {};} |
| 110 | virtual void foundTranslationBinding(QQmlTranslationBinding *, QObject *, QQmlContextData *) {} |
| 111 | }; |
| 112 | |
| 113 | #else |
| 114 | |
| 115 | class Q_QML_PRIVATE_EXPORT QV4DebugService : public QQmlDebugService |
| 116 | { |
| 117 | Q_OBJECT |
| 118 | public: |
| 119 | static const QString s_key; |
| 120 | |
| 121 | virtual void signalEmitted(const QString &signal) = 0; |
| 122 | |
| 123 | protected: |
| 124 | friend class QQmlDebugConnector; |
| 125 | |
| 126 | QV4DebugService(float version, QObject *parent = nullptr) : |
| 127 | QQmlDebugService(s_key, version, parent) {} |
| 128 | }; |
| 129 | |
| 130 | class QQmlAbstractProfilerAdapter; |
| 131 | class Q_QML_PRIVATE_EXPORT QQmlProfilerService : public QQmlDebugService |
| 132 | { |
| 133 | Q_OBJECT |
| 134 | public: |
| 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 | |
| 146 | protected: |
| 147 | friend class QQmlDebugConnector; |
| 148 | |
| 149 | QQmlProfilerService(float version, QObject *parent = nullptr) : |
| 150 | QQmlDebugService(s_key, version, parent) {} |
| 151 | }; |
| 152 | |
| 153 | class Q_QML_PRIVATE_EXPORT QQmlEngineDebugService : public QQmlDebugService |
| 154 | { |
| 155 | Q_OBJECT |
| 156 | public: |
| 157 | static const QString s_key; |
| 158 | |
| 159 | virtual void objectCreated(QJSEngine *engine, QObject *object) = 0; |
| 160 | virtual void setStatesDelegate(QQmlDebugStatesDelegate *) = 0; |
| 161 | |
| 162 | protected: |
| 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 | |
| 171 | class Q_QML_PRIVATE_EXPORT QQmlDebugTranslationService : public QQmlDebugService |
| 172 | { |
| 173 | Q_OBJECT |
| 174 | public: |
| 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; |
| 179 | protected: |
| 180 | friend class QQmlDebugConnector; |
| 181 | |
| 182 | QQmlDebugTranslationService(float version, QObject *parent = nullptr) : |
| 183 | QQmlDebugService(s_key, version, parent) {} |
| 184 | |
| 185 | }; |
| 186 | |
| 187 | class Q_QML_PRIVATE_EXPORT QQmlInspectorService : public QQmlDebugService |
| 188 | { |
| 189 | Q_OBJECT |
| 190 | public: |
| 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 | |
| 197 | protected: |
| 198 | friend class QQmlDebugConnector; |
| 199 | |
| 200 | QQmlInspectorService(float version, QObject *parent = nullptr) : |
| 201 | QQmlDebugService(s_key, version, parent) {} |
| 202 | }; |
| 203 | |
| 204 | class Q_QML_PRIVATE_EXPORT QDebugMessageService : public QQmlDebugService |
| 205 | { |
| 206 | Q_OBJECT |
| 207 | public: |
| 208 | static const QString s_key; |
| 209 | |
| 210 | virtual void synchronizeTime(const QElapsedTimer &otherTimer) = 0; |
| 211 | |
| 212 | protected: |
| 213 | friend class QQmlDebugConnector; |
| 214 | |
| 215 | QDebugMessageService(float version, QObject *parent = nullptr) : |
| 216 | QQmlDebugService(s_key, version, parent) {} |
| 217 | }; |
| 218 | |
| 219 | class Q_QML_PRIVATE_EXPORT QQmlEngineControlService : public QQmlDebugService |
| 220 | { |
| 221 | Q_OBJECT |
| 222 | public: |
| 223 | static const QString s_key; |
| 224 | |
| 225 | protected: |
| 226 | friend class QQmlDebugConnector; |
| 227 | |
| 228 | QQmlEngineControlService(float version, QObject *parent = nullptr) : |
| 229 | QQmlDebugService(s_key, version, parent) {} |
| 230 | |
| 231 | }; |
| 232 | |
| 233 | class Q_QML_PRIVATE_EXPORT QQmlNativeDebugService : public QQmlDebugService |
| 234 | { |
| 235 | Q_OBJECT |
| 236 | public: |
| 237 | static const QString s_key; |
| 238 | |
| 239 | protected: |
| 240 | friend class QQmlDebugConnector; |
| 241 | |
| 242 | QQmlNativeDebugService(float version, QObject *parent = nullptr) |
| 243 | : QQmlDebugService(s_key, version, parent) {} |
| 244 | }; |
| 245 | |
| 246 | #endif |
| 247 | |
| 248 | QT_END_NAMESPACE |
| 249 | |
| 250 | #endif // QQMLDEBUGSERVICEINTERFACES_P_H |
| 251 | |
| 252 | |