X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Fviewbase.hpp;h=9621f35117bd47a702eb9e397afa7e8a54fc9d7c;hp=c8f72ab7a3caf9e6005379bd253e779974c5b73a;hb=0a952555b9d153f42912e47f35fac5dd4643fca9;hpb=8c3397413149b87d2755494fe73186f27edab369 diff --git a/pv/views/viewbase.hpp b/pv/views/viewbase.hpp index c8f72ab7..9621f351 100644 --- a/pv/views/viewbase.hpp +++ b/pv/views/viewbase.hpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -50,11 +51,17 @@ 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 @@ -63,7 +70,16 @@ private: 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(); @@ -113,6 +129,9 @@ protected: 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_;