X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Ftoolbars%2Fsamplingbar.cpp;h=bafb9cd406bf05f9c76b54f2d91156e34d593e93;hb=95237c18d988245fd5f484b70a481891982f5f37;hp=ae4f298b6f2eae30f744ce4636e344459b87b5c6;hpb=51d4a9ab96a6bf64a1fcd1700e7e174498d4c118;p=pulseview.git diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index ae4f298..bafb9cd 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -64,9 +64,11 @@ const uint64_t SamplingBar::RecordLengths[20] = { const uint64_t SamplingBar::DefaultRecordLength = 1000000; -SamplingBar::SamplingBar(QWidget *parent) : +SamplingBar::SamplingBar(SigSession &session, QWidget *parent) : QToolBar("Sampling Bar", parent), + _session(session), _device_selector(this), + _updating_device_selector(false), _configure_button(this), _probes_button(this), _record_length_selector(this), @@ -122,6 +124,8 @@ SamplingBar::SamplingBar(QWidget *parent) : void SamplingBar::set_device_list( const std::list &devices) { + _updating_device_selector = true; + _device_selector.clear(); BOOST_FOREACH (sr_dev_inst *sdi, devices) { @@ -130,6 +134,8 @@ void SamplingBar::set_device_list( qVariantFromValue((void*)sdi)); } + _updating_device_selector = false; + update_sample_rate_selector(); } @@ -296,14 +302,16 @@ void SamplingBar::on_device_selected() { using namespace pv::popups; + if (_updating_device_selector) + return; + update_sample_rate_selector(); sr_dev_inst *const sdi = get_selected_device(); + _session.set_device(sdi); _configure_button.set_popup(new DeviceOptions(sdi, this)); - _probes_button.set_popup(new Probes(sdi, this)); - - device_selected(); + _probes_button.set_popup(new Probes(_session, this)); } void SamplingBar::on_sample_rate_changed()