Commit Graph

281 Commits

Author SHA1 Message Date
Roland Knall cfee0f8082 Qt: Remove frameSelect signal
As all frameSelect signals now transport a QList<int> of selected
frames, use this instead

Change-Id: I1888e45a4df997920aebde9706ca0ae803bdba03
Reviewed-on: https://code.wireshark.org/review/35176
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-21 10:59:05 +00:00
Roland Knall f211624fa6 Qt: Display selected rows in overlay bar
Indicate all selected rows in the overlay bar for the PacketList

Change-Id: Icddf8607b59bde12701a7e7983df6acbf26e0d23
Reviewed-on: https://code.wireshark.org/review/35161
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-20 16:22:02 +00:00
Roland Knall 0d534873dc Qt: Speed up selection handling
Improve the speed for selection checks in PacketList and MainWindow

Change-Id: Ic3a413624463a798b5d13102965f75c7b1347b5f
Reviewed-on: https://code.wireshark.org/review/35160
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-20 16:21:51 +00:00
Mike78 b7ce4e3f7a Qt: Include Column Headings with Edit -> Copy -> Plain Text / CSV
Bug: 16215
Change-Id: Ie59aa354be055831055a294724f8d7b800d35d90
Reviewed-on: https://code.wireshark.org/review/35153
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-20 15:04:15 +00:00
Guy Harris fc18fbd522 Raise a question in a comment.
In PacketList::selectedRow, will we ever have a current index but not a
selection model?

Change-Id: Ie4a4a78b836876d6a890b2a0a5e5cba2de02a870
Reviewed-on: https://code.wireshark.org/review/35140
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-11-19 21:22:34 +00:00
Roland Knall c07aad1015 Qt: Speedup Packetlist
Make dataChanged more specific and remove unnecessary iteration
in case of recoloring

Change-Id: I1ee270623b1cb8ac3907a5d45d6a8c4c5027c322
Reviewed-on: https://code.wireshark.org/review/35135
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-19 14:18:11 +00:00
Roland Knall 962f8d0c7e Qt: Handle emptying selections
Clicking in an empty area of the Packet List to "unselect" the packet
selection, left one packet indicated as selected (by having a single
field active, but not highlighted). This is fixed, by selecting this
entry.

If the last line is being deselected, not index is set as active, as
it has been in previous versions of the Qt interface

Bug: 16216
Change-Id: Ib5353a7e59b09a4f816655e1dd65a20d6c6d1a13
Reviewed-on: https://code.wireshark.org/review/35132
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-19 09:37:06 +00:00
Stig Bjørlykke a51c58fa1b Qt: Cleanup space inside parentheses
Remove randomly used space inside parentheses to make the coding
style uniform. Add space after if, for and while.

Change-Id: I519f5994b6f73d8a57a5004d51ca460276c618fe
Reviewed-on: https://code.wireshark.org/review/35112
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-17 20:43:10 +00:00
Roland Knall b3f240dbf8 Qt: Multiselection in PacketList
This implements multi-selection for the PacketList. It
allows multiple lines to be selected, and either drag/drop
them to a text editor or use Ctrl/Cmd+C to copy the content
to a clipboard.

Opening the context menu disables the selection, and it
does not change the underlying currently selection. This is
done on purpose, as multi-selection is a copy-task only
functionality at this point

Export & Print work as expected, exporting just the selected
items. Same goes for the copy menu, which has the additional
entries for copying the list elements

Bug: 14612
Change-Id: I77960aa1ab1d172a21abfa469baac0cd57f9f9d9
Reviewed-on: https://code.wireshark.org/review/35073
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-17 12:20:29 +00:00
Roland Knall 013e87a8fd Qt: Remove DisplayFilterMimeData
Make the mimetype for the display filter more generic, so that external
programs can attach to Wireshark and users can drag and drop display
filters to the program

Change-Id: Id78b4dff7883e3dab879a31aad07f577d8cc4ee3
Reviewed-on: https://code.wireshark.org/review/34936
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-11-04 11:39:48 +00:00
Tomasz Moń 7e2aada266 Qt: Connect destroyed() signal to flushAppSignals()
Connect destroyed(QWidget *) signal instead of finished(int) to
flushAppSignals(). This is to ensure that flushAppSignals() is executed
after any potential accepted() or rejected() slots.

This fixes the code flow for preferences update. That is, the signals are
first queued in PreferencesDialog::on_buttonBox_accepted() before
flushAppSignal() is executed.

Change-Id: Ie1497df66adb52cdc10d1b7c701f531d4eeb7351
Reviewed-on: https://code.wireshark.org/review/34823
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-21 17:34:00 +00:00
Peter Wu d2a660d805 QUIC: Add Follow QUIC Stream support to Qt and tshark
The QUIC transport protocol provides a stream, similar to HTTP/2. Make
it possible to look at the stream contents. This can be helpful while
HTTP/3 support is not yet complete.

Known issues that will be addressed in the future:

 - If a single packet contains multiple streams, then Follow QUIC Stream
   will wrongly include data from streams other than the selected one.
   This is tracked by bug 16093 and affects HTTP/2 as well.

 - The Substream index menu does not properly filter for available
   stream numbers. If a non-existing stream is selected, then changing
   to another (potentially valid) index results in the "Capture file
   invalid." error. As workaround, clear the display filter first.

 - Follow Stream always selects Stream ID 0 instead of the first or
   currently selected stream field in a packet. Users should manually
   update the stream index as needed.

Change-Id: I5866be380d58c96f0a71a29abdbd1be20ae3534a
Ping-Bug: 13881
Reviewed-on: https://code.wireshark.org/review/34694
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-04 04:36:09 +00:00
Tomasz Moń f67eccedd9 Qt: Do not spin unnecessary additional event loops
Show the dialogs asynchronously so no new event loops are created. This
not only simplifies stack traces (reduces the nesting level) but also
prevents hard to debug problems (eg. Bug 15743) from happening.

Change-Id: I85821a1403839a5baca504b40efce0ede2f1e0cb
Reviewed-on: https://code.wireshark.org/review/34646
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-01 03:53:46 +00:00
Tomasz Moń 0b0bc1441a Qt: Fix NULL pointer dereference on mouse click
The call to model() returns nullptr if executed while file is still
loading. This won't happen if current model index is valid.

Change-Id: I2b5b084f0d2092af2b0e78b58e1e17983e01351d
Reviewed-on: https://code.wireshark.org/review/34597
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-09-25 07:15:04 +00:00
Alexander Gryanko 9fff62e2a8 Qt, http2: Add Follow HTTP/2 Stream functionality
The HTTP/2 protocol multiplexes a single TCP connection into multiple
independent streams. The Follow TCP output can interleave multiple
HTTP/2 streams, making it harder to analyze a single HTTP/2 stream.

Add the ability to select HTTP/2 Streams within a TCP stream.
Internally, the HTTP/2 dissector now stores the known Stream IDs in a
set for every TCP session which allows an amortized O(n) lookup time for
the previous/next/max Stream ID.

[Peter: make the dissector responsible for clamping the HTTP/2 Stream ID
instead of the Qt code, that should permit future optimizations.]

