| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the QtDeclarative module of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 | #ifndef QDECLARATIVEDEBUG_H
|
|---|
| 42 | #define QDECLARATIVEDEBUG_H
|
|---|
| 43 |
|
|---|
| 44 | #include <QtCore/qobject.h>
|
|---|
| 45 | #include <QtCore/qurl.h>
|
|---|
| 46 | #include <QtCore/qvariant.h>
|
|---|
| 47 |
|
|---|
| 48 | #include <private/qdeclarativeglobal_p.h>
|
|---|
| 49 |
|
|---|
| 50 | QT_BEGIN_HEADER
|
|---|
| 51 |
|
|---|
| 52 | QT_BEGIN_NAMESPACE
|
|---|
| 53 |
|
|---|
| 54 | QT_MODULE(Declarative)
|
|---|
| 55 |
|
|---|
| 56 | class QDeclarativeDebugConnection;
|
|---|
| 57 | class QDeclarativeDebugWatch;
|
|---|
| 58 | class QDeclarativeDebugPropertyWatch;
|
|---|
| 59 | class QDeclarativeDebugObjectExpressionWatch;
|
|---|
| 60 | class QDeclarativeDebugEnginesQuery;
|
|---|
| 61 | class QDeclarativeDebugRootContextQuery;
|
|---|
| 62 | class QDeclarativeDebugObjectQuery;
|
|---|
| 63 | class QDeclarativeDebugExpressionQuery;
|
|---|
| 64 | class QDeclarativeDebugPropertyReference;
|
|---|
| 65 | class QDeclarativeDebugContextReference;
|
|---|
| 66 | class QDeclarativeDebugObjectReference;
|
|---|
| 67 | class QDeclarativeDebugFileReference;
|
|---|
| 68 | class QDeclarativeDebugEngineReference;
|
|---|
| 69 | class QDeclarativeEngineDebugPrivate;
|
|---|
| 70 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeEngineDebug : public QObject
|
|---|
| 71 | {
|
|---|
| 72 | Q_OBJECT
|
|---|
| 73 | public:
|
|---|
| 74 | enum Status { NotConnected, Unavailable, Enabled };
|
|---|
| 75 |
|
|---|
| 76 | explicit QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0);
|
|---|
| 77 |
|
|---|
| 78 | Status status() const;
|
|---|
| 79 |
|
|---|
| 80 | QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &,
|
|---|
| 81 | QObject *parent = 0);
|
|---|
| 82 | QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &,
|
|---|
| 83 | QObject *parent = 0);
|
|---|
| 84 | QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &,
|
|---|
| 85 | QObject *parent = 0);
|
|---|
| 86 | QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &,
|
|---|
| 87 | QObject *parent = 0);
|
|---|
| 88 | QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &,
|
|---|
| 89 | QObject *parent = 0);
|
|---|
| 90 |
|
|---|
| 91 | void removeWatch(QDeclarativeDebugWatch *watch);
|
|---|
| 92 |
|
|---|
| 93 | QDeclarativeDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
|
|---|
| 94 | QDeclarativeDebugRootContextQuery *queryRootContexts(const QDeclarativeDebugEngineReference &,
|
|---|
| 95 | QObject *parent = 0);
|
|---|
| 96 | QDeclarativeDebugObjectQuery *queryObject(const QDeclarativeDebugObjectReference &,
|
|---|
| 97 | QObject *parent = 0);
|
|---|
| 98 | QDeclarativeDebugObjectQuery *queryObjectRecursive(const QDeclarativeDebugObjectReference &,
|
|---|
| 99 | QObject *parent = 0);
|
|---|
| 100 | QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId,
|
|---|
| 101 | const QString &expr,
|
|---|
| 102 | QObject *parent = 0);
|
|---|
| 103 | bool setBindingForObject(int objectDebugId, const QString &propertyName,
|
|---|
| 104 | const QVariant &bindingExpression, bool isLiteralValue);
|
|---|
| 105 | bool resetBindingForObject(int objectDebugId, const QString &propertyName);
|
|---|
| 106 | bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
|
|---|
| 107 |
|
|---|
| 108 | Q_SIGNALS:
|
|---|
| 109 | void newObjects();
|
|---|
| 110 | void statusChanged(Status status);
|
|---|
| 111 |
|
|---|
| 112 | private:
|
|---|
| 113 | Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
|
|---|
| 114 | };
|
|---|
| 115 |
|
|---|
| 116 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugWatch : public QObject
|
|---|
| 117 | {
|
|---|
| 118 | Q_OBJECT
|
|---|
| 119 | public:
|
|---|
| 120 | enum State { Waiting, Active, Inactive, Dead };
|
|---|
| 121 |
|
|---|
| 122 | QDeclarativeDebugWatch(QObject *);
|
|---|
| 123 | ~QDeclarativeDebugWatch();
|
|---|
| 124 |
|
|---|
| 125 | int queryId() const;
|
|---|
| 126 | int objectDebugId() const;
|
|---|
| 127 | State state() const;
|
|---|
| 128 |
|
|---|
| 129 | Q_SIGNALS:
|
|---|
| 130 | void stateChanged(QDeclarativeDebugWatch::State);
|
|---|
| 131 | //void objectChanged(int, const QDeclarativeDebugObjectReference &);
|
|---|
| 132 | //void valueChanged(int, const QVariant &);
|
|---|
| 133 |
|
|---|
| 134 | // Server sends value as string if it is a user-type variant
|
|---|
| 135 | void valueChanged(const QByteArray &name, const QVariant &value);
|
|---|
| 136 |
|
|---|
| 137 | private:
|
|---|
| 138 | friend class QDeclarativeEngineDebug;
|
|---|
| 139 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 140 | void setState(State);
|
|---|
| 141 | State m_state;
|
|---|
| 142 | int m_queryId;
|
|---|
| 143 | QDeclarativeEngineDebug *m_client;
|
|---|
| 144 | int m_objectDebugId;
|
|---|
| 145 | };
|
|---|
| 146 |
|
|---|
| 147 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch
|
|---|
| 148 | {
|
|---|
| 149 | Q_OBJECT
|
|---|
| 150 | public:
|
|---|
| 151 | QDeclarativeDebugPropertyWatch(QObject *parent);
|
|---|
| 152 |
|
|---|
| 153 | QString name() const;
|
|---|
| 154 |
|
|---|
| 155 | private:
|
|---|
| 156 | friend class QDeclarativeEngineDebug;
|
|---|
| 157 | QString m_name;
|
|---|
| 158 | };
|
|---|
| 159 |
|
|---|
| 160 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch
|
|---|
| 161 | {
|
|---|
| 162 | Q_OBJECT
|
|---|
| 163 | public:
|
|---|
| 164 | QDeclarativeDebugObjectExpressionWatch(QObject *parent);
|
|---|
| 165 |
|
|---|
| 166 | QString expression() const;
|
|---|
| 167 |
|
|---|
| 168 | private:
|
|---|
| 169 | friend class QDeclarativeEngineDebug;
|
|---|
| 170 | QString m_expr;
|
|---|
| 171 | int m_debugId;
|
|---|
| 172 | };
|
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugQuery : public QObject
|
|---|
| 176 | {
|
|---|
| 177 | Q_OBJECT
|
|---|
| 178 | public:
|
|---|
| 179 | enum State { Waiting, Error, Completed };
|
|---|
| 180 |
|
|---|
| 181 | State state() const;
|
|---|
| 182 | bool isWaiting() const;
|
|---|
| 183 |
|
|---|
| 184 | // bool waitUntilCompleted();
|
|---|
| 185 |
|
|---|
| 186 | Q_SIGNALS:
|
|---|
| 187 | void stateChanged(QDeclarativeDebugQuery::State);
|
|---|
| 188 |
|
|---|
| 189 | protected:
|
|---|
| 190 | QDeclarativeDebugQuery(QObject *);
|
|---|
| 191 |
|
|---|
| 192 | private:
|
|---|
| 193 | friend class QDeclarativeEngineDebug;
|
|---|
| 194 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 195 | void setState(State);
|
|---|
| 196 | State m_state;
|
|---|
| 197 | };
|
|---|
| 198 |
|
|---|
| 199 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugFileReference
|
|---|
| 200 | {
|
|---|
| 201 | public:
|
|---|
| 202 | QDeclarativeDebugFileReference();
|
|---|
| 203 | QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &);
|
|---|
| 204 | QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &);
|
|---|
| 205 |
|
|---|
| 206 | QUrl url() const;
|
|---|
| 207 | void setUrl(const QUrl &);
|
|---|
| 208 | int lineNumber() const;
|
|---|
| 209 | void setLineNumber(int);
|
|---|
| 210 | int columnNumber() const;
|
|---|
| 211 | void setColumnNumber(int);
|
|---|
| 212 |
|
|---|
| 213 | private:
|
|---|
| 214 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 215 | QUrl m_url;
|
|---|
| 216 | int m_lineNumber;
|
|---|
| 217 | int m_columnNumber;
|
|---|
| 218 | };
|
|---|
| 219 |
|
|---|
| 220 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEngineReference
|
|---|
| 221 | {
|
|---|
| 222 | public:
|
|---|
| 223 | QDeclarativeDebugEngineReference();
|
|---|
| 224 | QDeclarativeDebugEngineReference(int);
|
|---|
| 225 | QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &);
|
|---|
| 226 | QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &);
|
|---|
| 227 |
|
|---|
| 228 | int debugId() const;
|
|---|
| 229 | QString name() const;
|
|---|
| 230 |
|
|---|
| 231 | private:
|
|---|
| 232 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 233 | int m_debugId;
|
|---|
| 234 | QString m_name;
|
|---|
| 235 | };
|
|---|
| 236 |
|
|---|
| 237 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectReference
|
|---|
| 238 | {
|
|---|
| 239 | public:
|
|---|
| 240 | QDeclarativeDebugObjectReference();
|
|---|
| 241 | QDeclarativeDebugObjectReference(int);
|
|---|
| 242 | QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &);
|
|---|
| 243 | QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &);
|
|---|
| 244 |
|
|---|
| 245 | int debugId() const;
|
|---|
| 246 | QString className() const;
|
|---|
| 247 | QString idString() const;
|
|---|
| 248 | QString name() const;
|
|---|
| 249 |
|
|---|
| 250 | QDeclarativeDebugFileReference source() const;
|
|---|
| 251 | int contextDebugId() const;
|
|---|
| 252 |
|
|---|
| 253 | QList<QDeclarativeDebugPropertyReference> properties() const;
|
|---|
| 254 | QList<QDeclarativeDebugObjectReference> children() const;
|
|---|
| 255 |
|
|---|
| 256 | private:
|
|---|
| 257 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 258 | int m_debugId;
|
|---|
| 259 | QString m_class;
|
|---|
| 260 | QString m_idString;
|
|---|
| 261 | QString m_name;
|
|---|
| 262 | QDeclarativeDebugFileReference m_source;
|
|---|
| 263 | int m_contextDebugId;
|
|---|
| 264 | QList<QDeclarativeDebugPropertyReference> m_properties;
|
|---|
| 265 | QList<QDeclarativeDebugObjectReference> m_children;
|
|---|
| 266 | };
|
|---|
| 267 |
|
|---|
| 268 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugContextReference
|
|---|
| 269 | {
|
|---|
| 270 | public:
|
|---|
| 271 | QDeclarativeDebugContextReference();
|
|---|
| 272 | QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &);
|
|---|
| 273 | QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &);
|
|---|
| 274 |
|
|---|
| 275 | int debugId() const;
|
|---|
| 276 | QString name() const;
|
|---|
| 277 |
|
|---|
| 278 | QList<QDeclarativeDebugObjectReference> objects() const;
|
|---|
| 279 | QList<QDeclarativeDebugContextReference> contexts() const;
|
|---|
| 280 |
|
|---|
| 281 | private:
|
|---|
| 282 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 283 | int m_debugId;
|
|---|
| 284 | QString m_name;
|
|---|
| 285 | QList<QDeclarativeDebugObjectReference> m_objects;
|
|---|
| 286 | QList<QDeclarativeDebugContextReference> m_contexts;
|
|---|
| 287 | };
|
|---|
| 288 |
|
|---|
| 289 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyReference
|
|---|
| 290 | {
|
|---|
| 291 | public:
|
|---|
| 292 | QDeclarativeDebugPropertyReference();
|
|---|
| 293 | QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &);
|
|---|
| 294 | QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &);
|
|---|
| 295 |
|
|---|
| 296 | int objectDebugId() const;
|
|---|
| 297 | QString name() const;
|
|---|
| 298 | QVariant value() const;
|
|---|
| 299 | QString valueTypeName() const;
|
|---|
| 300 | QString binding() const;
|
|---|
| 301 | bool hasNotifySignal() const;
|
|---|
| 302 |
|
|---|
| 303 | private:
|
|---|
| 304 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 305 | int m_objectDebugId;
|
|---|
| 306 | QString m_name;
|
|---|
| 307 | QVariant m_value;
|
|---|
| 308 | QString m_valueTypeName;
|
|---|
| 309 | QString m_binding;
|
|---|
| 310 | bool m_hasNotifySignal;
|
|---|
| 311 | };
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery
|
|---|
| 315 | {
|
|---|
| 316 | Q_OBJECT
|
|---|
| 317 | public:
|
|---|
| 318 | virtual ~QDeclarativeDebugEnginesQuery();
|
|---|
| 319 | QList<QDeclarativeDebugEngineReference> engines() const;
|
|---|
| 320 | private:
|
|---|
| 321 | friend class QDeclarativeEngineDebug;
|
|---|
| 322 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 323 | QDeclarativeDebugEnginesQuery(QObject *);
|
|---|
| 324 | QDeclarativeEngineDebug *m_client;
|
|---|
| 325 | int m_queryId;
|
|---|
| 326 | QList<QDeclarativeDebugEngineReference> m_engines;
|
|---|
| 327 | };
|
|---|
| 328 |
|
|---|
| 329 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery
|
|---|
| 330 | {
|
|---|
| 331 | Q_OBJECT
|
|---|
| 332 | public:
|
|---|
| 333 | virtual ~QDeclarativeDebugRootContextQuery();
|
|---|
| 334 | QDeclarativeDebugContextReference rootContext() const;
|
|---|
| 335 | private:
|
|---|
| 336 | friend class QDeclarativeEngineDebug;
|
|---|
| 337 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 338 | QDeclarativeDebugRootContextQuery(QObject *);
|
|---|
| 339 | QDeclarativeEngineDebug *m_client;
|
|---|
| 340 | int m_queryId;
|
|---|
| 341 | QDeclarativeDebugContextReference m_context;
|
|---|
| 342 | };
|
|---|
| 343 |
|
|---|
| 344 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery
|
|---|
| 345 | {
|
|---|
| 346 | Q_OBJECT
|
|---|
| 347 | public:
|
|---|
| 348 | virtual ~QDeclarativeDebugObjectQuery();
|
|---|
| 349 | QDeclarativeDebugObjectReference object() const;
|
|---|
| 350 | private:
|
|---|
| 351 | friend class QDeclarativeEngineDebug;
|
|---|
| 352 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 353 | QDeclarativeDebugObjectQuery(QObject *);
|
|---|
| 354 | QDeclarativeEngineDebug *m_client;
|
|---|
| 355 | int m_queryId;
|
|---|
| 356 | QDeclarativeDebugObjectReference m_object;
|
|---|
| 357 |
|
|---|
| 358 | };
|
|---|
| 359 |
|
|---|
| 360 | class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery
|
|---|
| 361 | {
|
|---|
| 362 | Q_OBJECT
|
|---|
| 363 | public:
|
|---|
| 364 | virtual ~QDeclarativeDebugExpressionQuery();
|
|---|
| 365 | QVariant expression() const;
|
|---|
| 366 | QVariant result() const;
|
|---|
| 367 | private:
|
|---|
| 368 | friend class QDeclarativeEngineDebug;
|
|---|
| 369 | friend class QDeclarativeEngineDebugPrivate;
|
|---|
| 370 | QDeclarativeDebugExpressionQuery(QObject *);
|
|---|
| 371 | QDeclarativeEngineDebug *m_client;
|
|---|
| 372 | int m_queryId;
|
|---|
| 373 | QVariant m_expr;
|
|---|
| 374 | QVariant m_result;
|
|---|
| 375 | };
|
|---|
| 376 |
|
|---|
| 377 | QT_END_NAMESPACE
|
|---|
| 378 |
|
|---|
| 379 | Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference)
|
|---|
| 380 | Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
|
|---|
| 381 | Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
|
|---|
| 382 | Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
|
|---|
| 383 |
|
|---|
| 384 | QT_END_HEADER
|
|---|
| 385 |
|
|---|
| 386 | #endif // QDECLARATIVEDEBUG_H
|
|---|