1 |
capela |
1013 |
// qsamplerInstrumentList.h |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
|
|
Copyright (C) 2003-2007, 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 |
schoenebeck |
1461 |
#include <QListWidget> |
27 |
|
|
#include <QItemDelegate> |
28 |
capela |
1013 |
|
29 |
|
|
#include <lscp/client.h> |
30 |
|
|
|
31 |
schoenebeck |
1461 |
#include "qsamplerInstrument.h" |
32 |
|
|
|
33 |
capela |
1013 |
|
34 |
schoenebeck |
1492 |
//------------------------------------------------------------------------- |
35 |
|
|
// MidiInstrumentsModel - data model for MIDI prog mappings (used for QTableView) |
36 |
capela |
1013 |
// |
37 |
|
|
|
38 |
schoenebeck |
1461 |
class MidiInstrumentsModel : public QAbstractTableModel { |
39 |
|
|
Q_OBJECT |
40 |
|
|
public: |
41 |
|
|
MidiInstrumentsModel(QObject* parent = 0); |
42 |
capela |
1013 |
|
43 |
schoenebeck |
1461 |
// overridden methods from subclass(es) |
44 |
|
|
int rowCount(const QModelIndex &parent) const; |
45 |
|
|
int columnCount(const QModelIndex &parent) const; |
46 |
|
|
QVariant data(const QModelIndex &index, int role) const; |
47 |
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
48 |
|
|
|
49 |
schoenebeck |
1492 |
// make the following method public |
50 |
|
|
QAbstractTableModel::reset; |
51 |
|
|
|
52 |
|
|
// own methods |
53 |
schoenebeck |
1461 |
qsamplerInstrument* addInstrument(int iMap = 0, int iBank = -1, int iProg = -1); |
54 |
schoenebeck |
1492 |
void removeInstrument(const qsamplerInstrument& instrument); |
55 |
|
|
void resort(const qsamplerInstrument instrument); |
56 |
schoenebeck |
1461 |
|
57 |
|
|
// Map selector. |
58 |
|
|
void setMidiMap(int iMidiMap); |
59 |
|
|
int midiMap() const; |
60 |
|
|
|
61 |
|
|
signals: |
62 |
|
|
// Instrument map/session change signal. |
63 |
|
|
void instrumentsChanged(); |
64 |
|
|
|
65 |
|
|
public slots: |
66 |
|
|
// General reloader. |
67 |
|
|
void refresh(); |
68 |
|
|
|
69 |
|
|
private: |
70 |
|
|
typedef QMap<int, QList<qsamplerInstrument> > InstrumentsMap; |
71 |
|
|
|
72 |
|
|
// Current map selection. |
73 |
|
|
int m_iMidiMap; |
74 |
|
|
|
75 |
|
|
InstrumentsMap instruments; |
76 |
|
|
}; |
77 |
|
|
|
78 |
schoenebeck |
1492 |
|
79 |
|
|
//------------------------------------------------------------------------- |
80 |
|
|
// MidiInstrumentsDelegate - table cell renderer for MIDI prog mappings |
81 |
|
|
// (doesn't actually do anything ATM, but is already there for a future |
82 |
|
|
// cell editor widget implementation) |
83 |
|
|
|
84 |
schoenebeck |
1461 |
class MidiInstrumentsDelegate : public QItemDelegate { |
85 |
|
|
Q_OBJECT |
86 |
|
|
public: |
87 |
|
|
MidiInstrumentsDelegate(QObject* parent = 0); |
88 |
|
|
|
89 |
|
|
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, |
90 |
|
|
const QModelIndex& index) const; |
91 |
|
|
|
92 |
|
|
void setEditorData(QWidget* editor, const QModelIndex& index) const; |
93 |
|
|
void setModelData(QWidget* editor, QAbstractItemModel* model, |
94 |
|
|
const QModelIndex& index) const; |
95 |
|
|
|
96 |
|
|
void updateEditorGeometry(QWidget* editor, |
97 |
|
|
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
98 |
|
|
}; |
99 |
|
|
|
100 |
|
|
|
101 |
capela |
1013 |
#endif // __qsamplerInstrumentList_h |
102 |
|
|
|
103 |
capela |
1464 |
|
104 |
capela |
1013 |
// end of qsamplerInstrumentList.h |