- if (sr_config_get(sdi->driver, sdi, NULL,
- SR_CONF_LIMIT_SAMPLES, &gvar) == SR_OK)
- {
- sample_count = g_variant_get_uint64(gvar);
- if (sample_count == 0)
- sample_count = DefaultSampleCount;
- sample_count = min(max(sample_count, MinSampleCount),
- max_sample_count);
+ const auto keys = device->config_keys(ConfigKey::DEVICE_OPTIONS);
+ const auto iter = keys.find(ConfigKey::LIMIT_SAMPLES);
+ if (iter != keys.end() &&
+ (*iter).second.find(sigrok::LIST) != (*iter).second.end()) {
+ auto gvar = device->config_list(ConfigKey::LIMIT_SAMPLES);
+ g_variant_get(gvar.gobj(), "(tt)",
+ &min_sample_count, &max_sample_count);
+ }
+
+ min_sample_count = min(max(min_sample_count, MinSampleCount),
+ max_sample_count);
+
+ sample_count_.show_125_list(
+ min_sample_count, max_sample_count);
+
+ try {
+ auto gvar = device->config_get(ConfigKey::LIMIT_SAMPLES);
+ sample_count = g_variant_get_uint64(gvar.gobj());
+ if (sample_count == 0)
+ sample_count = DefaultSampleCount;
+ sample_count = min(max(sample_count, MinSampleCount),
+ max_sample_count);
+ } catch (Error error) {}
+
+ sample_count_.set_value(sample_count);
+
+ updating_sample_count_ = false;
+}
+
+void SamplingBar::update_device_config_widgets()
+{
+ using namespace pv::popups;
+
+ const shared_ptr<Device> device = get_selected_device();
+ if (!device)
+ return;
+
+ // Update the configure popup
+ DeviceOptions *const opts = new DeviceOptions(device, this);
+ configure_button_action_->setVisible(
+ !opts->binding().properties().empty());
+ configure_button_.set_popup(opts);
+
+ // Update the channels popup
+ Channels *const channels = new Channels(session_, this);
+ channels_button_.set_popup(channels);
+
+ // Update supported options.
+ sample_count_supported_ = false;