Change-Id: I5d78f29904ae8f227ae36e1a883155c0ed719200
Reviewed-on: https://code.wireshark.org/review/32221
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexander Gryanko <xpahos@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-09-22 05:29:30 +00:00
Roland Knall c2a7214845 Qt: Make first column moveable
Due to changes in Qt 5.11, the first section is no longer moveable
by default. This is due to internal storage mechanism. For strictly
flat tables it is not an issue to make the first column moveable
again. (see https://codereview.qt-project.org/c/qt/qtbase/+/207947)

Bug: 15879
Change-Id: If4f1371404cd252ec9f65a27c25b1c68781a0c33
Reviewed-on: https://code.wireshark.org/review/34445
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-09-03 20:09:58 +00:00
Roland Knall f402b4cdaa Qt: PacketList call DecodeAsDialog directly
Calling the directly from the context menu and setting data
just before the execute of the menu can lead to information
not present.

Furthermore for future changes, the move to have QMenu only
as a local variable is being reverted

Change-Id: I470da26e658ae81ca416b3864889a4317b865755
Reviewed-on: https://code.wireshark.org/review/34428
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-09-02 13:36:12 +00:00
Roland Knall cd8f720251 Qt: Move Apply/Prepare to general QMenu handler
Also clarify the method by which the filter can be selected. From the
main menu only selected filters from a ProtoTree can be selected,
therefore the code for PacketList handling has been removed.

Change-Id: I5e5827d763ab3b25db14a384581f283238f96d28
Reviewed-on: https://code.wireshark.org/review/34384
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-29 07:51:45 +00:00
Roland Knall b84a8e29e8 Qt: Create Apply/Prepare in Packetlist
Create the menu for apply/prepare inside Packetlist. At the
same time disabled the "..." methods if no filter has been
set yet

Move the action list to FilterAction as well

Change-Id: Ia18a4021cc95562702ff516a24fb029063096f94
Reviewed-on: https://code.wireshark.org/review/34377
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-26 20:26:17 +00:00
Roland Knall c9361120f0 Qt: Remove unnecessary code for context menus
This code is no longer required, as context menus should
be bound to local events.

As for "Reloading LUA plugins" - the keyboard shortcut would
be able to trigger while the menu is open, except Qt explicitely
prevents that

Change-Id: Id18a3a17d62bae1ff547a6ef96772e12a2535219
Reviewed-on: https://code.wireshark.org/review/34371
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-26 19:57:24 +00:00
Peter Wu e1e41c0db5 Qt: fix wrong default packet list order in Qt 5.13
Workaround a Qt 5.13 bug that made QTreeView::sortByColumn(-1)
ineffective and results in sorting rows by the first column in reverse
order.

This must be called before setModel since that already triggers sorting.

Bug: 15979
Change-Id: I86c26959d3cb9dd4118193dcda4b1308cc911290
Reviewed-on: https://code.wireshark.org/review/34226
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-10 18:50:42 +00:00
Roland Knall a76044f47c Qt: Mark with middle button
Allow to mark a packet with clicking the middle mouse button

Change-Id: I1d291c58ac99f17f94e0b31c6b67e30cc4ad5379
Reviewed-on: https://code.wireshark.org/review/34167
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-03 07:29:39 +00:00
Roland Knall 2fd549551c Qt: Properly hide the choosen model from external views
This moves the append function to the model, where it makes more sense.

Change-Id: Iea9ccaf0672e8ad05454b4c35c303ca7dc2e6373
Reviewed-on: https://code.wireshark.org/review/33843
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-07-04 16:34:29 +00:00
Roland Knall ca4b950bfa Qt: Workaround for Qt model() bug
model() on the TreeView should return a value, but instead returns a null
pointer. Moving the methods to the model would be the next step, but until
then, this workaround regains functionality

Change-Id: Iaa0b6470af41b297a821c0dd6e3a238481752886
Reviewed-on: https://code.wireshark.org/review/33839
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-07-04 11:12:54 +00:00
Roland Knall 66e92e7276 Qt: Do not export the model of the packetlist
Exporting the model for the packetlist via a function prohibits implementing
further models (sorting) inside the packetlist

Change-Id: Ica159fc8f242ae1a5b657507a26e33827c366bee
Reviewed-on: https://code.wireshark.org/review/33834
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-04 03:55:55 +00:00
Roland Knall cab175e03e Qt: Cleanup PacketList
Cleanup various smaller issues with PacketList

Change-Id: I39581da486c415b6269eeabd4363a323f9436c04
Reviewed-on: https://code.wireshark.org/review/33831
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-03 18:32:28 +00:00
Jason Cohen 9900c86548 MacOS: Fix highlight color in dark mode, graphite highlight
Bug: 15885
Change-Id: I7921f84c05cad560b0673db951571f186adda3f4
Reviewed-on: https://code.wireshark.org/review/33775
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-06-30 18:38:03 +00:00
Roland Knall 1e7f85e02f Qt: Prevent hidden global parameters
Remove the hidden global parameter settings

Change-Id: I186dfb22d972abf8de2e37ccd0a4d76340b188dc
Reviewed-on: https://code.wireshark.org/review/33762
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-29 12:23:26 +00:00
Roland Knall 8e80415aaf Qt: Fix 5.13 deprecated warnings
With Qt 5.13 some methods are deprecated. Fixing those warnings

Change-Id: Ia290f06f2b681de1d5b437624de77d8a5c2f5266
Reviewed-on: https://code.wireshark.org/review/33761
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-28 17:16:09 +00:00
Roland Knall 154b4f680d Qt: Drop column content as text
If the column context does not yield a field description (as in the
case of the protocol or info column) drop as a text instead

Change-Id: Iaa0babf55df8eea65d879aadcf82d6d54f3c8208
Reviewed-on: https://code.wireshark.org/review/33757
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-27 15:43:50 +00:00
Dario Lombardo 1af6e1f860 tap: add credentials tap.
This new tap collects credentials (username and paassword)
from the dissectors.

So far, few dissectors have been instrumented:
- http (basic auth)
- http (header auth)
- ftp
Others can be instrumented as well using the same technique.

Tshark has a new option (-z credentials) and Wireshark a new
"tools" menu: the documentation has been updated accordingly.

Change-Id: I2d0d96598c85bb3ea4fb5ec090dd8dc28b481fc9
Reviewed-on: https://code.wireshark.org/review/33453
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2019-06-26 07:09:54 +00:00
Roland Knall c288574842 Qt: Fix ghost drag-and-drop in PacketList on empty fields
If you start dragging on an empty field, you pick up the value of
a field you drag over. This is fixed

Change-Id: I7e1c5e353dbc79ee1193b305729fb44d62d98470
Reviewed-on: https://code.wireshark.org/review/33629
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-16 22:09:12 +00:00
Roland Knall 64badc5a3a Qt: Allow Drag-and-drop on info and protocol
Allow for drag-and-drop on info and protocol columns. Protocol columns
may also be dragged to the display filter, everything else is dragged
as plain-text and can just be used as text

Change-Id: I0fff390580c22175efe50037b18d7199949fd8eb
Reviewed-on: https://code.wireshark.org/review/33621
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-16 21:07:27 +00:00
Roland Knall e4713e8745 Qt: Fix drag-and-drop from packet list
Only initiate drag-and-drop when the left mousebutton has been
clicked, and also add the filter as plain text, so to enable
dragging to external applications.

Change-Id: I2f6ac7f9c543d003070c2a6c0ce671ed5a215669
Reviewed-on: https://code.wireshark.org/review/33620
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-16 21:07:21 +00:00
Roland Knall 20246cf005 Qt: Add Drag-and-Drop to Packetlist
Allow cells to be used in drag-and-drop operations

Change-Id: I6eeb5e32076ba9dddc73265e213e8cfeae1f0783
Reviewed-on: https://code.wireshark.org/review/33604
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-14 21:48:00 +00:00
Roland Knall d370f54c47 Qt: Fix Contextmenu for Packetlist
The context menu got removed, adding it back

Change-Id: Ia44a6ed576a88be5a07d76c184740a2fd9bfa844
Reviewed-on: https://code.wireshark.org/review/33602
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-14 21:18:40 +00:00
Roland Knall e39f2bb517 Qt: Move Packetlist Header Context Menu to subclass
This is a cleanup patch to remove unused or unnecessary code from
packet list and put it in its respective header class for better
code maintenance

Change-Id: Ib7d7f34ab9cdd802199b3f279499855c80f8f0c5
Reviewed-on: https://code.wireshark.org/review/33587
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-13 19:11:35 +00:00
Roland Knall 5ae259c495 Qt: Allow dropping fields to add columns and indicate width
Allows for dropping fields on the columns to add them as well as indicate
width while dragging the columns

Change-Id: Ic98ae431886e5eb2ebd9ba50390742995bf22d5a
Reviewed-on: https://code.wireshark.org/review/33573
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-06-13 15:11:10 +00:00
Arvind Dalvi 2331675eb5 Revert "Copy selected lines from Packet List view for existing formats."
This reverts commit 13c5960a2c.

Based on the features that needs integration of "multi-selection" (which this change introduced), it seems that there will be fair amount time and code changes required in packet_list.cpp and possibly other files.
I am reverting this change from the master branch so that people can still continue to use features with single-selection.
Meanwhile, Stig B and others ready to test can import this change to verify which features are missing integration and/or integrated correctly. Once the feature set integration is complete and there is fair amount of approval from all of you, the core committers can decide on it.

Change-Id: I106fd3c54350dd0fd85fc44743e7f5321cb04110
Reviewed-on: https://code.wireshark.org/review/33454
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-05 03:41:17 +00:00
Arvind Dalvi 13c5960a2c Copy selected lines from Packet List view for existing formats.
For all platforms that is supported by Qt framework...
- Select copy/<options> from context menu and it will copy selected lines.

Note: This change implements part 1 of another change, # 33007.
      And has been tested on Windows 10 only.

Change-Id: Iba2668d7c411aa33de77003fe116e63e6f650b3d
Reviewed-on: https://code.wireshark.org/review/33074
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-26 06:34:46 +00:00
Stig Bjørlykke 0d5a9b270d Qt: Remove the border around inactive+selected packet list items
It was a bad idea to bring back the border around inactive+selected packet
list items in g009283a6 because it will move the text some pixels down.
Revert this part because we now have support for customize the colors.

Remove the old "style_inactive_selected" handling because it has no effect.

Change-Id: I7599591a957a11d42964f7dc0981411cf3b28b4f
Reviewed-on: https://code.wireshark.org/review/32964
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-05-02 06:40:14 +00:00
Guy Harris 89f339afa2 Hava a routine to read the currently-selected frome.
Have cf_read_current_record() take a capture_file as an argument and
read, into its wtap_rec and Buffer for the currently-selected frame,
information for the currently-selected frame.

Rename cf_read_record_r() to cf_read_record().

That gives us 1) a routine that reads the currently-selected frame into
the wtap_rec and Buffer for the currently-selected frame and 2) a
routine that reads an arbitrary frame into the wtap_rec and Buffer
supplied to it.  If you *want* the currently-selected record, use the
former, otherwise use the latter.

