/[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 969 by capela, Wed Dec 6 19:38:02 2006 UTC revision 1013 by capela, Mon Jan 8 16:52:48 2007 UTC
# Line 1  Line 1 
1  // qsamplerInstrumentList.h  // qsamplerInstrumentList.h
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  #ifndef __qsamplerInstrumentList_h  #ifndef __qsamplerInstrumentList_h
23  #define __qsamplerInstrumentList_h  #define __qsamplerInstrumentList_h
24    
25  #include <qlistview.h>  #include <qlistview.h>
26  #include <qheader.h>  #include <qheader.h>
27    
28  #include <lscp/client.h>  #include <lscp/client.h>
29    
30    
31  // Forward declarations.  // Forward declarations.
32  class qsamplerInstrument;  class qsamplerInstrument;
33  class qsamplerInstrumentList;  class qsamplerInstrumentList;
34    
35  class QAction;  class QAction;
36    
37    
38  //----------------------------------------------------------------------  //----------------------------------------------------------------------
39  // class qsamplerInstrumentGroup -- custom group list view item.  // class qsamplerInstrumentGroup -- custom group list view item.
40  //  //
41    
42  class qsamplerInstrumentGroup : public QListViewItem  class qsamplerInstrumentGroup : public QListViewItem
43  {  {
44  public:  public:
45    
46          // Constructors.          // Constructors.
47          qsamplerInstrumentGroup(qsamplerInstrumentList *pListView,          qsamplerInstrumentGroup(qsamplerInstrumentList *pListView,
48                  const QString& sName, QListViewItem *pItemAfter = NULL);                  const QString& sName, QListViewItem *pItemAfter = NULL);
49          qsamplerInstrumentGroup(qsamplerInstrumentGroup *pGroupItem,          qsamplerInstrumentGroup(qsamplerInstrumentGroup *pGroupItem,
50                  const QString& sName);                  const QString& sName);
51          // Default destructor.          // Default destructor.
52          virtual ~qsamplerInstrumentGroup();          virtual ~qsamplerInstrumentGroup();
53    
54          // Instance accessors.          // Instance accessors.
55          void setName(const QString& sName);          void setName(const QString& sName);
56          QString name() const;          QString name() const;
57    
58          qsamplerInstrumentList  *listView() const;          qsamplerInstrumentList  *listView() const;
59          qsamplerInstrumentGroup *groupItem() const;          qsamplerInstrumentGroup *groupItem() const;
60    
61          // To show up whether its open or not.          // To show up whether its open or not.
62          virtual void setOpen(bool bOpen);          virtual void setOpen(bool bOpen);
63    
64          // To virtually distinguish between list view items.          // To virtually distinguish between list view items.
65          virtual int rtti() const;          virtual int rtti() const;
66  };  };
67    
68    
69  //----------------------------------------------------------------------  //----------------------------------------------------------------------
70  // class qsamplerInstrumentItem -- custom file list view item.  // class qsamplerInstrumentItem -- custom file list view item.
71  //  //
72    
73  class qsamplerInstrumentItem : public qsamplerInstrumentGroup  class qsamplerInstrumentItem : public qsamplerInstrumentGroup
74  {  {
75  public:  public:
76    
77          // Constructors.          // Constructors.
78          qsamplerInstrumentItem(qsamplerInstrumentList *pListView,          qsamplerInstrumentItem(qsamplerInstrumentList *pListView,
79                  qsamplerInstrument *pInstrument,                  qsamplerInstrument *pInstrument,
80                  QListViewItem *pItemAfter = NULL);                  QListViewItem *pItemAfter = NULL);
81          qsamplerInstrumentItem(qsamplerInstrumentGroup *pGroupItem,          qsamplerInstrumentItem(qsamplerInstrumentGroup *pGroupItem,
82                  qsamplerInstrument *pInstrument);                  qsamplerInstrument *pInstrument);
83          // Default destructor.          // Default destructor.
84          virtual ~qsamplerInstrumentItem();          virtual ~qsamplerInstrumentItem();
85    
86          // To virtually distinguish between list view items.          // To virtually distinguish between list view items.
87          virtual int rtti() const;          virtual int rtti() const;
88    
89          // Payload accessor.          // Payload accessor.
90          qsamplerInstrument *instrument() const;          qsamplerInstrument *instrument() const;
91    
92          // View refreshment.          // View refreshment.
93          void update();          void update();
94    
95  private:  private:
96    
97          // File item full path.          // File item full path.
98          qsamplerInstrument *m_pInstrument;          qsamplerInstrument *m_pInstrument;
99  };  };
100    
101    
102  //----------------------------------------------------------------------------  //----------------------------------------------------------------------------
103  // qsamplerInstrumentList -- MIDI instrument list view.  // qsamplerInstrumentList -- MIDI instrument list view.
104  //  //
105    
106  class qsamplerInstrumentList : public QListView  class qsamplerInstrumentList : public QListView
107  {  {
108          Q_OBJECT          Q_OBJECT
109    
110  public:  public:
111    
112          // Constructor.          // Constructor.
113          qsamplerInstrumentList(QWidget *pParent, const char *pszName = NULL);          qsamplerInstrumentList(QWidget *pParent, const char *pszName = NULL);
114          // Default destructor.          // Default destructor.
115          ~qsamplerInstrumentList();          ~qsamplerInstrumentList();
116    
117          // QListViewItem::rtti() return values.          // QListViewItem::rtti() return values.
118          enum ItemType { Group = 1001, Item = 1002 };          enum ItemType { Group = 1001, Item = 1002 };
119    
120          // Add a new group/file item, optionally under a given group.          // Add a new group/file item, optionally under a given group.
121          qsamplerInstrumentGroup *addGroup(const QString& sName,          qsamplerInstrumentGroup *addGroup(const QString& sName,
122                  qsamplerInstrumentGroup *pParentGroup = NULL);                  qsamplerInstrumentGroup *pParentGroup = NULL);
123          qsamplerInstrumentItem *addItem(          qsamplerInstrumentItem *addItem(
124                  qsamplerInstrument *pInstrument,                  qsamplerInstrument *pInstrument,
125                  qsamplerInstrumentGroup *pParentGroup = NULL);                  qsamplerInstrumentGroup *pParentGroup = NULL);
126    
127          // Find a group/file item, given its name.          // Find a group/file item, given its name.
128          qsamplerInstrumentGroup *findGroup(const QString& sName) const;          qsamplerInstrumentGroup *findGroup(const QString& sName) const;
129          qsamplerInstrumentItem  *findItem(          qsamplerInstrumentItem  *findItem(
130                  qsamplerInstrument *pInstrument) const;                  qsamplerInstrument *pInstrument) const;
131    
132  signals:          // Map selector.
133            void setMidiMap(int iMidiMap);
134          // Instrument map/session change signal.          int midiMap() const;
135          void instrumentsChanged();  
136            // List actions accessors.
137  public slots:          QAction *newGroupAction() const;
138            QAction *newItemAction() const;
139          // General reloader.          QAction *editItemAction() const;
140          void refresh();          QAction *renameAction() const;
141            QAction *deleteAction() const;
142  protected slots:          QAction *refreshAction() const;
143    
144          // Add a new group item below the current one.  signals:
145          void newGroupSlot();  
146          // Add a instrument item below the current one.          // Instrument map/session change signal.
147          void newItemSlot();          void instrumentsChanged();
148          // Change current instrument item.  
149          void editItemSlot();  public slots:
150          // Rename current group/item.  
151          void renameSlot();          // General reloader.
152          // Remove current group/item.          void refresh();
153          void deleteSlot();  
154    protected slots:
155          // In-place selection slot.  
156          void selectionChangedSlot();          // Add a new group item below the current one.
157            void newGroupSlot();
158          // In-place activation slot.          // Add a instrument item below the current one.
159          void activatedSlot(QListViewItem *pListItem);          void newItemSlot();
160            // Change current instrument item.
161          // In-place aliasing slot.          void editItemSlot();
162          void renamedSlot(QListViewItem *pItem);          // Rename current group/item.
163            void renameSlot();
164  protected:          // Remove current group/item.
165            void deleteSlot();
166          // Find and return the nearest group item...  
167          qsamplerInstrumentGroup *groupItem(QListViewItem *pListItem) const;          // In-place selection slot.
168            void selectionChangedSlot();
169          // Context menu request event handler.  
170          void contextMenuEvent(QContextMenuEvent *pContextMenuEvent);          // In-place activation slot.
171            void activatedSlot(QListViewItem *pListItem);
172  private:  
173            // In-place aliasing slot.
174          // List view actions.          void renamedSlot(QListViewItem *pItem);
175          QAction *m_pNewGroupAction;  
176          QAction *m_pNewItemAction;  protected:
177          QAction *m_pEditItemAction;  
178          QAction *m_pRenameAction;          // Find and return the nearest group item...
179          QAction *m_pDeleteAction;          qsamplerInstrumentGroup *groupItem(QListViewItem *pListItem) const;
180          QAction *m_pRefreshAction;  
181  };          // Context menu request event handler.
182            void contextMenuEvent(QContextMenuEvent *pContextMenuEvent);
183    
184  #endif  // __qsamplerInstrumentList_h  private:
185    
186  // end of qsamplerInstrumentList.h          // List view actions.
187            QAction *m_pNewGroupAction;
188            QAction *m_pNewItemAction;
189            QAction *m_pEditItemAction;
190            QAction *m_pRenameAction;
191            QAction *m_pDeleteAction;
192            QAction *m_pRefreshAction;
193    
194            // Current map selection.
195            int m_iMidiMap;
196    };
197    
198    
199    #endif  // __qsamplerInstrumentList_h
200    
201    // end of qsamplerInstrumentList.h

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

  ViewVC Help
Powered by ViewVC