summaryrefslogtreecommitdiffstats
path: root/src/declarative/debugger
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-26 00:03:08 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-26 00:03:08 (GMT)
commitabb9a3b5031e86bdd89a9338c4f12d703e6f385b (patch)
tree2d0fb9eb222885a15ee06e486e7400cdedcc0a92 /src/declarative/debugger
parent7f43bd48595025961989fcd51bee0271a275b475 (diff)
downloadQt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.zip
Qt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.tar.gz
Qt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.tar.bz2
Move canvas scene snapshot out of in-process debugger
Diffstat (limited to 'src/declarative/debugger')
-rw-r--r--src/declarative/debugger/debugger.pri2
-rw-r--r--src/declarative/debugger/qmlcanvasdebugger.cpp240
-rw-r--r--src/declarative/debugger/qmlcanvasdebugger_p.h89
-rw-r--r--src/declarative/debugger/qmldebugclient.cpp4
-rw-r--r--src/declarative/debugger/qmldebugclient.h1
-rw-r--r--src/declarative/debugger/qmldebugger.cpp9
-rw-r--r--src/declarative/debugger/qmldebugger.h2
-rw-r--r--src/declarative/debugger/qmldebugserver.cpp15
-rw-r--r--src/declarative/debugger/qmldebugserver.h1
9 files changed, 19 insertions, 344 deletions
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri
index 121cb98..aa36675 100644
--- a/src/declarative/debugger/debugger.pri
+++ b/src/declarative/debugger/debugger.pri
@@ -3,7 +3,6 @@ SOURCES += debugger/qmldebugger.cpp \
debugger/qmlpropertyview.cpp \
debugger/qmlwatches.cpp \
debugger/qmlobjecttree.cpp \
- debugger/qmlcanvasdebugger.cpp \
debugger/qpacketprotocol.cpp \
debugger/qmldebugserver.cpp \
debugger/qmldebugclient.cpp
@@ -13,7 +12,6 @@ HEADERS += debugger/qmldebugger.h \
debugger/qmlpropertyview_p.h \
debugger/qmlwatches_p.h \
debugger/qmlobjecttree_p.h \
- debugger/qmlcanvasdebugger_p.h \
debugger/qpacketprotocol.h \
debugger/qmldebugserver.h \
debugger/qmldebugclient.h
diff --git a/src/declarative/debugger/qmlcanvasdebugger.cpp b/src/declarative/debugger/qmlcanvasdebugger.cpp
deleted file mode 100644
index 21abd2d..0000000
--- a/src/declarative/debugger/qmlcanvasdebugger.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qmlcanvasdebugger_p.h>
-#include <private/qmlwatches_p.h>
-#include <QtDeclarative/qsimplecanvas.h>
-#include <QtGui/qboxlayout.h>
-#include <QtGui/qpushbutton.h>
-#include <QtGui/qspinbox.h>
-#include <QtGui/qsplitter.h>
-#include <QtGui/qtreewidget.h>
-
-#include <QtDeclarative/qfxrect.h>
-#include <QtDeclarative/qfximage.h>
-
-QmlCanvasDebugger::QmlCanvasDebugger(QmlWatches *w, QWidget *parent)
-: QWidget(parent), m_watches(w), m_tree(0), m_canvas(0), m_canvasRoot(0), m_debugCanvas(0),
- m_selected(0)
-{
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setContentsMargins(0,0,0,0);
- layout->setSpacing(0);
- setLayout(layout);
- QHBoxLayout *hlayout = new QHBoxLayout;
- hlayout->setContentsMargins(0,0,0,0);
- hlayout->addStretch(2);
- hlayout->setSpacing(0);
- layout->addLayout(hlayout);
- QSpinBox *x = new QSpinBox(this);
- x->setSingleStep(50);
- x->setMaximum(10000);
- x->setMinimum(-10000);
- QObject::connect(x, SIGNAL(valueChanged(int)), this, SLOT(setX(int)));
- QSpinBox *y = new QSpinBox(this);
- y->setSingleStep(50);
- y->setMaximum(10000);
- y->setMinimum(-10000);
- QObject::connect(y, SIGNAL(valueChanged(int)), this, SLOT(setY(int)));
- hlayout->addWidget(x);
- hlayout->addWidget(y);
- QPushButton *pb = new QPushButton(tr("Refresh"), this);
- QObject::connect(pb, SIGNAL(clicked()), this, SLOT(refresh()));
- hlayout->addWidget(pb);
-
- QSplitter *splitter = new QSplitter(this);
-
- m_tree = new QTreeWidget(this);
- QObject::connect(m_tree, SIGNAL(itemExpanded(QTreeWidgetItem*)),
- this, SLOT(itemExpanded(QTreeWidgetItem*)));
- QObject::connect(m_tree, SIGNAL(itemCollapsed(QTreeWidgetItem*)),
- this, SLOT(itemCollapsed(QTreeWidgetItem*)));
- QObject::connect(m_tree, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
- this, SLOT(itemClicked(QTreeWidgetItem*)));
- m_canvas = new QSimpleCanvas(QSimpleCanvas::SimpleCanvas, this);
- m_canvasRoot = new QSimpleCanvasItem;
- m_canvasRoot->setParent(m_canvas->root());
- splitter->addWidget(m_tree);
- splitter->addWidget(m_canvas);
- splitter->setStretchFactor(1, 2);
- layout->addWidget(splitter);
-}
-
-void QmlCanvasDebugger::refresh()
-{
- setCanvas(m_debugCanvas);
-}
-
-class QmlCanvasDebuggerItem : public QTreeWidgetItem
-{
-public:
- QmlCanvasDebuggerItem(QTreeWidget *tree)
- : QTreeWidgetItem(tree), me(0), img(0)
- {
- }
-
- QmlCanvasDebuggerItem(QTreeWidgetItem *item)
- : QTreeWidgetItem(item), me(0), img(0)
- {
- }
-
- QPointer<QObject> them;
- QFxRect *me;
- QFxImage *img;
-};
-
-void QmlCanvasDebugger::itemExpanded(QTreeWidgetItem *i)
-{
- QmlCanvasDebuggerItem *item = static_cast<QmlCanvasDebuggerItem *>(i);
- if(item->me)
- item->me->setOpacity(1);
-}
-
-void QmlCanvasDebugger::setOpacityRecur(QTreeWidgetItem *i, qreal op)
-{
- QmlCanvasDebuggerItem *item = static_cast<QmlCanvasDebuggerItem *>(i);
- if(item->img)
- item->img->setOpacity(op);
-
- for(int ii = 0; ii < item->childCount(); ++ii)
- setOpacityRecur(item->child(ii), op);
-}
-
-void QmlCanvasDebugger::itemClicked(QTreeWidgetItem *i)
-{
- QmlCanvasDebuggerItem *item = static_cast<QmlCanvasDebuggerItem *>(i);
- if(item->them)
- emit objectClicked(m_watches->objectId(item->them));
-
- if(m_selected) {
- setOpacityRecur(m_selected, 0);
- m_selected = 0;
- }
-
- m_selected = item;
- setOpacityRecur(m_selected, 1);
-}
-
-void QmlCanvasDebugger::itemCollapsed(QTreeWidgetItem *i)
-{
- QmlCanvasDebuggerItem *item = static_cast<QmlCanvasDebuggerItem *>(i);
- if(item->me)
- item->me->setOpacity(0);
-}
-
-void QmlCanvasDebugger::clone(QTreeWidgetItem *item, QSimpleCanvasItem *me, QSimpleCanvasItem *them)
-{
- const QList<QSimpleCanvasItem *> &children = them->children();
-
- foreach(QSimpleCanvasItem *child, children) {
- QmlCanvasDebuggerItem *childItem = new QmlCanvasDebuggerItem(item);
- childItem->setText(0, QmlWatches::objectToString(child));
- childItem->setExpanded(true);
-
- QFxRect *rect = new QFxRect;
- rect->setParent(me);
- rect->setX(child->x());
- rect->setY(child->y());
- rect->setZ(child->z());
- rect->setWidth(child->width());
- rect->setHeight(child->height());
- rect->setTransformOrigin(child->transformOrigin());
- rect->setScale(child->scale());
- rect->setFlip(child->flip());
- rect->setTransform(child->transform());
-
- if(child->hasActiveFocus())
- rect->setColor(QColor(0, 0, 0, 10));
- else if(child->options() & QSimpleCanvasItem::IsFocusPanel)
- rect->setColor(QColor(0, 255, 0, 10));
- else if(child->options() & QSimpleCanvasItem::IsFocusRealm)
- rect->setColor(QColor(0, 0, 255, 10));
- else
- rect->setColor(QColor(255, 0, 0, 10));
-
- if(child->width() > 0 && child->height() > 0) {
- QPixmap pix(child->width(), child->height());
- pix.fill(QColor(0,0,0,0));
- QPainter p(&pix);
- child->paintContents(p);
- QFxImage *img = new QFxImage;
- img->setParent(rect);
- img->setWidth(child->width());
- img->setHeight(child->height());
- img->setPixmap(pix);
- img->setOpacity(0);
- childItem->img = img;
- }
-
- childItem->them = child;
- childItem->me = rect;
-
- clone(childItem, rect, child);
- }
-}
-
-void QmlCanvasDebugger::setX(int x)
-{
- m_canvasRoot->setX(x);
-}
-
-void QmlCanvasDebugger::setY(int y)
-{
- m_canvasRoot->setY(y);
-}
-
-void QmlCanvasDebugger::setCanvas(QSimpleCanvas *canvas)
-{
- QList<QSimpleCanvasItem *> children = m_canvasRoot->children();
- qDeleteAll(children);
- m_tree->clear();
- m_selected = 0;
-
- m_debugCanvas = canvas;
- if(!m_debugCanvas)
- return;
-
- QTreeWidgetItem *root = new QmlCanvasDebuggerItem(m_tree);
- root->setText(0, tr("Root"));
- root->setExpanded(true);
- clone(root, m_canvasRoot, m_debugCanvas->root());
-}
-
diff --git a/src/declarative/debugger/qmlcanvasdebugger_p.h b/src/declarative/debugger/qmlcanvasdebugger_p.h
deleted file mode 100644
index 80a2322..0000000
--- a/src/declarative/debugger/qmlcanvasdebugger_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLCANVASDEBUGGER_P_H
-#define QMLCANVASDEBUGGER_P_H
-
-#include <QtGui/qwidget.h>
-#include <QtCore/qpointer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSimpleCanvas;
-class QSimpleCanvasItem;
-class QTreeWidget;
-class QTreeWidgetItem;
-class QmlWatches;
-class QmlCanvasDebugger : public QWidget
-{
- Q_OBJECT
-public:
- QmlCanvasDebugger(QmlWatches *, QWidget *parent = 0);
-
- void setCanvas(QSimpleCanvas *);
-
-signals:
- void objectClicked(quint32);
-
-private slots:
- void refresh();
- void itemClicked(QTreeWidgetItem *);
- void itemExpanded(QTreeWidgetItem *);
- void itemCollapsed(QTreeWidgetItem *);
- void setX(int);
- void setY(int);
-
-private:
- void setOpacityRecur(QTreeWidgetItem *, qreal);
- void clone(QTreeWidgetItem *, QSimpleCanvasItem *me, QSimpleCanvasItem *them);
-
- QmlWatches *m_watches;
- QTreeWidget *m_tree;
- QSimpleCanvas *m_canvas;
- QSimpleCanvasItem *m_canvasRoot;
- QPointer<QSimpleCanvas> m_debugCanvas;
- QTreeWidgetItem *m_selected;
-};
-
-QT_END_NAMESPACE
-
-#endif // QMLCANVASDEBUGGER_P_H
-
diff --git a/src/declarative/debugger/qmldebugclient.cpp b/src/declarative/debugger/qmldebugclient.cpp
index 7a304ef..85ccf0b 100644
--- a/src/declarative/debugger/qmldebugclient.cpp
+++ b/src/declarative/debugger/qmldebugclient.cpp
@@ -73,7 +73,7 @@ QmlDebugClientPrivate::QmlDebugClientPrivate(QmlDebugClient *c)
void QmlDebugClientPrivate::connected()
{
QPacket pack;
- pack << QString(QLatin1String("QmlDebugServer")) << QStringList();
+ pack << QString(QLatin1String("QmlDebugServer")) << enabled;
protocol->send(pack);
}
@@ -178,7 +178,7 @@ void QmlDebugClientPlugin::sendMessage(const QByteArray &message)
QPacket pack;
pack << d->name << message;
- d->client->d_func()->protocol->send(pack);
+ d->client->d->protocol->send(pack);
}
void QmlDebugClientPlugin::messageReceived(const QByteArray &)
diff --git a/src/declarative/debugger/qmldebugclient.h b/src/declarative/debugger/qmldebugclient.h
index d765822..3fbf534 100644
--- a/src/declarative/debugger/qmldebugclient.h
+++ b/src/declarative/debugger/qmldebugclient.h
@@ -54,7 +54,6 @@ class QmlDebugClientPrivate;
class Q_DECLARATIVE_EXPORT QmlDebugClient : public QTcpSocket
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlDebugClient)
Q_DISABLE_COPY(QmlDebugClient)
public:
QmlDebugClient(QObject * = 0);
diff --git a/src/declarative/debugger/qmldebugger.cpp b/src/declarative/debugger/qmldebugger.cpp
index 0bbcb2c..c925148 100644
--- a/src/declarative/debugger/qmldebugger.cpp
+++ b/src/declarative/debugger/qmldebugger.cpp
@@ -61,11 +61,10 @@
#include <QtDeclarative/qmlexpression.h>
#include <private/qmlpropertyview_p.h>
#include <private/qmlwatches_p.h>
-#include <private/qmlcanvasdebugger_p.h>
QmlDebugger::QmlDebugger(QWidget *parent)
: QWidget(parent), m_tree(0), m_warnings(0), m_watchTable(0), m_watches(0),
- m_canvas(0), m_properties(0), m_text(0), m_highlightedItem(0)
+ m_properties(0), m_text(0), m_highlightedItem(0)
{
QHBoxLayout *layout = new QHBoxLayout;
setLayout(layout);
@@ -111,11 +110,6 @@ QmlDebugger::QmlDebugger(QWidget *parent)
tabs->addTab(m_properties, tr("Properties"));
tabs->setCurrentWidget(m_properties);
- m_canvas = new QmlCanvasDebugger(m_watches, this);
- QObject::connect(m_canvas, SIGNAL(objectClicked(quint32)),
- this, SLOT(highlightObject(quint32)));
- tabs->addTab(m_canvas, tr("Canvas"));
-
splitter->addWidget(tabs);
splitter->setStretchFactor(1, 2);
@@ -339,7 +333,6 @@ bool operator<(const QPair<quint32, QPair<int, QString> > &lhs,
void QmlDebugger::setCanvas(QSimpleCanvas *c)
{
- m_canvas->setCanvas(c);
}
void QmlDebugger::setDebugObject(QObject *obj)
diff --git a/src/declarative/debugger/qmldebugger.h b/src/declarative/debugger/qmldebugger.h
index 4641bce..10b2f9a 100644
--- a/src/declarative/debugger/qmldebugger.h
+++ b/src/declarative/debugger/qmldebugger.h
@@ -61,7 +61,6 @@ class QmlPropertyView;
class QmlWatches;
class QmlObjectTree;
class QmlContext;
-class QmlCanvasDebugger;
class QSimpleCanvas;
class QmlDebugger : public QWidget
{
@@ -88,7 +87,6 @@ private:
QTreeWidget *m_warnings;
QTableView *m_watchTable;
QmlWatches *m_watches;
- QmlCanvasDebugger *m_canvas;
QmlPropertyView *m_properties;
QPlainTextEdit *m_text;
QPointer<QObject> m_object;
diff --git a/src/declarative/debugger/qmldebugserver.cpp b/src/declarative/debugger/qmldebugserver.cpp
index bce7e6d..a253e8c 100644
--- a/src/declarative/debugger/qmldebugserver.cpp
+++ b/src/declarative/debugger/qmldebugserver.cpp
@@ -258,6 +258,21 @@ bool QmlDebugServerPlugin::isDebuggingEnabled()
return QmlDebugServer::instance() != 0;
}
+QString QmlDebugServerPlugin::objectToString(QObject *obj)
+{
+ if(!obj)
+ return QLatin1String("NULL");
+
+ QString objectName = obj->objectName();
+ if(objectName.isEmpty())
+ objectName = QLatin1String("<unnamed>");
+
+ QString rv = QLatin1String(obj->metaObject()->className()) +
+ QLatin1String(": ") + objectName;
+
+ return rv;
+}
+
void QmlDebugServerPlugin::sendMessage(const QByteArray &message)
{
Q_D(QmlDebugServerPlugin);
diff --git a/src/declarative/debugger/qmldebugserver.h b/src/declarative/debugger/qmldebugserver.h
index 8ee2cfb..02fe7d1 100644
--- a/src/declarative/debugger/qmldebugserver.h
+++ b/src/declarative/debugger/qmldebugserver.h
@@ -64,6 +64,7 @@ public:
void sendMessage(const QByteArray &);
static bool isDebuggingEnabled();
+ static QString objectToString(QObject *obj);
protected:
virtual void enabledChanged(bool);