194 |
// |
// |
195 |
|
|
196 |
struct ChannelRoutingItem { |
struct ChannelRoutingItem { |
197 |
QStringList options; |
QStringList options; |
198 |
int selection; |
int selection; |
199 |
}; |
}; |
200 |
|
|
201 |
// so we can use it i.e. through QVariant |
// so we can use it i.e. through QVariant |
202 |
Q_DECLARE_METATYPE(ChannelRoutingItem) |
Q_DECLARE_METATYPE(ChannelRoutingItem) |
203 |
|
|
204 |
class ChannelRoutingModel : public QAbstractTableModel { |
class ChannelRoutingModel : public QAbstractTableModel |
205 |
Q_OBJECT |
{ |
206 |
public: |
Q_OBJECT |
207 |
ChannelRoutingModel(QObject* parent = 0); |
public: |
208 |
|
|
209 |
// overridden methods from subclass(es) |
ChannelRoutingModel(QObject* pParent = NULL); |
210 |
int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
211 |
int columnCount(const QModelIndex &parent = QModelIndex()) const; |
// overridden methods from subclass(es) |
212 |
Qt::ItemFlags flags(const QModelIndex& index) const; |
int rowCount(const QModelIndex& parent = QModelIndex()) const; |
213 |
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); |
int columnCount(const QModelIndex& parent = QModelIndex()) const; |
214 |
QVariant data(const QModelIndex &index, int role) const; |
Qt::ItemFlags flags(const QModelIndex& index) const; |
215 |
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
bool setData(const QModelIndex& index, const QVariant& value, |
216 |
|
int role = Qt::EditRole); |
217 |
// own methods |
QVariant data(const QModelIndex &index, int role) const; |
218 |
qsamplerChannelRoutingMap routingMap() const { |
QVariant headerData(int section, Qt::Orientation orientation, |
219 |
return routing; |
int role = Qt::DisplayRole) const; |
220 |
} |
|
221 |
|
// own methods |
222 |
void clear() { routing.clear(); } |
qsamplerChannelRoutingMap routingMap() const { return m_routing; } |
223 |
|
|
224 |
public slots: |
void clear() { m_routing.clear(); } |
225 |
void refresh(qsamplerDevice *pDevice, const qsamplerChannelRoutingMap& routing); |
|
226 |
|
public slots: |
227 |
private: |
|
228 |
qsamplerDevice* pDevice; |
void refresh(qsamplerDevice *pDevice, |
229 |
qsamplerChannelRoutingMap routing; |
const qsamplerChannelRoutingMap& routing); |
230 |
|
|
231 |
|
private: |
232 |
|
|
233 |
|
qsamplerDevice *m_pDevice; |
234 |
|
qsamplerChannelRoutingMap m_routing; |
235 |
}; |
}; |
236 |
|
|
237 |
|
|
239 |
// ChannelRoutingDelegate - table cell renderer for audio routing |
// ChannelRoutingDelegate - table cell renderer for audio routing |
240 |
// |
// |
241 |
|
|
242 |
class ChannelRoutingDelegate : public QItemDelegate { |
class ChannelRoutingDelegate : public QItemDelegate |
243 |
Q_OBJECT |
{ |
244 |
public: |
Q_OBJECT |
245 |
ChannelRoutingDelegate(QObject* parent = 0); |
|
246 |
QWidget* createEditor(QWidget* parent, |
public: |
247 |
const QStyleOptionViewItem& option, |
|
248 |
const QModelIndex& index) const; |
ChannelRoutingDelegate(QObject* pParent = NULL); |
249 |
void setEditorData(QWidget* editor, const QModelIndex& index) const; |
|
250 |
void setModelData(QWidget* editor, QAbstractItemModel* model, |
QWidget* createEditor(QWidget *pParent, |
251 |
const QModelIndex& index) const; |
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
252 |
void updateEditorGeometry(QWidget* editor, |
void setEditorData(QWidget *pEditor, const QModelIndex& index) const; |
253 |
const QStyleOptionViewItem& option, |
void setModelData(QWidget *pEditor, QAbstractItemModel* model, |
254 |
const QModelIndex& index) const; |
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 |