diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-07 05:45:08 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-07 05:45:08 (GMT) |
commit | b530723f5a7254d6a2a144aa27789651fe872c6d (patch) | |
tree | e94a418f2bdde351248974aea0c1e59445df27a7 /src/declarative/debugger | |
parent | e82217bf8e4ebaba20eb255bd52a9f261467b9d8 (diff) | |
download | Qt-b530723f5a7254d6a2a144aa27789651fe872c6d.zip Qt-b530723f5a7254d6a2a144aa27789651fe872c6d.tar.gz Qt-b530723f5a7254d6a2a144aa27789651fe872c6d.tar.bz2 |
Add a QmlDebuggerStatus interface elements can use to interact with the debugger
Diffstat (limited to 'src/declarative/debugger')
-rw-r--r-- | src/declarative/debugger/debugger.pri | 6 | ||||
-rw-r--r-- | src/declarative/debugger/qmldebugger.cpp | 22 | ||||
-rw-r--r-- | src/declarative/debugger/qmldebugger.h | 1 | ||||
-rw-r--r-- | src/declarative/debugger/qmldebuggerstatus.cpp | 54 | ||||
-rw-r--r-- | src/declarative/debugger/qmldebuggerstatus.h | 67 |
5 files changed, 148 insertions, 2 deletions
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index ea5219a..b88b7b3 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -1,3 +1,5 @@ -SOURCES += debugger/qmldebugger.cpp +SOURCES += debugger/qmldebugger.cpp \ + debugger/qmldebuggerstatus.cpp -HEADERS += debugger/qmldebugger.h +HEADERS += debugger/qmldebugger.h \ + debugger/qmldebuggerstatus.h diff --git a/src/declarative/debugger/qmldebugger.cpp b/src/declarative/debugger/qmldebugger.cpp index a1956f9..f232f02 100644 --- a/src/declarative/debugger/qmldebugger.cpp +++ b/src/declarative/debugger/qmldebugger.cpp @@ -46,6 +46,7 @@ #include <QTextBlock> #include <QtGui/qtabwidget.h> #include <QtDeclarative/qmlbindablevalue.h> +#include <QtDeclarative/qmldebuggerstatus.h> #include <private/qmlboundsignal_p.h> #include <private/qmlcontext_p.h> #include <private/qmlengine_p.h> @@ -119,6 +120,7 @@ public: int endLine; QUrl url; + QPointer<QObject> object; QPointer<QmlBindableValue> bindableValue; }; @@ -144,6 +146,24 @@ void QmlDebugger::itemDoubleClicked(QTreeWidgetItem *i) void QmlDebugger::itemClicked(QTreeWidgetItem *i) { QmlDebuggerItem *item = static_cast<QmlDebuggerItem *>(i); + + if(m_selectedItem) { + QmlDebuggerStatus *debug = + qobject_cast<QmlDebuggerStatus *>(m_selectedItem); + Q_ASSERT(debug); + debug->setSelectedState(false); + m_selectedItem = 0; + } + + if(item->object) { + QmlDebuggerStatus *debug = + qobject_cast<QmlDebuggerStatus *>(item->object); + if(debug) { + debug->setSelectedState(true); + m_selectedItem = item->object; + } + } + if(item->url.scheme() == QLatin1String("file")) { QString f = item->url.toLocalFile(); QFile file(f); @@ -194,6 +214,8 @@ bool QmlDebugger::makeItem(QObject *obj, QmlDebuggerItem *item) QString text; + item->object = obj; + if(QmlBindableValue *bv = qobject_cast<QmlBindableValue *>(obj)) { QmlExpressionPrivate *p = bv->d; diff --git a/src/declarative/debugger/qmldebugger.h b/src/declarative/debugger/qmldebugger.h index e04eb2e..8d2593d 100644 --- a/src/declarative/debugger/qmldebugger.h +++ b/src/declarative/debugger/qmldebugger.h @@ -82,6 +82,7 @@ private: QPointer<QObject> m_object; QList<QPair<quint32, QPair<int, QString> > > m_expressions; QSet<quint32> m_watchedIds; + QPointer<QObject> m_selectedItem; }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qmldebuggerstatus.cpp b/src/declarative/debugger/qmldebuggerstatus.cpp new file mode 100644 index 0000000..d46a21d --- /dev/null +++ b/src/declarative/debugger/qmldebuggerstatus.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** 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 "qmldebuggerstatus.h" + +QT_BEGIN_NAMESPACE + +QmlDebuggerStatus::~QmlDebuggerStatus() +{ +} + +void QmlDebuggerStatus::setSelectedState(bool) +{ +} + +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qmldebuggerstatus.h b/src/declarative/debugger/qmldebuggerstatus.h new file mode 100644 index 0000000..8c6355d --- /dev/null +++ b/src/declarative/debugger/qmldebuggerstatus.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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 QMLDEBUGGERSTATUS_P_H +#define QMLDEBUGGERSTATUS_P_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class Q_DECLARATIVE_EXPORT QmlDebuggerStatus +{ +public: + virtual ~QmlDebuggerStatus(); + + virtual void setSelectedState(bool); +}; +Q_DECLARE_INTERFACE(QmlDebuggerStatus, "com.trolltech.qml.QmlDebuggerStatus"); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLMDEBUGGERSTATUS_P_H + |