--- qsampler/trunk/src/qsamplerDevice.cpp 2005/03/10 20:45:42 447 +++ qsampler/trunk/src/qsamplerDevice.cpp 2005/03/13 22:06:59 452 @@ -143,7 +143,7 @@ // If we're bogus, bail out... if (pDeviceInfo == NULL) { m_sDriverName = QString::null; - m_sDeviceName = QObject::tr("New device"); + m_sDeviceName = QObject::tr("New %1 device").arg(m_sDeviceType); return; } @@ -426,35 +426,35 @@ bool bEnabled = (device.deviceID() < 0 || !param.fix); QTable::setText(iRow, 0, iter.key()); QTable::setText(iRow, 1, param.description); - if (param.type == LSCP_TYPE_BOOL) { + if (param.type == LSCP_TYPE_BOOL && bEnabled) { QStringList opts; opts.append(tr("false")); opts.append(tr("true")); QComboTableItem *pComboItem = new QComboTableItem(this, opts); - pComboItem->setCurrentItem(param.value.lower() == "true" ? 1 : 0); - pComboItem->setEnabled(bEnabled); + pComboItem->setCurrentItem(param.value.lower() == "true" ? 1 : 0); + pComboItem->setEnabled(bEnabled); QTable::setItem(iRow, 2, pComboItem); - } else if (param.possibilities.count() > 0) { + } else if (param.possibilities.count() > 0 && bEnabled) { QComboTableItem *pComboItem = new QComboTableItem(this, param.possibilities); - pComboItem->setCurrentItem(param.value); - pComboItem->setEnabled(bEnabled); - pComboItem->setEditable(bEnabled && param.multiplicity); + pComboItem->setCurrentItem(param.value); + pComboItem->setEnabled(bEnabled); + pComboItem->setEditable(bEnabled && param.multiplicity); QTable::setItem(iRow, 2, pComboItem); - } else if (param.type == LSCP_TYPE_INT) { - qsamplerDeviceParamTableSpinBox *pSpinItem = + } else if (param.type == LSCP_TYPE_INT && bEnabled + && !param.range_min.isEmpty() + && !param.range_max.isEmpty()) { + qsamplerDeviceParamTableSpinBox *pSpinItem = new qsamplerDeviceParamTableSpinBox(this, - bEnabled ? QTableItem::OnTyping : QTableItem::Never, + bEnabled ? QTableItem::OnTyping : QTableItem::Never, param.value); - if (!param.range_min.isEmpty()) - pSpinItem->setMinValue(param.range_min.toInt()); - if (!param.range_max.isEmpty()) - pSpinItem->setMaxValue(param.range_max.toInt()); + pSpinItem->setMinValue(param.range_min.toInt()); + pSpinItem->setMaxValue(param.range_max.toInt()); QTable::setItem(iRow, 2, pSpinItem); } else { - qsamplerDeviceParamTableEditBox *pEditItem = + qsamplerDeviceParamTableEditBox *pEditItem = new qsamplerDeviceParamTableEditBox(this, - bEnabled ? QTableItem::OnTyping : QTableItem::Never, + bEnabled ? QTableItem::OnTyping : QTableItem::Never, param.value); QTable::setItem(iRow, 2, pEditItem); } @@ -479,9 +479,8 @@ QTable *pTable, EditType editType, const QString& sText ) : QTableItem(pTable, editType, sText) { - m_iValue = sText.toInt(); - m_iMinValue = 0; - m_iMaxValue = 999999; + m_iValue = sText.toInt(); + m_iMinValue = m_iMaxValue = 0; } // Public accessors. @@ -518,9 +517,9 @@ void qsamplerDeviceParamTableSpinBox::setContentFromEditor ( QWidget *pWidget ) { if (pWidget->inherits("QSpinBox")) - QTableItem::setText(QString::number(((QSpinBox *) pWidget)->value())); + QTableItem::setText(QString::number(((QSpinBox *) pWidget)->value())); else - QTableItem::setContentFromEditor(pWidget); + QTableItem::setContentFromEditor(pWidget); } @@ -548,9 +547,9 @@ void qsamplerDeviceParamTableEditBox::setContentFromEditor ( QWidget *pWidget ) { if (pWidget->inherits("QLineEdit")) - QTableItem::setText(((QLineEdit *) pWidget)->text()); + QTableItem::setText(((QLineEdit *) pWidget)->text()); else - QTableItem::setContentFromEditor(pWidget); + QTableItem::setContentFromEditor(pWidget); }