+void InputMappingDialog::fill_delay_from_bus(unsigned row, const InputMapping::Bus &bus, const InputMapping &mapping)
+{
+ QDoubleSpinBox *delay_spinner = static_cast<QDoubleSpinBox *>(ui->table->cellWidget(row, 4));
+ if (delay_spinner == nullptr) {
+ delay_spinner = new QDoubleSpinBox;
+ delay_spinner->setDecimals(1);
+ delay_spinner->setMinimum(-50.0);
+ delay_spinner->setMaximum(500.0);
+ connect(delay_spinner, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
+ bind(&InputMappingDialog::delay_changed, this, row, _1));
+ }
+ delay_spinner->blockSignals(true);
+ if (bus.device.type == InputSourceType::SILENCE) {
+ delay_spinner->setEnabled(false);
+ delay_spinner->setValue(0.0);
+ } else {
+ delay_spinner->setEnabled(true);
+ const auto delay_it = mapping.extra_delay_ms.find(bus.device);
+ if (delay_it != mapping.extra_delay_ms.end()) {
+ delay_spinner->setValue(delay_it->second);
+ } else {
+ delay_spinner->setValue(0.0);
+ }
+ }
+ delay_spinner->blockSignals(false);
+ ui->table->setCellWidget(row, 4, delay_spinner);
+}
+