Wait until SDI is set before updating sweep timing widgets.
[pulseview.git] / pv / toolbars / samplingbar.cpp
index a2ddaae6bb46a4bde8284b92438ee87716b2052d..9e16c5119384f208f12f7760cb2c06dcca373d04 100644 (file)
@@ -126,11 +126,6 @@ void SamplingBar::set_selected_device(struct sr_dev_inst *const sdi)
                }
 }
 
-uint64_t SamplingBar::get_record_length() const
-{
-       return _sample_count.value();
-}
-
 void SamplingBar::set_capture_state(pv::SigSession::capture_state state)
 {
        const QIcon *icons[] = {&_icon_grey, &_icon_red, &_icon_green};
@@ -273,12 +268,6 @@ void SamplingBar::on_device_selected()
        if (_updating_device_selector)
                return;
 
-       update_sample_count_selector();
-       update_sample_rate_selector();
-
-       if (_sample_count.value() == 0)
-               _sample_count.set_value(DefaultRecordLength);
-
        sr_dev_inst *const sdi = get_selected_device();
        _session.set_device(sdi);
 
@@ -291,6 +280,13 @@ void SamplingBar::on_device_selected()
        // Update the probes popup
        Probes *const probes = new Probes(_session, this);
        _probes_button.set_popup(probes);
+
+       // Update sweep timing widgets.
+       update_sample_count_selector();
+       update_sample_rate_selector();
+
+       if (_sample_count.value() == 0)
+               _sample_count.set_value(DefaultRecordLength);
 }
 
 void SamplingBar::on_sample_count_changed()