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

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

  ViewVC Help
Powered by ViewVC