Change-Id: If6bd5915dd5bc18334d7b89859822a19234153a4
Reviewed-on: https://code.wireshark.org/review/32858
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-15 05:54:41 +00:00
Guy Harris 937ec02581 1514 is a better initial Buffer size than 1500.
Ethernet packets without the CRC are 1514 bytes long, not 1500 bytes
long; using 1514 bytes will avoid a reallocation for a full-sized
Ethernet packet.

Change-Id: Ie8da3f13bf3df07e23e4478b7dcf84f06dec6a9d
Reviewed-on: https://code.wireshark.org/review/32761
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-06 21:04:02 +00:00
Peter Wu f0a2b8303a Revert "Get rid of the per-capture_file wtap_rec and Buffer."
This reverts commit 9445403f95.

cf_select_packet frees the buffer backing the dissection result
(cf->edt) which results in use-after-frees when callers try to access
the contents. See for example this call trace:

* PacketList::selectionChanged
  * cf_select_packet(cap_file_, row)
  * frameSelected(row) -> ByteViewTab::selectedFrameChanged
    * addTab(source_name, get_data_source_tvb(source))

get_data_source_tvb returns the buffer that backs the dissection and
must remain valid even after dissection has completed. If this is not
done, then a possibly expensive redissection must be done in order to
populate the byte view. The temporary memory savings are not worth it.

