2010-07-08 11:32:45 +02:00
|
|
|
#ifndef QMLJSOUTLINE_H
|
|
|
|
|
#define QMLJSOUTLINE_H
|
|
|
|
|
|
2010-07-08 15:23:22 +02:00
|
|
|
#include "qmljseditor.h"
|
2010-07-08 11:32:45 +02:00
|
|
|
|
2010-07-16 11:18:30 +02:00
|
|
|
#include <utils/navigationtreeview.h>
|
2010-07-08 11:32:45 +02:00
|
|
|
#include <texteditor/ioutlinewidget.h>
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QTreeView>
|
2010-07-14 16:46:54 +02:00
|
|
|
#include <QtGui/QSortFilterProxyModel>
|
2010-07-08 11:32:45 +02:00
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class IEditor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace QmlJS {
|
|
|
|
|
class Editor;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
namespace QmlJSEditor {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-07-16 11:18:30 +02:00
|
|
|
class QmlJSOutlineTreeView : public Utils::NavigationTreeView
|
2010-07-08 11:32:45 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
QmlJSOutlineTreeView(QWidget *parent = 0);
|
|
|
|
|
};
|
|
|
|
|
|
2010-07-14 16:46:54 +02:00
|
|
|
class QmlJSOutlineFilterModel : public QSortFilterProxyModel
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
QmlJSOutlineFilterModel(QObject *parent);
|
|
|
|
|
// QSortFilterProxyModel
|
|
|
|
|
bool filterAcceptsRow(int sourceRow,
|
|
|
|
|
const QModelIndex &sourceParent) const;
|
|
|
|
|
|
|
|
|
|
bool filterBindings() const;
|
|
|
|
|
void setFilterBindings(bool filterBindings);
|
|
|
|
|
private:
|
|
|
|
|
bool m_filterBindings;
|
|
|
|
|
};
|
|
|
|
|
|
2010-07-08 11:32:45 +02:00
|
|
|
class QmlJSOutlineWidget : public TextEditor::IOutlineWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
QmlJSOutlineWidget(QWidget *parent = 0);
|
|
|
|
|
|
|
|
|
|
void setEditor(QmlJSTextEditor *editor);
|
|
|
|
|
|
|
|
|
|
// IOutlineWidget
|
2010-07-14 16:46:54 +02:00
|
|
|
virtual QList<QAction*> filterMenuActions() const;
|
2010-07-08 11:32:45 +02:00
|
|
|
virtual void setCursorSynchronization(bool syncWithCursor);
|
|
|
|
|
|
|
|
|
|
private slots:
|
2010-07-12 14:45:22 +02:00
|
|
|
void modelUpdated();
|
|
|
|
|
void updateSelectionInTree(const QModelIndex &index);
|
2010-07-08 11:32:45 +02:00
|
|
|
void updateSelectionInText(const QItemSelection &selection);
|
2010-07-14 16:46:54 +02:00
|
|
|
void setShowBindings(bool showBindings);
|
2010-07-08 11:32:45 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool syncCursor();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QmlJSOutlineTreeView *m_treeView;
|
2010-07-14 16:46:54 +02:00
|
|
|
QmlJSOutlineFilterModel *m_filterModel;
|
2010-07-08 11:32:45 +02:00
|
|
|
QWeakPointer<QmlJSTextEditor> m_editor;
|
|
|
|
|
|
2010-07-14 16:46:54 +02:00
|
|
|
QAction *m_showBindingsAction;
|
|
|
|
|
|
2010-07-08 11:32:45 +02:00
|
|
|
bool m_enableCursorSync;
|
|
|
|
|
bool m_blockCursorSync;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QmlJSOutlineWidgetFactory : public TextEditor::IOutlineWidgetFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
bool supportsEditor(Core::IEditor *editor) const;
|
|
|
|
|
TextEditor::IOutlineWidget *createWidget(Core::IEditor *editor);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlJSEditor
|
|
|
|
|
|
|
|
|
|
#endif // QMLJSOUTLINE_H
|