X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Fviewbase.hpp;h=d3111dc79cdfbc5929f260d8f0181a2238f592a9;hp=0a7605db153f822693aff9ae6c709265d86cd887;hb=74bf66669012692f7eda790abe724bd5bb4ae8c6;hpb=ffc00fdd5946593ad2a587078fd4ee9ba0a507ec diff --git a/pv/views/viewbase.hpp b/pv/views/viewbase.hpp index 0a7605db..d3111dc7 100644 --- a/pv/views/viewbase.hpp +++ b/pv/views/viewbase.hpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -50,20 +51,35 @@ class Signal; namespace views { +// When adding an entry here, don't forget to update ViewTypeNames as well enum ViewType { ViewTypeTrace, - ViewTypeTabularDecode +#ifdef ENABLE_DECODE + ViewTypeDecoderOutput, +#endif + ViewTypeCount // Indicates how many view types there are, must always be last }; +extern const char* ViewTypeNames[ViewTypeCount]; + class ViewBase : public QWidget { Q_OBJECT -private: +public: static const int MaxViewAutoUpdateRate; public: - explicit ViewBase(Session &session, bool is_main_view = false, QWidget *parent = nullptr); + explicit ViewBase(Session &session, bool is_main_view = false, QMainWindow *parent = nullptr); + + virtual ViewType get_type() const = 0; + bool is_main_view() const; + + /** + * Resets the view to its default state after construction. It does however + * not reset the signal bases or any other connections with the session. + */ + virtual void reset_view_state(); Session& session(); const Session& session() const; @@ -92,7 +108,7 @@ public: virtual void restore_settings(QSettings &settings); public Q_SLOTS: - virtual void trigger_event(util::Timestamp location); + virtual void trigger_event(int segment_id, util::Timestamp location); virtual void signals_changed(); virtual void capture_state_updated(int state); virtual void on_new_segment(int new_segment_id); @@ -100,7 +116,7 @@ public Q_SLOTS: virtual void perform_delayed_view_update(); private Q_SLOTS: - void on_samples_added(QObject* segment, uint64_t start_sample, + void on_samples_added(uint64_t segment_id, uint64_t start_sample, uint64_t end_sample); void on_data_updated(); @@ -110,10 +126,12 @@ protected: const bool is_main_view_; - util::Timestamp ruler_shift_; util::TimeUnit time_unit_; unordered_set< shared_ptr > signalbases_; +#ifdef ENABLE_DECODE + unordered_set< shared_ptr > decode_signals_; +#endif /// The ID of the currently displayed segment uint32_t current_segment_;