]> sigrok.org Git - pulseview.git/blobdiff - pv/dialogs/connect.cpp
Connect dialog: Make button caption more clear
[pulseview.git] / pv / dialogs / connect.cpp
index 5baedcbcacaa1a2e06c52050419f5c77158b906d..997234be76dc1815f229dd54ae56a7559eab730d 100644 (file)
@@ -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> 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<HardwareDevice> > devices =
                device_manager_.driver_scan(driver, drvopts);
 
-       for (shared_ptr<HardwareDevice> device : devices)
-       {
+       for (shared_ptr<HardwareDevice> 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);
 }