/[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 969 by capela, Wed Dec 6 19:38:02 2006 UTC revision 1461 by schoenebeck, Sun Oct 28 23:30:36 2007 UTC
# Line 1  Line 1 
1  // qsamplerInstrumentList.cpp  // qsamplerInstrumentList.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2003-2007, rncbc aka Rui Nuno Capela. All rights reserved.
5    
6     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
7     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
8     as published by the Free Software Foundation; either version 2     as published by the Free Software Foundation; either version 2
9     of the License, or (at your option) any later version.     of the License, or (at your option) any later version.
10    
11     This program is distributed in the hope that it will be useful,     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.     GNU General Public License for more details.
15    
16     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19    
20  *****************************************************************************/  *****************************************************************************/
21    
22  #include "qsamplerAbout.h"  #include "qsamplerAbout.h"
23  #include "qsamplerInstrumentList.h"  #include "qsamplerInstrumentList.h"
24    
25  #include "qsamplerInstrument.h"  #include "qsamplerInstrument.h"
26  #include "qsamplerInstrumentForm.h"  #include "qsamplerInstrumentForm.h"
27    
28  #include "qsamplerMainForm.h"  #include "qsamplerOptions.h"
29    #include "qsamplerMainForm.h"
30  #include <qaction.h>  
31  #include <qfileinfo.h>  #include <qapplication.h>
32  #include <qpopupmenu.h>  #include <qmessagebox.h>
33    #include <qeventloop.h>
34  // Needed for lroundf()  #include <qaction.h>
35  #include <math.h>  #include <qcursor.h>
36    #include <qfileinfo.h>
37    
38  //----------------------------------------------------------------------  #include <QMenu>
39  // class qsamplerInstrumentGroup -- custom group list view item.  
40  //  // Needed for lroundf()
41    #include <math.h>
42  // Constructors.  
43  qsamplerInstrumentGroup::qsamplerInstrumentGroup (  #ifndef CONFIG_ROUND
44          qsamplerInstrumentList *pListView, const QString& sName,  static inline long lroundf ( float x )
45          QListViewItem *pItemAfter )  {
46          : QListViewItem(pListView, pItemAfter ? pItemAfter : pListView->lastItem())          if (x >= 0.0f)
47  {                  return long(x + 0.5f);
48          QListViewItem::setRenameEnabled(0, true);          else
49                    return long(x - 0.5f);
50          QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));  }
51          QListViewItem::setText(0, sName);  #endif
52  }  
53    using namespace QSampler;
54    
55  qsamplerInstrumentGroup::qsamplerInstrumentGroup (  //----------------------------------------------------------------------
56          qsamplerInstrumentGroup *pGroupItem, const QString& sName )  // class qsamplerInstrumentGroup -- custom group list view item.
57          : QListViewItem(pGroupItem, sName)  //
58  {  
59          QListViewItem::setRenameEnabled(0, true);  #if 0
60    // Constructors.
61          QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));  qsamplerInstrumentGroup::qsamplerInstrumentGroup (
62  }          qsamplerInstrumentList *pListView, const QString& sName,
63            QListViewItem *pItemAfter )
64            : QListViewItem(pListView, pItemAfter ? pItemAfter : pListView->lastItem())
65  // Default destructor.  {
66  qsamplerInstrumentGroup::~qsamplerInstrumentGroup (void)          QListViewItem::setRenameEnabled(0, true);
67  {  
68  }          QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));
69            QListViewItem::setText(0, sName);
70    }
71  // Instance accessors.  
72  void qsamplerInstrumentGroup::setName ( const QString& sName )  
73  {  qsamplerInstrumentGroup::qsamplerInstrumentGroup (
74          QListViewItem::setText(0, sName);          qsamplerInstrumentGroup *pGroupItem, const QString& sName )
75  }          : QListViewItem(pGroupItem, sName)
76    {
77            QListViewItem::setRenameEnabled(0, true);
78  QString qsamplerInstrumentGroup::name (void) const  
79  {          QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemGroup.png"));
80          return QListViewItem::text(0);  }
81  }  
82    
83    // Default destructor.
84  qsamplerInstrumentGroup *qsamplerInstrumentGroup::groupItem (void) const  qsamplerInstrumentGroup::~qsamplerInstrumentGroup (void)
85  {  {
86          QListViewItem *pParent = QListViewItem::parent();  }
87          while (pParent && pParent->rtti() != qsamplerInstrumentList::Group)  
88                  pParent = pParent->parent();  
89          return static_cast<qsamplerInstrumentGroup *> (pParent);  // Instance accessors.
90  }  void qsamplerInstrumentGroup::setName ( const QString& sName )
91    {
92            QListViewItem::setText(0, sName);
93  qsamplerInstrumentList *qsamplerInstrumentGroup::listView (void) const  }
94  {  
95          return static_cast<qsamplerInstrumentList *> (QListViewItem::listView());  
96  }  QString qsamplerInstrumentGroup::name (void) const
97    {
98            return QListViewItem::text(0);
99  // To show up whether its open or not.  }
100  void qsamplerInstrumentGroup::setOpen ( bool bOpen )  
101  {  
102          // Set the proper pixmap of this...  qsamplerInstrumentGroup *qsamplerInstrumentGroup::groupItem (void) const
103          if (rtti() == qsamplerInstrumentList::Group) {  {
104                  QListViewItem::setPixmap(0, QPixmap::fromMimeSource(          QListViewItem *pParent = QListViewItem::parent();
105                          bOpen ? "itemGroupOpen.png" : "itemGroup.png"));          while (pParent && pParent->rtti() != qsamplerInstrumentList::Group)
106          }                  pParent = pParent->parent();
107          // Open it up...          return static_cast<qsamplerInstrumentGroup *> (pParent);
108          QListViewItem::setOpen(bOpen);  }
109    
110          // All ancestors should be also visible.  
111          if (bOpen && QListViewItem::parent())  qsamplerInstrumentList *qsamplerInstrumentGroup::listView (void) const
112                  QListViewItem::parent()->setOpen(true);  {
113  }          return static_cast<qsamplerInstrumentList *> (QListViewItem::listView());
114    }
115    
116  // To virtually distinguish between list view items.  
117  int qsamplerInstrumentGroup::rtti (void) const  // To show up whether its open or not.
118  {  void qsamplerInstrumentGroup::setOpen ( bool bOpen )
119          return qsamplerInstrumentList::Group;  {
120  }          // Set the proper pixmap of this...
121            if (rtti() == qsamplerInstrumentList::Group) {
122                    QListViewItem::setPixmap(0, QPixmap::fromMimeSource(
123  //----------------------------------------------------------------------                          bOpen ? "itemGroupOpen.png" : "itemGroup.png"));
124  // class qsamplerInstrumentItem -- custom file list view item.          }
125  //          // Open it up...
126            QListViewItem::setOpen(bOpen);
127  // Constructors.  
128  qsamplerInstrumentItem::qsamplerInstrumentItem (          // All ancestors should be also visible.
129          qsamplerInstrumentList *pListView,          if (bOpen && QListViewItem::parent())
130          qsamplerInstrument *pInstrument,                  QListViewItem::parent()->setOpen(true);
131          QListViewItem *pItemAfter )  }
132          : qsamplerInstrumentGroup(pListView, pInstrument->name(), pItemAfter)  
133  {  
134          m_pInstrument = pInstrument;  // To virtually distinguish between list view items.
135    int qsamplerInstrumentGroup::rtti (void) const
136          update();  {
137  }          return qsamplerInstrumentList::Group;
138    }
139  qsamplerInstrumentItem::qsamplerInstrumentItem (  
140          qsamplerInstrumentGroup *pGroupItem,  
141          qsamplerInstrument *pInstrument )  //----------------------------------------------------------------------
142          : qsamplerInstrumentGroup(pGroupItem, pInstrument->name())  // class qsamplerInstrumentItem -- custom file list view item.
143  {  //
144          m_pInstrument = pInstrument;  
145    // Constructors.
146          update();  qsamplerInstrumentItem::qsamplerInstrumentItem (
147  }          qsamplerInstrumentList *pListView,
148            qsamplerInstrument *pInstrument,
149            QListViewItem *pItemAfter )
150  // Default destructor.          : qsamplerInstrumentGroup(pListView, pInstrument->name(), pItemAfter)
151  qsamplerInstrumentItem::~qsamplerInstrumentItem (void)  {
152  {          m_pInstrument = pInstrument;
153          if (m_pInstrument)  
154                  delete m_pInstrument;          update();
155  }  }
156    
157    qsamplerInstrumentItem::qsamplerInstrumentItem (
158  // To virtually distinguish between list view items.          qsamplerInstrumentGroup *pGroupItem,
159  int qsamplerInstrumentItem::rtti (void) const          qsamplerInstrument *pInstrument )
160  {          : qsamplerInstrumentGroup(pGroupItem, pInstrument->name())
161          return qsamplerInstrumentList::Item;  {
162  }          m_pInstrument = pInstrument;
163    
164            update();
165  // Payload accessor.  }
166  qsamplerInstrument *qsamplerInstrumentItem::instrument (void) const  
167  {  
168          return m_pInstrument;  // Default destructor.
169  }  qsamplerInstrumentItem::~qsamplerInstrumentItem (void)
170    {
171            if (m_pInstrument)
172  // Item refreshment.                  delete m_pInstrument;
173  void qsamplerInstrumentItem::update (void)  }
174  {  
175          QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemFile.png"));  
176    // To virtually distinguish between list view items.
177          const QString s = "-";  int qsamplerInstrumentItem::rtti (void) const
178          if (m_pInstrument) {  {
179                  setText(0, m_pInstrument->name());          return qsamplerInstrumentList::Item;
180                  setText(1, QString::number(m_pInstrument->bank()));  }
181                  setText(2, QString::number(m_pInstrument->program()));  
182                  setText(3, m_pInstrument->engineName());  
183                  setText(4, QFileInfo(m_pInstrument->instrumentFile()).fileName());  // Payload accessor.
184                  setText(5, QString::number(m_pInstrument->instrumentNr()));  qsamplerInstrument *qsamplerInstrumentItem::instrument (void) const
185                  setText(6, QString::number(::lroundf(100.0f * m_pInstrument->volume())));  {
186                  QString sLoadMode = s;          return m_pInstrument;
187                  switch (m_pInstrument->loadMode()) {  }
188                  case 3:  
189                          sLoadMode = QObject::tr("Persistent");  
190                          break;  // Item refreshment.
191                  case 2:  void qsamplerInstrumentItem::update (void)
192                          sLoadMode = QObject::tr("On Demand Hold");  {
193                          break;          QListViewItem::setPixmap(0, QPixmap::fromMimeSource("itemFile.png"));
194                  case 1:  
195                          sLoadMode = QObject::tr("On Demand");          const QString s = "-";
196                          break;          if (m_pInstrument) {
197                  }                  setText(0, m_pInstrument->name());
198                  setText(7, sLoadMode);                  setText(1, QString::number(m_pInstrument->map()));
199          } else {                  setText(2, QString::number(m_pInstrument->bank()));
200                  for (int i = 0; i < listView()->columns(); i++)                  setText(3, QString::number(m_pInstrument->prog() + 1));
201                          setText(i, s);                  setText(4, m_pInstrument->engineName());
202          }                  setText(5, QFileInfo(m_pInstrument->instrumentFile()).fileName());
203  }                  setText(6, QString::number(m_pInstrument->instrumentNr()));
204                    setText(7, QString::number(::lroundf(100.0f * m_pInstrument->volume())));
205                    QString sLoadMode = s;
206  //----------------------------------------------------------------------------                  switch (m_pInstrument->loadMode()) {
207  // qsamplerInstrumentList -- MIDI instrument list view.                  case 3:
208  //                          sLoadMode = QObject::tr("Persistent");
209                            break;
210  // Constructor.                  case 2:
211  qsamplerInstrumentList::qsamplerInstrumentList (                          sLoadMode = QObject::tr("On Demand Hold");
212          QWidget *pParent, const char *pszName )                          break;
213          : QListView(pParent, pszName)                  case 1:
214  {                          sLoadMode = QObject::tr("On Demand");
215  //  QListView::setRootIsDecorated(true);                          break;
216          QListView::setResizeMode(QListView::NoColumn);                  }
217  //      QListView::setAcceptDrops(true);                  setText(8, sLoadMode);
218          QListView::setDragAutoScroll(true);          } else {
219          QListView::setSizePolicy(                  for (int i = 0; i < listView()->columns(); i++)
220                  QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));                          setText(i, s);
221  //      QListView::setShowToolTips(false);          }
222          QListView::setSortColumn(-1);  }
223    
224          QListView::addColumn(tr("Name"));  
225          QListView::addColumn(tr("Bank"));  //----------------------------------------------------------------------------
226          QListView::addColumn(tr("Prog"));  // qsamplerInstrumentList -- MIDI instrument list view.
227          QListView::addColumn(tr("Engine"));  //
228          QListView::addColumn(tr("File"));  
229          QListView::addColumn(tr("Nr"));  // Constructor.
230          QListView::addColumn(tr("Vol"));  qsamplerInstrumentList::qsamplerInstrumentList (
231          QListView::addColumn(tr("Mode"));          QWidget *pParent, const char *pszName )
232            : QListView(pParent, pszName)
233          QListView::setColumnAlignment(1, Qt::AlignHCenter);     // Bank  {
234          QListView::setColumnAlignment(2, Qt::AlignHCenter);     // Prog          m_iMidiMap = LSCP_MIDI_MAP_ALL;
235          QListView::setColumnAlignment(5, Qt::AlignHCenter);     // Nr  
236          QListView::setColumnAlignment(6, Qt::AlignHCenter);     // Vol  //  QListView::setRootIsDecorated(true);
237            QListView::setAllColumnsShowFocus(true);
238          QListView::setColumnWidth(0, 60);       // Name          QListView::setResizeMode(QListView::NoColumn);
239          QListView::setColumnWidth(0, 120);      // File  //      QListView::setAcceptDrops(true);
240            QListView::setDragAutoScroll(true);
241          m_pNewGroupAction = new QAction(tr("New &Group"), tr("Ctrl+G"), this);          QListView::setSizePolicy(
242          m_pNewItemAction  = new QAction(tr("New &Instrument..."), tr("Ctrl+I"), this);                  QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
243          m_pEditItemAction = new QAction(tr("&Edit..."), tr("Ctrl+E"), this);  //      QListView::setShowToolTips(false);
244          m_pRenameAction   = new QAction(tr("&Rename"), tr("Ctrl+R"), this);          QListView::setSortColumn(-1);
245          m_pDeleteAction   = new QAction(tr("&Delete"), tr("Ctrl+D"), this);  
246          m_pRefreshAction  = new QAction(tr("Re&fresh"), tr("Ctrl+F"), this);          QListView::addColumn(tr("Name"));
247            QListView::addColumn(tr("Map"));
248          QObject::connect(m_pNewGroupAction,          QListView::addColumn(tr("Bank"));
249                  SIGNAL(activated()),          QListView::addColumn(tr("Prog"));
250                  SLOT(newGroupSlot()));          QListView::addColumn(tr("Engine"));
251          QObject::connect(m_pNewItemAction,          QListView::addColumn(tr("File"));
252                  SIGNAL(activated()),          QListView::addColumn(tr("Nr"));
253                  SLOT(newItemSlot()));          QListView::addColumn(tr("Vol"));
254          QObject::connect(m_pEditItemAction,          QListView::addColumn(tr("Mode"));
255                  SIGNAL(activated()),  
256                  SLOT(editItemSlot()));          QListView::setColumnAlignment(1, Qt::AlignHCenter);     // Map
257          QObject::connect(m_pRenameAction,          QListView::setColumnAlignment(2, Qt::AlignHCenter);     // Bank
258                  SIGNAL(activated()),          QListView::setColumnAlignment(3, Qt::AlignHCenter);     // Prog
259                  SLOT(renameSlot()));          QListView::setColumnAlignment(6, Qt::AlignHCenter);     // Nr
260          QObject::connect(m_pDeleteAction,          QListView::setColumnAlignment(7, Qt::AlignHCenter);     // Vol
261                  SIGNAL(activated()),  
262                  SLOT(deleteSlot()));          QListView::setColumnWidth(0, 120);      // Name
263          QObject::connect(m_pRefreshAction,          QListView::setColumnWidth(5, 240);      // File
264                  SIGNAL(activated()),  
265                  SLOT(refresh()));          m_pNewGroupAction = new QAction(
266                    QIconSet(QPixmap::fromMimeSource("itemGroupNew.png")),
267          QObject::connect(this,                  tr("New &Group"), tr("Ctrl+G"), this);
268                  SIGNAL(selectionChanged()),          m_pNewItemAction  = new QAction(
269                  SLOT(selectionChangedSlot()));                  QIconSet(QPixmap::fromMimeSource("itemNew.png")),
270          QObject::connect(this,                  tr("New &Instrument..."), tr("Ins"), this);
271                  SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)),          m_pEditItemAction = new QAction(
272                  SLOT(activatedSlot(QListViewItem*)));                  QIconSet(QPixmap::fromMimeSource("formEdit.png")),
273          QObject::connect(this,                  tr("&Edit..."), tr("Enter"), this);
274                  SIGNAL(returnPressed(QListViewItem*)),          m_pRenameAction   = new QAction(tr("&Rename"), tr("F2"), this);
275                  SLOT(activatedSlot(QListViewItem*)));          m_pDeleteAction   = new QAction(
276          QObject::connect(this,                  QIconSet(QPixmap::fromMimeSource("formRemove.png")),
277                  SIGNAL(itemRenamed(QListViewItem*,int)),                  tr("&Delete"), tr("Del"), this);
278                  SLOT(renamedSlot(QListViewItem*)));          m_pRefreshAction  = new QAction(
279                    QIconSet(QPixmap::fromMimeSource("formRefresh.png")),
280          selectionChangedSlot();                  tr("Re&fresh"), tr("F5"), this);
281  }  
282            m_pNewGroupAction->setToolTip(tr("New Group"));
283            m_pNewItemAction->setToolTip(tr("New Instrument"));
284  // Default destructor.          m_pEditItemAction->setToolTip(tr("Edit"));
285  qsamplerInstrumentList::~qsamplerInstrumentList (void)          m_pRenameAction->setToolTip(tr("Rename"));
286  {          m_pDeleteAction->setToolTip(tr("Delete"));
287          delete m_pNewGroupAction;          m_pRefreshAction->setToolTip(tr("Refresh"));
288          delete m_pNewItemAction;  
289          delete m_pEditItemAction;          QObject::connect(m_pNewGroupAction,
290          delete m_pRenameAction;                  SIGNAL(activated()),
291          delete m_pDeleteAction;                  SLOT(newGroupSlot()));
292  }          QObject::connect(m_pNewItemAction,
293                    SIGNAL(activated()),
294                    SLOT(newItemSlot()));
295  // Add a new instrument item, optionally under a given group.          QObject::connect(m_pEditItemAction,
296  qsamplerInstrumentItem *qsamplerInstrumentList::addItem (                  SIGNAL(activated()),
297          qsamplerInstrument *pInstrument,                  SLOT(editItemSlot()));
298          qsamplerInstrumentGroup *pParentGroup )          QObject::connect(m_pRenameAction,
299  {                  SIGNAL(activated()),
300          qsamplerInstrumentItem *pItem = findItem(pInstrument);                  SLOT(renameSlot()));
301          if (pItem == NULL) {          QObject::connect(m_pDeleteAction,
302                  if (pParentGroup)                  SIGNAL(activated()),
303                          pItem = new qsamplerInstrumentItem(pParentGroup, pInstrument);                  SLOT(deleteSlot()));
304                  else          QObject::connect(m_pRefreshAction,
305                          pItem = new qsamplerInstrumentItem(this, pInstrument);                  SIGNAL(activated()),
306          }                  SLOT(refresh()));
307          QListView::setSelected(pItem, true);  
308          return pItem;          QObject::connect(this,
309  }                  SIGNAL(selectionChanged()),
310                    SLOT(selectionChangedSlot()));
311            QObject::connect(this,
312  // Add a new instrument group, optionally under another group.                  SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)),
313  qsamplerInstrumentGroup *qsamplerInstrumentList::addGroup (                  SLOT(activatedSlot(QListViewItem*)));
314          const QString& sName, qsamplerInstrumentGroup *pParentGroup )          QObject::connect(this,
315  {                  SIGNAL(returnPressed(QListViewItem*)),
316          qsamplerInstrumentGroup *pGroup = findGroup(sName);                  SLOT(activatedSlot(QListViewItem*)));
317          if (pGroup == NULL) {          QObject::connect(this,
318                  if (pParentGroup)                  SIGNAL(itemRenamed(QListViewItem*,int)),
319                          pGroup = new qsamplerInstrumentGroup(pParentGroup, sName);                  SLOT(renamedSlot(QListViewItem*)));
320                  else  
321                          pGroup = new qsamplerInstrumentGroup(this, sName);          selectionChangedSlot();
322          }  }
323          QListView::setSelected(pGroup, true);  
324          return pGroup;  
325  }  // Default destructor.
326    qsamplerInstrumentList::~qsamplerInstrumentList (void)
327    {
328  // Find a group item, given its name.          delete m_pNewGroupAction;
329  qsamplerInstrumentGroup *qsamplerInstrumentList::findGroup (          delete m_pNewItemAction;
330          const QString& sName ) const          delete m_pEditItemAction;
331  {          delete m_pRenameAction;
332          // Iterate all over the place to search for the group.          delete m_pDeleteAction;
333          QListViewItemIterator iter((QListView *) this);  }
334          while (iter.current()) {  
335                  QListViewItem *pItem = iter.current();  
336                  if (pItem->rtti() == Group && pItem->text(0) == sName)  // Add a new instrument item, optionally under a given group.
337                          return static_cast<qsamplerInstrumentGroup *> (pItem);  qsamplerInstrumentItem *qsamplerInstrumentList::addItem (
338                  ++iter;          qsamplerInstrument *pInstrument,
339          }          qsamplerInstrumentGroup *pParentGroup )
340          // Not found.  {
341          return NULL;          // Check it there's already one instrument item
342  }          // with the very same key (bank, program);
343            // if yes, just remove it without prejudice...
344            qsamplerInstrumentItem *pItem = findItem(pInstrument);
345  // Find a file item, given its name.          if (pItem) {
346  qsamplerInstrumentItem *qsamplerInstrumentList::findItem (                  // If exactly the same, just update view and bail out...
347          qsamplerInstrument *pInstrument ) const                  if (pItem->instrument() == pInstrument) {
348  {                          pItem->update();
349          if (pInstrument == NULL)                          return pItem;
350                  return NULL;                  }
351                    // Remove it, as instrument keys must be unique.
352          // Iterate all over the place to search for the group.                  delete pItem;
353          QListViewItemIterator iter((QListView *) this);          }
354          while (iter.current()) {  
355                  QListViewItem *pListItem = iter.current();          // Add the new item under proper group one, if any...
356                  if (pListItem->rtti() == Item) {          if (pParentGroup) {
357                          qsamplerInstrumentItem *pItem                  pParentGroup->setOpen(true);
358                                  = static_cast<qsamplerInstrumentItem *> (pListItem);                  pItem = new qsamplerInstrumentItem(pParentGroup, pInstrument);
359                          if (pItem && pItem->instrument()          } else {
360                                  && pItem->instrument()->bank() == pInstrument->bank()                  pItem = new qsamplerInstrumentItem(this, pInstrument);
361                                  && pItem->instrument()->program() == pInstrument->program())          }
362                                  return pItem;  
363                  }          // Set it as current selection...
364                  ++iter;          QListView::setSelected(pItem, true);
365          }  
366          // Not found.          return pItem;
367          return NULL;  }
368  }  
369    
370    // Add a new instrument group, optionally under another group.
371  // Find and return the nearest group item...  qsamplerInstrumentGroup *qsamplerInstrumentList::addGroup (
372  qsamplerInstrumentGroup *qsamplerInstrumentList::groupItem (          const QString& sName, qsamplerInstrumentGroup *pParentGroup )
373          QListViewItem *pItem ) const  {
374  {          qsamplerInstrumentGroup *pGroup = findGroup(sName);
375          while (pItem && pItem->rtti() != Group)          if (pGroup == NULL) {
376                  pItem = pItem->parent();                  if (pParentGroup) {
377          return static_cast<qsamplerInstrumentGroup *> (pItem);                          pParentGroup->setOpen(true);
378  }                          pGroup = new qsamplerInstrumentGroup(pParentGroup, sName);
379                    } else {
380                            pGroup = new qsamplerInstrumentGroup(this, sName);
381  // Add a new group item below the current one.                  }
382  void qsamplerInstrumentList::newGroupSlot (void)          }
383  {          QListView::setSelected(pGroup, true);
384          qsamplerInstrumentGroup *pParentGroup          return pGroup;
385                  = groupItem(QListView::selectedItem());  }
386          qsamplerInstrumentGroup *pNewGroup  
387                  = addGroup(tr("New Group"), pParentGroup);  
388          if (pParentGroup)  // Find a group item, given its name.
389                  pParentGroup->setOpen(true);  qsamplerInstrumentGroup *qsamplerInstrumentList::findGroup (
390          if (pNewGroup)          const QString& sName ) const
391                  pNewGroup->startRename(0);  {
392            // Iterate all over the place to search for the group.
393          selectionChangedSlot();          QListViewItemIterator iter((QListView *) this);
394  }          while (iter.current()) {
395                    QListViewItem *pItem = iter.current();
396                    if (pItem->rtti() == Group && pItem->text(0) == sName)
397  // Add a new instrument item below the current one.                          return static_cast<qsamplerInstrumentGroup *> (pItem);
398  void qsamplerInstrumentList::newItemSlot (void)                  ++iter;
399  {          }
400          qsamplerInstrument *pInstrument = new qsamplerInstrument();          // Not found.
401            return NULL;
402          qsamplerInstrumentForm form(this);  }
403          form.setup(pInstrument);  
404          if (!form.exec()) {  
405                  delete pInstrument;  // Find a file item, given its name.
406                  return;  qsamplerInstrumentItem *qsamplerInstrumentList::findItem (
407          }          qsamplerInstrument *pInstrument ) const
408    {
409          // Check it there's already one for the same key (bank, program)          if (pInstrument == NULL)
410          qsamplerInstrumentItem *pItem = findItem(pInstrument);                  return NULL;
411          if (pItem)  
412                  delete pItem;          // Iterate all over the place to search for the group.
413            QListViewItemIterator iter((QListView *) this);
414          pInstrument->map();          while (iter.current()) {
415          emit instrumentsChanged();                  QListViewItem *pListItem = iter.current();
416                    if (pListItem->rtti() == Item) {
417          qsamplerInstrumentGroup *pParentGroup                          qsamplerInstrumentItem *pItem
418                  = groupItem(QListView::selectedItem());                                  = static_cast<qsamplerInstrumentItem *> (pListItem);
419          addItem(pInstrument, pParentGroup);                          if (pItem && pItem->instrument()
420          if (pParentGroup)                                  && pItem->instrument()->map()  == pInstrument->map()
421                  pParentGroup->setOpen(true);                                  && pItem->instrument()->bank() == pInstrument->bank()
422                                    && pItem->instrument()->prog() == pInstrument->prog())
423          selectionChangedSlot();                                  return pItem;
424  }                  }
425                    ++iter;
426            }
427  // Edit current item below the current one.          // Not found.
428  void qsamplerInstrumentList::editItemSlot (void)          return NULL;
429  {  }
430          QListViewItem *pListItem = QListView::selectedItem();  
431          if (pListItem == NULL)  
432                  return;  // Find and return the nearest group item...
433          if (pListItem->rtti() == Item) {  qsamplerInstrumentGroup *qsamplerInstrumentList::groupItem (
434                  qsamplerInstrumentItem *pItem          QListViewItem *pItem ) const
435                          = static_cast<qsamplerInstrumentItem *> (pListItem);  {
436                  if (pItem && pItem->instrument()) {          while (pItem && pItem->rtti() != Group)
437                          qsamplerInstrumentForm form(this);                  pItem = pItem->parent();
438                          form.setup(pItem->instrument());          return static_cast<qsamplerInstrumentGroup *> (pItem);
439                          if (form.exec()) {  }
440                                  pItem->instrument()->map();  
441                                  emit instrumentsChanged();  
442                                  pItem->update();  // Add a new group item below the current one.
443                          }  void qsamplerInstrumentList::newGroupSlot (void)
444                  }  {
445          }          qsamplerInstrumentGroup *pNewGroup
446                    = addGroup(tr("New Group"), groupItem(QListView::selectedItem()));
447          selectionChangedSlot();          if (pNewGroup)
448  }                  pNewGroup->startRename(0);
449    
450            selectionChangedSlot();
451  // Rename current group/item.  }
452  void qsamplerInstrumentList::renameSlot (void)  
453  {  
454          QListViewItem *pListItem = QListView::selectedItem();  // Map selector.
455          if (pListItem)  void qsamplerInstrumentList::setMidiMap ( int iMidiMap )
456                  pListItem->startRename(0);  {
457            if (iMidiMap < 0)
458          selectionChangedSlot();                  iMidiMap = LSCP_MIDI_MAP_ALL;
459  }  
460            m_iMidiMap = iMidiMap;
461    }
462  // Remove current group/item.  
463  void qsamplerInstrumentList::deleteSlot (void)  int qsamplerInstrumentList::midiMap (void) const
464  {  {
465          QListViewItem *pListItem = QListView::selectedItem();          return m_iMidiMap;
466          if (pListItem) {  }
467                  if (pListItem->rtti() == Item) {  
468                          qsamplerInstrumentItem *pItem  
469                                  = static_cast<qsamplerInstrumentItem *> (pListItem);  // List actions accessors.
470                          if (pItem && pItem->instrument()) {  QAction *qsamplerInstrumentList::newGroupAction (void) const
471                                  pItem->instrument()->unmap();  {
472                                  emit instrumentsChanged();          return m_pNewGroupAction;
473                          }  }
474                  }  
475                  delete pListItem;  QAction *qsamplerInstrumentList::newItemAction (void) const
476          }  {
477            return m_pNewItemAction;
478          selectionChangedSlot();  }
479  }  
480    QAction *qsamplerInstrumentList::editItemAction (void) const
481    {
482  // In-place selection slot.          return m_pEditItemAction;
483  void qsamplerInstrumentList::selectionChangedSlot (void)  }
484  {  
485          qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();  QAction *qsamplerInstrumentList::renameAction (void) const
486          QListViewItem *pListItem = QListView::selectedItem();  {
487          bool bEnabled = (pMainForm && pMainForm->client());          return m_pRenameAction;
488          m_pNewItemAction->setEnabled(bEnabled);  }
489          bEnabled = (bEnabled && pListItem != NULL);  
490          m_pEditItemAction->setEnabled(bEnabled && pListItem->rtti() == Item);  QAction *qsamplerInstrumentList::deleteAction (void) const
491          m_pRenameAction->setEnabled(bEnabled);  {
492          m_pDeleteAction->setEnabled(bEnabled);          return m_pDeleteAction;
493  }  }
494    
495    QAction *qsamplerInstrumentList::refreshAction (void) const
496  // In-place activation slot.  {
497  void qsamplerInstrumentList::activatedSlot ( QListViewItem *pListItem )          return m_pRefreshAction;
498  {  }
499          // FIXME: Hope the list view item is the one selected.  
500          if (pListItem->rtti() == Item)  
501                  editItemSlot();  // Add a new instrument item below the current one.
502  }  void qsamplerInstrumentList::newItemSlot (void)
503    {
504            qsamplerInstrument *pInstrument = new qsamplerInstrument();
505  // In-place aliasing slot.  
506  void qsamplerInstrumentList::renamedSlot ( QListViewItem *pListItem )          qsamplerInstrumentForm form(this);
507  {          form.setup(pInstrument);
508          if (pListItem->rtti() == Item) {          if (!form.exec()) {
509                  qsamplerInstrumentItem *pItem                  delete pInstrument;
510                          = static_cast<qsamplerInstrumentItem *> (pListItem);                  return;
511                  if (pItem && pItem->instrument()) {          }
512                          pItem->instrument()->setName(pListItem->text(0));  
513                          pItem->instrument()->map();          // Commit...
514                          emit instrumentsChanged();          pInstrument->mapInstrument();
515                          pItem->update();          // add new item to the tree...
516                  }          addItem(pInstrument, groupItem(QListView::selectedItem()));
517          }          // Notify we've changes...
518  }          emit instrumentsChanged();
519    
520            selectionChangedSlot();
521  // Context menu request event handler.  }
522  void qsamplerInstrumentList::contextMenuEvent (  
523          QContextMenuEvent *pContextMenuEvent )  
524  {  // Edit current item below the current one.
525          QPopupMenu menu(this);  void qsamplerInstrumentList::editItemSlot (void)
526    {
527          // Construct context menu.          QListViewItem *pListItem = QListView::selectedItem();
528          m_pNewItemAction->addTo(&menu);          if (pListItem == NULL)
529  //      m_pNewGroupAction->addTo(&menu);                  return;
530          menu.insertSeparator();          if (pListItem->rtti() == Item) {
531          m_pEditItemAction->addTo(&menu);                  qsamplerInstrument *pInstrument = NULL;
532          m_pRenameAction->addTo(&menu);                  qsamplerInstrumentItem *pItem
533          m_pDeleteAction->addTo(&menu);                          = static_cast<qsamplerInstrumentItem *> (pListItem);
534          menu.insertSeparator();                  if (pItem)
535          m_pRefreshAction->addTo(&menu);                          pInstrument = pItem->instrument();
536                    if (pInstrument) {
537          menu.exec(pContextMenuEvent->globalPos());                          // Save current key values...
538  }                          qsamplerInstrument oldInstrument(*pInstrument);
539                            // Do the edit dance...
540                            qsamplerInstrumentForm form(this);
541  // General reloader.                          form.setup(pInstrument);
542  void qsamplerInstrumentList::refresh (void)                          if (form.exec()) {
543  {                                  // Commit...
544          clear();                                  pInstrument->mapInstrument();
545                                    // Check whether we changed instrument key...
546          qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();                                  if (oldInstrument.map()  == pInstrument->map()  &&
547          if (pMainForm == NULL)                                          oldInstrument.bank() == pInstrument->bank() &&
548                  return;                                          oldInstrument.prog() == pInstrument->prog()) {
549          if (pMainForm->client() == NULL)                                          // just update tree item...
550                  return;                                          pItem->update();
551                                    } else {
552          qsamplerInstrumentItem *pItem = NULL;                                          // Unmap old instance...
553          lscp_midi_instrument_t *pInstrs                                          oldInstrument.unmapInstrument();
554                  = ::lscp_list_midi_instruments(pMainForm->client());                                          // Change item tree, whether applicable...
555          for (int iInstr = 0; pInstrs && pInstrs[iInstr].program >= 0; ++iInstr) {                                          if (m_iMidiMap < 0 || m_iMidiMap == pInstrument->map()) {
556                  int iBank = (pInstrs[iInstr].bank_msb << 7) | pInstrs[iInstr].bank_lsb;                                                  // Add new brand item into view...
557                  int iProgram = pInstrs[iInstr].program;                                                  addItem(pInstrument, groupItem(pListItem));
558                  qsamplerInstrument *pInstrument                                          } else {
559                          = new qsamplerInstrument(iBank, iProgram);                                                  // Just remove/hide old one.
560                  if (pInstrument->get())                                                  delete pItem;
561                          pItem = new qsamplerInstrumentItem(this, pInstrument, pItem);                                          }
562          }                                  }
563                                    // Notify we've changes...
564          if (pInstrs == NULL && ::lscp_client_get_errno(pMainForm->client())) {                                  emit instrumentsChanged();
565                  pMainForm->appendMessagesClient("lscp_list_midi_instruments");                          }
566                  pMainForm->appendMessagesError(tr("Could not get current list of MIDI instrument mappings.\n\nSorry."));                  }
567          }          }
568    
569          selectionChangedSlot();          selectionChangedSlot();
570  }  }
571    
572    
573  // end of qsamplerInstrumentList.cpp  // Rename current group/item.
574    void qsamplerInstrumentList::renameSlot (void)
575    {
576            QListViewItem *pListItem = QListView::selectedItem();
577            if (pListItem)
578                    pListItem->startRename(0);
579    
580            selectionChangedSlot();
581    }
582    
583    
584    // Remove current group/item.
585    void qsamplerInstrumentList::deleteSlot (void)
586    {
587            QListViewItem *pListItem = QListView::selectedItem();
588            if (pListItem == NULL)
589                    return;
590    
591            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
592            if (pMainForm == NULL)
593                    return;
594    
595            // Prompt user if this is for real...
596            qsamplerOptions *pOptions = pMainForm->options();
597            if (pOptions && pOptions->bConfirmRemove) {
598                    if (QMessageBox::warning(this,
599                            QSAMPLER_TITLE ": " + tr("Warning"),
600                            tr("Delete %1:\n\n"
601                            "%2\n\n"
602                            "Are you sure?")
603                            .arg(pListItem->rtti() == Item ? tr("instrument") : tr("group"))
604                            .arg(pListItem->text(0)),
605                            tr("OK"), tr("Cancel")) > 0)
606                            return;
607            }
608    
609            // Unmap instrument entry...
610            if (pListItem->rtti() == Item) {
611                    qsamplerInstrumentItem *pItem
612                            = static_cast<qsamplerInstrumentItem *> (pListItem);
613                    if (pItem && pItem->instrument()) {
614                            pItem->instrument()->unmapInstrument();
615                            emit instrumentsChanged();
616                    }
617            }
618    
619            // Do it for real...
620            delete pListItem;
621    
622            selectionChangedSlot();
623    }
624    
625    
626    // In-place selection slot.
627    void qsamplerInstrumentList::selectionChangedSlot (void)
628    {
629            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
630            QListViewItem *pListItem = QListView::selectedItem();
631            bool bEnabled = (pMainForm && pMainForm->client());
632            m_pNewItemAction->setEnabled(bEnabled);
633            bEnabled = (bEnabled && pListItem != NULL);
634            m_pEditItemAction->setEnabled(bEnabled && pListItem->rtti() == Item);
635            m_pRenameAction->setEnabled(bEnabled);
636            m_pDeleteAction->setEnabled(bEnabled);
637    }
638    
639    
640    // In-place activation slot.
641    void qsamplerInstrumentList::activatedSlot ( QListViewItem *pListItem )
642    {
643            // FIXME: Hope the list view item is the one selected.
644            if (pListItem && pListItem->rtti() == Item)
645                    editItemSlot();
646    }
647    
648    
649    // In-place aliasing slot.
650    void qsamplerInstrumentList::renamedSlot ( QListViewItem *pListItem )
651    {
652            if (pListItem->rtti() == Item) {
653                    qsamplerInstrumentItem *pItem
654                            = static_cast<qsamplerInstrumentItem *> (pListItem);
655                    if (pItem && pItem->instrument()) {
656                            pItem->instrument()->setName(pListItem->text(0));
657                            pItem->instrument()->mapInstrument();
658                            emit instrumentsChanged();
659                            pItem->update();
660                    }
661            }
662    }
663    
664    
665    // Context menu request event handler.
666    void qsamplerInstrumentList::contextMenuEvent (
667            QContextMenuEvent *pContextMenuEvent )
668    {
669            if (!m_pNewItemAction->isEnabled())
670                    return;
671    
672            QPopupMenu menu(this);
673    
674            // Construct context menu.
675            m_pNewItemAction->addTo(&menu);
676    //      m_pNewGroupAction->addTo(&menu);
677            menu.insertSeparator();
678            m_pEditItemAction->addTo(&menu);
679            m_pRenameAction->addTo(&menu);
680            m_pDeleteAction->addTo(&menu);
681            menu.insertSeparator();
682            m_pRefreshAction->addTo(&menu);
683    
684            menu.exec(pContextMenuEvent->globalPos());
685    }
686    
687    
688    // General reloader.
689    void qsamplerInstrumentList::refresh (void)
690    {
691            clear();
692    
693            qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance();
694            if (pMainForm == NULL)
695                    return;
696            if (pMainForm->client() == NULL)
697                    return;
698    
699            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
700    
701            // Load the whole bunch of instrument items...
702            qsamplerInstrumentItem *pItem = NULL;
703            lscp_midi_instrument_t *pInstrs
704                    = ::lscp_list_midi_instruments(pMainForm->client(), m_iMidiMap);
705            for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; ++iInstr) {
706                    int iMap  = pInstrs[iInstr].map;
707                    int iBank = pInstrs[iInstr].bank;
708                    int iProg = pInstrs[iInstr].prog;
709                    qsamplerInstrument *pInstrument
710                            = new qsamplerInstrument(iMap, iBank, iProg);
711                    if (pInstrument->getInstrument())
712                            pItem = new qsamplerInstrumentItem(this, pInstrument, pItem);
713                    // Try to keep it snappy :)
714                    QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
715            }
716    
717            QApplication::restoreOverrideCursor();
718    
719            if (pInstrs == NULL && ::lscp_client_get_errno(pMainForm->client())) {
720                    pMainForm->appendMessagesClient("lscp_list_midi_instruments");
721                    pMainForm->appendMessagesError(tr("Could not get current list of MIDI instrument mappings.\n\nSorry."));
722            }
723    
724            selectionChangedSlot();
725    }
726    #endif
727    
728    MidiInstrumentsModel::MidiInstrumentsModel(QObject* parent) : QAbstractTableModel(parent) {
729        m_iMidiMap = LSCP_MIDI_MAP_ALL;
730    }
731    
732    int MidiInstrumentsModel::rowCount(const QModelIndex& /*parent*/) const {
733        if (m_iMidiMap == LSCP_MIDI_MAP_ALL) {
734            int n = 0;
735            for (InstrumentsMap::const_iterator itMap = instruments.begin(); itMap != instruments.end(); ++itMap)
736                n += (*itMap).size();
737            return n;
738        }
739        InstrumentsMap::const_iterator itMap = instruments.find(m_iMidiMap);
740        if (itMap == instruments.end()) return 0;
741        return (*itMap).size();
742    }
743    
744    int MidiInstrumentsModel::columnCount(const QModelIndex& /*parent*/) const {
745        return 9;
746    }
747    
748    QVariant MidiInstrumentsModel::data(const QModelIndex &index, int role) const {
749        if (!index.isValid() || role != Qt::DisplayRole) return QVariant();
750    
751        if (m_iMidiMap == LSCP_MIDI_MAP_ALL) {
752            int n = 0;
753            for (InstrumentsMap::const_iterator itMap = instruments.begin(); itMap != instruments.end(); ++itMap) {
754                n += (*itMap).size();
755                if (index.row() < n)
756                    return QVariant::fromValue(
757                        (*itMap)[index.row() + (*itMap).size() - n]
758                    );
759            }
760        } else {
761            // resolve MIDI instrument map
762            InstrumentsMap::const_iterator itMap = instruments.find(m_iMidiMap);
763            if (itMap == instruments.end()) return QVariant();
764            // resolve instrument in that map
765            if (index.row() >= (*itMap).size()) return QVariant();
766            return QVariant::fromValue(
767                (*itMap)[index.row()]
768            );
769        }
770    
771        return QVariant();
772    }
773    
774    QVariant MidiInstrumentsModel::headerData(int section, Qt::Orientation orientation, int role) const {
775        if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
776            return QVariant();
777    
778        switch (section) {
779            case 0: return tr("Name");
780            case 1: return tr("Map");
781            case 2: return tr("Bank");
782            case 3: return tr("Prog");
783            case 4: return tr("Engine");
784            case 5: return tr("File");
785            case 6: return tr("Nr");
786            case 7: return tr("Vol");
787            case 8: return tr("Mode");
788            default: return QVariant();
789        }
790    }
791    
792    qsamplerInstrument* MidiInstrumentsModel::addInstrument(int iMap, int iBank, int iProg) {
793        // Check it there's already one instrument item
794        // with the very same key (bank, program);
795        // if yes, just remove it without prejudice...
796        for (int i = 0; i < instruments[iMap].size(); i++) {
797            if (
798                instruments[iMap][i].bank() == iBank &&
799                instruments[iMap][i].prog() == iProg
800            ) {
801                instruments[iMap].removeAt(i);
802                break;
803            }
804        }
805    
806        // resolve the appropriate place, we keep the list sorted that way ...
807        int i = 0;
808        for (; i < instruments[iMap].size(); i++)
809            if (
810                iBank > instruments[iMap][i].bank() ||
811                ( iBank == instruments[iMap][i].bank() &&
812                  iProg > instruments[iMap][i].prog() )
813            ) break;
814    
815        qsamplerInstrument& instr = instruments[iMap][i] = qsamplerInstrument(iMap, iBank, iProg);
816    
817        return &instr;
818    }
819    
820    void MidiInstrumentsModel::setMidiMap(int iMidiMap) {
821        if (iMidiMap < 0)
822            iMidiMap = LSCP_MIDI_MAP_ALL;
823    
824        m_iMidiMap = iMidiMap;
825    }
826    
827    int MidiInstrumentsModel::midiMap() const {
828        return m_iMidiMap;
829    }
830    
831    void MidiInstrumentsModel::refresh() {
832            instruments.clear();
833    
834            MainForm* pMainForm = MainForm::getInstance();
835            if (pMainForm == NULL)
836                    return;
837            if (pMainForm->client() == NULL)
838                    return;
839    
840            QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
841    
842            // Load the whole bunch of instrument items...
843            lscp_midi_instrument_t* pInstrs
844                    = ::lscp_list_midi_instruments(pMainForm->client(), m_iMidiMap);
845            for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; ++iInstr) {
846                    const int iMap  = pInstrs[iInstr].map;
847                    const int iBank = pInstrs[iInstr].bank;
848                    const int iProg = pInstrs[iInstr].prog;
849                    addInstrument(iMap, iBank, iProg);
850                    // Try to keep it snappy :)
851                    QApplication::processEvents(QEventLoop::ExcludeUserInput);
852            }
853    
854            QApplication::restoreOverrideCursor();
855    
856            if (pInstrs == NULL && ::lscp_client_get_errno(pMainForm->client())) {
857                    pMainForm->appendMessagesClient("lscp_list_midi_instruments");
858                    pMainForm->appendMessagesError(tr("Could not get current list of MIDI instrument mappings.\n\nSorry."));
859            }
860    
861            //selectionChangedSlot();
862    }
863    
864    
865    MidiInstrumentsDelegate::MidiInstrumentsDelegate(QObject* parent) : QItemDelegate(parent) {
866    }
867    
868    QWidget* MidiInstrumentsDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const {
869        return new QLabel(index.model()->data(index, Qt::DisplayRole).toString(), parent);
870    }
871    
872    void MidiInstrumentsDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const {
873    }
874    
875    void MidiInstrumentsDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const {
876    }
877    
878    void MidiInstrumentsDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const {
879        if (editor) editor->setGeometry(option.rect);
880    }
881    
882    // end of qsamplerInstrumentList.cpp
883    

Legend:
Removed from v.969  
changed lines
  Added in v.1461

  ViewVC Help
Powered by ViewVC