Remove the separate copy of the conversation column type
enum in ConversationDialog. It doesn't correspond to the
enum in ATapDataModel, because it doesn't include the
Conversation ID and Total columns.
Delegates set to the Traffic Tree (a QTreeView) apply to
the displayed column number, not the what is displayed
in the column. That is, when columns are hidden (filtered),
the delegates stay with the old column number and end up
being displayed on new content. That's not what we want;
we want to always have the timeline graph on the Start and
Duration columns. Moving around the Delegate depending on
which columns are filtered is complicated; just set the
TimeLine delegate to the entire TrafficTree, and use the
default paint if we're on any column other than Start or
Duration. This does mean that we don't need to store a
map of Delegates.
Use a slightly different way to get TimelineDelegate to
paint the rect with no text using the current style, so
we can use the default paint with text for other columns.
The timeline graph needs to get the value of the Start and
Duration columns as filtered by the proxy column, so have
the model pass in indices so that they can be mapped to
the current displayed column.
Have the timeline graph apply to just the Start or just the
Duration column if only one is visible.
Together these compute the proper pixel values to apply
the timeline graph to the Start and Duration columns regardless
of which columns are displayed and which are filtered, in any
tab, regardless of what optional columns appear in that tab.
Fix#18860
a9a7dcec21 broke the build by using std::as_const (new in C++17, we require
C++11). 189d93b4b8 switched to using a for loop with indices, but that
still fails on Qt5, because Qt5 uses int instead of qsizetype.
Switch back to the foreach-style loop, but using C++11 range-for instead of
Qt's foreach (which is semi-deprecated). Also, use qAsConst, which works in
C++11, instead of std::as_const.
Set some models to have the Traffic Tab or Traffic Type List
that creates them as parent, so that they will be deleted
properly. Setting a model does not cause it to be deleted
unless it is parented, because models can be shared among
multiple views. Since these models are only used by the
one view, parenting them is fine.
Add functions to PacketListRecord to invalidate a single record's
colorization and column strings, used for a record is modified in a
way that needs to trigger redrawing, but we don't need to redraw
all packets.
Move the functionality for adding, deleting, and setting frame comments
into PacketListModel, operating on QModelIndexes (or on all physical
rows in the case of deleting all comments from a file.) Trigger
recolorization of any record with an updated comment.
Only set a block as modified when deleting comments if we actually
deleted comments. This avoids marking a file as modified if we
delete all comments from all frames, or all comments from selected
frames, when those comments do not actually have frames.
If cf_set_modified_block is used to modify a block that is already
modified, it can't update the comment count. In that case, return
false and have the callers update the comment count. (It already
has a return value, which is always true.) This avoids having the
GUI warning about saving into a format that doesn't support comments
when comments have been added and then removed.
Note that, unlike with time references and time shifts, there
are no fields (and hence no columns nor color filters) that depend
on whether other fields have comments. If for some reason some
were added, then the model data for all frames would have to be
updated instead. Since there aren't, we don't need to
redrawVisiblePackets, but we do need to drawCurrentPacket to ensure
the packet details are redissected.
Fix#12519
Don't call resize in applyRecentColumnWidths(). It doesn't seem
to be necessary in Qt5 or Qt6 to stretch the packet list last column
when the main window is wider than the total columns, and it doesn't
seem to be necessary to get the horizontal scroll bar to appear if
the columns are wider than the window frame either.
(When adding and removing columns, resizing the main window, etc.,
the columns all behave as expected, including if the wide Info
column is removed).
Resizing the packet list makes the scrollbar (and minimap) disappear.
It reappears when selecting another packet, but since it's not
necessary to resize, don't.
Fix#13597
Add a drop-down combobox for UATs, including User DLTs, that
have a choice of dissectors. Make the combobox editable, which
will provide suggestions, and pass things through to the existing
UAT validation for dissectors. (It's a very long list, especially
with 1717 entries, including 530 just from various BT GATT UUIDs,
so being able to still type it in seems useful.)
Dissectors are not protocols. Rename the UAT field from PROTO to
DISSECTOR where used. Update the column names and long descriptions
to use dissector instead of protocol in dissectors that used this.
There may at some point be UATs that want protocols instead of
dissectors, but that's not what the current behavior does and
none of the current dissectors that use the existing types want.
Update the documentation to use "dissector" instead of "protocol."
Put the names of the actual current three Ethernet dissectors.
Clarify that the "ip" dissector actually tries IPv4 and IPv6,
instead of just IPv4.
UAT entries are backwards and forwards compatible with versions
without this change.
Fix#18836.
Fix the calculation of the ratio for converting a packet number
to the scrollbar value by accounting for the length of the slider.
maximum() does not correpond to the last packet; it corresponds to
the first packet shown when the scrollbar is at maximum. The last
packet is maximum() + pageStep().
(See https://doc.qt.io/qt-6/qscrollbar.html#details)
The quarter of a page padding should be subtracted, not added,
from the calculated position.
(Fix up 422c0f45d4)
This correctly makes clicking on the a line in the minimap scroll
the packet list so that the corresponding packet is 25% of the
way down the visible window. (Excepting the cases of packets at
the very beginning or end of the entire packet list.)
Fix#13989
PacketListRecords should only report themselves as colorized when
colorized with the latest version of the coloring rules. Otherwise,
ensureRowColorized will not recolorize rows when the rules have changed.
This makes the minimap/intelligent scrollbar correctly update
colors in the background when the rules have changed. (Rows that
were being displayed were being updated, because the columnStrings
were invalidated at the same time, and when fetching the columnStrings
the colors would be updated if the rules had changed.)
Fix#17621
The location of the next line should be based off one row larger
than the current row.
This fixes an issue where all the lines drawn in the intelligent
scrollbar are off by one - the color intended to be drawn for
the first packet never appears, the first packet corresponds to
the line for the second packet, etc., and there is a line at
the bottom that can never be colored in.
Fix#18850
Add the ability to cancel sorting. Since we now parse user inputs
during the sort, test and set the capture file read lock. Try to
sort in PacketList::captureFileReadFinished, since now sorting during
thawing won't happen if it's in the middle of a rescan.
Fix#17640
In certain situations using __MINGW64__ is not correct.
We want to have the condition apply using MinGW-w64 but also
using MSYS2, which the __MINGW64__ condition alone does not
capture.
Add a HAVE_MSYSTEM C define and use it where appropriate.
Forcing the use of a dedicated header to replace pcap.h is
unnecessary code and mental overhead in this case. We can
use config.h instead for the same purpose of defining a
macro symbol before including pcap.h.
The packet loss column has been sorting on a private variable
that is never set(?!) and also is unsigned whereas the actual
lost number is signed. Get the calculated packet loss number
and sort by that. (Should this be sorting by the total number or
the percentage, since the column displays both? Total number is
first so let's use that.)
This should probably be some kind of Model/View instead.
Fix#16785.
The ShowAs enum should stay in the same order as the Items
are added to the ShowAs combobox, because setCurrentIndex()
is used with the enum values, e.g. when setting the value to
"Show As Image" when the bytes are an image.
Fixup c9e08b7be3
It is fine to dissect and cache columns data during color dissection if
it won't evict already cached data. There is rather high probability of
using the column data because color information is dissected in order.
The personal extcap folder $XDG_CONFIG_DIR/wireshark on Linux is
inconsistent with the global extcap folder (lib/wireshark/extcap)
and personal plugins folder (.local/lib/wireshark/plugins) and also
the configuration folder should not contain architecture-specific files.
The extcap personal folder is changed from:
.config/wireshark/extcap
to:
.local/lib/wireshark/extcap
QItemSelectionModel tracks both the selected index and the
current index.
PacketList redraws when the *selected* index changes, not
the current index. Clearing the current index, and then marking
the same packet as selected and current fires currentChanged but
not selectionChanged. So drawCurrentPacket needs to call
clearSelection(), not clearCurrentIndex(), in order to trigger
a redissection of the currently selected packet and update
the packet details.
For example, if you mark or unmark the currently selected frame,
this causes the packet details to update. Cf 52955b9c43,
which fixed the same issue but for Find Packet.
Fix#14330.
Only TCP uses fragments, but we don't need to check FOLLOW_TCP
because the fragments pointers exist but are null if not being
used. See the similar code in epan/follow.c
Part of making it simpler for dissectors to register with Follow.
The websocket protocol masking feature makes follow TCP stream
on websocket traffic show masked payload. To easily view unmasked
and reassembled websocket payload add follow websocket stream
support.
Return the percentage in the UNFORMATTED_DISPLAYDATA converted
from our string so it it compares properly with an equality filter.
Use QVariant comparisons where appropriate so that Filter by
works as expected with types that are not integers, such as doubles
the City/Country strings from GeoIP, or when absolute start time
is used for conversation starts.
Fix#18738.
Obtain the capture file read lock when computing protocol hierarchy
stats to prevent segfaulting if the file is closed.
The protocol hierarchy stats are always computed on all the packets
of the current file that pass the current filter, so don't let it run
until a read or rescan is complete.
Since the protocol hierarchy stats use the common progress bar,
these two changes keep it from hijacking the progress bar when a
rescan is in progress, which led to anomolies with the stop button
behavior and clearing the progress bar when the stats were done
(but not the temporarily paused rescan.)
Make the stop button actually stop the protocol hierarchy stats.
In the future, the protocol hierarchy stats could perhaps use
process_specified_records from file.c
Fix#18787. Fix#18788.
ElidedLabel escapes HTML after !9261, so use its own methods to make text
small and italicized instead of passing in rich text.
IOGraphDialog used to make an error message, if it existed, bold.
Perhaps ElidedLabel should have a way to have prepended bold
text for such usage.
Autoset "Limit to display filter" if a display filter is
present when the dialog is open, but do not re-enable it each
time the widget is updated, if the user has unchecked it.
[skip ci]
Fix#18461
QVariant canConvert<double>() does not test that a particular QVariant
value can be converted to a double, but only that at least some values
of that type can convert. (Just checking the type is much faster than
actually trying the conversion; this is why convert() has a boolean
output parameter as well.) It thus always returns TRUE for strings even
for strings that fail to convert, and is not by itself a useful test
when trying to sort unknown types.
Luckily, we don't need to test this anyway. Set the default data role used
for sorting to UNFORMATTED_DISPLAYDATA, so the parent QSortFilterProxyModel
will handle QVariants that are numbers appropriately. In particular,
this makes the GeoIP city and country column strings in the Endpoints
table sort correctly.
Fix#18749
When converting from our columns as displayed to the canonical
list of columns, add 1 for the missing conversation ID if it
is not present (as opposed to if it is present.) Also change the
test for the total packets to account for the new conversation ID
column.
Related to #18738