From: Joel Holdsworth Date: Thu, 7 Mar 2013 22:41:04 +0000 (+0000) Subject: Added pv::SamplingBar::set_selected_device X-Git-Tag: pulseview-0.1.0~97 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=dba73e734310f538bd19d709c95c5cbe7f453c0e;p=pulseview.git Added pv::SamplingBar::set_selected_device --- diff --git a/pv/samplingbar.cpp b/pv/samplingbar.cpp index 4ea2686b..04070033 100644 --- a/pv/samplingbar.cpp +++ b/pv/samplingbar.cpp @@ -143,6 +143,15 @@ struct sr_dev_inst* SamplingBar::get_selected_device() const index).value(); } +void SamplingBar::set_selected_device(struct sr_dev_inst *const sdi) +{ + for(int i = 0; i < _device_selector.count(); i++) + if(sdi == _device_selector.itemData(i).value()) { + _device_selector.setCurrentIndex(i); + return; + } +} + uint64_t SamplingBar::get_record_length() const { const int index = _record_length_selector.currentIndex(); diff --git a/pv/samplingbar.h b/pv/samplingbar.h index 8d646c5d..7034962c 100644 --- a/pv/samplingbar.h +++ b/pv/samplingbar.h @@ -49,6 +49,7 @@ public: void set_device_list(const std::list &devices); struct sr_dev_inst* get_selected_device() const; + void set_selected_device(struct sr_dev_inst *const sdi); uint64_t get_record_length() const;