+void SamplingBar::commit_sample_count()
+{
+ uint64_t sample_count = 0;
+
+ if (_updating_sample_count)
+ return;
+
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
+ if (!dev_inst)
+ return;
+
+ sample_count = _sample_count.value();
+
+ // Set the sample count
+ assert(!_updating_sample_count);
+ _updating_sample_count = true;
+ 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;
+ }
+ _updating_sample_count = false;
+}
+
+void SamplingBar::commit_sample_rate()
+{
+ uint64_t sample_rate = 0;
+
+ if (_updating_sample_rate)
+ return;
+
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
+ if (!dev_inst)
+ return;
+
+ sample_rate = _sample_rate.value();
+ if (sample_rate == 0)
+ return;
+
+ // Set the samplerate
+ assert(!_updating_sample_rate);
+ _updating_sample_rate = true;
+ if (!dev_inst->set_config(NULL, SR_CONF_SAMPLERATE,
+ g_variant_new_uint64(sample_rate))) {
+ qDebug() << "Failed to configure samplerate.";
+ return;
+ }
+ _updating_sample_rate = false;
+}
+
+void SamplingBar::on_device_selected()
+{
+ if (_updating_device_selector)
+ return;
+
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
+ if (!dev_inst)
+ return;
+
+ _session.set_device(dev_inst);
+
+ update_device_config_widgets();
+}
+