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

Annotation of /qsampler/trunk/src/qsamplerInstrumentList.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 962 - (hide annotations) (download) (as text)
Sun Dec 3 18:27:23 2006 UTC (17 years, 4 months ago) by capela
File MIME type: text/x-c++hdr
File size: 5103 byte(s)
* Adding preliminary MIDI instrument mapping support; now
  with an instrument list widget and editing capabilities.

1 capela 962 // qsamplerInstrumentList.h
2     //
3     /****************************************************************************
4     Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
5    
6     This program is free software; you can redistribute it and/or
7     modify it under the terms of the GNU General Public License
8     as published by the Free Software Foundation; either version 2
9     of the License, or (at your option) any later version.
10    
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     GNU General Public License for more details.
15    
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19    
20     *****************************************************************************/
21    
22     #ifndef __qsamplerInstrumentList_h
23     #define __qsamplerInstrumentList_h
24    
25     #include <qlistview.h>
26     #include <qheader.h>
27    
28     #include <lscp/client.h>
29    
30    
31     // Forward declarations.
32     class qsamplerInstrument;
33     class qsamplerInstrumentList;
34    
35     class QAction;
36    
37    
38     //----------------------------------------------------------------------
39     // class qsamplerInstrumentGroup -- custom group list view item.
40     //
41    
42     class qsamplerInstrumentGroup : public QListViewItem
43     {
44     public:
45    
46     // Constructors.
47     qsamplerInstrumentGroup(qsamplerInstrumentList *pListView,
48     const QString& sName, QListViewItem *pItemAfter = NULL);
49     qsamplerInstrumentGroup(qsamplerInstrumentGroup *pGroupItem,
50     const QString& sName);
51     // Default destructor.
52     virtual ~qsamplerInstrumentGroup();
53    
54     // Instance accessors.
55     void setName(const QString& sName);
56     QString name() const;
57    
58     qsamplerInstrumentList *listView() const;
59     qsamplerInstrumentGroup *groupItem() const;
60    
61     // To show up whether its open or not.
62     virtual void setOpen(bool bOpen);
63    
64     // To virtually distinguish between list view items.
65     virtual int rtti() const;
66     };
67    
68    
69     //----------------------------------------------------------------------
70     // class qsamplerInstrumentItem -- custom file list view item.
71     //
72    
73     class qsamplerInstrumentItem : public qsamplerInstrumentGroup
74     {
75     public:
76    
77     // Constructors.
78     qsamplerInstrumentItem(qsamplerInstrumentList *pListView,
79     qsamplerInstrument *pInstrument,
80     QListViewItem *pItemAfter = NULL);
81     qsamplerInstrumentItem(qsamplerInstrumentGroup *pGroupItem,
82     qsamplerInstrument *pInstrument);
83     // Default destructor.
84     virtual ~qsamplerInstrumentItem();
85    
86     // To virtually distinguish between list view items.
87     virtual int rtti() const;
88    
89     // Payload accessor.
90     qsamplerInstrument *Instrument() const;
91    
92     // View refreshment.
93     void update();
94    
95     private:
96    
97     // File item full path.
98     qsamplerInstrument *m_pInstrument;
99     };
100    
101    
102     //----------------------------------------------------------------------------
103     // qsamplerInstrumentList -- MIDI instrument list view.
104     //
105    
106     class qsamplerInstrumentList : public QListView
107     {
108     Q_OBJECT
109    
110     public:
111    
112     // Constructor.
113     qsamplerInstrumentList(QWidget *pParent, const char *pszName = NULL);
114     // Default destructor.
115     ~qsamplerInstrumentList();
116    
117     // QListViewItem::rtti() return values.
118     enum ItemType { Group = 1001, Item = 1002 };
119    
120     // Add a new group/file item, optionally under a given group.
121     qsamplerInstrumentGroup *addGroup(const QString& sName,
122     qsamplerInstrumentGroup *pParentGroup = NULL);
123     qsamplerInstrumentItem *addItem(
124     qsamplerInstrument *pInstrument,
125     qsamplerInstrumentGroup *pParentGroup = NULL);
126    
127     // Find a group/file item, given its name.
128     qsamplerInstrumentGroup *findGroup(const QString& sName) const;
129     qsamplerInstrumentItem *findItem(
130     qsamplerInstrument *pInstrument) const;
131    
132     signals:
133    
134     // Instrument map/session change signal.
135     void instrumentsChanged();
136    
137     public slots:
138    
139     // General reloader.
140     void refresh();
141    
142     protected slots:
143    
144     // Add a new group item below the current one.
145     void newGroupSlot();
146     // Add a instrument item below the current one.
147     void newItemSlot();
148     // Change current instrument item.
149     void editItemSlot();
150     // Rename current group/item.
151     void renameSlot();
152     // Remove current group/item.
153     void deleteSlot();
154    
155     // In-place selection slot.
156     void selectionChangedSlot();
157    
158     // In-place activation slot.
159     void activatedSlot(QListViewItem *pListItem);
160    
161     // In-place aliasing slot.
162     void renamedSlot(QListViewItem *pItem);
163    
164     protected:
165    
166     // Find and return the nearest group item...
167     qsamplerInstrumentGroup *groupItem(QListViewItem *pListItem) const;
168    
169     // Context menu request event handler.
170     void contextMenuEvent(QContextMenuEvent *pContextMenuEvent);
171    
172     private:
173    
174     // List view actions.
175     QAction *m_pNewGroupAction;
176     QAction *m_pNewItemAction;
177     QAction *m_pEditItemAction;
178     QAction *m_pRenameAction;
179     QAction *m_pDeleteAction;
180     QAction *m_pRefreshAction;
181     };
182    
183    
184     #endif // __qsamplerInstrumentList_h
185    
186     // end of qsamplerInstrumentList.h

  ViewVC Help
Powered by ViewVC