X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Ftoolbars%2Fsamplingbar.cpp;h=dce7aa38417753c7927f3eefa0c23cd0369b7ae4;hb=19f511a492b5fb917802b84a8ae81b4c8073c747;hp=f58f4fc38fd60c2ecedce0aefae3bd8468fa6ffa;hpb=945745012eb57cefa1ef457daf48cfffa99f9ec2;p=pulseview.git diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index f58f4fc..dce7aa3 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -115,8 +115,6 @@ void SamplingBar::set_device_list( } _updating_device_selector = false; - - on_device_selected(); } shared_ptr SamplingBar::get_selected_device() const @@ -145,6 +143,8 @@ void SamplingBar::set_selected_device(shared_ptr dev_inst) for (int i = 0; i < _device_selector.count(); i++) if (dev_inst->dev_inst() == _device_selector.itemData(i).value()) { + // Calling this leads to on_device_selected being + // invoked, which updates the sampling bar widgets. _device_selector.setCurrentIndex(i); return; } @@ -264,10 +264,13 @@ void SamplingBar::update_sample_count_selector() if (_sample_count_supported) { - uint64_t sample_count = DefaultSampleCount; + uint64_t sample_count = _sample_count.value(); uint64_t min_sample_count = 0; uint64_t max_sample_count = MaxSampleCount; + if (sample_count == 0) + sample_count = DefaultSampleCount; + if ((gvar = dev_inst->list_config(NULL, SR_CONF_LIMIT_SAMPLES))) { g_variant_get(gvar, "(tt)", @@ -316,7 +319,8 @@ void SamplingBar::commit_sample_count() // Set the sample count assert(!_updating_sample_count); _updating_sample_count = true; - if (!dev_inst->set_config(NULL, SR_CONF_LIMIT_SAMPLES, + if (_sample_count_supported && + !dev_inst->set_config(NULL, SR_CONF_LIMIT_SAMPLES, g_variant_new_uint64(sample_count))) { qDebug() << "Failed to configure sample count."; return;