diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2012-04-18 14:20:54 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2012-05-09 12:42:44 +0200 |
commit | 7f09d0b756ff3f9bb52737d4aaf65ed84d751316 (patch) | |
tree | 7469486e35fd0b6a3e7c4e7e8775f75784c414fd /src/plugins/debugger/qml/qmllivetextpreview.h | |
parent | d201c681daae42b005c9ea4f3a1e272ea9cc5ef5 (diff) |
Merge QML inspector into debugger plugin
Merge QmlJSInspector plugin into the debugger. Also merge the
extra Inspector window with the Locals & Watchers: It now shows
the QML object tree in the running state.
Change-Id: I59ae0c1b970a48ba10ecda92ed3ba765d94b1d9c
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
Diffstat (limited to 'src/plugins/debugger/qml/qmllivetextpreview.h')
-rw-r--r-- | src/plugins/debugger/qml/qmllivetextpreview.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/plugins/debugger/qml/qmllivetextpreview.h b/src/plugins/debugger/qml/qmllivetextpreview.h new file mode 100644 index 0000000000..0ba3a30b6f --- /dev/null +++ b/src/plugins/debugger/qml/qmllivetextpreview.h @@ -0,0 +1,114 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef QMLLIVETEXTPREVIEW_H +#define QMLLIVETEXTPREVIEW_H + +#include <QObject> + +#include <texteditor/basetexteditor.h> +#include <qmljs/qmljsdocument.h> + +namespace Core { +class IEditor; +} + +namespace QmlJS { +class ModelManagerInterface; +} + +namespace Debugger { +namespace Internal { + +class UpdateInspector; +class QmlInspectorAdapter; + +class QmlLiveTextPreview : public QObject +{ + Q_OBJECT + +public: + QmlLiveTextPreview(const QmlJS::Document::Ptr &doc, + const QmlJS::Document::Ptr &initDoc, + QmlInspectorAdapter *inspectorAdapter, + QObject *parent = 0); + + void associateEditor(Core::IEditor *editor); + void unassociateEditor(Core::IEditor *editor); + void resetInitialDoc(const QmlJS::Document::Ptr &doc); + +signals: + void selectedItemsChanged(const QList<int> &debugIds); + +public slots: + void setApplyChangesToQmlInspector(bool applyChanges); + void updateDebugIds(); + +private slots: + void changeSelectedElements(QList<int> offsets, const QString &wordAtCursor); + void documentChanged(QmlJS::Document::Ptr doc); + +private: + enum UnsyncronizableChangeType { + NoUnsyncronizableChanges, + AttributeChangeWarning, + ElementChangeWarning + }; + + QList<int> objectReferencesForOffset(quint32 offset); + void showSyncWarning(UnsyncronizableChangeType unsyncronizableChangeType, + const QString &elementName, + unsigned line, unsigned column); + +private: + QHash<QmlJS::AST::UiObjectMember*, QList<int> > m_debugIds; + QHash<QmlJS::Document::Ptr, QSet<QmlJS::AST::UiObjectMember *> > m_createdObjects; + + QmlJS::Document::Ptr m_previousDoc; + QmlJS::Document::Ptr m_initialDoc; //the document that was loaded by the server + + QList<QPointer<TextEditor::BaseTextEditorWidget> > m_editors; + + bool m_applyChangesToQmlInspector; + QmlJS::Document::Ptr m_docWithUnappliedChanges; + QmlInspectorAdapter *m_inspectorAdapter; + QList<int> m_lastOffsets; + QmlJS::AST::UiObjectMember *m_nodeForOffset; + bool m_updateNodeForOffset; + + friend class UpdateInspector; +}; + +} // namespace Internal +} // namespace Debugger + +#endif // QMLLIVETEXTPREVIEW_H |