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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC