From: Joel Holdsworth Date: Sat, 27 Apr 2013 18:27:07 +0000 (+0100) Subject: Fix "Failed to configure samplerate." warnings. X-Git-Tag: pulseview-0.1.0~14 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f9541bde559ebdad1dff36bd27a2656ada99c6da;p=pulseview.git Fix "Failed to configure samplerate." warnings. We need to keep the sample rate selectors hidden until they have been reconfigured and we need to ignore the samplerate when the device selector is hidden. This fixes bug #109. --- diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index 7e052f81..90dc6575 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -174,6 +174,7 @@ void SamplingBar::update_sample_rate_selector() GVariant *gvar_dict, *gvar_list; const uint64_t *elements = NULL; gsize num_elements; + QAction *selector_action = NULL; assert(_sample_rate_value_action); assert(_sample_rate_list_action); @@ -194,8 +195,9 @@ void SamplingBar::update_sample_rate_selector() gvar_list, &num_elements, sizeof(uint64_t)); _sample_rate_value.setRange(elements[0], elements[1]); _sample_rate_value.setSingleStep(elements[2]); - _sample_rate_value_action->setVisible(true); g_variant_unref(gvar_list); + + selector_action = _sample_rate_value_action; } else if ((gvar_list = g_variant_lookup_value(gvar_dict, "samplerates", G_VARIANT_TYPE("at")))) @@ -213,12 +215,18 @@ void SamplingBar::update_sample_rate_selector() } _sample_rate_list.show(); - _sample_rate_list_action->setVisible(true); g_variant_unref(gvar_list); + + selector_action = _sample_rate_list_action; } g_variant_unref(gvar_dict); update_sample_rate_selector_value(); + + // We delay showing the action, so that value change events + // are ignored. + if (selector_action) + selector_action->setVisible(true); } void SamplingBar::update_sample_rate_selector_value() @@ -272,6 +280,9 @@ void SamplingBar::commit_sample_rate() index).value(); } + if (sample_rate == 0) + return; + // Set the samplerate if (sr_config_set(sdi, SR_CONF_SAMPLERATE, g_variant_new_uint64(sample_rate)) != SR_OK) {