Chris@43
|
1
|
Chris@58
|
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@43
|
3
|
Chris@43
|
4 /*
|
Chris@59
|
5 Sonic Visualiser
|
Chris@59
|
6 An audio file viewer and annotation editor.
|
Chris@59
|
7 Centre for Digital Music, Queen Mary, University of London.
|
Chris@59
|
8 This file copyright 2006 Chris Cannam.
|
Chris@43
|
9
|
Chris@59
|
10 This program is free software; you can redistribute it and/or
|
Chris@59
|
11 modify it under the terms of the GNU General Public License as
|
Chris@59
|
12 published by the Free Software Foundation; either version 2 of the
|
Chris@59
|
13 License, or (at your option) any later version. See the file
|
Chris@59
|
14 COPYING included with this distribution for more information.
|
Chris@43
|
15 */
|
Chris@43
|
16
|
Chris@43
|
17 #ifndef _LAYER_TREE_H_
|
Chris@43
|
18 #define _LAYER_TREE_H_
|
Chris@43
|
19
|
Chris@43
|
20 #include <QAbstractItemModel>
|
Chris@43
|
21
|
Chris@374
|
22 #include <set>
|
Chris@374
|
23
|
Chris@43
|
24 class PaneStack;
|
Chris@56
|
25 class View;
|
Chris@374
|
26 class Pane;
|
Chris@56
|
27 class Layer;
|
Chris@298
|
28 class PropertyContainer;
|
Chris@374
|
29 class Model;
|
Chris@374
|
30
|
Chris@374
|
31 class ModelDataModel : public QAbstractItemModel
|
Chris@374
|
32 {
|
Chris@374
|
33 Q_OBJECT
|
Chris@374
|
34
|
Chris@374
|
35 public:
|
Chris@374
|
36 ModelDataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0);
|
Chris@374
|
37 virtual ~ModelDataModel();
|
Chris@374
|
38
|
Chris@374
|
39 QVariant data(const QModelIndex &index, int role) const;
|
Chris@374
|
40
|
Chris@374
|
41 bool setData(const QModelIndex &index, const QVariant &value, int role);
|
Chris@374
|
42
|
Chris@374
|
43 Qt::ItemFlags flags(const QModelIndex &index) const;
|
Chris@374
|
44
|
Chris@374
|
45 QVariant headerData(int section, Qt::Orientation orientation,
|
Chris@374
|
46 int role = Qt::DisplayRole) const;
|
Chris@374
|
47
|
Chris@374
|
48 QModelIndex index(int row, int column,
|
Chris@374
|
49 const QModelIndex &parent = QModelIndex()) const;
|
Chris@374
|
50
|
Chris@374
|
51 QModelIndex parent(const QModelIndex &index) const;
|
Chris@374
|
52
|
Chris@374
|
53 int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
Chris@374
|
54 int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
Chris@374
|
55
|
Chris@374
|
56 protected slots:
|
Chris@374
|
57 void paneAdded();
|
Chris@374
|
58 void paneDeleted();
|
Chris@374
|
59 void propertyContainerAdded(PropertyContainer *);
|
Chris@374
|
60 void propertyContainerRemoved(PropertyContainer *);
|
Chris@374
|
61 void propertyContainerSelected(PropertyContainer *);
|
Chris@374
|
62 void propertyContainerPropertyChanged(PropertyContainer *);
|
Chris@374
|
63 void playParametersAudibilityChanged(bool);
|
Chris@374
|
64 void paneLayerModelChanged();
|
Chris@374
|
65 void rebuildModelSet();
|
Chris@374
|
66
|
Chris@374
|
67 protected:
|
Chris@374
|
68 PaneStack *m_stack;
|
Chris@374
|
69 bool m_waveModelsOnly;
|
Chris@374
|
70 int m_modelTypeColumn;
|
Chris@374
|
71 int m_modelNameColumn;
|
Chris@374
|
72 int m_modelMakerColumn;
|
Chris@374
|
73 int m_modelSourceColumn;
|
Chris@374
|
74 int m_columnCount;
|
Chris@374
|
75
|
Chris@374
|
76 std::set<Model *> m_models;
|
Chris@374
|
77 };
|
Chris@43
|
78
|
Chris@43
|
79 class LayerTreeModel : public QAbstractItemModel
|
Chris@43
|
80 {
|
Chris@43
|
81 Q_OBJECT
|
Chris@43
|
82
|
Chris@43
|
83 public:
|
Chris@43
|
84 LayerTreeModel(PaneStack *stack, QObject *parent = 0);
|
Chris@43
|
85 virtual ~LayerTreeModel();
|
Chris@43
|
86
|
Chris@43
|
87 QVariant data(const QModelIndex &index, int role) const;
|
Chris@43
|
88
|
Chris@298
|
89 bool setData(const QModelIndex &index, const QVariant &value, int role);
|
Chris@298
|
90
|
Chris@56
|
91 Qt::ItemFlags flags(const QModelIndex &index) const;
|
Chris@43
|
92
|
Chris@56
|
93 QVariant headerData(int section, Qt::Orientation orientation,
|
Chris@56
|
94 int role = Qt::DisplayRole) const;
|
Chris@43
|
95
|
Chris@43
|
96 QModelIndex index(int row, int column,
|
Chris@43
|
97 const QModelIndex &parent = QModelIndex()) const;
|
Chris@43
|
98
|
Chris@43
|
99 QModelIndex parent(const QModelIndex &index) const;
|
Chris@43
|
100
|
Chris@43
|
101 int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
Chris@43
|
102 int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
Chris@43
|
103
|
Chris@298
|
104 protected slots:
|
Chris@374
|
105 void paneAdded();
|
Chris@374
|
106 void paneAboutToBeDeleted(Pane *);
|
Chris@298
|
107 void propertyContainerAdded(PropertyContainer *);
|
Chris@298
|
108 void propertyContainerRemoved(PropertyContainer *);
|
Chris@298
|
109 void propertyContainerSelected(PropertyContainer *);
|
Chris@298
|
110 void propertyContainerPropertyChanged(PropertyContainer *);
|
Chris@374
|
111 void paneLayerModelChanged();
|
Chris@298
|
112 void playParametersAudibilityChanged(bool);
|
Chris@374
|
113
|
Chris@374
|
114 protected:
|
Chris@374
|
115 PaneStack *m_stack;
|
Chris@374
|
116 std::set<QObject *> m_deletedPanes;
|
Chris@374
|
117 int m_layerNameColumn;
|
Chris@374
|
118 int m_layerVisibleColumn;
|
Chris@374
|
119 int m_layerPlayedColumn;
|
Chris@374
|
120 int m_modelNameColumn;
|
Chris@374
|
121 int m_columnCount;
|
Chris@43
|
122 };
|
Chris@43
|
123
|
Chris@43
|
124 #endif
|