1
// qsamplerInstrumentList.h
3
/****************************************************************************
4
Copyright (C) 2003-2007, rncbc aka Rui Nuno Capela. All rights reserved.
5
Copyright (C) 2007, Christian Schoenebeck
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.
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.
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.
21
*****************************************************************************/
23
#ifndef __qsamplerInstrumentList_h
24
#define __qsamplerInstrumentList_h
26
#include <QListWidget>
27
#include <QItemDelegate>
29
#include <lscp/client.h>
31
#include "qsamplerInstrument.h"
35
//-------------------------------------------------------------------------
36
// QSampler::MidiInstrumentsModel - data model for MIDI prog mappings
37
// (used for QTableView)
39
class MidiInstrumentsModel : public QAbstractTableModel
45
MidiInstrumentsModel(QObject* pParent = NULL);
47
// Overridden methods from subclass(es)
48
int rowCount(const QModelIndex& parent) const;
49
int columnCount(const QModelIndex& parent) const;
51
QVariant data(const QModelIndex& index, int role) const;
52
QVariant headerData(int section, Qt::Orientation orientation,
53
int role = Qt::DisplayRole) const;
55
// Make the following method public
56
QAbstractTableModel::reset;
59
Instrument* addInstrument(int iMap = 0,
60
int iBank = -1, int iProg = -1);
61
void removeInstrument(const Instrument& instrument);
63
void resort(const Instrument& instrument);
66
void setMidiMap(int iMidiMap);
71
// Instrument map/session change signal.
72
void instrumentsChanged();
81
typedef QMap<int, QList<Instrument> > InstrumentsMap;
83
InstrumentsMap m_instruments;
85
// Current map selection.
90
//-------------------------------------------------------------------------
91
// QSampler::MidiInstrumentsDelegate - table cell renderer for MIDI prog
92
// mappings (doesn't actually do anything ATM, but is already there for
93
// a future cell editor widget implementation)
95
class MidiInstrumentsDelegate : public QItemDelegate
100
MidiInstrumentsDelegate(QObject *pParent = NULL);
102
QWidget* createEditor(QWidget *pParent,
103
const QStyleOptionViewItem& option, const QModelIndex& index) const;
105
void setEditorData(QWidget *pEditor,
106
const QModelIndex& index) const;
107
void setModelData(QWidget *pEditor,
108
QAbstractItemModel* model, const QModelIndex& index) const;
110
void updateEditorGeometry(QWidget* pEditor,
111
const QStyleOptionViewItem& option, const QModelIndex& index) const;
114
} // namespace QSampler
116
#endif // __qsamplerInstrumentList_h
119
// end of qsamplerInstrumentList.h