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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1509 - (hide annotations) (download) (as text)
Thu Nov 22 11:10:44 2007 UTC (16 years, 4 months ago) by capela
File MIME type: text/x-c++hdr
File size: 3304 byte(s)
* Audio routing table is initially hidden in the dialog, when
  creating a new sampler channel.

* README requirements and configuration notes update.

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 capela 1509 class MidiInstrumentsModel : public QAbstractTableModel
39     {
40     Q_OBJECT
41    
42 schoenebeck 1461 public:
43 capela 1013
44 capela 1509 MidiInstrumentsModel(QObject* pParent = NULL);
45 schoenebeck 1461
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 1509 // Make the following method public
55     QAbstractTableModel::reset;
56 schoenebeck 1461
57 capela 1509 // Own methods
58     qsamplerInstrument* addInstrument(int iMap = 0,
59     int iBank = -1, int iProg = -1);
60     void removeInstrument(const qsamplerInstrument& instrument);
61    
62     void resort(const qsamplerInstrument instrument);
63    
64     // Map selector.
65     void setMidiMap(int iMidiMap);
66     int midiMap() const;
67    
68 schoenebeck 1461 signals:
69    
70 capela 1509 // Instrument map/session change signal.
71     void instrumentsChanged();
72    
73 schoenebeck 1461 public slots:
74    
75 capela 1509 // General reloader.
76     void refresh();
77    
78 schoenebeck 1461 private:
79    
80 capela 1509 typedef QMap<int, QList<qsamplerInstrument> > InstrumentsMap;
81 schoenebeck 1461
82 capela 1509 // Current map selection.
83     int m_iMidiMap;
84    
85     InstrumentsMap m_instruments;
86 schoenebeck 1461 };
87    
88 schoenebeck 1492
89     //-------------------------------------------------------------------------
90     // MidiInstrumentsDelegate - table cell renderer for MIDI prog mappings
91     // (doesn't actually do anything ATM, but is already there for a future
92     // cell editor widget implementation)
93    
94 capela 1509 class MidiInstrumentsDelegate : public QItemDelegate
95     {
96     Q_OBJECT
97    
98 schoenebeck 1461 public:
99 capela 1509 MidiInstrumentsDelegate(QObject *pParent = NULL);
100 schoenebeck 1461
101 capela 1509 QWidget* createEditor(QWidget *pParent,
102     const QStyleOptionViewItem& option, const QModelIndex& index) const;
103 schoenebeck 1461
104 capela 1509 void setEditorData(QWidget *pEditor,
105     const QModelIndex& index) const;
106     void setModelData(QWidget *pEditor,
107     QAbstractItemModel* model, const QModelIndex& index) const;
108 schoenebeck 1461
109 capela 1509 void updateEditorGeometry(QWidget* pEditor,
110     const QStyleOptionViewItem& option, const QModelIndex& index) const;
111 schoenebeck 1461 };
112    
113    
114 capela 1013 #endif // __qsamplerInstrumentList_h
115    
116 capela 1464
117 capela 1013 // end of qsamplerInstrumentList.h

  ViewVC Help
Powered by ViewVC