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

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

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

revision 2064 by capela, Fri Mar 12 16:02:32 2010 UTC revision 2068 by capela, Sun Mar 14 16:35:48 2010 UTC
# Line 39  namespace QSampler { Line 39  namespace QSampler {
39  //  //
40    
41  InstrumentListModel::InstrumentListModel ( QObject *pParent )  InstrumentListModel::InstrumentListModel ( QObject *pParent )
42          : QAbstractItemModel(pParent)          : QAbstractItemModel(pParent), m_iMidiMap(LSCP_MIDI_MAP_ALL)
43  {  {
44          m_iMidiMap = LSCP_MIDI_MAP_ALL;  //      QAbstractItemModel::reset();
   
         QAbstractItemModel::reset();  
45  }  }
46    
47  InstrumentListModel::~InstrumentListModel (void)  InstrumentListModel::~InstrumentListModel (void)
# Line 81  QVariant InstrumentListModel::data ( Line 79  QVariant InstrumentListModel::data (
79  {  {
80          if (!index.isValid())          if (!index.isValid())
81                  return QVariant();                  return QVariant();
   
82          const Instrument *pInstr          const Instrument *pInstr
83                  = static_cast<Instrument *> (index.internalPointer());                  = static_cast<Instrument *> (index.internalPointer());
84    
# Line 132  QModelIndex InstrumentListModel::index ( Line 129  QModelIndex InstrumentListModel::index (
129                  InstrumentMap::const_iterator itMap     = m_instruments.find(m_iMidiMap);                  InstrumentMap::const_iterator itMap     = m_instruments.find(m_iMidiMap);
130                  if (itMap != m_instruments.constEnd()) {                  if (itMap != m_instruments.constEnd()) {
131                          const InstrumentList& list = *itMap;                          const InstrumentList& list = *itMap;
                         // resolve instrument in that map  
132                          if (row < list.size())                          if (row < list.size())
133                                  pInstr = list.at(row);                                  pInstr = list.at(row);
134                  }                  }
# Line 145  QModelIndex InstrumentListModel::index ( Line 141  QModelIndex InstrumentListModel::index (
141  }  }
142    
143    
144  QModelIndex InstrumentListModel::parent ( const QModelIndex& child ) const  QModelIndex InstrumentListModel::parent ( const QModelIndex& /*child*/ ) const
145  {  {
146          return QModelIndex();          return QModelIndex();
147  }  }
# Line 335  InstrumentListView::InstrumentListView ( Line 331  InstrumentListView::InstrumentListView (
331          m_pListModel = new InstrumentListModel(this);          m_pListModel = new InstrumentListModel(this);
332    
333          QTreeView::setModel(m_pListModel);          QTreeView::setModel(m_pListModel);
334    
335            QTreeView::setRootIsDecorated(false);
336            QTreeView::setUniformRowHeights(true);
337            QTreeView::setAlternatingRowColors(true);
338            QTreeView::setSelectionBehavior(QAbstractItemView::SelectRows);
339            QTreeView::setSelectionMode(QAbstractItemView::SingleSelection);
340            
341            QHeaderView *pHeader = QTreeView::header();
342            pHeader->setDefaultAlignment(Qt::AlignLeft);
343            pHeader->setMovable(false);
344            pHeader->setStretchLastSection(true);
345            pHeader->resizeSection(0, 120);                 // Name
346            QTreeView::resizeColumnToContents(1);   // Map
347            QTreeView::resizeColumnToContents(2);   // Bank
348            QTreeView::resizeColumnToContents(3);   // Prog
349            QTreeView::resizeColumnToContents(4);   // Engine
350            pHeader->resizeSection(5, 240);                 // File
351            QTreeView::resizeColumnToContents(6);   // Nr
352            pHeader->resizeSection(7, 60);                  // Vol
353  }  }
354    
355    
# Line 382  void InstrumentListView::updateInstrumen Line 397  void InstrumentListView::updateInstrumen
397  {  {
398          m_pListModel->beginReset();          m_pListModel->beginReset();
399          m_pListModel->updateInstrument(pInstrument);          m_pListModel->updateInstrument(pInstrument);
400          m_pListModel->endReset();}          m_pListModel->endReset();
401    }
402    
403    
404  // Refreshener.  // Refreshener.

Legend:
Removed from v.2064  
changed lines
  Added in v.2068

  ViewVC Help
Powered by ViewVC