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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1013 - (hide annotations) (download) (as text)
Mon Jan 8 16:52:48 2007 UTC (17 years, 3 months ago) by capela
File MIME type: text/x-c++hdr
File size: 5262 byte(s)
* Instruments window gets its own toolbar (and statusbar too);
  also introducing MIDI instrument map selection to the view;
  MIDI instrument item editing now allows changing map, bank
  or program key values (were previously disabled).

1 capela 1013 // qsamplerInstrumentList.h
2     //
3     /****************************************************************************
4     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
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     // Map selector.
133     void setMidiMap(int iMidiMap);
134     int midiMap() const;
135    
136     // List actions accessors.
137     QAction *newGroupAction() const;
138     QAction *newItemAction() const;
139     QAction *editItemAction() const;
140     QAction *renameAction() const;
141     QAction *deleteAction() const;
142     QAction *refreshAction() const;
143    
144     signals:
145    
146     // Instrument map/session change signal.
147     void instrumentsChanged();
148    
149     public slots:
150    
151     // General reloader.
152     void refresh();
153    
154     protected slots:
155    
156     // Add a new group item below the current one.
157     void newGroupSlot();
158     // Add a instrument item below the current one.
159     void newItemSlot();
160     // Change current instrument item.
161     void editItemSlot();
162     // Rename current group/item.
163     void renameSlot();
164     // Remove current group/item.
165     void deleteSlot();
166    
167     // In-place selection slot.
168     void selectionChangedSlot();
169    
170     // In-place activation slot.
171     void activatedSlot(QListViewItem *pListItem);
172    
173     // In-place aliasing slot.
174     void renamedSlot(QListViewItem *pItem);
175    
176     protected:
177    
178     // Find and return the nearest group item...
179     qsamplerInstrumentGroup *groupItem(QListViewItem *pListItem) const;
180    
181     // Context menu request event handler.
182     void contextMenuEvent(QContextMenuEvent *pContextMenuEvent);
183    
184     private:
185    
186     // 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

  ViewVC Help
Powered by ViewVC