2010-06-29 12:41:26 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLJSINSPECTOR_H
|
|
|
|
|
#define QMLJSINSPECTOR_H
|
|
|
|
|
|
2010-06-29 13:51:50 +02:00
|
|
|
#include "qmljsprivateapi.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/basemode.h>
|
|
|
|
|
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
|
|
|
|
|
|
|
|
|
|
#include <qmljs/qmljsdocument.h>
|
|
|
|
|
#include <qmljs/parser/qmljsastfwd_p.h>
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QAction>
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class Project;
|
|
|
|
|
class Environment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class IContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
class DebuggerRunControl;
|
|
|
|
|
}
|
2010-06-29 12:41:26 +02:00
|
|
|
|
|
|
|
|
namespace QmlJSInspector {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-06-29 13:51:50 +02:00
|
|
|
class ClientProxy;
|
|
|
|
|
class InspectorContext;
|
2010-07-08 11:34:51 +02:00
|
|
|
class QmlJSLiveTextPreview;
|
2010-06-29 13:51:50 +02:00
|
|
|
|
2010-06-29 12:41:26 +02:00
|
|
|
class Inspector : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-06-29 13:51:50 +02:00
|
|
|
enum DebugMode {
|
|
|
|
|
StandaloneMode,
|
|
|
|
|
CppProjectWithQmlEngines,
|
|
|
|
|
QmlProjectWithCppPlugins
|
|
|
|
|
};
|
|
|
|
|
|
2010-07-09 17:02:36 +02:00
|
|
|
QHash< QString, QList< QPair< QmlJS::AST::UiObjectMember*, int > > > m_initialTable;
|
|
|
|
|
|
2010-06-29 14:12:39 +02:00
|
|
|
public:
|
2010-06-29 12:41:26 +02:00
|
|
|
Inspector(QObject *parent = 0);
|
2010-06-29 14:12:39 +02:00
|
|
|
virtual ~Inspector();
|
2010-06-29 13:51:50 +02:00
|
|
|
|
|
|
|
|
bool connectToViewer(); // using host, port from widgets
|
2010-06-29 14:12:39 +02:00
|
|
|
void shutdown();
|
2010-06-29 13:51:50 +02:00
|
|
|
|
|
|
|
|
// returns false if project is not debuggable.
|
|
|
|
|
bool setDebugConfigurationDataFromProject(ProjectExplorer::Project *projectToDebug);
|
|
|
|
|
void startQmlProjectDebugger();
|
|
|
|
|
|
|
|
|
|
QDeclarativeDebugExpressionQuery *executeExpression(int objectDebugId, const QString &objectId,
|
|
|
|
|
const QString &propertyName, const QVariant &value);
|
|
|
|
|
|
|
|
|
|
QDeclarativeDebugExpressionQuery *setBindingForObject(int objectDebugId, const QString &objectId,
|
2010-06-29 14:12:39 +02:00
|
|
|
const QString &propertyName, const QVariant &value,
|
|
|
|
|
bool isLiteralValue);
|
2010-06-29 13:51:50 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void statusMessage(const QString &text);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void setSimpleDockWidgetArrangement();
|
|
|
|
|
void reloadQmlViewer();
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void gotoObjectReferenceDefinition(const QDeclarativeDebugObjectReference &obj);
|
|
|
|
|
void simultaneouslyDebugQmlCppApplication();
|
|
|
|
|
|
|
|
|
|
void debuggerStateChanged(int newState);
|
|
|
|
|
void pollInspector();
|
|
|
|
|
|
|
|
|
|
void setSelectedItemsByObjectReference(QList<QDeclarativeDebugObjectReference> objectReferences);
|
2010-07-08 11:34:51 +02:00
|
|
|
void changeSelectedItems(const QList<QDeclarativeDebugObjectReference> &objects);
|
2010-06-29 13:51:50 +02:00
|
|
|
|
|
|
|
|
void updateMenuActions();
|
|
|
|
|
void connected(QDeclarativeEngineDebug *client);
|
|
|
|
|
void aboutToReloadEngines();
|
|
|
|
|
void updateEngineList();
|
|
|
|
|
|
|
|
|
|
void disconnectWidgets();
|
|
|
|
|
void disconnected();
|
|
|
|
|
|
2010-07-09 17:02:36 +02:00
|
|
|
void objectTreeUpdated(const QDeclarativeDebugObjectReference &ref);
|
|
|
|
|
|
2010-06-29 13:51:50 +02:00
|
|
|
private:
|
|
|
|
|
Debugger::DebuggerRunControl *createDebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig,
|
|
|
|
|
const QString &executableFile = QString(),
|
|
|
|
|
const QString &executableArguments = QString());
|
|
|
|
|
|
|
|
|
|
QString executeDebuggerRunControl(Debugger::DebuggerRunControl *debuggableRunControl,
|
|
|
|
|
ProjectExplorer::Environment *environment);
|
|
|
|
|
|
|
|
|
|
QString attachToQmlViewerAsExternalApp(ProjectExplorer::Project *project);
|
|
|
|
|
QString attachToExternalCppAppWithQml(ProjectExplorer::Project *project);
|
|
|
|
|
|
|
|
|
|
bool addQuotesForData(const QVariant &value) const;
|
|
|
|
|
void resetViews();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QWeakPointer<QDeclarativeEngineDebug> m_client;
|
2010-06-29 14:12:39 +02:00
|
|
|
QmlProjectManager::QmlProjectRunConfigurationDebugData m_runConfigurationDebugData;
|
2010-06-29 13:51:50 +02:00
|
|
|
InspectorContext *m_context;
|
|
|
|
|
QTimer *m_connectionTimer;
|
|
|
|
|
int m_connectionAttempts;
|
|
|
|
|
int m_cppDebuggerState;
|
|
|
|
|
bool m_connectionInitialized;
|
|
|
|
|
bool m_simultaneousCppAndQmlDebugMode;
|
|
|
|
|
DebugMode m_debugMode;
|
|
|
|
|
ClientProxy *m_clientProxy;
|
2010-07-08 11:34:51 +02:00
|
|
|
|
|
|
|
|
// Qml/JS integration
|
|
|
|
|
QmlJSLiveTextPreview *m_textPreview;
|
2010-06-29 12:41:26 +02:00
|
|
|
};
|
|
|
|
|
|
2010-06-29 13:51:50 +02:00
|
|
|
} // Internal
|
|
|
|
|
} // QmlJSInspector
|
2010-06-29 12:41:26 +02:00
|
|
|
|
2010-06-29 13:51:50 +02:00
|
|
|
#endif
|