X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Ftoolbars%2Fsamplingbar.h;h=d8d81219659e9a0cc19ca496ef8e11a6fcb2b234;hp=d2b3ad50aa035a57a208c845086120a99603d05d;hb=4fe06f499c5dafe187832036b900354f0d1da284;hpb=32c81aef875696bdd1b933e20ab91703ad63203d diff --git a/pv/toolbars/samplingbar.h b/pv/toolbars/samplingbar.h index d2b3ad5..d8d8121 100644 --- a/pv/toolbars/samplingbar.h +++ b/pv/toolbars/samplingbar.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -31,10 +32,15 @@ #include #include -#include #include +#include + +namespace sigrok { + class Device; +} + +Q_DECLARE_METATYPE(std::shared_ptr) -struct st_dev_inst; class QAction; namespace pv { @@ -48,34 +54,43 @@ 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); - - struct sr_dev_inst* get_selected_device() const; - void set_selected_device(struct sr_dev_inst *const sdi); + void set_device_list( + const std::list< std::pair, std::string> > &devices, + std::shared_ptr selected); - 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; @@ -83,17 +98,16 @@ private: bool _updating_device_selector; pv::widgets::PopupToolButton _configure_button; + QAction *_configure_button_action; - pv::widgets::PopupToolButton _probes_button; - pv::popups::Probes _probes_popup; + pv::widgets::PopupToolButton _channels_button; - QComboBox _record_length_selector; + pv::widgets::SweepTimingWidget _sample_count; + pv::widgets::SweepTimingWidget _sample_rate; + bool _updating_sample_rate; + bool _updating_sample_count; - QAction *_sample_rate_action; - QComboBox _sample_rate_list; - QAction *_sample_rate_list_action; - QDoubleSpinBox _sample_rate_value; - QAction *_sample_rate_value_action; + bool _sample_count_supported; QIcon _icon_red; QIcon _icon_green;