+ device_list_.clear();
+
+ const int index = drivers_.currentIndex();
+ if (index == -1)
+ return;
+
+ shared_ptr<Driver> driver =
+ drivers_.itemData(index).value<shared_ptr<Driver>>();
+
+ assert(driver);
+
+ map<const ConfigKey *, VariantBase> drvopts;
+
+ if (serial_devices_.isEnabled()) {
+ QString serial;
+ const int index = serial_devices_.currentIndex();
+ if (index >= 0 && index < serial_devices_.count() &&
+ serial_devices_.currentText() == serial_devices_.itemText(index))
+ serial = serial_devices_.itemData(index).value<QString>();
+ else
+ serial = serial_devices_.currentText();
+ drvopts[ConfigKey::CONN] = Variant<ustring>::create(
+ serial.toUtf8().constData());
+ }
+
+ if (tcp_config_->isEnabled()) {
+ QString host = tcp_host_->text();
+ QString port = tcp_port_->text();
+ if (!host.isEmpty()) {
+ QString conn;
+ if (tcp_use_vxi_->isChecked())
+ conn = QString("vxi/%1/%2").arg(host, port);
+ else
+ conn = QString("tcp-raw/%1/%2").arg(host, port);
+
+ drvopts[ConfigKey::CONN] = Variant<ustring>::create(
+ conn.toUtf8().constData());
+ }
+ }
+
+ const list< shared_ptr<HardwareDevice> > devices =
+ device_manager_.driver_scan(driver, drvopts);
+
+ for (shared_ptr<HardwareDevice> device : devices) {
+ assert(device);
+
+ QString text = QString::fromStdString(
+ device->display_name(device_manager_));
+ text += QString(" with %1 channels").arg(
+ device->device()->channels().size());
+
+ QListWidgetItem *const item = new QListWidgetItem(text,
+ &device_list_);
+ item->setData(Qt::UserRole, qVariantFromValue(device));
+ device_list_.addItem(item);
+ }
+
+ device_list_.setCurrentRow(0);
+ button_box_.button(QDialogButtonBox::Ok)->setDisabled(device_list_.count() == 0);