]> sigrok.org Git - pulseview.git/blobdiff - pv/toolbars/samplingbar.h
Reworked SamplingBar device selection logic
[pulseview.git] / pv / toolbars / samplingbar.h
index db4c10e48fa4065221cb3004c250a00abc1a222f..e59d2f9f0b195da8417c126de2ea6f4ec7f53539 100644 (file)
@@ -24,6 +24,9 @@
 #include <stdint.h>
 
 #include <list>
+#include <map>
+
+#include <boost/shared_ptr.hpp>
 
 #include <QComboBox>
 #include <QDoubleSpinBox>
 #include <pv/widgets/popuptoolbutton.h>
 #include <pv/widgets/sweeptimingwidget.h>
 
-struct st_dev_inst;
 class QAction;
 
 namespace pv {
 
 class SigSession;
 
+namespace device {
+class DevInst;
+}
+
 namespace toolbars {
 
 class SamplingBar : public QToolBar
@@ -48,15 +54,19 @@ class SamplingBar : public QToolBar
        Q_OBJECT
 
 private:
-       static const uint64_t DefaultRecordLength;
+       static const uint64_t MinSampleCount;
+       static const uint64_t MaxSampleCount;
+       static const uint64_t DefaultSampleCount;
 
 public:
        SamplingBar(SigSession &session, QWidget *parent);
 
-       void set_device_list(const std::list<struct sr_dev_inst*> &devices);
+       void set_device_list(
+               const std::list< boost::shared_ptr<pv::device::DevInst> >
+                       &devices,
+               boost::shared_ptr<pv::device::DevInst> selected);
 
-       struct sr_dev_inst* get_selected_device() const;
-       void set_selected_device(struct sr_dev_inst *const sdi);
+       boost::shared_ptr<pv::device::DevInst> get_selected_device() const;
 
        void set_capture_state(pv::SigSession::capture_state state);
 
@@ -67,6 +77,7 @@ private:
        void update_sample_rate_selector();
        void update_sample_rate_selector_value();
        void update_sample_count_selector();
+       void update_device_config_widgets();
        void commit_sample_rate();
        void commit_sample_count();
 
@@ -76,10 +87,14 @@ private slots:
        void on_sample_rate_changed();
        void on_run_stop();
 
+       void on_config_changed();
+
 private:
        SigSession &_session;
 
        QComboBox _device_selector;
+       std::map<const sr_dev_inst*, boost::weak_ptr<device::DevInst> >
+               _device_selector_map;
        bool _updating_device_selector;
 
        pv::widgets::PopupToolButton _configure_button;