245 |
qsamplerDevice m_device; |
qsamplerDevice m_device; |
246 |
}; |
}; |
247 |
|
|
|
|
|
|
//------------------------------------------------------------------------- |
|
|
// qsamplerDeviceParamTable - Device parameter view table. |
|
|
// |
|
|
|
|
|
#if 0 |
|
|
class qsamplerDeviceParamTable : public QTable |
|
|
{ |
|
|
Q_OBJECT |
|
|
|
|
|
public: |
|
|
|
|
|
// Constructor. |
|
|
qsamplerDeviceParamTable(QWidget *pParent = 0, const char *pszName = 0); |
|
|
// Default destructor. |
|
|
~qsamplerDeviceParamTable(); |
|
|
|
|
|
// Common parameter table renderer. |
|
|
void refresh(const qsamplerDeviceParamMap& params, bool bEditable); |
|
|
}; |
|
|
#endif |
|
|
|
|
248 |
struct DeviceParameterRow { |
struct DeviceParameterRow { |
249 |
QString name; |
QString name; |
250 |
qsamplerDeviceParam param; |
qsamplerDeviceParam param; |
253 |
// so we can use it i.e. through QVariant |
// so we can use it i.e. through QVariant |
254 |
Q_DECLARE_METATYPE(DeviceParameterRow) |
Q_DECLARE_METATYPE(DeviceParameterRow) |
255 |
|
|
256 |
class DeviceParamModel : public QAbstractTableModel { |
//------------------------------------------------------------------------- |
257 |
|
// AbstractDeviceParamModel - data model base class for device parameters |
258 |
|
// |
259 |
|
class AbstractDeviceParamModel : public QAbstractTableModel { |
260 |
Q_OBJECT |
Q_OBJECT |
261 |
public: |
public: |
262 |
DeviceParamModel(QObject* parent = 0); |
AbstractDeviceParamModel(QObject* parent = 0); |
263 |
|
|
264 |
// overridden methods from subclass(es) |
// overridden methods from subclass(es) |
265 |
int rowCount(const QModelIndex &parent) const; |
int rowCount(const QModelIndex& parent = QModelIndex()) const; |
266 |
int columnCount(const QModelIndex &parent) const; |
int columnCount(const QModelIndex& parent = QModelIndex() ) const; |
267 |
QVariant data(const QModelIndex &index, int role) const; |
QVariant data(const QModelIndex &index, int role) const; |
268 |
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; |
269 |
|
Qt::ItemFlags flags(const QModelIndex& index) const; |
270 |
|
|
271 |
void clear(); |
virtual void clear(); |
272 |
|
|
273 |
public slots: |
void refresh(const qsamplerDeviceParamMap* params, bool bEditable); |
|
void refresh(const qsamplerDeviceParamMap& params, bool bEditable); |
|
274 |
|
|
275 |
private: |
protected: |
276 |
qsamplerDeviceParamMap params; |
const qsamplerDeviceParamMap* params; |
277 |
bool bEditable; |
bool bEditable; |
278 |
}; |
}; |
279 |
|
|
280 |
class DeviceParamDelegate : public QItemDelegate { |
//------------------------------------------------------------------------- |
281 |
|
// DeviceParamModel - data model for device parameters (used for QTableView) |
282 |
|
// |
283 |
|
class DeviceParamModel : public AbstractDeviceParamModel { |
284 |
Q_OBJECT |
Q_OBJECT |
285 |
public: |
public: |
286 |
DeviceParamDelegate(QObject* parent = 0); |
DeviceParamModel(QObject* parent = 0); |
287 |
|
|
288 |
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, |
// overridden methods from subclass(es) |
289 |
const QModelIndex& index) const; |
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); |
290 |
|
void clear(); |
291 |
|
|
292 |
void setEditorData(QWidget* editor, const QModelIndex& index) const; |
public slots: |
293 |
void setModelData(QWidget* editor, QAbstractItemModel* model, |
void refresh(qsamplerDevice* pDevice, bool bEditable); |
|
const QModelIndex& index) const; |
|
294 |
|
|
295 |
void updateEditorGeometry(QWidget* editor, |
private: |
296 |
const QStyleOptionViewItem& option, const QModelIndex& index) const; |
qsamplerDevice* device; |
297 |
}; |
}; |
298 |
|
|
|
|
|
299 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
300 |
// qsamplerDeviceParamTableSpinBox - Custom spin box for parameter table. |
// PortParamModel - data model for port parameters (used for QTableView) |
301 |
// |
// |
302 |
|
class PortParamModel : public AbstractDeviceParamModel { |
303 |
|
Q_OBJECT |
304 |
|
public: |
305 |
|
PortParamModel(QObject* parent = 0); |
306 |
|
|
307 |
#if 0 |
// overridden methods from subclass(es) |
308 |
class qsamplerDeviceParamTableSpinBox : public QTableWidgetItem |
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); |
309 |
{ |
void clear(); |
|
public: |
|
|
|
|
|
// Constructor. |
|
|
qsamplerDeviceParamTableSpinBox (QTableWidget *pTable, Qt::ItemFlags flags, |
|
|
const QString& sText); |
|
|
|
|
|
// Public accessors. |
|
|
void setMinValue(int iMinValue); |
|
|
void setMaxValue(int iMaxValue); |
|
|
void setValue(int iValue); |
|
|
|
|
|
protected: |
|
|
|
|
|
// Virtual implemetations. |
|
|
QWidget *createEditor() const; |
|
|
void setContentFromEditor(QWidget *pWidget); |
|
|
|
|
|
private: |
|
|
|
|
|
// Initial value holders. |
|
|
int m_iValue; |
|
|
int m_iMinValue; |
|
|
int m_iMaxValue; |
|
|
}; |
|
310 |
|
|
311 |
|
public slots: |
312 |
|
void refresh(qsamplerDevicePort* pPort, bool bEditable); |
313 |
|
|
314 |
|
private: |
315 |
|
qsamplerDevicePort* port; |
316 |
|
}; |
317 |
|
|
318 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
319 |
// qsamplerDeviceParamTableEditBox - Custom edit box for parameter table. |
// DeviceParamDelegate - table cell renderer for device/port parameters |
320 |
// |
// |
321 |
|
class DeviceParamDelegate : public QItemDelegate { |
322 |
class qsamplerDeviceParamTableEditBox : public QTableWidgetItem |
Q_OBJECT |
323 |
{ |
public: |
324 |
public: |
DeviceParamDelegate(QObject* parent = 0); |
325 |
|
QWidget* createEditor(QWidget* parent, |
326 |
// Constructor. |
const QStyleOptionViewItem& option, |
327 |
qsamplerDeviceParamTableEditBox (QTableWidget *pTable, Qt::ItemFlags flags, |
const QModelIndex& index) const; |
328 |
const QString& sText); |
void setEditorData(QWidget* editor, const QModelIndex& index) const; |
329 |
|
void setModelData(QWidget* editor, QAbstractItemModel* model, |
330 |
protected: |
const QModelIndex& index) const; |
331 |
|
void updateEditorGeometry(QWidget* editor, |
332 |
// Virtual implemetations. |
const QStyleOptionViewItem& option, |
333 |
QWidget *createEditor() const; |
const QModelIndex& index) const; |
|
void setContentFromEditor(QWidget *pWidget); |
|
334 |
}; |
}; |
|
#endif |
|
335 |
|
|
336 |
#endif // __qsamplerDevice_h |
#endif // __qsamplerDevice_h |
337 |
|
|
|
|
|
338 |
// end of qsamplerDevice.h |
// end of qsamplerDevice.h |