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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1499 by capela, Tue Nov 20 16:48:04 2007 UTC revision 1558 by capela, Thu Dec 6 09:35:33 2007 UTC
# Line 30  Line 30 
30    
31  #include "qsamplerInstrument.h"  #include "qsamplerInstrument.h"
32    
33    namespace QSampler {
34    
35  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
36  // MidiInstrumentsModel - data model for MIDI prog mappings (used for QTableView)  // QSampler::MidiInstrumentsModel - data model for MIDI prog mappings
37  //  //                                  (used for QTableView)
38    
39    class MidiInstrumentsModel : public QAbstractTableModel
40    {
41            Q_OBJECT
42    
 class MidiInstrumentsModel : public QAbstractTableModel {  
 Q_OBJECT  
43  public:  public:
     MidiInstrumentsModel(QObject* parent = 0);  
44    
45      // overridden methods from subclass(es)          MidiInstrumentsModel(QObject* pParent = NULL);
46      int rowCount(const QModelIndex &parent) const;  
47      int columnCount(const QModelIndex &parent) const;          // Overridden methods from subclass(es)
48      QVariant data(const QModelIndex &index, int role) const;          int rowCount(const QModelIndex& parent) const;
49      QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;          int columnCount(const QModelIndex& parent) const;
50    
51      // make the following method public          QVariant data(const QModelIndex& index, int role) const;
52      QAbstractTableModel::reset;          QVariant headerData(int section, Qt::Orientation orientation,
53                    int role = Qt::DisplayRole) const;
54      // own methods  
55      qsamplerInstrument* addInstrument(int iMap = 0, int iBank = -1, int iProg = -1);          // Make the following method public
56      void removeInstrument(const qsamplerInstrument& instrument);          QAbstractTableModel::reset;
57      void resort(const qsamplerInstrument instrument);  
58            // Own methods
59      // Map selector.          Instrument* addInstrument(int iMap = 0,
60      void setMidiMap(int iMidiMap);                  int iBank = -1, int iProg = -1);
61      int midiMap() const;          void removeInstrument(const Instrument& instrument);
62    
63            void resort(const Instrument& instrument);
64    
65            // Map selector.
66            void setMidiMap(int iMidiMap);
67            int midiMap() const;
68    
69  signals:  signals:
70      // Instrument map/session change signal.  
71      void instrumentsChanged();          // Instrument map/session change signal.
72            void instrumentsChanged();
73    
74  public slots:  public slots:
75      // General reloader.  
76      void refresh();          // General reloader.
77            void refresh();
78    
79  private:  private:
     typedef QMap<int, QList<qsamplerInstrument> > InstrumentsMap;  
80    
81      // Current map selection.          typedef QMap<int, QList<Instrument> > InstrumentsMap;
82      int m_iMidiMap;  
83            InstrumentsMap m_instruments;
84    
85      InstrumentsMap instruments;          // Current map selection.
86            int m_iMidiMap;
87  };  };
88    
89    
90  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
91  // MidiInstrumentsDelegate - table cell renderer for MIDI prog mappings  // QSampler::MidiInstrumentsDelegate - table cell renderer for MIDI prog
92  // (doesn't actually do anything ATM, but is already there for a future  // mappings (doesn't actually do anything ATM, but is already there for
93  // cell editor widget implementation)  // a future cell editor widget implementation)
94    
95    class MidiInstrumentsDelegate : public QItemDelegate
96    {
97            Q_OBJECT
98    
 class MidiInstrumentsDelegate : public QItemDelegate {  
 Q_OBJECT  
99  public:  public:
100      MidiInstrumentsDelegate(QObject* parent = 0);          MidiInstrumentsDelegate(QObject *pParent = NULL);
101    
102      QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,          QWidget* createEditor(QWidget *pParent,
103                            const QModelIndex& index) const;                  const QStyleOptionViewItem& option, const QModelIndex& index) const;
104    
105      void setEditorData(QWidget* editor, const QModelIndex& index) const;          void setEditorData(QWidget *pEditor,
106      void setModelData(QWidget* editor, QAbstractItemModel* model,                  const QModelIndex& index) const;
107                        const QModelIndex& index) const;          void setModelData(QWidget *pEditor,
108                    QAbstractItemModel* model, const QModelIndex& index) const;
109    
110      void updateEditorGeometry(QWidget* editor,          void updateEditorGeometry(QWidget* pEditor,
111          const QStyleOptionViewItem& option, const QModelIndex& index) const;                  const QStyleOptionViewItem& option, const QModelIndex& index) const;
112  };  };
113    
114    } // namespace QSampler
115    
116  #endif  // __qsamplerInstrumentList_h  #endif  // __qsamplerInstrumentList_h
117    

Legend:
Removed from v.1499  
changed lines
  Added in v.1558

  ViewVC Help
Powered by ViewVC