_layout.addWidget(&_button_box);
}
+struct sr_dev_inst* Connect::get_selected_device() const
+{
+ const QListWidgetItem *const item = _device_list.currentItem();
+ if (!item)
+ return NULL;
+
+ return (sr_dev_inst*)item->data(Qt::UserRole).value<void*>();
+}
+
void Connect::populate_drivers()
{
const int *hwopts;
g_slist_length(sdi->probes));
}
- _device_list.addItem(text);
+ QListWidgetItem *const item = new QListWidgetItem(text,
+ &_device_list);
+ item->setData(Qt::UserRole, qVariantFromValue((void*)sdi));
+ _device_list.addItem(item);
}
g_slist_free(devices);
void MainWindow::on_actionConnect_triggered()
{
dialogs::Connect dlg(this);
- dlg.exec();
+ if(!dlg.exec())
+ return;
+
+ struct sr_dev_inst *const sdi = dlg.get_selected_device();
+ if (sdi) {
+ assert(_sampling_bar);
+
+ _devices.push_back(sdi);
+ _sampling_bar->set_device_list(_devices);
+ _sampling_bar->set_selected_device(sdi);
+ }
}
void MainWindow::on_actionQuit_triggered()