Bug: 15683
Change-Id: Ia5ec2c7736cdebbac3c5bf46a4e2470c9236262d
Reviewed-on: https://code.wireshark.org/review/32758
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-06 20:00:57 +00:00
Guy Harris 9445403f95 Get rid of the per-capture_file wtap_rec and Buffer.
Most code that reads from a capture_file already has its own wtap_rec
and Buffer; change the remaining ones to do so as well.

Change-Id: I9b7c136642bbb375848c37ebe23c9cdeffe830c3
Reviewed-on: https://code.wireshark.org/review/32732
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05 08:15:40 +00:00
Stig Bjørlykke fc56f23303 Qt: Add hover style to packet list and proto tree
Highlight the row in packet list and proto tree when mouse hovers
above the row. This mimics the behaviour on Windows.

Change-Id: I28461f9d7740269bad39893597232fe775f77a86
Reviewed-on: https://code.wireshark.org/review/32619
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-02 03:30:15 +00:00
Stig Bjørlykke 009283a68b Qt: Bring back border around inactive+selected packet list items
The border around inactive+selected packet list items from aaba30a3
was removed in 00776f83 and 53dfec9b. Add this back again.

Use solid color in flat_style_format, no need for a gradient between
the same color.

Remove the empty default_style_format, it does not add anything.

Ping-Bug: 12010
Change-Id: I97df7147b196c73e9f6ec4b9c370ddb6bd54488a
Reviewed-on: https://code.wireshark.org/review/32676
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-02 03:29:41 +00:00
Stig Bjørlykke 66c548fdb7 Qt: Restore column width and visibility when switching profiles
In some cases the column width and/or hidden setting is not correctly applied
when switching between profiles having different hidden settings.

Unhiding the column before applying width and hidden setting fixes this issue.

Bug: 15466
Change-Id: I09e3451612ba6dd0510b19f7f4d84d281b0188b5
Reviewed-on: https://code.wireshark.org/review/31812
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-01-31 10:15:56 +00:00
Peter Wu 66345f008f Fix memory ownership when using cf_get_packet_comment
cf_get_packet_comment already has one code path that returns duplicated
memory. Be sure to document the requirement to free this memory and
adjust Qt to avoid memory leaks.

Be firm and assume that wth.opt_comment is owned by wth, so duplicate it
before returning it from cf_get_packet_comment.

Change-Id: I91f406296c9db5ea21b90fc2e108c37de4528527
Ping-Bug: 7515
Reviewed-on: https://code.wireshark.org/review/31712
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-25 04:53:01 +00:00
Guy Harris 7eb3e47fa4 Try to squeeze some bytes out of the frame_data structure.
Make the time stamp precision a 4-bit bitfield, so, when combined with
the other bitfields, we have 32 bits.  That means we put the flags at
the same structure level as the time stamp precision, so they can be
combined; that gets rid of an extra "flags." for references to the flags.

Put the two pointers next to each other, and after a multiple of 8 bytes
worth of other fields, so that there's no padding before or between them.

It's still not down to 64 bytes, which is the next lower power of 2, so
there's more work to do.

Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe
Reviewed-on: https://code.wireshark.org/review/31213
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-27 04:34:29 +00:00