X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Fdecoder_output%2Fview.hpp;h=16d35e82e2823af56cfe83cd5738798360667e6c;hb=feda6c6bbde575242cf01c769c0ecd3e89f9f7a0;hp=58aec954f24a855c7a49b1657b44a2d9c66be0ce;hpb=628b45cc0ba7ac38ac6a003fedbbc746f15dd724;p=pulseview.git diff --git a/pv/views/decoder_output/view.hpp b/pv/views/decoder_output/view.hpp index 58aec954..16d35e82 100644 --- a/pv/views/decoder_output/view.hpp +++ b/pv/views/decoder_output/view.hpp @@ -20,8 +20,10 @@ #ifndef PULSEVIEW_PV_VIEWS_DECODEROUTPUT_VIEW_HPP #define PULSEVIEW_PV_VIEWS_DECODEROUTPUT_VIEW_HPP +#include #include #include +#include #include #include @@ -36,6 +38,18 @@ namespace views { namespace decoder_output { +// When adding an entry here, don't forget to update SaveTypeNames as well +enum SaveType { + SaveTypeBinary, + SaveTypeHexDumpPlain, + SaveTypeHexDumpWithOffset, + SaveTypeHexDumpComplete, + SaveTypeCount // Indicates how many save types there are, must always be last +}; + +extern const char* SaveTypeNames[SaveTypeCount]; + + class View : public ViewBase { Q_OBJECT @@ -43,8 +57,6 @@ class View : public ViewBase public: explicit View(Session &session, bool is_main_view=false, QMainWindow *parent = nullptr); - ~View(); - virtual ViewType get_type() const; /** @@ -53,8 +65,6 @@ public: */ virtual void reset_view_state(); - virtual void clear_signals(); - virtual void clear_decode_signals(); virtual void add_decode_signal(shared_ptr signal); virtual void remove_decode_signal(shared_ptr signal); @@ -63,8 +73,12 @@ public: virtual void restore_settings(QSettings &settings); private: + void reset_data(); void update_data(); + void save_data() const; + void save_data_as_hex_dump(bool with_offset=false, bool with_ascii=false) const; + private Q_SLOTS: void on_selected_decoder_changed(int index); void on_selected_class_changed(int index); @@ -74,14 +88,24 @@ private Q_SLOTS: void on_decoder_stacked(void* decoder); void on_decoder_removed(void* decoder); + void on_actionSave_triggered(QAction* action = nullptr); + + virtual void perform_delayed_view_update(); + private: + QWidget* parent_; + QComboBox *decoder_selector_, *format_selector_, *class_selector_; QStackedWidget *stacked_widget_; QHexView *hex_view_; + QToolButton* save_button_; + QAction* save_action_; + data::DecodeSignal *signal_; const data::decode::Decoder *decoder_; - uint8_t bin_class_id_; + uint32_t bin_class_id_; + bool binary_data_exists_; }; } // namespace decoder_output