/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #ifndef SERIESTREEWIDGET_H #define SERIESTREEWIDGET_H #include #include #include class QLineEdit; class QPushButton; class QSortFilterProxyModel; class SeriesTreeModel; class SeriesTreeView; class SeriesTreeSortModel; class SeriesTreeWidget : public QWidget { Q_OBJECT public: explicit SeriesTreeWidget(QWidget *parent = 0); SeriesTreeView *seriesTree() { return mView; } QModelIndexList mapToSource(const QModelIndexList &indexes) const; QModelIndex mapToSource(const QModelIndex &index) const; public slots: void newSeries(); void deleteFromSeries(); void readSettings(); void writeSettings(); void expandCurrent(); private slots: void filter(); void resort(); void itemExpanded(const QModelIndex &); void itemCollaped(const QModelIndex &); private: QLineEdit *mFilterEdit; QPushButton *mFilter; SeriesTreeView *mView; SeriesTreeSortModel *mProxy; SeriesTreeModel *mModel; QStringList mExpandedItems; }; class SeriesTreeView : public QTreeView { Q_OBJECT public: explicit SeriesTreeView(QWidget *parent = 0); protected: virtual void contextMenuEvent(QContextMenuEvent *e); }; class SeriesTreeSortModel : public QSortFilterProxyModel { Q_OBJECT public: SeriesTreeSortModel(QObject *parent = 0); ~SeriesTreeSortModel() {} protected: virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; }; #endif