X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Ftoolbars%2Fsamplingbar.cpp;h=8c1b3c6d17691a42a1ee4dd80cbbf7d23ae106b4;hb=c2db8ec3890e004455a55a493968d02a24a97242;hp=b5a2aee513c7a12026b94e7bd3720894fd9e735e;hpb=51cf49fe312f92cccde3e861d357e4b459976c0d;p=pulseview.git diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index b5a2aee..8c1b3c6 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -111,7 +111,7 @@ SamplingBar::SamplingBar(Session &session, MainWindow &main_window) : } void SamplingBar::set_device_list( - const std::list< std::pair, std::string> > &devices, + const std::list< std::shared_ptr > &devices, shared_ptr selected) { int selected_index = -1; @@ -122,12 +122,12 @@ void SamplingBar::set_device_list( device_selector_.clear(); - for (auto entry : devices) { - auto device = entry.first; - auto display_name = entry.second; - + for (auto device : devices) { assert(device); + string display_name = + session_.device_manager().get_display_name(device); + if (selected == device) selected_index = device_selector_.count(); @@ -183,8 +183,17 @@ void SamplingBar::update_sample_rate_selector() const auto iter = keys.find(ConfigKey::SAMPLERATE); if (iter != keys.end() && (*iter).second.find(sigrok::LIST) != (*iter).second.end()) { - gvar_dict = device->config_list(ConfigKey::SAMPLERATE); - } else { + const auto keys = device->config_keys( + ConfigKey::DEVICE_OPTIONS); + try { + gvar_dict = device->config_list(ConfigKey::SAMPLERATE); + } catch(const sigrok::Error &e) { + // Failed to enunmerate samplerate + (void)e; + } + } + + if (!gvar_dict) { sample_rate_.show_none(); updating_sample_rate_ = false; return;