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@336
|
22 #include <set>
|
Chris@336
|
23
|
Chris@43
|
24 class PaneStack;
|
Chris@56
|
25 class View;
|
Chris@336
|
26 class Pane;
|
Chris@56
|
27 class Layer;
|
Chris@298
|
28 class PropertyContainer;
|
Chris@336
|
29 class Model;
|
Chris@336
|
30
|
Chris@392
|
31 class ModelMetadataModel : public QAbstractItemModel
|
Chris@336
|
32 {
|
Chris@336
|
33 Q_OBJECT
|
Chris@336
|
34
|
Chris@336
|
35 public:
|
Chris@392
|
36 ModelMetadataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0);
|
Chris@392
|
37 virtual ~ModelMetadataModel();
|
Chris@336
|
38
|
Chris@336
|
39 QVariant data(const QModelIndex &index, int role) const;
|
Chris@336
|
40
|
Chris@336
|
41 bool setData(const QModelIndex &index, const QVariant &value, int role);
|
Chris@336
|
42
|
Chris@336
|
43 Qt::ItemFlags flags(const QModelIndex &index) const;
|
Chris@336
|
44
|
Chris@336
|
45 QVariant headerData(int section, Qt::Orientation orientation,
|
Chris@336
|
46 int role = Qt::DisplayRole) const;
|
Chris@336
|
47
|
Chris@336
|
48 QModelIndex index(int row, int column,
|
Chris@336
|
49 const QModelIndex &parent = QModelIndex()) const;
|
Chris@336
|
50
|
Chris@336
|
51 QModelIndex parent(const QModelIndex &index) const;
|
Chris@336
|
52
|
Chris@336
|
53 int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
Chris@336
|
54 int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
Chris@336
|
55
|
Chris@336
|
56 protected slots:
|
Chris@336
|
57 void paneAdded();
|
Chris@336
|
58 void paneDeleted();
|
Chris@336
|
59 void propertyContainerAdded(PropertyContainer *);
|
Chris@336
|
60 void propertyContainerRemoved(PropertyContainer *);
|
Chris@336
|
61 void propertyContainerSelected(PropertyContainer *);
|
Chris@336
|
62 void propertyContainerPropertyChanged(PropertyContainer *);
|
Chris@336
|
63 void playParametersAudibilityChanged(bool);
|
Chris@336
|
64 void paneLayerModelChanged();
|
Chris@336
|
65 void rebuildModelSet();
|
Chris@336
|
66
|
Chris@336
|
67 protected:
|
Chris@336
|
68 PaneStack *m_stack;
|
Chris@336
|
69 bool m_waveModelsOnly;
|
Chris@336
|
70 int m_modelTypeColumn;
|
Chris@336
|
71 int m_modelNameColumn;
|
Chris@336
|
72 int m_modelMakerColumn;
|
Chris@336
|
73 int m_modelSourceColumn;
|
Chris@336
|
74 int m_columnCount;
|
Chris@336
|
75
|
Chris@336
|
76 std::set<Model *> m_models;
|
Chris@336
|
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@336
|
105 void paneAdded();
|
Chris@336
|
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@336
|
111 void paneLayerModelChanged();
|
Chris@298
|
112 void playParametersAudibilityChanged(bool);
|
Chris@336
|
113
|
Chris@336
|
114 protected:
|
Chris@336
|
115 PaneStack *m_stack;
|
Chris@336
|
116 std::set<QObject *> m_deletedPanes;
|
Chris@336
|
117 int m_layerNameColumn;
|
Chris@336
|
118 int m_layerVisibleColumn;
|
Chris@336
|
119 int m_layerPlayedColumn;
|
Chris@336
|
120 int m_modelNameColumn;
|
Chris@336
|
121 int m_columnCount;
|
Chris@43
|
122 };
|
Chris@43
|
123
|
Chris@43
|
124 #endif
|