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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2829 - (hide annotations) (download) (as text)
Thu Jul 23 17:32:31 2015 UTC (8 years, 8 months ago) by capela
File MIME type: text/x-c++hdr
File size: 3396 byte(s)
- Post 0.3.1 Qt5 packaging build fixing. (2)
1 capela 1013 // qsamplerInstrumentList.h
2     //
3     /****************************************************************************
4 capela 2828 Copyright (C) 2003-2015, rncbc aka Rui Nuno Capela. All rights reserved.
5 capela 1464 Copyright (C) 2007, Christian Schoenebeck
6 capela 1013
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 capela 2064 #include <QTreeView>
27 capela 1013
28 capela 2064 namespace QSampler {
29 capela 1013
30 capela 2064 class Instrument;
31 schoenebeck 1461
32 schoenebeck 1492 //-------------------------------------------------------------------------
33 capela 2064 // QSampler:InstrumentListModel - data model for MIDI prog mappings
34     //
35 capela 1013
36 capela 2064 class InstrumentListModel : public QAbstractItemModel
37 capela 1509 {
38 capela 2828 Q_OBJECT
39    
40 schoenebeck 1461 public:
41 capela 1013
42 capela 2064 // Constructor.
43     InstrumentListModel(QObject *pParent = NULL);
44 schoenebeck 1461
45 capela 2064 // Destructor.
46     ~InstrumentListModel();
47    
48 capela 1509 // Overridden methods from subclass(es)
49     int rowCount(const QModelIndex& parent) const;
50     int columnCount(const QModelIndex& parent) const;
51 schoenebeck 1492
52 capela 1509 QVariant data(const QModelIndex& index, int role) const;
53     QVariant headerData(int section, Qt::Orientation orientation,
54     int role = Qt::DisplayRole) const;
55 schoenebeck 1461
56 capela 2064 // Map selector.
57     void setMidiMap(int iMidiMap);
58     int midiMap() const;
59 schoenebeck 1461
60 capela 1509 // Own methods
61 capela 2064 const Instrument *addInstrument(int iMap, int iBank, int iProg);
62 capela 2070 void removeInstrument(Instrument *pInstrument);
63     void updateInstrument(Instrument *pInstrument);
64     void resortInstrument(Instrument *pInstrument);
65 capela 1509
66 capela 2064 // General reloader.
67     void refresh();
68 capela 1509
69 capela 2064 // Make the following method public
70     void beginReset();
71     void endReset();
72 capela 1509
73 capela 2064 // Map clear.
74     void clear();
75 schoenebeck 1461
76 capela 2064 protected:
77 capela 1509
78 capela 2064 QModelIndex index(int row, int col, const QModelIndex& parent) const;
79     QModelIndex parent(const QModelIndex& child) const;
80 schoenebeck 1461
81     private:
82    
83 capela 2064 typedef QList<Instrument *> InstrumentList;
84     typedef QMap<int, InstrumentList> InstrumentMap;
85 schoenebeck 1461
86 capela 2064 InstrumentMap m_instruments;
87 capela 1523
88 capela 1509 // Current map selection.
89     int m_iMidiMap;
90 schoenebeck 1461 };
91    
92 schoenebeck 1492
93     //-------------------------------------------------------------------------
94 capela 2064 // QSampler::InstrumentListView - list view for MIDI prog mappings
95     //
96 schoenebeck 1492
97 capela 2064 class InstrumentListView : public QTreeView
98 capela 1509 {
99 capela 2829 Q_OBJECT
100    
101 schoenebeck 1461 public:
102    
103 capela 2064 // Constructor.
104 capela 2066 InstrumentListView(QWidget *pParent = NULL);
105 schoenebeck 1461
106 capela 2064 // Destructor.
107     ~InstrumentListView();
108 schoenebeck 1461
109 capela 2064 // Map selector.
110     void setMidiMap(int iMidiMap);
111     int midiMap() const;
112    
113     // Own methods
114     const Instrument *addInstrument(int iMap, int iBank, int iProg);
115 capela 2070 void removeInstrument(Instrument *pInstrument);
116     void updateInstrument(Instrument *pInstrument);
117     void resortInstrument(Instrument *pInstrument);
118 capela 2064
119     // General reloader.
120     void refresh();
121    
122     private:
123    
124     // Instance variables.
125     InstrumentListModel *m_pListModel;
126 schoenebeck 1461 };
127    
128 capela 2064
129 capela 1558 } // namespace QSampler
130 schoenebeck 1461
131 capela 1013 #endif // __qsamplerInstrumentList_h
132    
133 capela 1464
134 capela 1013 // end of qsamplerInstrumentList.h

  ViewVC Help
Powered by ViewVC