]> sigrok.org Git - pulseview.git/commitdiff
Prevent Ok being pressed when no device is selected
authorJoel Holdsworth <redacted>
Thu, 7 Mar 2013 23:25:02 +0000 (23:25 +0000)
committerUwe Hermann <redacted>
Sat, 9 Mar 2013 10:43:04 +0000 (11:43 +0100)
Disable Ok until a device has been selected, and select the first device when scan is pressed

pv/dialogs/connect.cpp

index 87fc451acee3819e2b9622cbe849f9d8faec8e79..51de735e00e1d5e24eb1ad6d5e0dab13ee877f15 100644 (file)
@@ -112,6 +112,7 @@ void Connect::unset_connection()
        _device_list.clear();
        _serial_device.hide();
        _form_layout.labelForField(&_serial_device)->hide();
        _device_list.clear();
        _serial_device.hide();
        _form_layout.labelForField(&_serial_device)->hide();
+       _button_box.button(QDialogButtonBox::Ok)->setDisabled(true);
 }
 
 void Connect::set_serial_connection()
 }
 
 void Connect::set_serial_connection()
@@ -167,6 +168,9 @@ void Connect::scan_pressed()
 
        g_slist_free(devices);
        g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts);
 
        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)
 }
 
 void Connect::device_selected(int index)