51 void setFormat(bytes_view_type format);
52 void setAnnotations(
const QVector<ByteViewAnnotation> &annotations);
54 bool selectionRange(
int *start,
int *length)
const;
55 int selectionAnchor()
const;
56 int selectionEnd()
const;
57 int contextByteOffset()
const;
58 int dataSize()
const {
59 Q_ASSERT(data_.size() <= std::numeric_limits<int>::max());
60 return static_cast<int>(data_.size());
62 int offsetStart()
const {
return offset_start_byte_; }
63 int offsetEnd()
const {
return offset_end_byte_; }
64 int selectedFieldStart()
const {
return field_start_; }
65 int selectedFieldLength()
const {
return field_len_; }
66 int selectedProtocolStart()
const {
return proto_start_; }
67 int selectedProtocolLength()
const {
return proto_len_; }
68 bool selectedFieldIsProtocol()
const {
return selected_field_is_protocol_; }
69 bool selectedFieldUsesOwnRange()
const {
return selected_field_use_own_range_; }
70 void setOffsetStart(
int byte);
71 void setOffsetEnd(
int byte);
72 void clearOffsetMarkers();
73 void setSelectedFieldIsProtocol(
bool is_protocol) { selected_field_is_protocol_ = is_protocol; }
74 void setSelectedFieldUsesOwnRange(
bool use_own_range) { selected_field_use_own_range_ = use_own_range; }
77 void byteViewSettingsChanged();
78 void addAnnotationRequested();
79 void editAnnotationRequested();
80 void removeAnnotationRequested();
81 void offsetStartRequested(
int byte);
82 void offsetEndRequested(
int byte);
83 void offsetMarkersCleared();
86 void setMonospaceFont(
const QFont &mono_font);
87 void updateByteViewSettings();
89 void markProtocol(
int start,
int length);
90 void markField(
int start,
int length,
bool scroll_to =
true,
bool hover =
false);
91 void markAppendix(
int start,
int length);
95 virtual void paintEvent(QPaintEvent *);
96 virtual void resizeEvent(QResizeEvent *);
97 virtual void showEvent(QShowEvent *);
98 virtual void mousePressEvent (QMouseEvent * event);
99 virtual void mouseMoveEvent (QMouseEvent * event);
100 virtual void mouseReleaseEvent(QMouseEvent *event);
101 virtual void leaveEvent(QEvent *event);
102 virtual void contextMenuEvent(QContextMenuEvent *event);
103 virtual void keyPressEvent(QKeyEvent *event);
117 QTextLayout *layout_;
119 void updateLayoutMetrics();
120 int stringWidth(
const QString &line);
121 void drawLine(QPainter *painter,
const int offset,
const int row_y);
122 bool addFormatRange(QList<QTextLayout::FormatRange> &fmt_list,
int start,
int length, HighlightMode mode);
123 bool addHexFormatRange(QList<QTextLayout::FormatRange> &fmt_list,
int mark_start,
int mark_length,
int tvb_offset,
int max_tvb_pos, HighlightMode mode);
124 bool addAsciiFormatRange(QList<QTextLayout::FormatRange> &fmt_list,
int mark_start,
int mark_length,
int tvb_offset,
int max_tvb_pos, HighlightMode mode);
125 bool addHexCustomRange(QList<QTextLayout::FormatRange> &fmt_list,
int mark_start,
int mark_length,
int tvb_offset,
int max_tvb_pos,
const QColor &bg,
const QColor &fg);
126 bool addAsciiCustomRange(QList<QTextLayout::FormatRange> &fmt_list,
int mark_start,
int mark_length,
int tvb_offset,
int max_tvb_pos,
const QColor &bg,
const QColor &fg);
127 int annotationIndexAt(
int byte_offset)
const;
128 int annotationIndexIntersecting(
int start,
int length)
const;
129 void updateSelection(
int byte_offset,
bool extend,
bool emit_signal);
130 void updateAnnotationToolTip(
int byte_offset,
const QPoint &global_pos);
131 void scrollToByte(
int byte);
132 void updateScrollbars();
133 int byteOffsetAtPixel(QPoint pos,
bool allow_fuzzy =
false);
135 void createContextMenu();
136 void updateContextMenu();
138 int offsetChars(
bool include_pad =
true);
143 const QByteArray printableData() {
return data_; }
145 static const int separator_interval_;
150 QColor offset_normal_fg_;
151 QColor offset_field_fg_;
158 int hovered_byte_offset_;
165 int field_hover_start_;
166 int field_hover_len_;
174 QList<QRect> hover_outlines_;
176 bool allow_hover_selection_;
178 QVector<ByteViewAnnotation> annotations_;
180 int selection_anchor_;
181 int selection_start_;
184 int context_byte_offset_;
186 int hovered_annotation_index_;
187 int offset_start_byte_;
188 int offset_end_byte_;
189 bool selected_field_is_protocol_;
190 bool selected_field_use_own_range_;
193 QVector<int> x_pos_to_column_;
196 QAction *action_allow_hover_selection_;
197 QAction *action_add_annotation_;
198 QAction *action_edit_annotation_;
199 QAction *action_remove_annotation_;
200 QAction *action_set_offset_start_;
201 QAction *action_set_offset_end_;
202 QAction *action_clear_offset_markers_;
203 QAction *action_bytes_hex_;
204 QAction *action_bytes_dec_;
205 QAction *action_bytes_oct_;
206 QAction *action_bytes_bits_;
207 QAction *action_bytes_enc_from_packet_;
208 QAction *action_bytes_enc_ascii_;
209 QAction *action_bytes_enc_ebcdic_;
212 void copyBytes(
bool);
213 void setHexDisplayFormat(QAction *action);
214 void setCharacterEncoding(QAction *action);
215 void toggleHoverAllowed(
bool);
216 void requestAddAnnotation();
217 void requestEditAnnotation();
218 void requestRemoveAnnotation();
219 void requestSetOffsetStart();
220 void requestSetOffsetEnd();
221 void requestClearOffsetMarkers();