]> sigrok.org Git - pulseview.git/commitdiff
Added pv::SamplingBar::set_selected_device
authorJoel Holdsworth <redacted>
Thu, 7 Mar 2013 22:41:04 +0000 (22:41 +0000)
committerUwe Hermann <redacted>
Sat, 9 Mar 2013 10:43:04 +0000 (11:43 +0100)
pv/samplingbar.cpp
pv/samplingbar.h

index 4ea2686b4d2b522c2203dab01a00cfee86e4951b..040700331f6c5aedae66f1175cf9fa1d699975db 100644 (file)
@@ -143,6 +143,15 @@ struct sr_dev_inst* SamplingBar::get_selected_device() const
                index).value<void*>();
 }
 
+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<void*>()) {
+                       _device_selector.setCurrentIndex(i);
+                       return;
+               }
+}
+
 uint64_t SamplingBar::get_record_length() const
 {
        const int index = _record_length_selector.currentIndex();
index 8d646c5d55b5104eddcccb2cfcf6d6a1a1d82d25..7034962c2a1a5593630815f632db53cd27ca155b 100644 (file)
@@ -49,6 +49,7 @@ public:
        void set_device_list(const std::list<struct sr_dev_inst*> &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;