summaryrefslogtreecommitdiffstats
path: root/mappingtreewidget.h
blob: b6bbd57eb088109f1a976210c14e9dee81a34e28 (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
/*
  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 MAPPINGTREEWIDGET_H
#define MAPPINGTREEWIDGET_H

#include <QDialog>
#include <QSortFilterProxyModel>

#include "smtreeview.h"

class MappingTreeView;
class MappingTreeModel;
class QComboBox;
class QCheckBox;
class QStringListModel;
class MappingTreeResultModel;
class QLineEdit;
class MappingTreeProxy;
struct MappingData;

class MappingTreeWidget : public QWidget {
    Q_OBJECT
    public:
        explicit MappingTreeWidget(QWidget *parent = 0);
        MappingData selectedItem() const;
        QList<MappingData> selectedTree() const;
        QList<MappingData> selectedTreeRecursive(const QModelIndex &start) const;
        MappingTreeView *mappingTreeView() const { return mTree; }
        MappingTreeModel *mappingTreeModel() const { return mModel; }
        MappingTreeProxy *mappingTreeProxy() const { return mProxy; }

    public slots:
        void addChild();
        void addActor();
        void addType();
        void deleteChild();
        void deleteType();

    protected:
        virtual void hideEvent(QHideEvent *event);

    private slots:
        void typeChanged(QString type);
        void editChild();
        void selectionChanged();
        void filter();
        void clearFilter();

    signals:
        void mappingChanged(int);

    private:
        const QModelIndex selected() const;
        MappingTreeView *mTree;
        MappingTreeModel *mModel;
        MappingTreeProxy *mProxy;
        QStringListModel *mTypesModel;
        QComboBox *mTypeBox;
        QLineEdit *mFilter;
        QPushButton *mAddType;
        QPushButton *mDeleteType;
        QAction *mAddChildA;
        QAction *mAddActorA;
        QAction *mDeleteChildA;
        QAction *mEditChildA;
};

#endif // MAPPINGTREEWIDGET_H