2010-07-08 11:34:51 +02:00
|
|
|
#ifndef SCRIPTBINDINGREWRITER_H
|
|
|
|
|
#define SCRIPTBINDINGREWRITER_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QWeakPointer>
|
|
|
|
|
|
|
|
|
|
#include <private/qdeclarativedebug_p.h>
|
|
|
|
|
#include <qmljs/parser/qmljsastfwd_p.h>
|
|
|
|
|
#include <qmljs/qmljsdocument.h>
|
|
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QTextDocument)
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QDeclarativeDebugObjectReference)
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class IEditor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace QmlJS {
|
|
|
|
|
class ModelManagerInterface;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace QmlJSEditor {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
class QmlJSTextEditor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace QmlJSInspector {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class QmlJSLiveTextPreview : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2010-07-09 17:02:36 +02:00
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
public:
|
2010-07-20 12:35:36 +02:00
|
|
|
explicit QmlJSLiveTextPreview(const QmlJS::Document::Ptr &doc, const QmlJS::Document::Ptr &initDoc, QObject *parent = 0);
|
2010-07-08 11:34:51 +02:00
|
|
|
static QmlJS::ModelManagerInterface *modelManager();
|
2010-07-16 15:59:08 +02:00
|
|
|
//void updateDocuments();
|
2010-07-08 11:34:51 +02:00
|
|
|
|
2010-07-16 15:59:08 +02:00
|
|
|
void associateEditor(Core::IEditor *editor);
|
|
|
|
|
void unassociateEditor(Core::IEditor *editor);
|
2010-07-08 11:34:51 +02:00
|
|
|
void setActiveObject(const QDeclarativeDebugObjectReference &object);
|
|
|
|
|
void mapObjectToQml(const QDeclarativeDebugObjectReference &object);
|
2010-07-20 12:35:36 +02:00
|
|
|
void resetInitialDoc(const QmlJS::Document::Ptr &doc);
|
2010-07-08 11:34:51 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void selectedItemsChanged(const QList<QDeclarativeDebugObjectReference> &objects);
|
|
|
|
|
|
|
|
|
|
private slots:
|
2010-07-12 17:18:05 +02:00
|
|
|
void changeSelectedElements(QList<int> offsets, const QString &wordAtCursor);
|
2010-07-08 11:34:51 +02:00
|
|
|
void documentChanged(QmlJS::Document::Ptr doc);
|
2010-07-20 12:50:14 +02:00
|
|
|
public slots:
|
2010-07-14 17:38:04 +02:00
|
|
|
void updateDebugIds(const QDeclarativeDebugObjectReference &rootReference);
|
2010-07-08 11:34:51 +02:00
|
|
|
|
|
|
|
|
private:
|
2010-07-13 14:08:11 +02:00
|
|
|
QList<QDeclarativeDebugObjectReference > objectReferencesForOffset(quint32 offset) const;
|
2010-07-08 11:34:51 +02:00
|
|
|
QVariant castToLiteral(const QString &expression, QmlJS::AST::UiScriptBinding *scriptBinding);
|
|
|
|
|
|
|
|
|
|
private:
|
2010-07-16 15:59:08 +02:00
|
|
|
QHash<QmlJS::AST::UiObjectMember*, QList<QDeclarativeDebugObjectReference> > m_debugIds;
|
2010-07-19 15:10:36 +02:00
|
|
|
QHash<QmlJS::Document::Ptr, QSet<QmlJS::AST::UiObjectMember *> > m_createdObjects;
|
2010-07-16 15:59:08 +02:00
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
QmlJS::Document::Ptr m_previousDoc;
|
2010-07-16 16:37:40 +02:00
|
|
|
QmlJS::Document::Ptr m_initialDoc; //the document that was loaded by the server
|
2010-07-16 15:59:08 +02:00
|
|
|
QString m_filename;
|
2010-07-08 11:34:51 +02:00
|
|
|
|
2010-07-16 15:59:08 +02:00
|
|
|
QList<QWeakPointer<QmlJSEditor::Internal::QmlJSTextEditor> > m_editors;
|
2010-07-08 11:34:51 +02:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlJSInspector
|
|
|
|
|
|
|
|
|
|
#endif // SCRIPTBINDINGREWRITER_H
|