1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef QMLJSINSPECTOR_H
35 #define QMLJSINSPECTOR_H
37 #include "qmljsprivateapi.h"
39 #include <qmlprojectmanager/qmlprojectrunconfiguration.h>
40 #include <utils/fileinprojectfinder.h>
42 #include <qmljs/qmljsdocument.h>
43 #include <qmljs/parser/qmljsastfwd_p.h>
45 #include <QtGui/QAction>
46 #include <QtCore/QObject>
48 QT_FORWARD_DECLARE_CLASS(QLineEdit)
50 namespace ProjectExplorer {
55 namespace TextEditor {
64 class ModelManagerInterface;
67 namespace QmlJSInspector {
70 class QmlInspectorToolBar;
71 class QmlJSPropertyInspector;
73 class InspectorSettings;
74 class ContextCrumblePath;
75 class QmlJSLiveTextPreview;
77 class InspectorUi : public QObject
84 CppProjectWithQmlEngines,
85 QmlProjectWithCppPlugins
88 InspectorUi(QObject *parent = 0);
89 virtual ~InspectorUi();
91 void saveSettings() const;
92 void restoreSettings();
94 bool showExperimentalWarning();
95 void setShowExperimentalWarning(bool value);
97 static InspectorUi *instance();
99 QString findFileInProject(const QString &file) const;
102 bool isConnected() const;
103 void connected(ClientProxy *clientProxy);
105 void setDebuggerEngine(QObject *qmlEngine);
106 QObject *debuggerEngine() const;
109 void statusMessage(const QString &text);
110 void livePreviewActivated(bool isActivated);
113 void reloadQmlViewer();
114 void serverReloaded();
115 void setApplyChangesToQmlObserver(bool applyChanges);
120 void gotoObjectReferenceDefinition(const QDeclarativeDebugObjectReference &obj);
121 void selectItems(const QList<QDeclarativeDebugObjectReference> &objectReferences);
122 void selectItems(const QList<int> &objectIds);
123 void changeSelectedItems(const QList<QDeclarativeDebugObjectReference> &objects);
124 void changePropertyValue(int debugId,const QString &propertyName, const QString &valueExpression);
125 void objectTreeReady();
127 void updateEngineList();
129 void removePreviewForEditor(Core::IEditor *newEditor);
130 QmlJSLiveTextPreview *createPreviewForEditor(Core::IEditor *newEditor);
132 void disableLivePreview();
133 void crumblePathElementClicked(int);
135 void currentDebugProjectRemoved();
136 void updatePendingPreviewDocuments(QmlJS::Document::Ptr doc);
137 void showDebuggerTooltip(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
138 void debugQueryUpdated(QDeclarativeDebugQuery::State);
141 bool addQuotesForData(const QVariant &value) const;
144 void initializeDocuments();
145 void applyChangesToQmlObserverHelper(bool applyChanges);
146 void setupDockWidgets();
147 QString filenameForShadowBuildFile(const QString &filename) const;
148 void populateCrumblePath(const QDeclarativeDebugObjectReference &objRef);
149 bool isRoot(const QDeclarativeDebugObjectReference &obj) const;
150 QDeclarativeDebugObjectReference objectReferenceForLocation(const QString &fileName, int cursorPosition=-1) const;
152 void connectSignals();
153 void disconnectSignals();
156 bool m_listeningToEditorManager;
157 QmlInspectorToolBar *m_toolBar;
158 ContextCrumblePath *m_crumblePath;
159 QLineEdit *m_filterExp;
160 QmlJSPropertyInspector *m_propertyInspector;
162 InspectorSettings *m_settings;
163 ClientProxy *m_clientProxy;
164 QObject *m_qmlEngine;
165 QDeclarativeDebugExpressionQuery *m_debugQuery;
167 // Qml/JS integration
168 QHash<QString, QmlJSLiveTextPreview *> m_textPreviews;
169 QmlJS::Snapshot m_loadedSnapshot; //the snapshot loaded by the viewer
171 // project is needed for matching filenames, esp. with shadow builds.
172 ProjectExplorer::Project *m_debugProject;
174 QStringList m_pendingPreviewDocumentNames;
175 Utils::FileInProjectFinder m_projectFinder;
177 static InspectorUi *m_instance;
178 bool m_selectionCallbackExpected;
179 bool m_cursorPositionChangedExternally;
185 #endif // QMLJSINSPECTOR_H