X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fconnect.cpp;h=997234be76dc1815f229dd54ae56a7559eab730d;hp=5baedcbcacaa1a2e06c52050419f5c77158b906d;hb=be7645e8d02d1865f9bc1a4a9bb397812ea3c380;hpb=3d79f521396c8e908fd237f5328153165099f5c3 diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index 5baedcbc..997234be 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -53,7 +53,7 @@ Connect::Connect(QWidget *parent, pv::DeviceManager &device_manager) : form_layout_(&form_), drivers_(&form_), serial_devices_(&form_), - scan_button_(tr("&Scan for Devices"), this), + scan_button_(tr("&Scan for devices using driver above"), this), device_list_(this), button_box_(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this) @@ -106,14 +106,14 @@ void Connect::populate_drivers() * @todo Add support for non-monotonic devices i.e. DMMs * and sensors. */ - bool supported_device = driver->config_check( - ConfigKey::LOGIC_ANALYZER, ConfigKey::DEVICE_OPTIONS) | - driver->config_check( - ConfigKey::OSCILLOSCOPE, ConfigKey::DEVICE_OPTIONS); + const auto keys = driver->config_keys(); + + bool supported_device = keys.count(ConfigKey::LOGIC_ANALYZER) | + keys.count(ConfigKey::OSCILLOSCOPE); if (supported_device) drivers_.addItem(QString("%1 (%2)").arg( - driver->long_name().c_str()).arg(name.c_str()), + driver->long_name().c_str(), name.c_str()), qVariantFromValue(driver)); } } @@ -123,7 +123,7 @@ void Connect::populate_serials(shared_ptr driver) serial_devices_.clear(); for (auto serial : device_manager_.context()->serials(driver)) serial_devices_.addItem(QString("%1 (%2)").arg( - serial.first.c_str()).arg(serial.second.c_str()), + serial.first.c_str(), serial.second.c_str()), QString::fromStdString(serial.first)); } @@ -172,8 +172,7 @@ void Connect::scan_pressed() const list< shared_ptr > devices = device_manager_.driver_scan(driver, drvopts); - for (shared_ptr device : devices) - { + for (shared_ptr device : devices) { assert(device); QString text = QString::fromStdString( @@ -198,7 +197,7 @@ void Connect::device_selected(int index) unset_connection(); - if (driver->config_check(ConfigKey::SERIALCOMM, ConfigKey::SCAN_OPTIONS)) + if (driver->scan_options().count(ConfigKey::SERIALCOMM)) set_serial_connection(driver); }