_sample_count(" samples", this),
_sample_rate("Hz", this),
_updating_sample_rate(false),
+ _updating_sample_count(false),
_icon_red(":/icons/status-red.svg"),
_icon_green(":/icons/status-green.svg"),
_icon_grey(":/icons/status-grey.svg"),
this, SLOT(on_sample_rate_changed()));
_sample_count.show_min_max_step(0, UINT64_MAX, 1);
- _sample_count.set_value(DefaultRecordLength);
set_capture_state(pv::SigSession::Stopped);
_updating_sample_rate = false;
}
+void SamplingBar::update_sample_count_selector()
+{
+ sr_dev_inst *const sdi = get_selected_device();
+ GVariant *gvar;
+ uint64_t samplecount;
+
+ assert(sdi);
+
+ if (sr_config_get(sdi->driver, sdi, NULL,
+ SR_CONF_LIMIT_SAMPLES, &gvar) != SR_OK)
+ {
+ _sample_count.show_none();
+ }
+ else
+ {
+ _sample_count.show_min_max_step(0, UINT64_MAX, 1);
+
+ samplecount = g_variant_get_uint64(gvar);
+ g_variant_unref(gvar);
+
+ _updating_sample_count = true;
+ _sample_count.set_value(samplecount);
+ _updating_sample_count = false;
+ }
+}
+
void SamplingBar::commit_sample_count()
{
uint64_t sample_count = 0;
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);
void SamplingBar::on_sample_count_changed()
{
- commit_sample_count();
+ if(!_updating_sample_count)
+ commit_sample_count();
}
void SamplingBar::on_sample_rate_changed()
private:
void update_sample_rate_selector();
void update_sample_rate_selector_value();
+ void update_sample_count_selector();
void commit_sample_rate();
void commit_sample_count();
pv::widgets::SweepTimingWidget _sample_count;
pv::widgets::SweepTimingWidget _sample_rate;
bool _updating_sample_rate;
+ bool _updating_sample_count;
QIcon _icon_red;
QIcon _icon_green;