/[svn]/qsampler/trunk/src/qsamplerInstrumentList.h
ViewVC logotype

Contents of /qsampler/trunk/src/qsamplerInstrumentList.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2828 - (show annotations) (download) (as text)
Wed Jul 22 21:28:27 2015 UTC (8 years, 9 months ago) by capela
File MIME type: text/x-c++hdr
File size: 3385 byte(s)
- Post-preparations for v0.3.1 Summer'15 frenzy release.
1 // qsamplerInstrumentList.h
2 //
3 /****************************************************************************
4 Copyright (C) 2003-2015, rncbc aka Rui Nuno Capela. All rights reserved.
5 Copyright (C) 2007, Christian Schoenebeck
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 *****************************************************************************/
22
23 #ifndef __qsamplerInstrumentList_h
24 #define __qsamplerInstrumentList_h
25
26 #include <QTreeView>
27
28 namespace QSampler {
29
30 class Instrument;
31
32 //-------------------------------------------------------------------------
33 // QSampler:InstrumentListModel - data model for MIDI prog mappings
34 //
35
36 class InstrumentListModel : public QAbstractItemModel
37 {
38 Q_OBJECT
39
40 public:
41
42 // Constructor.
43 InstrumentListModel(QObject *pParent = NULL);
44
45 // Destructor.
46 ~InstrumentListModel();
47
48 // Overridden methods from subclass(es)
49 int rowCount(const QModelIndex& parent) const;
50 int columnCount(const QModelIndex& parent) const;
51
52 QVariant data(const QModelIndex& index, int role) const;
53 QVariant headerData(int section, Qt::Orientation orientation,
54 int role = Qt::DisplayRole) const;
55
56 // Map selector.
57 void setMidiMap(int iMidiMap);
58 int midiMap() const;
59
60 // Own methods
61 const Instrument *addInstrument(int iMap, int iBank, int iProg);
62 void removeInstrument(Instrument *pInstrument);
63 void updateInstrument(Instrument *pInstrument);
64 void resortInstrument(Instrument *pInstrument);
65
66 // General reloader.
67 void refresh();
68
69 // Make the following method public
70 void beginReset();
71 void endReset();
72
73 // Map clear.
74 void clear();
75
76 protected:
77
78 QModelIndex index(int row, int col, const QModelIndex& parent) const;
79 QModelIndex parent(const QModelIndex& child) const;
80
81 private:
82
83 typedef QList<Instrument *> InstrumentList;
84 typedef QMap<int, InstrumentList> InstrumentMap;
85
86 InstrumentMap m_instruments;
87
88 // Current map selection.
89 int m_iMidiMap;
90 };
91
92
93 //-------------------------------------------------------------------------
94 // QSampler::InstrumentListView - list view for MIDI prog mappings
95 //
96
97 class InstrumentListView : public QTreeView
98 {
99 public:
100
101 // Constructor.
102 InstrumentListView(QWidget *pParent = NULL);
103
104 // Destructor.
105 ~InstrumentListView();
106
107 // Map selector.
108 void setMidiMap(int iMidiMap);
109 int midiMap() const;
110
111 // Own methods
112 const Instrument *addInstrument(int iMap, int iBank, int iProg);
113 void removeInstrument(Instrument *pInstrument);
114 void updateInstrument(Instrument *pInstrument);
115 void resortInstrument(Instrument *pInstrument);
116
117 // General reloader.
118 void refresh();
119
120 private:
121
122 // Instance variables.
123 InstrumentListModel *m_pListModel;
124 };
125
126
127 } // namespace QSampler
128
129 #endif // __qsamplerInstrumentList_h
130
131
132 // end of qsamplerInstrumentList.h

  ViewVC Help
Powered by ViewVC