/[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 2065 by capela, Sat Mar 13 12:44:15 2010 UTC revision 2070 by capela, Mon Mar 15 17:06:46 2010 UTC
# Line 41  namespace QSampler { Line 41  namespace QSampler {
41  InstrumentListModel::InstrumentListModel ( QObject *pParent )  InstrumentListModel::InstrumentListModel ( QObject *pParent )
42          : QAbstractItemModel(pParent), m_iMidiMap(LSCP_MIDI_MAP_ALL)          : QAbstractItemModel(pParent), m_iMidiMap(LSCP_MIDI_MAP_ALL)
43  {  {
44          QAbstractItemModel::reset();  //      QAbstractItemModel::reset();
45  }  }
46    
47  InstrumentListModel::~InstrumentListModel (void)  InstrumentListModel::~InstrumentListModel (void)
# Line 79  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 130  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 223  const Instrument *InstrumentListModel::a Line 221  const Instrument *InstrumentListModel::a
221  }  }
222    
223    
224  void InstrumentListModel::removeInstrument ( const Instrument *pInstrument )  void InstrumentListModel::removeInstrument ( Instrument *pInstrument )
225  {  {
226          const int iMap  = pInstrument->map();          const int iMap  = pInstrument->map();
227          const int iBank = pInstrument->bank();          const int iBank = pInstrument->bank();
# Line 243  void InstrumentListModel::removeInstrume Line 241  void InstrumentListModel::removeInstrume
241  }  }
242    
243    
244    void InstrumentListModel::updateInstrument ( Instrument *pInstrument )
245    {
246            pInstrument->getInstrument();
247    }
248    
249    
250  // Reposition the instrument in the model (called when map/bank/prg changed)  // Reposition the instrument in the model (called when map/bank/prg changed)
251  void InstrumentListModel::updateInstrument ( const Instrument *pInstrument )  void InstrumentListModel::resortInstrument ( Instrument *pInstrument )
252  {  {
253          const int iMap  = pInstrument->map();          const int iMap  = pInstrument->map();
254          const int iBank = pInstrument->bank();          const int iBank = pInstrument->bank();
# Line 339  InstrumentListView::InstrumentListView ( Line 343  InstrumentListView::InstrumentListView (
343          QTreeView::setAlternatingRowColors(true);          QTreeView::setAlternatingRowColors(true);
344          QTreeView::setSelectionBehavior(QAbstractItemView::SelectRows);          QTreeView::setSelectionBehavior(QAbstractItemView::SelectRows);
345          QTreeView::setSelectionMode(QAbstractItemView::SingleSelection);          QTreeView::setSelectionMode(QAbstractItemView::SingleSelection);
346                    QTreeView::setItemsExpandable(false);
347    
348          QHeaderView *pHeader = QTreeView::header();          QHeaderView *pHeader = QTreeView::header();
349          pHeader->setDefaultAlignment(Qt::AlignLeft);          pHeader->setDefaultAlignment(Qt::AlignLeft);
350          pHeader->setMovable(false);          pHeader->setMovable(false);
# Line 386  const Instrument *InstrumentListView::ad Line 391  const Instrument *InstrumentListView::ad
391  }  }
392    
393    
394  void InstrumentListView::removeInstrument ( const Instrument *pInstrument )  void InstrumentListView::removeInstrument ( Instrument *pInstrument )
395  {  {
396          m_pListModel->beginReset();          m_pListModel->beginReset();
397          m_pListModel->removeInstrument(pInstrument);          m_pListModel->removeInstrument(pInstrument);
# Line 394  void InstrumentListView::removeInstrumen Line 399  void InstrumentListView::removeInstrumen
399  }  }
400    
401    
402  // Reposition the instrument in the model (called when map/bank/prg changed)  void InstrumentListView::updateInstrument ( Instrument *pInstrument )
 void InstrumentListView::updateInstrument ( const Instrument *pInstrument )  
403  {  {
404          m_pListModel->beginReset();          m_pListModel->beginReset();
405          m_pListModel->updateInstrument(pInstrument);          m_pListModel->updateInstrument(pInstrument);
406          m_pListModel->endReset();}          m_pListModel->endReset();
407    }
408    
409    
410    // Reposition the instrument in the model (called when map/bank/prg changed)
411    void InstrumentListView::resortInstrument ( Instrument *pInstrument )
412    {
413            m_pListModel->beginReset();
414            m_pListModel->resortInstrument(pInstrument);
415            m_pListModel->endReset();
416    }
417    
418    
419  // Refreshener.  // Refreshener.

Legend:
Removed from v.2065  
changed lines
  Added in v.2070

  ViewVC Help
Powered by ViewVC