/[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 3517 by schoenebeck, Fri Jan 26 16:55:50 2018 UTC revision 3518 by capela, Sun Jun 30 16:58:30 2019 UTC
# Line 1  Line 1 
1  // qsamplerDevice.cpp  // qsamplerDevice.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2012, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 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
# Line 45  DeviceParam::DeviceParam ( lscp_param_in Line 45  DeviceParam::DeviceParam ( lscp_param_in
45  }  }
46    
47    
 // Default destructor.  
 DeviceParam::~DeviceParam (void)  
 {  
 }  
   
   
48  // Initializer.  // Initializer.
49  void DeviceParam::setParam ( lscp_param_info_t *pParamInfo,  void DeviceParam::setParam ( lscp_param_info_t *pParamInfo,
50          const char *pszValue )          const char *pszValue )
# Line 65  void DeviceParam::setParam ( lscp_param_ Line 59  void DeviceParam::setParam ( lscp_param_
59          if (pParamInfo->description)          if (pParamInfo->description)
60                  description = pParamInfo->description;                  description = pParamInfo->description;
61          else          else
62                  description = QString::null;                  description.clear();
63    
64          mandatory = (bool) pParamInfo->mandatory;          mandatory = bool(pParamInfo->mandatory);
65          fix = (bool) pParamInfo->fix;          fix = bool(pParamInfo->fix);
66          multiplicity = (bool) pParamInfo->multiplicity;          multiplicity = bool(pParamInfo->multiplicity);
67    
68          depends.clear();          depends.clear();
69          for (int i = 0; pParamInfo->depends && pParamInfo->depends[i]; i++)          for (int i = 0; pParamInfo->depends && pParamInfo->depends[i]; i++)
# Line 78  void DeviceParam::setParam ( lscp_param_ Line 72  void DeviceParam::setParam ( lscp_param_
72          if (pParamInfo->defaultv)          if (pParamInfo->defaultv)
73                  defaultv = pParamInfo->defaultv;                  defaultv = pParamInfo->defaultv;
74          else          else
75                  defaultv = QString::null;                  defaultv.clear();
76    
77          if (pParamInfo->range_min)          if (pParamInfo->range_min)
78                  range_min = pParamInfo->range_min;                  range_min = pParamInfo->range_min;
79          else          else
80                  range_min = QString::null;                  range_min.clear();
81    
82          if (pParamInfo->range_max)          if (pParamInfo->range_max)
83                  range_max = pParamInfo->range_max;                  range_max = pParamInfo->range_max;
84          else          else
85                  range_max = QString::null;                  range_max.clear();
86    
87          possibilities.clear();          possibilities.clear();
88          for (int i = 0; pParamInfo->possibilities && pParamInfo->possibilities[i]; i++)          for (int i = 0; pParamInfo->possibilities && pParamInfo->possibilities[i]; i++)
# Line 98  void DeviceParam::setParam ( lscp_param_ Line 92  void DeviceParam::setParam ( lscp_param_
92          if (pszValue)          if (pszValue)
93                  value = pszValue;                  value = pszValue;
94          else          else
95                  value = QString::null;                  value.clear();
96  }  }
97    
98    
# Line 167  void Device::setDevice ( DeviceType devi Line 161  void Device::setDevice ( DeviceType devi
161                          appendMessagesClient("lscp_get_midi_device_info");                          appendMessagesClient("lscp_get_midi_device_info");
162                  break;                  break;
163          case Device::None:          case Device::None:
164                  m_sDeviceType = QString::null;                  m_sDeviceType.clear();
165                  break;                  break;
166          }          }
167          // If we're bogus, bail out...          // If we're bogus, bail out...
168          if (pDeviceInfo == NULL) {          if (pDeviceInfo == NULL) {
169                  m_sDriverName = QString::null;                  m_sDriverName.clear();
170                  m_sDeviceName = QObject::tr("New %1 device").arg(m_sDeviceType);                  m_sDeviceName = QObject::tr("New %1 device").arg(m_sDeviceType);
171                  return;                  return;
172          }          }
# Line 336  bool Device::setParam ( const QString& s Line 330  bool Device::setParam ( const QString& s
330    
331          // If the device already exists, things get immediate...          // If the device already exists, things get immediate...
332          int iRefresh = 0;          int iRefresh = 0;
333          if (m_iDeviceID >= 0 && sValue != QString::null) {          if (m_iDeviceID >= 0 && !sValue.isEmpty()) {
334    
335                  // we need temporary byte arrrays with the final strings, because                  // we need temporary byte arrrays with the final strings, because
336                  // i.e. QString::toUtf8() only returns a temporary object and the                  // i.e. QString::toUtf8() only returns a temporary object and the
# Line 416  bool Device::createDevice (void) Line 410  bool Device::createDevice (void)
410    
411          DeviceParamMap::ConstIterator iter;          DeviceParamMap::ConstIterator iter;
412          for (iter = m_params.begin(); iter != m_params.end(); ++iter) {          for (iter = m_params.begin(); iter != m_params.end(); ++iter) {
413                  if (iter.value().value == QString::null) continue;                  if (iter.value().value.isEmpty()) continue;
414                  finalKeys.push_back(iter.key().toUtf8());                  finalKeys.push_back(iter.key().toUtf8());
415                  finalVals.push_back(iter.value().value.toUtf8());                  finalVals.push_back(iter.value().value.toUtf8());
416          }          }
# Line 790  void DevicePort::setDevicePort ( int iPo Line 784  void DevicePort::setDevicePort ( int iPo
784    
785          // If we're bogus, bail out...          // If we're bogus, bail out...
786          if (pPortInfo == NULL) {          if (pPortInfo == NULL) {
787                  m_sPortName = QString::null;                  m_sPortName.clear();
788                  return;                  return;
789          }          }
790    
# Line 1181  QWidget* DeviceParamDelegate::createEdit Line 1175  QWidget* DeviceParamDelegate::createEdit
1175                  case 1: {                  case 1: {
1176                          if (r.param.type == LSCP_TYPE_BOOL) {                          if (r.param.type == LSCP_TYPE_BOOL) {
1177                                  QCheckBox *pCheckBox = new QCheckBox(pParent);                                  QCheckBox *pCheckBox = new QCheckBox(pParent);
1178                                  if (val != QString::null)                                  if (!val.isEmpty())
1179                                          pCheckBox->setChecked(val.toLower() == "true");                                          pCheckBox->setChecked(val.toLower() == "true");
1180                                  pCheckBox->setEnabled(bEnabled);                                  pCheckBox->setEnabled(bEnabled);
1181                                  pCheckBox->setCheckable(!bFix);                                  pCheckBox->setCheckable(!bFix);

Legend:
Removed from v.3517  
changed lines
  Added in v.3518

  ViewVC Help
Powered by ViewVC