Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
in_packet_find_bar.h
Go to the documentation of this file.
1
10#ifndef IN_PACKET_FIND_BAR_H
11#define IN_PACKET_FIND_BAR_H
12
13#include <QLabel>
16#include <QModelIndex>
17#include <QPropertyAnimation>
18#include <QTimer>
19#include <QToolButton>
20#include <QWidget>
21
22class ProtoTree;
23
27class InPacketFindBar : public QWidget
28{
29 Q_OBJECT
30 Q_PROPERTY(int barHeight READ barHeight WRITE setBarHeight)
31
32public:
38 explicit InPacketFindBar(ProtoTree *tree, QWidget *parent = nullptr);
39
44
49 static int openInstances() { return open_instances_; }
50
54 void showAnimated();
55
59 void hideAnimated();
60
64 void focusSearchField();
65
71 bool isMatch(const QModelIndex &model_index) const;
72
78 bool isCurrentMatch(const QModelIndex &model_index) const;
79
84 bool isDarkMode() const;
85
90 int barHeight() const;
91
96 void setBarHeight(int h);
97
98signals:
103
104protected:
111 bool eventFilter(QObject *obj, QEvent *event) override;
112
113private slots:
118 void onTextChanged(const QString &text);
119
123 void performSearch();
124
128 void findNext();
129
133 void findPrevious();
134
138 void closeBar();
139
143 void onToggleChanged();
144
145private:
149 void updateMatches();
150
154 void updateCounterLabel();
155
160 void navigateTo(qsizetype model_index);
161
166 void expandParents(const QModelIndex &model_index);
167
173 void collectIndices(const QModelIndex &parent, QList<QModelIndex> &out);
174
176 ProtoTree *proto_tree_;
177
179 SyntaxLineEdit *search_edit_;
181 QToolButton *case_button_;
183 QToolButton *regex_button_;
185 QToolButton *word_button_;
187 QLabel *counter_label_;
189 QToolButton *prev_button_;
191 QToolButton *next_button_;
193 QToolButton *close_button_;
194
196 QTimer *debounce_timer_;
198 QPropertyAnimation *animation_;
199
201 bool is_open_;
202
204 static int open_instances_;
205
207 QList<QModelIndex> matches_;
209 qsizetype current_match_;
211 bool regex_invalid_;
213 int natural_height_;
214};
215
216#endif // IN_PACKET_FIND_BAR_H
Find bar widget for searching within a specific packet's protocol tree.
Definition in_packet_find_bar.h:28
void matchesChanged()
Signal emitted when the search matches are updated.
void hideAnimated()
Hides the find bar with an animation.
Definition in_packet_find_bar.cpp:176
void showAnimated()
Shows the find bar with an animation.
Definition in_packet_find_bar.cpp:144
static int openInstances()
Returns the number of currently open instances of the find bar.
Definition in_packet_find_bar.h:49
bool isCurrentMatch(const QModelIndex &model_index) const
Checks if a specific model index is the currently active/selected match.
Definition in_packet_find_bar.cpp:215
void focusSearchField()
Sets focus to the search input field.
Definition in_packet_find_bar.cpp:202
bool eventFilter(QObject *obj, QEvent *event) override
Event filter for handling specific widget events.
Definition in_packet_find_bar.cpp:227
~InPacketFindBar()
Destroys the InPacketFindBar object.
Definition in_packet_find_bar.cpp:25
void setBarHeight(int h)
Sets the height of the animated bar.
Definition in_packet_find_bar.cpp:139
bool isMatch(const QModelIndex &model_index) const
Checks if a specific model index matches the current search criteria.
Definition in_packet_find_bar.cpp:210
bool isDarkMode() const
Checks whether the widget is currently operating in dark mode.
Definition in_packet_find_bar.cpp:222
A tree view for displaying protocol dissection details.
Definition proto_tree.h:30
QLineEdit subclass that adds syntax-state colouring, error messaging, and partial token-based autocom...
Definition syntax_line_edit.h:28