24 |
#define __qsamplerChannel_h |
#define __qsamplerChannel_h |
25 |
|
|
26 |
#include <QTableWidgetItem> |
#include <QTableWidgetItem> |
|
#include <QAbstractTableModel> |
|
|
#include <QMetaType> |
|
27 |
#include <QItemDelegate> |
#include <QItemDelegate> |
|
#include <QFontMetrics> |
|
|
#include <QModelIndex> |
|
|
#include <QSize> |
|
28 |
|
|
29 |
#include <lscp/client.h> |
#include <lscp/client.h> |
30 |
#include <lscp/device.h> |
#include <lscp/device.h> |
190 |
|
|
191 |
|
|
192 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
193 |
// qsamplerChannelRoutingTable - Channel routing table widget. |
// ChannelRoutingModel - data model for audio routing (used for QTableView) |
194 |
// |
// |
195 |
|
|
196 |
#if 0 |
struct ChannelRoutingItem { |
197 |
class qsamplerChannelRoutingTable : public QTable |
QStringList options; |
198 |
|
int selection; |
199 |
|
}; |
200 |
|
|
201 |
|
// so we can use it i.e. through QVariant |
202 |
|
Q_DECLARE_METATYPE(ChannelRoutingItem) |
203 |
|
|
204 |
|
class ChannelRoutingModel : public QAbstractTableModel |
205 |
{ |
{ |
206 |
Q_OBJECT |
Q_OBJECT |
|
|
|
207 |
public: |
public: |
208 |
|
|
209 |
// Constructor. |
ChannelRoutingModel(QObject* pParent = NULL); |
|
qsamplerChannelRoutingTable(QWidget *pParent = 0, const char *pszName = 0); |
|
|
// Default destructor. |
|
|
~qsamplerChannelRoutingTable(); |
|
210 |
|
|
211 |
// Common parameter table renderer. |
// overridden methods from subclass(es) |
212 |
void refresh(qsamplerDevice *pDevice, |
int rowCount(const QModelIndex& parent = QModelIndex()) const; |
213 |
const qsamplerChannelRoutingMap& routing); |
int columnCount(const QModelIndex& parent = QModelIndex()) const; |
214 |
|
Qt::ItemFlags flags(const QModelIndex& index) const; |
215 |
|
bool setData(const QModelIndex& index, const QVariant& value, |
216 |
|
int role = Qt::EditRole); |
217 |
|
QVariant data(const QModelIndex &index, int role) const; |
218 |
|
QVariant headerData(int section, Qt::Orientation orientation, |
219 |
|
int role = Qt::DisplayRole) const; |
220 |
|
|
221 |
// Commit any pending editing. |
// own methods |
222 |
void flush(); |
qsamplerChannelRoutingMap routingMap() const { return m_routing; } |
|
}; |
|
|
#endif |
|
223 |
|
|
224 |
struct ChannelRoutingItem { |
void clear() { m_routing.clear(); } |
|
QStringList options; |
|
|
int selection; |
|
|
}; |
|
225 |
|
|
226 |
// so we can use it i.e. through QVariant |
public slots: |
|
Q_DECLARE_METATYPE(ChannelRoutingItem) |
|
227 |
|
|
228 |
class ChannelRoutingModel : public QAbstractTableModel { |
void refresh(qsamplerDevice *pDevice, |
229 |
Q_OBJECT |
const qsamplerChannelRoutingMap& routing); |
|
public: |
|
|
ChannelRoutingModel(QObject* parent = 0); |
|
|
|
|
|
// overridden methods from subclass(es) |
|
|
int rowCount(const QModelIndex &parent) const; |
|
|
int columnCount(const QModelIndex &parent) const; |
|
|
QVariant data(const QModelIndex &index, int role) const; |
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
|
|
|
|
|
public slots: |
|
|
void refresh(qsamplerDevice *pDevice, const qsamplerChannelRoutingMap& routing); |
|
|
|
|
|
private: |
|
|
qsamplerDevice* pDevice; |
|
|
qsamplerChannelRoutingMap routing; |
|
|
}; |
|
230 |
|
|
231 |
class ChannelRoutingDelegate : public QItemDelegate { |
private: |
|
Q_OBJECT |
|
|
public: |
|
|
ChannelRoutingDelegate(QObject* parent = 0); |
|
|
|
|
|
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, |
|
|
const QModelIndex& index) const; |
|
|
|
|
|
void setEditorData(QWidget* editor, const QModelIndex& index) const; |
|
|
void setModelData(QWidget* editor, QAbstractItemModel* model, |
|
|
const QModelIndex& index) const; |
|
232 |
|
|
233 |
void updateEditorGeometry(QWidget* editor, |
qsamplerDevice *m_pDevice; |
234 |
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
qsamplerChannelRoutingMap m_routing; |
235 |
}; |
}; |
236 |
|
|
237 |
|
|
238 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
239 |
// qsamplerChannelRoutingComboBox - Custom combo box for routing table. |
// ChannelRoutingDelegate - table cell renderer for audio routing |
240 |
// |
// |
241 |
|
|
242 |
/* |
class ChannelRoutingDelegate : public QItemDelegate |
|
class qsamplerChannelRoutingComboBox : public QTableWidgetItem |
|
243 |
{ |
{ |
244 |
public: |
Q_OBJECT |
|
|
|
|
// Constructor. |
|
|
qsamplerChannelRoutingComboBox(QTableWidget *pTable, |
|
|
const QStringList& list, const QPixmap& pixmap); |
|
245 |
|
|
246 |
// Public accessors. |
public: |
|
void setCurrentItem(int iCurrentItem); |
|
|
int currentItem() const; |
|
|
|
|
|
protected: |
|
|
|
|
|
// Virtual implemetations. |
|
|
QWidget *createEditor() const; |
|
|
void setContentFromEditor(QWidget *pWidget); |
|
247 |
|
|
248 |
private: |
ChannelRoutingDelegate(QObject* pParent = NULL); |
249 |
|
|
250 |
// Initial value holders |
QWidget* createEditor(QWidget *pParent, |
251 |
QStringList m_list; |
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
252 |
int m_iCurrentItem; |
void setEditorData(QWidget *pEditor, const QModelIndex& index) const; |
253 |
|
void setModelData(QWidget *pEditor, QAbstractItemModel* model, |
254 |
|
const QModelIndex& index) const; |
255 |
|
void updateEditorGeometry(QWidget *pEditor, |
256 |
|
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
257 |
}; |
}; |
|
*/ |
|
258 |
|
|
259 |
#endif // __qsamplerChannel_h |
#endif // __qsamplerChannel_h |
260 |
|
|
|
|
|
261 |
// end of qsamplerChannel.h |
// end of qsamplerChannel.h |