/[svn]/qsampler/trunk/src/qsamplerDevice.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerDevice.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1558 by capela, Thu Dec 6 09:35:33 2007 UTC revision 2059 by capela, Wed Feb 17 19:50:04 2010 UTC
# Line 1  Line 1 
1  // qsamplerDevice.cpp  // qsamplerDevice.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2010, 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
# Line 702  int *Device::getDevices ( lscp_client_t Line 702  int *Device::getDevices ( lscp_client_t
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,
# Line 901  bool DevicePort::setParam ( const QStrin Line 912  bool DevicePort::setParam ( const QStrin
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:
# Line 924  DeviceItem::DeviceItem ( QTreeWidgetItem Line 935  DeviceItem::DeviceItem ( QTreeWidgetItem
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:
# Line 1183  QWidget* DeviceParamDelegate::createEdit Line 1194  QWidget* DeviceParamDelegate::createEdit
1194                                  );                                  );
1195                                  pSpinBox->setMaximum(                                  pSpinBox->setMaximum(
1196                                          (!r.param.range_max.isEmpty()) ?                                          (!r.param.range_max.isEmpty()) ?
1197                                                  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 ?
1198                                  );                                  );
1199                                  pSpinBox->setValue(val.toInt());                                  pSpinBox->setValue(val.toInt());
1200                                  return pSpinBox;                                  return pSpinBox;
# Line 1217  void DeviceParamDelegate::setModelData ( Line 1228  void DeviceParamDelegate::setModelData (
1228                  DeviceParameterRow r = index.model()->data(index,                  DeviceParameterRow r = index.model()->data(index,
1229                          Qt::DisplayRole).value<DeviceParameterRow> ();                          Qt::DisplayRole).value<DeviceParameterRow> ();
1230                  if (pEditor->metaObject()->className() == QString("QCheckBox")) {                  if (pEditor->metaObject()->className() == QString("QCheckBox")) {
1231                          QCheckBox* pCheckBox = static_cast<QCheckBox*> (pEditor);                          QCheckBox *pCheckBox = static_cast<QCheckBox *> (pEditor);
1232                          pModel->setData(index, QVariant(pCheckBox->checkState() == Qt::Checked));                          pModel->setData(index, QVariant(pCheckBox->checkState() == Qt::Checked));
1233                  } else if (pEditor->metaObject()->className() == QString("QComboBox")) {                  } else if (pEditor->metaObject()->className() == QString("QComboBox")) {
1234                          QComboBox* pComboBox = static_cast<QComboBox*> (pEditor);                          QComboBox *pComboBox = static_cast<QComboBox *> (pEditor);
1235                          pModel->setData(index, pComboBox->currentText());                          pModel->setData(index, pComboBox->currentText());
1236                  } else if (pEditor->metaObject()->className() == QString("QSpinBox")) {                  } else if (pEditor->metaObject()->className() == QString("QSpinBox")) {
1237                          QSpinBox* pSpinBox = static_cast<QSpinBox*> (pEditor);                          QSpinBox *pSpinBox = static_cast<QSpinBox *> (pEditor);
1238                          pModel->setData(index, pSpinBox->value());                          pModel->setData(index, pSpinBox->value());
1239                  } else if (pEditor->metaObject()->className() == QString("QLineEdit")) {                  } else if (pEditor->metaObject()->className() == QString("QLineEdit")) {
1240                          QLineEdit* pLineEdit = static_cast<QLineEdit*> (pEditor);                          QLineEdit *pLineEdit = static_cast<QLineEdit *> (pEditor);
1241                          pModel->setData(index, pLineEdit->text());                          pModel->setData(index, pLineEdit->text());
1242                  } else if (pEditor->metaObject()->className() == QString("QLabel")) {                  } else if (pEditor->metaObject()->className() == QString("QLabel")) {
1243                          QLabel* pLabel = static_cast<QLabel*> (pEditor);                          QLabel *pLabel = static_cast<QLabel *> (pEditor);
1244                          pModel->setData(index, pLabel->text());                          pModel->setData(index, pLabel->text());
1245                  }                  }
1246          }          }

Legend:
Removed from v.1558  
changed lines
  Added in v.2059

  ViewVC Help
Powered by ViewVC