summaryrefslogtreecommitdiffstats
path: root/tools/qmldebugger/engine.h
blob: b2c8221e7e34c7154ba34a27d25fe0988c9edab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef ENGINE_H
#define ENGINE_H

#include <QWidget>
#include <QtCore/qpointer.h>
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcontext.h>
#include <QtDeclarative/qmlview.h>
#include <QtDeclarative/qmldebug.h>

QT_BEGIN_NAMESPACE

class QmlDebugConnection;
class QmlDebugPropertyReference;
class QmlDebugWatch;
class QmlObjectTree;
class EngineClientPlugin;
class WatchTableModel;
class QLineEdit;
class QModelIndex;
class QTreeWidget;
class QTreeWidgetItem;
class QTabWidget;
class QTableWidget;
class QTableView;
class QTableWidgetItem;

class EnginePane : public QWidget
{
Q_OBJECT
public:
    EnginePane(QmlDebugConnection *, QWidget *parent = 0);

private slots:
    void queryEngines();
    void enginesChanged();

    void queryContext(int);
    void contextChanged();

    void fetchClicked();
    void fetchObject(int);
    void objectFetched();

    void engineSelected(int);

    void itemClicked(QTreeWidgetItem *);
    void showProperties();
    void addExpressionWatch(int debugId, const QString &expr);

    void valueChanged(const QByteArray &property, const QVariant &value);

    void propertyDoubleClicked(QTableWidgetItem *);
    void watchedItemActivated(const QModelIndex &index);

private:
    void dump(const QmlDebugContextReference &, int);
    void dump(const QmlDebugObjectReference &, int);
    void buildTree(const QmlDebugObjectReference &, QTreeWidgetItem *parent);
    bool togglePropertyWatch(const QmlDebugObjectReference &object, const QmlDebugPropertyReference &property);

    QmlEngineDebug m_client;
    QmlDebugEnginesQuery *m_engines;
    QmlDebugRootContextQuery *m_context;
    QmlDebugObjectQuery *m_object;

    QLineEdit *m_text;
    QmlObjectTree *m_objTree;
    QTabWidget *m_tabs;
    QTableWidget *m_propTable;
    QTableView *m_watchTable;

    QmlView *m_engineView;
    QList<QObject *> m_engineItems;

    QmlDebugWatch *m_watchedObject;
    WatchTableModel *m_watchTableModel;
    QHash< QPair<int, QString>, QPointer<QmlDebugWatch> > m_watchedProps;
};

QT_END_NAMESPACE

#endif // ENGINE_H