X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Fdecoder_output%2FQHexView.hpp;h=e7c255670b7b793e014ac076c735ca34866261a6;hb=03408f5f5b62ce74016d91d60bdadce8dbddd46b;hp=80b58972cc0683db573a56a2f8ec51a5bb858f2c;hpb=01ba5ed7e7094dead8002ee430d67bde106f8835;p=pulseview.git diff --git a/pv/views/decoder_output/QHexView.hpp b/pv/views/decoder_output/QHexView.hpp index 80b58972..e7c25567 100644 --- a/pv/views/decoder_output/QHexView.hpp +++ b/pv/views/decoder_output/QHexView.hpp @@ -31,23 +31,37 @@ #define PULSEVIEW_PV_VIEWS_DECODEROUTPUT_QHEXVIEW_H #include -#include -#include + +#include using std::size_t; +using pv::data::DecodeBinaryClass; +using pv::data::DecodeBinaryDataChunk; class QHexView: public QAbstractScrollArea { + Q_OBJECT + +public: + enum Mode { + ChunkedDataMode, ///< Displays all data chunks in succession + MemoryEmulationMode ///< Reconstructs memory contents from data chunks + }; + public: QHexView(QWidget *parent = 0); - void setData(QByteArray *data); + void setMode(Mode m); + void setData(const DecodeBinaryClass* data); -public Q_SLOTS: void clear(); void showFromOffset(size_t offset); + virtual QSizePolicy sizePolicy() const; protected: + void initialize_byte_iterator(size_t offset); + uint8_t get_next_byte(bool* is_next_chunk = nullptr); + void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent *event); void mouseMoveEvent(QMouseEvent *event); @@ -63,11 +77,18 @@ private: size_t cursorPosFromMousePos(const QPoint &position); private: - QByteArray *data_; + Mode mode_; + const DecodeBinaryClass* data_; + size_t data_size_; size_t posAddr_, posHex_, posAscii_; size_t charWidth_, charHeight_; size_t selectBegin_, selectEnd_, selectInit_, cursorPos_; + + size_t current_chunk_id_, current_chunk_offset_, current_offset_; + DecodeBinaryDataChunk current_chunk_; // Cache locally so that we're not messed up when the vector is re-allocating its data + + vector chunk_colors_; }; #endif /* PULSEVIEW_PV_VIEWS_DECODEROUTPUT_QHEXVIEW_H */