X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Ftoolbars%2Fsamplingbar.h;h=7c0ec9af2d75a2d29577e7d5126f1b2c78c717ee;hp=aef26ef145c3882e73273ec9d52eb4aca3bf2646;hb=e8d009288de28cb194bc7964f96677c2baf900c9;hpb=1198b8872516662c257e5dcdec346094ed4f32dd diff --git a/pv/toolbars/samplingbar.h b/pv/toolbars/samplingbar.h index aef26ef1..7c0ec9af 100644 --- a/pv/toolbars/samplingbar.h +++ b/pv/toolbars/samplingbar.h @@ -23,7 +23,8 @@ #include -#include +#include +#include #include #include @@ -34,7 +35,12 @@ #include #include -struct st_dev_inst; +namespace sigrok { + class Device; +} + +Q_DECLARE_METATYPE(std::shared_ptr) + class QAction; namespace pv { @@ -48,34 +54,44 @@ class SamplingBar : public QToolBar Q_OBJECT private: - static const uint64_t RecordLengths[20]; - 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 &devices); + void set_device_list( + const std::map< std::shared_ptr, std::string > + &device_names, + std::shared_ptr selected); - struct sr_dev_inst* get_selected_device() const; - void set_selected_device(struct sr_dev_inst *const sdi); - - uint64_t get_record_length() const; + std::shared_ptr get_selected_device() const; void set_capture_state(pv::SigSession::capture_state state); -signals: +Q_SIGNALS: void run_stop(); 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(); -private slots: +private Q_SLOTS: void on_device_selected(); + void on_sample_count_changed(); void on_sample_rate_changed(); void on_run_stop(); + void on_config_changed(); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + private: SigSession &_session; @@ -85,12 +101,14 @@ private: pv::widgets::PopupToolButton _configure_button; QAction *_configure_button_action; - pv::widgets::PopupToolButton _probes_button; - - QComboBox _record_length_selector; + pv::widgets::PopupToolButton _channels_button; + pv::widgets::SweepTimingWidget _sample_count; pv::widgets::SweepTimingWidget _sample_rate; bool _updating_sample_rate; + bool _updating_sample_count; + + bool _sample_count_supported; QIcon _icon_red; QIcon _icon_green;