]> sigrok.org Git - pulseview.git/blobdiff - pv/dialogs/connect.cpp
Whitespace fixes.
[pulseview.git] / pv / dialogs / connect.cpp
index 87fc451acee3819e2b9622cbe849f9d8faec8e79..cb83b3d7b55cadbbcd74db66d159109d783b9ae0 100644 (file)
@@ -95,12 +95,12 @@ void Connect::populate_drivers()
                if ((sr_config_list(drivers[i], SR_CONF_DEVICE_OPTIONS,
                        (const void **)&hwopts, NULL) == SR_OK) && hwopts)
                        for (int j = 0; hwopts[j]; j++)
-                               if(hwopts[j] == SR_CONF_SAMPLERATE) {
+                               if (hwopts[j] == SR_CONF_SAMPLERATE) {
                                        supported_device = true;
                                        break;
                                }
 
-               if(supported_device)
+               if (supported_device)
                        _drivers.addItem(QString("%1 (%2)").arg(
                                drivers[i]->longname).arg(drivers[i]->name),
                                qVariantFromValue((void*)drivers[i]));
@@ -112,6 +112,7 @@ void Connect::unset_connection()
        _device_list.clear();
        _serial_device.hide();
        _form_layout.labelForField(&_serial_device)->hide();
+       _button_box.button(QDialogButtonBox::Ok)->setDisabled(true);
 }
 
 void Connect::set_serial_connection()
@@ -125,7 +126,7 @@ void Connect::scan_pressed()
        _device_list.clear();
 
        const int index = _drivers.currentIndex();
-       if(index == -1)
+       if (index == -1)
                return;
 
        sr_dev_driver *const driver = (sr_dev_driver*)_drivers.itemData(
@@ -167,6 +168,9 @@ void Connect::scan_pressed()
 
        g_slist_free(devices);
        g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts);
+
+       _device_list.setCurrentRow(0);
+       _button_box.button(QDialogButtonBox::Ok)->setDisabled(false);
 }
 
 void Connect::device_selected(int index)