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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1492 - (hide annotations) (download) (as text)
Mon Nov 19 21:08:18 2007 UTC (16 years, 5 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 3487 byte(s)
* Qt4 migration: finished MIDI instrument mapping dialogs, with this commit
  all the functionalities from the Qt3 version of qsampler are finally
  restored, only minor "cosmetical" things to fix now

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

  ViewVC Help
Powered by ViewVC