source: trunk/src/declarative/debugger/qdeclarativedebug.cpp

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 30.0 KB
Line 
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
42#include "private/qdeclarativedebug_p.h"
43
44#include "private/qdeclarativedebugclient_p.h"
45
46#include <qdeclarativeenginedebug_p.h>
47
48#include <private/qobject_p.h>
49
50QT_BEGIN_NAMESPACE
51
52class QDeclarativeEngineDebugClient : public QDeclarativeDebugClient
53{
54public:
55 QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client, QDeclarativeEngineDebugPrivate *p);
56
57protected:
58 virtual void statusChanged(Status status);
59 virtual void messageReceived(const QByteArray &);
60
61private:
62 QDeclarativeEngineDebugPrivate *priv;
63 friend class QDeclarativeEngineDebugPrivate;
64};
65
66class QDeclarativeEngineDebugPrivate : public QObjectPrivate
67{
68 Q_DECLARE_PUBLIC(QDeclarativeEngineDebug)
69public:
70 QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *);
71 ~QDeclarativeEngineDebugPrivate();
72
73 void statusChanged(QDeclarativeEngineDebug::Status status);
74 void message(const QByteArray &);
75
76 QDeclarativeEngineDebugClient *client;
77 int nextId;
78 int getId();
79
80 void decode(QDataStream &, QDeclarativeDebugContextReference &);
81 void decode(QDataStream &, QDeclarativeDebugObjectReference &, bool simple);
82
83 static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugEnginesQuery *);
84 static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugRootContextQuery *);
85 static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugObjectQuery *);
86 static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugExpressionQuery *);
87
88 QHash<int, QDeclarativeDebugEnginesQuery *> enginesQuery;
89 QHash<int, QDeclarativeDebugRootContextQuery *> rootContextQuery;
90 QHash<int, QDeclarativeDebugObjectQuery *> objectQuery;
91 QHash<int, QDeclarativeDebugExpressionQuery *> expressionQuery;
92
93 QHash<int, QDeclarativeDebugWatch *> watched;
94};
95
96QDeclarativeEngineDebugClient::QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client,
97 QDeclarativeEngineDebugPrivate *p)
98: QDeclarativeDebugClient(QLatin1String("QDeclarativeEngine"), client), priv(p)
99{
100}
101
102void QDeclarativeEngineDebugClient::statusChanged(Status status)
103{
104 if (priv)
105 priv->statusChanged(static_cast<QDeclarativeEngineDebug::Status>(status));
106}
107
108void QDeclarativeEngineDebugClient::messageReceived(const QByteArray &data)
109{
110 if (priv)
111 priv->message(data);
112}
113
114QDeclarativeEngineDebugPrivate::QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *c)
115: client(new QDeclarativeEngineDebugClient(c, this)), nextId(0)
116{
117}
118
119QDeclarativeEngineDebugPrivate::~QDeclarativeEngineDebugPrivate()
120{
121 if (client)
122 client->priv = 0;
123}
124
125int QDeclarativeEngineDebugPrivate::getId()
126{
127 return nextId++;
128}
129
130void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugEnginesQuery *q)
131{
132 if (c && q) {
133 QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
134 p->enginesQuery.remove(q->m_queryId);
135 }
136}
137
138void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c,
139 QDeclarativeDebugRootContextQuery *q)
140{
141 if (c && q) {
142 QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
143 p->rootContextQuery.remove(q->m_queryId);
144 }
145}
146
147void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugObjectQuery *q)
148{
149 if (c && q) {
150 QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
151 p->objectQuery.remove(q->m_queryId);
152 }
153}
154
155void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugExpressionQuery *q)
156{
157 if (c && q) {
158 QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
159 p->expressionQuery.remove(q->m_queryId);
160 }
161}
162
163void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugObjectReference &o,
164 bool simple)
165{
166 QDeclarativeEngineDebugServer::QDeclarativeObjectData data;
167 ds >> data;
168 o.m_debugId = data.objectId;
169 o.m_class = data.objectType;
170 o.m_idString = data.idString;
171 o.m_name = data.objectName;
172 o.m_source.m_url = data.url;
173 o.m_source.m_lineNumber = data.lineNumber;
174 o.m_source.m_columnNumber = data.columnNumber;
175 o.m_contextDebugId = data.contextId;
176
177 if (simple)
178 return;
179
180 int childCount;
181 bool recur;
182 ds >> childCount >> recur;
183
184 for (int ii = 0; ii < childCount; ++ii) {
185 o.m_children.append(QDeclarativeDebugObjectReference());
186 decode(ds, o.m_children.last(), !recur);
187 }
188
189 int propCount;
190 ds >> propCount;
191
192 for (int ii = 0; ii < propCount; ++ii) {
193 QDeclarativeEngineDebugServer::QDeclarativeObjectProperty data;
194 ds >> data;
195 QDeclarativeDebugPropertyReference prop;
196 prop.m_objectDebugId = o.m_debugId;
197 prop.m_name = data.name;
198 prop.m_binding = data.binding;
199 prop.m_hasNotifySignal = data.hasNotifySignal;
200 prop.m_valueTypeName = data.valueTypeName;
201 switch (data.type) {
202 case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Basic:
203 case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::List:
204 case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::SignalProperty:
205 {
206 prop.m_value = data.value;
207 break;
208 }
209 case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Object:
210 {
211 QDeclarativeDebugObjectReference obj;
212 obj.m_debugId = prop.m_value.toInt();
213 prop.m_value = qVariantFromValue(obj);
214 break;
215 }
216 case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Unknown:
217 break;
218 }
219 o.m_properties << prop;
220 }
221}
222
223void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugContextReference &c)
224{
225 ds >> c.m_name >> c.m_debugId;
226
227 int contextCount;
228 ds >> contextCount;
229
230 for (int ii = 0; ii < contextCount; ++ii) {
231 c.m_contexts.append(QDeclarativeDebugContextReference());
232 decode(ds, c.m_contexts.last());
233 }
234
235 int objectCount;
236 ds >> objectCount;
237
238 for (int ii = 0; ii < objectCount; ++ii) {
239 QDeclarativeDebugObjectReference obj;
240 decode(ds, obj, true);
241
242 obj.m_contextDebugId = c.m_debugId;
243 c.m_objects << obj;
244 }
245}
246
247void QDeclarativeEngineDebugPrivate::statusChanged(QDeclarativeEngineDebug::Status status)
248{
249 emit q_func()->statusChanged(status);
250}
251
252void QDeclarativeEngineDebugPrivate::message(const QByteArray &data)
253{
254 QDataStream ds(data);
255
256 QByteArray type;
257 ds >> type;
258
259 //qDebug() << "QDeclarativeEngineDebugPrivate::message()" << type;
260
261 if (type == "LIST_ENGINES_R") {
262 int queryId;
263 ds >> queryId;
264
265 QDeclarativeDebugEnginesQuery *query = enginesQuery.value(queryId);
266 if (!query)
267 return;
268 enginesQuery.remove(queryId);
269
270 int count;
271 ds >> count;
272
273 for (int ii = 0; ii < count; ++ii) {
274 QDeclarativeDebugEngineReference ref;
275 ds >> ref.m_name;
276 ds >> ref.m_debugId;
277 query->m_engines << ref;
278 }
279
280 query->m_client = 0;
281 query->setState(QDeclarativeDebugQuery::Completed);
282 } else if (type == "LIST_OBJECTS_R") {
283 int queryId;
284 ds >> queryId;
285
286 QDeclarativeDebugRootContextQuery *query = rootContextQuery.value(queryId);
287 if (!query)
288 return;
289 rootContextQuery.remove(queryId);
290
291 if (!ds.atEnd())
292 decode(ds, query->m_context);
293
294 query->m_client = 0;
295 query->setState(QDeclarativeDebugQuery::Completed);
296 } else if (type == "FETCH_OBJECT_R") {
297 int queryId;
298 ds >> queryId;
299
300 QDeclarativeDebugObjectQuery *query = objectQuery.value(queryId);
301 if (!query)
302 return;
303 objectQuery.remove(queryId);
304
305 if (!ds.atEnd())
306 decode(ds, query->m_object, false);
307
308 query->m_client = 0;
309 query->setState(QDeclarativeDebugQuery::Completed);
310 } else if (type == "EVAL_EXPRESSION_R") {
311 int queryId;
312 QVariant result;
313 ds >> queryId >> result;
314
315 QDeclarativeDebugExpressionQuery *query = expressionQuery.value(queryId);
316 if (!query)
317 return;
318 expressionQuery.remove(queryId);
319
320 query->m_result = result;
321 query->m_client = 0;
322 query->setState(QDeclarativeDebugQuery::Completed);
323 } else if (type == "WATCH_PROPERTY_R") {
324 int queryId;
325 bool ok;
326 ds >> queryId >> ok;
327
328 QDeclarativeDebugWatch *watch = watched.value(queryId);
329 if (!watch)
330 return;
331
332 watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive);
333 } else if (type == "WATCH_OBJECT_R") {
334 int queryId;
335 bool ok;
336 ds >> queryId >> ok;
337
338 QDeclarativeDebugWatch *watch = watched.value(queryId);
339 if (!watch)
340 return;
341
342 watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive);
343 } else if (type == "WATCH_EXPR_OBJECT_R") {
344 int queryId;
345 bool ok;
346 ds >> queryId >> ok;
347
348 QDeclarativeDebugWatch *watch = watched.value(queryId);
349 if (!watch)
350 return;
351
352 watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive);
353 } else if (type == "UPDATE_WATCH") {
354 int queryId;
355 int debugId;
356 QByteArray name;
357 QVariant value;
358 ds >> queryId >> debugId >> name >> value;
359
360 QDeclarativeDebugWatch *watch = watched.value(queryId, 0);
361 if (!watch)
362 return;
363 emit watch->valueChanged(name, value);
364 } else if (type == "OBJECT_CREATED") {
365 emit q_func()->newObjects();
366 }
367}
368
369QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *client, QObject *parent)
370: QObject(*(new QDeclarativeEngineDebugPrivate(client)), parent)
371{
372}
373
374QDeclarativeEngineDebug::Status QDeclarativeEngineDebug::status() const
375{
376 Q_D(const QDeclarativeEngineDebug);
377
378 return static_cast<QDeclarativeEngineDebug::Status>(d->client->status());
379}
380
381QDeclarativeDebugPropertyWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugPropertyReference &property, QObject *parent)
382{
383 Q_D(QDeclarativeEngineDebug);
384
385 QDeclarativeDebugPropertyWatch *watch = new QDeclarativeDebugPropertyWatch(parent);
386 if (d->client->status() == QDeclarativeDebugClient::Enabled) {
387 int queryId = d->getId();
388 watch->m_queryId = queryId;
389 watch->m_client = this;
390 watch->m_objectDebugId = property.objectDebugId();
391 watch->m_name = property.name();
392 d->watched.insert(queryId, watch);
393
394 QByteArray message;
395 QDataStream ds(&message, QIODevice::WriteOnly);
396 ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8();
397 d->client->sendMessage(message);
398 } else {
399 watch->m_state = QDeclarativeDebugWatch::Dead;
400 }
401
402 return watch;
403}
404
405QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugContextReference &, const QString &, QObject *)
406{
407 qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented");
408 return 0;
409}
410
411QDeclarativeDebugObjectExpressionWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, const QString &expr, QObject *parent)
412{
413 Q_D(QDeclarativeEngineDebug);
414 QDeclarativeDebugObjectExpressionWatch *watch = new QDeclarativeDebugObjectExpressionWatch(parent);
415 if (d->client->status() == QDeclarativeDebugClient::Enabled) {
416 int queryId = d->getId();
417 watch->m_queryId = queryId;
418 watch->m_client = this;
419 watch->m_objectDebugId = object.debugId();
420 watch->m_expr = expr;
421 d->watched.insert(queryId, watch);
422
423 QByteArray message;
424 QDataStream ds(&message, QIODevice::WriteOnly);
425 ds << QByteArray("WATCH_EXPR_OBJECT") << queryId << object.debugId() << expr;
426 d->client->sendMessage(message);
427 } else {
428 watch->m_state = QDeclarativeDebugWatch::Dead;
429 }
430 return watch;
431}
432
433QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, QObject *parent)
434{
435 Q_D(QDeclarativeEngineDebug);
436
437 QDeclarativeDebugWatch *watch = new QDeclarativeDebugWatch(parent);
438 if (d->client->status() == QDeclarativeDebugClient::Enabled) {
439 int queryId = d->getId();
440 watch->m_queryId = queryId;
441 watch->m_client = this;
442 watch->m_objectDebugId = object.debugId();
443 d->watched.insert(queryId, watch);
444
445 QByteArray message;
446 QDataStream ds(&message, QIODevice::WriteOnly);
447 ds << QByteArray("WATCH_OBJECT") << queryId << object.debugId();
448 d->client->sendMessage(message);
449 } else {
450 watch->m_state = QDeclarativeDebugWatch::Dead;
451 }
452
453 return watch;
454}
455
456QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugFileReference &, QObject *)
457{
458 qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented");
459 return 0;
460}
461
462void QDeclarativeEngineDebug::removeWatch(QDeclarativeDebugWatch *watch)
463{
464 Q_D(QDeclarativeEngineDebug);
465
466 if (!watch || !watch->m_client)
467 return;
468
469 watch->m_client = 0;
470 watch->setState(QDeclarativeDebugWatch::Inactive);
471
472 d->watched.remove(watch->queryId());
473
474 if (d->client && d->client->status() == QDeclarativeDebugClient::Enabled) {
475 QByteArray message;
476 QDataStream ds(&message, QIODevice::WriteOnly);
477 ds << QByteArray("NO_WATCH") << watch->queryId();
478 d->client->sendMessage(message);
479 }
480}
481
482QDeclarativeDebugEnginesQuery *QDeclarativeEngineDebug::queryAvailableEngines(QObject *parent)
483{
484 Q_D(QDeclarativeEngineDebug);
485
486 QDeclarativeDebugEnginesQuery *query = new QDeclarativeDebugEnginesQuery(parent);
487 if (d->client->status() == QDeclarativeDebugClient::Enabled) {
488 query->m_client = this;
489 int queryId = d->getId();
490 query->m_queryId = queryId;
491 d->enginesQuery.insert(queryId, query);
492
493 QByteArray message;
494 QDataStream ds(&message, QIODevice::WriteOnly);
495 ds << QByteArray("LIST_ENGINES") << queryId;
496 d->client->sendMessage(message);
497 } else {
498 query->m_state = QDeclarativeDebugQuery::Error;
499 }
500
501 return query;
502}
503
504QDeclarativeDebugRootContextQuery *QDeclarativeEngineDebug::queryRootContexts(const QDeclarativeDebugEngineReference &engine, QObject *parent)
505{
506 Q_D(QDeclarativeEngineDebug);
507
508 QDeclarativeDebugRootContextQuery *query = new QDeclarativeDebugRootContextQuery(parent);
509 if (d->client->status() == QDeclarativeDebugClient::Enabled && engine.debugId() != -1) {
510 query->m_client = this;
511 int queryId = d->getId();
512 query->m_queryId = queryId;
513 d->rootContextQuery.insert(queryId, query);
514
515 QByteArray message;
516 QDataStream ds(&message, QIODevice::WriteOnly);
517 ds << QByteArray("LIST_OBJECTS") << queryId << engine.debugId();
518 d->client->sendMessage(message);
519 } else {
520 query->m_state = QDeclarativeDebugQuery::Error;
521 }
522
523 return query;
524}
525
526QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObject(const QDeclarativeDebugObjectReference &object, QObject *parent)
527{
528 Q_D(QDeclarativeEngineDebug);
529
530 QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent);
531 if (d->client->status() == QDeclarativeDebugClient::Enabled && object.debugId() != -1) {
532 query->m_client = this;
533 int queryId = d->getId();
534 query->m_queryId = queryId;
535 d->objectQuery.insert(queryId, query);
536
537 QByteArray message;
538 QDataStream ds(&message, QIODevice::WriteOnly);
539 ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
540 << false << true;
541 d->client->sendMessage(message);
542 } else {
543 query->m_state = QDeclarativeDebugQuery::Error;
544 }
545
546 return query;
547}
548
549QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObjectRecursive(const QDeclarativeDebugObjectReference &object, QObject *parent)
550{
551 Q_D(QDeclarativeEngineDebug);
552
553 QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent);
554 if (d->client->status() == QDeclarativeDebugClient::Enabled && object.debugId() != -1) {
555 query->m_client = this;
556 int queryId = d->getId();
557 query->m_queryId = queryId;
558 d->objectQuery.insert(queryId, query);
559
560 QByteArray message;
561 QDataStream ds(&message, QIODevice::WriteOnly);
562 ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
563 << true << true;
564 d->client->sendMessage(message);
565 } else {
566 query->m_state = QDeclarativeDebugQuery::Error;
567 }
568
569 return query;
570}
571
572QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent)
573{
574 Q_D(QDeclarativeEngineDebug);
575
576 QDeclarativeDebugExpressionQuery *query = new QDeclarativeDebugExpressionQuery(parent);
577 if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) {
578 query->m_client = this;
579 query->m_expr = expr;
580 int queryId = d->getId();
581 query->m_queryId = queryId;
582 d->expressionQuery.insert(queryId, query);
583
584 QByteArray message;
585 QDataStream ds(&message, QIODevice::WriteOnly);
586 ds << QByteArray("EVAL_EXPRESSION") << queryId << objectDebugId << expr;
587 d->client->sendMessage(message);
588 } else {
589 query->m_state = QDeclarativeDebugQuery::Error;
590 }
591
592 return query;
593}
594
595bool QDeclarativeEngineDebug::setBindingForObject(int objectDebugId, const QString &propertyName,
596 const QVariant &bindingExpression,
597 bool isLiteralValue)
598{
599 Q_D(QDeclarativeEngineDebug);
600
601 if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) {
602 QByteArray message;
603 QDataStream ds(&message, QIODevice::WriteOnly);
604 ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue;
605 d->client->sendMessage(message);
606 return true;
607 } else {
608 return false;
609 }
610}
611
612bool QDeclarativeEngineDebug::resetBindingForObject(int objectDebugId, const QString &propertyName)
613{
614 Q_D(QDeclarativeEngineDebug);
615
616 if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) {
617 QByteArray message;
618 QDataStream ds(&message, QIODevice::WriteOnly);
619 ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName;
620 d->client->sendMessage(message);
621 return true;
622 } else {
623 return false;
624 }
625}
626
627bool QDeclarativeEngineDebug::setMethodBody(int objectDebugId, const QString &methodName,
628 const QString &methodBody)
629{
630 Q_D(QDeclarativeEngineDebug);
631
632 if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) {
633 QByteArray message;
634 QDataStream ds(&message, QIODevice::WriteOnly);
635 ds << QByteArray("SET_METHOD_BODY") << objectDebugId << methodName << methodBody;
636 d->client->sendMessage(message);
637 return true;
638 } else {
639 return false;
640 }
641}
642
643QDeclarativeDebugWatch::QDeclarativeDebugWatch(QObject *parent)
644: QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1)
645{
646}
647
648QDeclarativeDebugWatch::~QDeclarativeDebugWatch()
649{
650}
651
652int QDeclarativeDebugWatch::queryId() const
653{
654 return m_queryId;
655}
656
657int QDeclarativeDebugWatch::objectDebugId() const
658{
659 return m_objectDebugId;
660}
661
662QDeclarativeDebugWatch::State QDeclarativeDebugWatch::state() const
663{
664 return m_state;
665}
666
667void QDeclarativeDebugWatch::setState(State s)
668{
669 if (m_state == s)
670 return;
671 m_state = s;
672 emit stateChanged(m_state);
673}
674
675QDeclarativeDebugPropertyWatch::QDeclarativeDebugPropertyWatch(QObject *parent)
676 : QDeclarativeDebugWatch(parent)
677{
678}
679
680QString QDeclarativeDebugPropertyWatch::name() const
681{
682 return m_name;
683}
684
685
686QDeclarativeDebugObjectExpressionWatch::QDeclarativeDebugObjectExpressionWatch(QObject *parent)
687 : QDeclarativeDebugWatch(parent)
688{
689}
690
691QString QDeclarativeDebugObjectExpressionWatch::expression() const
692{
693 return m_expr;
694}
695
696
697QDeclarativeDebugQuery::QDeclarativeDebugQuery(QObject *parent)
698: QObject(parent), m_state(Waiting)
699{
700}
701
702QDeclarativeDebugQuery::State QDeclarativeDebugQuery::state() const
703{
704 return m_state;
705}
706
707bool QDeclarativeDebugQuery::isWaiting() const
708{
709 return m_state == Waiting;
710}
711
712void QDeclarativeDebugQuery::setState(State s)
713{
714 if (m_state == s)
715 return;
716 m_state = s;
717 emit stateChanged(m_state);
718}
719
720QDeclarativeDebugEnginesQuery::QDeclarativeDebugEnginesQuery(QObject *parent)
721: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
722{
723}
724
725QDeclarativeDebugEnginesQuery::~QDeclarativeDebugEnginesQuery()
726{
727 if (m_client && m_queryId != -1)
728 QDeclarativeEngineDebugPrivate::remove(m_client, this);
729}
730
731QList<QDeclarativeDebugEngineReference> QDeclarativeDebugEnginesQuery::engines() const
732{
733 return m_engines;
734}
735
736QDeclarativeDebugRootContextQuery::QDeclarativeDebugRootContextQuery(QObject *parent)
737: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
738{
739}
740
741QDeclarativeDebugRootContextQuery::~QDeclarativeDebugRootContextQuery()
742{
743 if (m_client && m_queryId != -1)
744 QDeclarativeEngineDebugPrivate::remove(m_client, this);
745}
746
747QDeclarativeDebugContextReference QDeclarativeDebugRootContextQuery::rootContext() const
748{
749 return m_context;
750}
751
752QDeclarativeDebugObjectQuery::QDeclarativeDebugObjectQuery(QObject *parent)
753: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
754{
755}
756
757QDeclarativeDebugObjectQuery::~QDeclarativeDebugObjectQuery()
758{
759 if (m_client && m_queryId != -1)
760 QDeclarativeEngineDebugPrivate::remove(m_client, this);
761}
762
763QDeclarativeDebugObjectReference QDeclarativeDebugObjectQuery::object() const
764{
765 return m_object;
766}
767
768QDeclarativeDebugExpressionQuery::QDeclarativeDebugExpressionQuery(QObject *parent)
769: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
770{
771}
772
773QDeclarativeDebugExpressionQuery::~QDeclarativeDebugExpressionQuery()
774{
775 if (m_client && m_queryId != -1)
776 QDeclarativeEngineDebugPrivate::remove(m_client, this);
777}
778
779QVariant QDeclarativeDebugExpressionQuery::expression() const
780{
781 return m_expr;
782}
783
784QVariant QDeclarativeDebugExpressionQuery::result() const
785{
786 return m_result;
787}
788
789QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference()
790: m_debugId(-1)
791{
792}
793
794QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(int debugId)
795: m_debugId(debugId)
796{
797}
798
799QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &o)
800: m_debugId(o.m_debugId), m_name(o.m_name)
801{
802}
803
804QDeclarativeDebugEngineReference &
805QDeclarativeDebugEngineReference::operator=(const QDeclarativeDebugEngineReference &o)
806{
807 m_debugId = o.m_debugId; m_name = o.m_name;
808 return *this;
809}
810
811int QDeclarativeDebugEngineReference::debugId() const
812{
813 return m_debugId;
814}
815
816QString QDeclarativeDebugEngineReference::name() const
817{
818 return m_name;
819}
820
821QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference()
822: m_debugId(-1), m_contextDebugId(-1)
823{
824}
825
826QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(int debugId)
827: m_debugId(debugId), m_contextDebugId(-1)
828{
829}
830
831QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &o)
832: m_debugId(o.m_debugId), m_class(o.m_class), m_idString(o.m_idString),
833 m_name(o.m_name), m_source(o.m_source), m_contextDebugId(o.m_contextDebugId),
834 m_properties(o.m_properties), m_children(o.m_children)
835{
836}
837
838QDeclarativeDebugObjectReference &
839QDeclarativeDebugObjectReference::operator=(const QDeclarativeDebugObjectReference &o)
840{
841 m_debugId = o.m_debugId; m_class = o.m_class; m_idString = o.m_idString;
842 m_name = o.m_name; m_source = o.m_source; m_contextDebugId = o.m_contextDebugId;
843 m_properties = o.m_properties; m_children = o.m_children;
844 return *this;
845}
846
847int QDeclarativeDebugObjectReference::debugId() const
848{
849 return m_debugId;
850}
851
852QString QDeclarativeDebugObjectReference::className() const
853{
854 return m_class;
855}
856
857QString QDeclarativeDebugObjectReference::idString() const
858{
859 return m_idString;
860}
861
862QString QDeclarativeDebugObjectReference::name() const
863{
864 return m_name;
865}
866
867QDeclarativeDebugFileReference QDeclarativeDebugObjectReference::source() const
868{
869 return m_source;
870}
871
872int QDeclarativeDebugObjectReference::contextDebugId() const
873{
874 return m_contextDebugId;
875}
876
877QList<QDeclarativeDebugPropertyReference> QDeclarativeDebugObjectReference::properties() const
878{
879 return m_properties;
880}
881
882QList<QDeclarativeDebugObjectReference> QDeclarativeDebugObjectReference::children() const
883{
884 return m_children;
885}
886
887QDeclarativeDebugContextReference::QDeclarativeDebugContextReference()
888: m_debugId(-1)
889{
890}
891
892QDeclarativeDebugContextReference::QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &o)
893: m_debugId(o.m_debugId), m_name(o.m_name), m_objects(o.m_objects), m_contexts(o.m_contexts)
894{
895}
896
897QDeclarativeDebugContextReference &QDeclarativeDebugContextReference::operator=(const QDeclarativeDebugContextReference &o)
898{
899 m_debugId = o.m_debugId; m_name = o.m_name; m_objects = o.m_objects;
900 m_contexts = o.m_contexts;
901 return *this;
902}
903
904int QDeclarativeDebugContextReference::debugId() const
905{
906 return m_debugId;
907}
908
909QString QDeclarativeDebugContextReference::name() const
910{
911 return m_name;
912}
913
914QList<QDeclarativeDebugObjectReference> QDeclarativeDebugContextReference::objects() const
915{
916 return m_objects;
917}
918
919QList<QDeclarativeDebugContextReference> QDeclarativeDebugContextReference::contexts() const
920{
921 return m_contexts;
922}
923
924QDeclarativeDebugFileReference::QDeclarativeDebugFileReference()
925: m_lineNumber(-1), m_columnNumber(-1)
926{
927}
928
929QDeclarativeDebugFileReference::QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &o)
930: m_url(o.m_url), m_lineNumber(o.m_lineNumber), m_columnNumber(o.m_columnNumber)
931{
932}
933
934QDeclarativeDebugFileReference &QDeclarativeDebugFileReference::operator=(const QDeclarativeDebugFileReference &o)
935{
936 m_url = o.m_url; m_lineNumber = o.m_lineNumber; m_columnNumber = o.m_columnNumber;
937 return *this;
938}
939
940QUrl QDeclarativeDebugFileReference::url() const
941{
942 return m_url;
943}
944
945void QDeclarativeDebugFileReference::setUrl(const QUrl &u)
946{
947 m_url = u;
948}
949
950int QDeclarativeDebugFileReference::lineNumber() const
951{
952 return m_lineNumber;
953}
954
955void QDeclarativeDebugFileReference::setLineNumber(int l)
956{
957 m_lineNumber = l;
958}
959
960int QDeclarativeDebugFileReference::columnNumber() const
961{
962 return m_columnNumber;
963}
964
965void QDeclarativeDebugFileReference::setColumnNumber(int c)
966{
967 m_columnNumber = c;
968}
969
970QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference()
971: m_objectDebugId(-1), m_hasNotifySignal(false)
972{
973}
974
975QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &o)
976: m_objectDebugId(o.m_objectDebugId), m_name(o.m_name), m_value(o.m_value),
977 m_valueTypeName(o.m_valueTypeName), m_binding(o.m_binding),
978 m_hasNotifySignal(o.m_hasNotifySignal)
979{
980}
981
982QDeclarativeDebugPropertyReference &QDeclarativeDebugPropertyReference::operator=(const QDeclarativeDebugPropertyReference &o)
983{
984 m_objectDebugId = o.m_objectDebugId; m_name = o.m_name; m_value = o.m_value;
985 m_valueTypeName = o.m_valueTypeName; m_binding = o.m_binding;
986 m_hasNotifySignal = o.m_hasNotifySignal;
987 return *this;
988}
989
990int QDeclarativeDebugPropertyReference::objectDebugId() const
991{
992 return m_objectDebugId;
993}
994
995QString QDeclarativeDebugPropertyReference::name() const
996{
997 return m_name;
998}
999
1000QString QDeclarativeDebugPropertyReference::valueTypeName() const
1001{
1002 return m_valueTypeName;
1003}
1004
1005QVariant QDeclarativeDebugPropertyReference::value() const
1006{
1007 return m_value;
1008}
1009
1010QString QDeclarativeDebugPropertyReference::binding() const
1011{
1012 return m_binding;
1013}
1014
1015bool QDeclarativeDebugPropertyReference::hasNotifySignal() const
1016{
1017 return m_hasNotifySignal;
1018}
1019
1020QT_END_NAMESPACE
1021
Note: See TracBrowser for help on using the repository browser.