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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1558 - (hide annotations) (download) (as text)
Thu Dec 6 09:35:33 2007 UTC (16 years, 3 months ago) by capela
File MIME type: text/x-c++hdr
File size: 3371 byte(s)
* Qt4 migration: complete QSampler namespace overhaul.

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 1558 namespace QSampler {
34 capela 1013
35 schoenebeck 1492 //-------------------------------------------------------------------------
36 capela 1558 // QSampler::MidiInstrumentsModel - data model for MIDI prog mappings
37     // (used for QTableView)
38 capela 1013
39 capela 1509 class MidiInstrumentsModel : public QAbstractTableModel
40     {
41     Q_OBJECT
42    
43 schoenebeck 1461 public:
44 capela 1013
45 capela 1509 MidiInstrumentsModel(QObject* pParent = NULL);
46 schoenebeck 1461
47 capela 1509 // Overridden methods from subclass(es)
48     int rowCount(const QModelIndex& parent) const;
49     int columnCount(const QModelIndex& parent) const;
50 schoenebeck 1492
51 capela 1509 QVariant data(const QModelIndex& index, int role) const;
52     QVariant headerData(int section, Qt::Orientation orientation,
53     int role = Qt::DisplayRole) const;
54 schoenebeck 1461
55 capela 1509 // Make the following method public
56     QAbstractTableModel::reset;
57 schoenebeck 1461
58 capela 1509 // Own methods
59 capela 1558 Instrument* addInstrument(int iMap = 0,
60 capela 1509 int iBank = -1, int iProg = -1);
61 capela 1558 void removeInstrument(const Instrument& instrument);
62 capela 1509
63 capela 1558 void resort(const Instrument& instrument);
64 capela 1509
65     // Map selector.
66     void setMidiMap(int iMidiMap);
67     int midiMap() const;
68    
69 schoenebeck 1461 signals:
70    
71 capela 1509 // Instrument map/session change signal.
72     void instrumentsChanged();
73    
74 schoenebeck 1461 public slots:
75    
76 capela 1509 // General reloader.
77     void refresh();
78    
79 schoenebeck 1461 private:
80    
81 capela 1558 typedef QMap<int, QList<Instrument> > InstrumentsMap;
82 schoenebeck 1461
83 capela 1523 InstrumentsMap m_instruments;
84    
85 capela 1509 // Current map selection.
86     int m_iMidiMap;
87 schoenebeck 1461 };
88    
89 schoenebeck 1492
90     //-------------------------------------------------------------------------
91 capela 1558 // 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)
94 schoenebeck 1492
95 capela 1509 class MidiInstrumentsDelegate : public QItemDelegate
96     {
97     Q_OBJECT
98    
99 schoenebeck 1461 public:
100 capela 1509 MidiInstrumentsDelegate(QObject *pParent = NULL);
101 schoenebeck 1461
102 capela 1509 QWidget* createEditor(QWidget *pParent,
103     const QStyleOptionViewItem& option, const QModelIndex& index) const;
104 schoenebeck 1461
105 capela 1509 void setEditorData(QWidget *pEditor,
106     const QModelIndex& index) const;
107     void setModelData(QWidget *pEditor,
108     QAbstractItemModel* model, const QModelIndex& index) const;
109 schoenebeck 1461
110 capela 1509 void updateEditorGeometry(QWidget* pEditor,
111     const QStyleOptionViewItem& option, const QModelIndex& index) const;
112 schoenebeck 1461 };
113    
114 capela 1558 } // namespace QSampler
115 schoenebeck 1461
116 capela 1013 #endif // __qsamplerInstrumentList_h
117    
118 capela 1464
119 capela 1013 // end of qsamplerInstrumentList.h

  ViewVC Help
Powered by ViewVC