1 |
// qsamplerChannel.h |
// qsamplerChannel.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
Copyright (C) 2007, Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
23 |
#ifndef __qsamplerChannel_h |
#ifndef __qsamplerChannel_h |
24 |
#define __qsamplerChannel_h |
#define __qsamplerChannel_h |
25 |
|
|
26 |
#include <qtable.h> |
#include <QTableWidgetItem> |
27 |
|
#include <QAbstractTableModel> |
28 |
|
#include <QMetaType> |
29 |
|
#include <QItemDelegate> |
30 |
|
#include <QFontMetrics> |
31 |
|
#include <QModelIndex> |
32 |
|
#include <QSize> |
33 |
|
|
34 |
#include <lscp/client.h> |
#include <lscp/client.h> |
35 |
#include <lscp/device.h> |
#include <lscp/device.h> |
140 |
// Reset channel method. |
// Reset channel method. |
141 |
bool channelReset(); |
bool channelReset(); |
142 |
|
|
143 |
|
// Spawn instrument editor method. |
144 |
|
bool editChannel(); |
145 |
|
|
146 |
// Message logging methods (brainlessly mapped to main form's). |
// Message logging methods (brainlessly mapped to main form's). |
147 |
void appendMessages (const QString & s) const; |
void appendMessages (const QString & s) const; |
148 |
void appendMessagesColor (const QString & s, const QString & c) const; |
void appendMessagesColor (const QString & s, const QString & c) const; |
198 |
// qsamplerChannelRoutingTable - Channel routing table widget. |
// qsamplerChannelRoutingTable - Channel routing table widget. |
199 |
// |
// |
200 |
|
|
201 |
|
#if 0 |
202 |
class qsamplerChannelRoutingTable : public QTable |
class qsamplerChannelRoutingTable : public QTable |
203 |
{ |
{ |
204 |
Q_OBJECT |
Q_OBJECT |
217 |
// Commit any pending editing. |
// Commit any pending editing. |
218 |
void flush(); |
void flush(); |
219 |
}; |
}; |
220 |
|
#endif |
221 |
|
|
222 |
|
struct ChannelRoutingItem { |
223 |
|
QStringList options; |
224 |
|
int selection; |
225 |
|
}; |
226 |
|
|
227 |
|
// so we can use it i.e. through QVariant |
228 |
|
Q_DECLARE_METATYPE(ChannelRoutingItem) |
229 |
|
|
230 |
|
class ChannelRoutingModel : public QAbstractTableModel { |
231 |
|
Q_OBJECT |
232 |
|
public: |
233 |
|
ChannelRoutingModel(QObject* parent = 0); |
234 |
|
|
235 |
|
// overridden methods from subclass(es) |
236 |
|
int rowCount(const QModelIndex &parent) const; |
237 |
|
int columnCount(const QModelIndex &parent) const; |
238 |
|
QVariant data(const QModelIndex &index, int role) const; |
239 |
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
240 |
|
|
241 |
|
public slots: |
242 |
|
void refresh(qsamplerDevice *pDevice, const qsamplerChannelRoutingMap& routing); |
243 |
|
|
244 |
|
private: |
245 |
|
qsamplerDevice* pDevice; |
246 |
|
qsamplerChannelRoutingMap routing; |
247 |
|
}; |
248 |
|
|
249 |
|
class ChannelRoutingDelegate : public QItemDelegate { |
250 |
|
Q_OBJECT |
251 |
|
public: |
252 |
|
ChannelRoutingDelegate(QObject* parent = 0); |
253 |
|
|
254 |
|
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, |
255 |
|
const QModelIndex& index) const; |
256 |
|
|
257 |
|
void setEditorData(QWidget* editor, const QModelIndex& index) const; |
258 |
|
void setModelData(QWidget* editor, QAbstractItemModel* model, |
259 |
|
const QModelIndex& index) const; |
260 |
|
|
261 |
|
void updateEditorGeometry(QWidget* editor, |
262 |
|
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
263 |
|
}; |
264 |
|
|
265 |
|
|
266 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
267 |
// qsamplerChannelRoutingComboBox - Custom combo box for routing table. |
// qsamplerChannelRoutingComboBox - Custom combo box for routing table. |
268 |
// |
// |
269 |
|
|
270 |
class qsamplerChannelRoutingComboBox : public QTableItem |
/* |
271 |
|
class qsamplerChannelRoutingComboBox : public QTableWidgetItem |
272 |
{ |
{ |
273 |
public: |
public: |
274 |
|
|
275 |
// Constructor. |
// Constructor. |
276 |
qsamplerChannelRoutingComboBox(QTable *pTable, |
qsamplerChannelRoutingComboBox(QTableWidget *pTable, |
277 |
const QStringList& list, const QPixmap& pixmap); |
const QStringList& list, const QPixmap& pixmap); |
278 |
|
|
279 |
// Public accessors. |
// Public accessors. |
292 |
QStringList m_list; |
QStringList m_list; |
293 |
int m_iCurrentItem; |
int m_iCurrentItem; |
294 |
}; |
}; |
295 |
|
*/ |
296 |
|
|
297 |
#endif // __qsamplerChannel_h |
#endif // __qsamplerChannel_h |
298 |
|
|