1 |
// qsamplerDevice.cpp |
// qsamplerDevice.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2012, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, Christian Schoenebeck |
Copyright (C) 2007, 2008 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 |
702 |
return piDeviceIDs; |
return piDeviceIDs; |
703 |
} |
} |
704 |
|
|
705 |
|
std::set<int> Device::getDeviceIDs(lscp_client_t *pClient, |
706 |
|
DeviceType deviceType) |
707 |
|
{ |
708 |
|
std::set<int> result; |
709 |
|
int* piDeviceIDs = getDevices(pClient, deviceType); |
710 |
|
if (!piDeviceIDs) return result; |
711 |
|
for (int i = 0; piDeviceIDs[i] != -1; ++i) |
712 |
|
result.insert(piDeviceIDs[i]); |
713 |
|
return result; |
714 |
|
} |
715 |
|
|
716 |
|
|
717 |
// Driver names enumerator. |
// Driver names enumerator. |
718 |
QStringList Device::getDrivers ( lscp_client_t *pClient, |
QStringList Device::getDrivers ( lscp_client_t *pClient, |
912 |
DeviceItem::DeviceItem ( QTreeWidget* pTreeWidget, |
DeviceItem::DeviceItem ( QTreeWidget* pTreeWidget, |
913 |
Device::DeviceType deviceType ) |
Device::DeviceType deviceType ) |
914 |
: QTreeWidgetItem(pTreeWidget, QSAMPLER_DEVICE_ITEM), |
: QTreeWidgetItem(pTreeWidget, QSAMPLER_DEVICE_ITEM), |
915 |
m_device(deviceType) |
m_device(deviceType) |
916 |
{ |
{ |
917 |
switch(m_device.deviceType()) { |
switch(m_device.deviceType()) { |
918 |
case Device::Audio: |
case Device::Audio: |
919 |
setIcon(0, QPixmap(":/icons/audio1.png")); |
setIcon(0, QPixmap(":/images/audio1.png")); |
920 |
setText(0, QObject::tr("Audio Devices")); |
setText(0, QObject::tr("Audio Devices")); |
921 |
break; |
break; |
922 |
case Device::Midi: |
case Device::Midi: |
923 |
setIcon(0, QPixmap(":/icons/midi1.png")); |
setIcon(0, QPixmap(":/images/midi1.png")); |
924 |
setText(0, QObject::tr("MIDI Devices")); |
setText(0, QObject::tr("MIDI Devices")); |
925 |
break; |
break; |
926 |
case Device::None: |
case Device::None: |
935 |
Device::DeviceType deviceType, |
Device::DeviceType deviceType, |
936 |
int iDeviceID ) |
int iDeviceID ) |
937 |
: QTreeWidgetItem(pItem, QSAMPLER_DEVICE_ITEM), |
: QTreeWidgetItem(pItem, QSAMPLER_DEVICE_ITEM), |
938 |
m_device(deviceType, iDeviceID) |
m_device(deviceType, iDeviceID) |
939 |
{ |
{ |
940 |
switch(m_device.deviceType()) { |
switch(m_device.deviceType()) { |
941 |
case Device::Audio: |
case Device::Audio: |
942 |
setIcon(0, QPixmap(":/icons/audio2.png")); |
setIcon(0, QPixmap(":/images/audio2.png")); |
943 |
break; |
break; |
944 |
case Device::Midi: |
case Device::Midi: |
945 |
setIcon(0, QPixmap(":/icons/midi2.png")); |
setIcon(0, QPixmap(":/images/midi2.png")); |
946 |
break; |
break; |
947 |
case Device::None: |
case Device::None: |
948 |
break; |
break; |
1018 |
m_pParams = pParams; |
m_pParams = pParams; |
1019 |
m_bEditable = bEditable; |
m_bEditable = bEditable; |
1020 |
// inform the outer world (QTableView) that our data changed |
// inform the outer world (QTableView) that our data changed |
1021 |
|
#if QT_VERSION < 0x050000 |
1022 |
QAbstractTableModel::reset(); |
QAbstractTableModel::reset(); |
1023 |
|
#else |
1024 |
|
QAbstractTableModel::beginResetModel(); |
1025 |
|
QAbstractTableModel::endResetModel(); |
1026 |
|
#endif |
1027 |
} |
} |
1028 |
|
|
1029 |
|
|
1031 |
{ |
{ |
1032 |
m_pParams = NULL; |
m_pParams = NULL; |
1033 |
// inform the outer world (QTableView) that our data changed |
// inform the outer world (QTableView) that our data changed |
1034 |
|
#if QT_VERSION < 0x050000 |
1035 |
QAbstractTableModel::reset(); |
QAbstractTableModel::reset(); |
1036 |
|
#else |
1037 |
|
QAbstractTableModel::beginResetModel(); |
1038 |
|
QAbstractTableModel::endResetModel(); |
1039 |
|
#endif |
1040 |
} |
} |
1041 |
|
|
1042 |
|
|
1204 |
); |
); |
1205 |
pSpinBox->setMaximum( |
pSpinBox->setMaximum( |
1206 |
(!r.param.range_max.isEmpty()) ? |
(!r.param.range_max.isEmpty()) ? |
1207 |
r.param.range_max.toInt() : (1 << 16) // or better a nigher default max value ? |
r.param.range_max.toInt() : (1 << 24) // or better a higher default max value ? |
1208 |
); |
); |
1209 |
pSpinBox->setValue(val.toInt()); |
pSpinBox->setValue(val.toInt()); |
1210 |
return pSpinBox; |
return pSpinBox; |
1238 |
DeviceParameterRow r = index.model()->data(index, |
DeviceParameterRow r = index.model()->data(index, |
1239 |
Qt::DisplayRole).value<DeviceParameterRow> (); |
Qt::DisplayRole).value<DeviceParameterRow> (); |
1240 |
if (pEditor->metaObject()->className() == QString("QCheckBox")) { |
if (pEditor->metaObject()->className() == QString("QCheckBox")) { |
1241 |
QCheckBox* pCheckBox = static_cast<QCheckBox*> (pEditor); |
QCheckBox *pCheckBox = static_cast<QCheckBox *> (pEditor); |
1242 |
pModel->setData(index, QVariant(pCheckBox->checkState() == Qt::Checked)); |
pModel->setData(index, QVariant(pCheckBox->checkState() == Qt::Checked)); |
1243 |
} else if (pEditor->metaObject()->className() == QString("QComboBox")) { |
} else if (pEditor->metaObject()->className() == QString("QComboBox")) { |
1244 |
QComboBox* pComboBox = static_cast<QComboBox*> (pEditor); |
QComboBox *pComboBox = static_cast<QComboBox *> (pEditor); |
1245 |
pModel->setData(index, pComboBox->currentText()); |
pModel->setData(index, pComboBox->currentText()); |
1246 |
} else if (pEditor->metaObject()->className() == QString("QSpinBox")) { |
} else if (pEditor->metaObject()->className() == QString("QSpinBox")) { |
1247 |
QSpinBox* pSpinBox = static_cast<QSpinBox*> (pEditor); |
QSpinBox *pSpinBox = static_cast<QSpinBox *> (pEditor); |
1248 |
pModel->setData(index, pSpinBox->value()); |
pModel->setData(index, pSpinBox->value()); |
1249 |
} else if (pEditor->metaObject()->className() == QString("QLineEdit")) { |
} else if (pEditor->metaObject()->className() == QString("QLineEdit")) { |
1250 |
QLineEdit* pLineEdit = static_cast<QLineEdit*> (pEditor); |
QLineEdit *pLineEdit = static_cast<QLineEdit *> (pEditor); |
1251 |
pModel->setData(index, pLineEdit->text()); |
pModel->setData(index, pLineEdit->text()); |
1252 |
} else if (pEditor->metaObject()->className() == QString("QLabel")) { |
} else if (pEditor->metaObject()->className() == QString("QLabel")) { |
1253 |
QLabel* pLabel = static_cast<QLabel*> (pEditor); |
QLabel *pLabel = static_cast<QLabel *> (pEditor); |
1254 |
pModel->setData(index, pLabel->text()); |
pModel->setData(index, pLabel->text()); |
1255 |
} |
} |
1256 |
} |
} |