blob: 1bd77f479a5bcfb29c5e21aff2074da88aba7153 (
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/*
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 <QtWidgets/QWidget>
#include <QtWidgets/QTreeView>
#include <QtWidgets/QDialog>
class MappingTreeView;
class MappingTreeModel;
class QComboBox;
class QPushButton;
class QLabel;
class QCheckBox;
class QSortFilterProxyModel;
class QStringListModel;
class QAction;
class MappingTreeResultModel;
// defined in mappingtreemodel.h
struct MappingData;
class MappingTreeWidget : public QWidget {
Q_OBJECT
public:
explicit MappingTreeWidget(QWidget *parent = 0);
MappingData selectedItem() const;
public slots:
void addChild();
void addType();
void deleteChild();
void deleteType();
void selectPath(const QString &path);
protected:
virtual void hideEvent(QHideEvent *event);
private slots:
void typeChanged(QString type);
void editChild();
void selectionChanged();
void moveChild();
signals:
void mappingChanged(int);
private:
const QModelIndex selected() const;
MappingTreeView *mTree;
MappingTreeModel *mModel;
QSortFilterProxyModel *mProxy;
QStringListModel *mTypesModel;
QComboBox *mTypeBox;
QPushButton *mAddType;
QPushButton *mDeleteType;
QAction *mAddChildA;
QAction *mDeleteChildA;
QAction *mEditChildA;
QAction *mMoveChildA;
};
class MappingTreeView : public QTreeView {
Q_OBJECT
public:
MappingTreeView(QWidget *parent = 0);
protected:
virtual void contextMenuEvent(QContextMenuEvent *e);
};
class MappingTreeResultView : public QTreeView {
Q_OBJECT
public:
explicit MappingTreeResultView(QWidget *parent = 0);
};
class MappingEditWidget : public QWidget {
Q_OBJECT
public:
explicit MappingEditWidget(QWidget *parent = 0);
const MappingTreeResultModel *model() const { return mResultModel; }
public slots:
void addMapping();
void removeMapping();
void setMappings(const QList<MappingData> &mappings);
private:
MappingTreeWidget *mMappingTree;
MappingTreeResultView *mMappingResult;
MappingTreeResultModel *mResultModel;
QPushButton *mAddMapping;
QPushButton *mRemoveMapping;
};
class MappingInputDialog : public QDialog {
Q_OBJECT
public:
explicit MappingInputDialog(QWidget *parent, Qt::WindowFlags f = 0);
QString mappingName() const;
bool createRoot() const;
private:
QPushButton *mOk;
QPushButton *mCancel;
QLineEdit *mEditor;
QCheckBox *mIsRoot;
};
class MappingEditDialog : public QDialog {
Q_OBJECT
public:
explicit MappingEditDialog(QWidget *parent, Qt::WindowFlags f = 0);
MappingEditWidget *editWidget() const { return mEditWidget; }
private:
MappingEditWidget *mEditWidget;
QPushButton *mOk;
QPushButton *mCancel;
};
#endif // MAPPINGTREEWIDGET_H
|