Commit Graph

262 Commits

Author SHA1 Message Date
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
Jim Young bbef2a87ff Better format for the recent file's column.width preference
Write the "Packet list column pixel widths" preference value in a
format that is both more human friendly and is more consistent with
other similarly formatted multivalued preference values.

From this ...

> # Packet list column pixel widths.
> # Each pair of strings consists of a column format and its pixel width.
> column.width: %m, 75, %t, 72, %s, 113, %d, 113, %p, 92, %L, 82, %i, 475

To this ...

> # Packet list column pixel widths.
> # Each pair of strings consists of a column format and its pixel width.
> column.width:
>         %m, 75,
>         %t, 72,
>         %s, 113,
>         %d, 113,
>         %p, 92,
>         %L, 82,
>         %i, 475

The preference reading code already accepts this new format.

Change-Id: Id731ec81e8ebf87ecfb268e48dfeaa96d8e00668
Reviewed-on: https://code.wireshark.org/review/31140
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-20 10:09:37 +00:00
Peter Wu 9118d959a4 Qt/PacketList: read packet record in private buffer
To prevent potential interference with other users of the capture file,
read data in a private buffer instead of reusing the one from capFile.

An accidental (?) change in commit v2.9.0rc0-2001-g123bcb0362 resulted
in "cf_read_record" reallocating the capture_file->buf buffer. That
issue combined with the current behavior would result in a crash when
ignoring a packet followed by two times opening a context menu:

    ==32187==ERROR: AddressSanitizer: heap-use-after-free on address 0x7fda91642800 at pc 0x55a98f3faaa7 bp 0x7fffa2807860 sp 0x7fffa2807858
    READ of size 1 at 0x7fda91642800 thread T0
        #0 0x55a98f3faaa6 in QByteArray::operator[](int) const /usr/include/qt/QtCore/qbytearray.h:476:47
        #1 0x55a9901006eb in ByteViewText::drawLine(QPainter*, int, int) ui/qt/widgets/byte_view_text.cpp:370:35
        #2 0x55a9900fd109 in ByteViewText::paintEvent(QPaintEvent*) ui/qt/widgets/byte_view_text.cpp:217:9
        ...
        #50 0x55a98e9fd32a in PacketList::contextMenuEvent(QContextMenuEvent*) ui/qt/packet_list.cpp:614:15
        ...

    0x7fda91642800 is located 0 bytes inside of 3038371-byte region [0x7fda91642800,0x7fda919284a3)
    freed by thread T0 here:
        #0 0x55a98e65fd99 in __interceptor_realloc (run/wireshark+0x1019d99)
        #1 0x7fdac6e1bb88 in g_realloc /build/src/glib/glib/gmem.c:164
        #2 0x7fdaac12c908 in wtap_read_packet_bytes wiretap/wtap.c:1368:2
        #3 0x7fdaabf01e5a in libpcap_read_packet wiretap/libpcap.c:789:7
        #4 0x7fdaabef887d in libpcap_seek_read wiretap/libpcap.c:690:7
        #5 0x7fdaac12d5f5 in wtap_seek_read wiretap/wtap.c:1431:7
        #6 0x55a98e6c8611 in cf_read_record_r file.c:1566:8
        #7 0x55a98e6c88c5 in cf_read_record file.c:1576:10
        #8 0x55a98ea0b725 in PacketList::getFilterFromRowAndColumn() ui/qt/packet_list.cpp:1041:14
        #9 0x55a98e94e4a1 in MainWindow::setMenusForSelectedPacket() ui/qt/main_window_slots.cpp:1175:39

    previously allocated by thread T0 here:
        #0 0x55a98e65fd99 in __interceptor_realloc (run/wireshark+0x1019d99)
        #1 0x7fdac6e1bb88 in g_realloc /build/src/glib/glib/gmem.c:164
        #2 0x7fdaac12c908 in wtap_read_packet_bytes wiretap/wtap.c:1368:2
        #3 0x7fdaabf01e5a in libpcap_read_packet wiretap/libpcap.c:789:7
        #4 0x7fdaabef887d in libpcap_seek_read wiretap/libpcap.c:690:7
        #5 0x7fdaac12d5f5 in wtap_seek_read wiretap/wtap.c:1431:7
        #6 0x55a98e6c8611 in cf_read_record_r file.c:1566:8
        #7 0x55a98e6c88c5 in cf_read_record file.c:1576:10
        #8 0x55a98e6e0bde in cf_select_packet file.c:3777:8
        #9 0x55a98e9ea2ff in PacketList::selectionChanged(QItemSelection const&, QItemSelection const&) ui/qt/packet_list.cpp:420:9

This should be fixed now by I4f1264a406a28c79491dcd77c552193bf3cdf62d,
but let's avoid the shared buffer. It's not exactly a hot code path
anyway.

Change-Id: I548d7293a822601f4eb882672477540f066a066b
Reviewed-on: https://code.wireshark.org/review/29921
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-30 16:30:04 +00:00
Gerald Combs cd95e197ca Start renaming SSL to TLS.
Rename the "ssl" protocol to "tls" and add an "ssl" alias. Prefer "TLS"
over "SSL" in user interface text and in the documentation.

Fix the test_tls_master_secret test while we're here.

Bug: 14922
Change-Id: Iab6ba2c7c4c0f8f6dd0f6d5d90fac5e9486612f8
Reviewed-on: https://code.wireshark.org/review/29649
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-09-13 22:37:52 +00:00
Stig Bjørlykke 7d7175a130 Qt: Restore column visibility when loading packets
Always restore column visibility when loading packets to avoid some
situations where the column hidden state was incorrect.

This fixes the following scenario:
 - Apply a column and hide it using the column popup menu
 - Apply another column and remove it using the column popup menu
 - Close and reopen the capture file
 - Observe the hidden column is shown, but with wrong width

Change-Id: I00531907b2383c6605a2d62e8243092906037d0c
Reviewed-on: https://code.wireshark.org/review/29516
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-09-10 07:26:00 +00:00
Stig Bjørlykke 5af98d9be5 prefs: Remove prefs.gui_use_pref_save
This setting was only used in GTK.

Change-Id: If184c61e4e081992e517f480b4faf129b81508c1
Reviewed-on: https://code.wireshark.org/review/29388
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-09-02 18:36:25 +00:00
Stig Bjørlykke f61cb129a9 Qt: Improve fetching preferences from the packet list.
The Lua fake item will not give preferences for the last protocol
in the packet, so avoid this. The Lua fake item is always added when
having a Lua post-dissector, even if the post-dissector does not add
any elements to the tree.

Change-Id: I43427bf522a32feebd44f192888e73b5607e6fff
Reviewed-on: https://code.wireshark.org/review/29377
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-09-01 11:19:54 +00:00
Peter Wu 8da4777440 Qt: fix memleaks on opening a context menu
FrameInformation was never deallocated, leaking the whole pinfo scope.
Fix a dealloc-alloc-mismatch (packet_data_ was g_memdup'd). Attach the
DataPrinter menu actions to the action group instead of the singleton
DataPrinter instance, this enables freeing the actions when the submenu
is gone rather than clearing this at program exit.

Reported by ASAN.

Change-Id: If13af94a60b07b0e52973ccc5c437ef987bfb394
Fixes: v2.5.0rc0-1627-g8a6ea0e454 ("Qt: Further cleanup ByteView")
Reviewed-on: https://code.wireshark.org/review/27844
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-30 08:20:42 +00:00
Peter Wu 7a59406e78 Qt: fix memleak in PacketList::contextMenuEvent
Change-Id: I925d2e1529a70aaf403896a4d7df3f491265916d
Fixes: v1.99.7rc0-225-g26dacfc8c3 ("Qt: Add protocol preferences menus.")
Reviewed-on: https://code.wireshark.org/review/27831
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-30 08:19:06 +00:00
Paul Zander 53dfec9b99 Qt: Configure the selection color via the preferences
The active selection color and inactive selection color can be configured via Edit / Preferences / Font and Colors
There are 3 styles that can be used for the selection color:
Default: legacy behavior
Flat: Use background and foreground color with no gradient.
Gradient: Use background and foreground color with a gradient.

Bug: 14714
Change-Id: Ieca293bb9830d2c5702949d0459d1d6f679e41e4
Reviewed-on: https://code.wireshark.org/review/27701
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-05-25 11:07:01 +00:00
Alexis La Goutte 2fd5f93188 Qt: fix issue found by PVS Studio (V519)
The 'dp_ratio' variable is assigned values twice successively

Change-Id: Iac3bcefe61c3fe2f628f046ee6f77377fe7dd775
Reviewed-on: https://code.wireshark.org/review/27598
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-17 04:24:28 +00:00
Stig Bjørlykke 612fb778f5 Qt: Update frame selected in several cases
Ensure that frameSelected(0) is emitted when not having a proto tree
field selected because of:

 1. No match when trying to restore selected field
 2. Search selects a packet with no field to select
 3. Current packet is deselected

This will disable functionality which requires a selected field
and updates the status bar according to selected field.

Bug: 14658
Change-Id: I158fae4f26c02f718cee0030ef9e38b597876381
Reviewed-on: https://code.wireshark.org/review/27395
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-05-09 06:20:58 +00:00
Paul Zander 00776f832a Qt: Make the selected packet in the packet list more clear.
When using coloring rules the selected packet is sometime hard to recognize. The stylesheet of the packet list is extended for this.

Bug: 14621
Change-Id: Ied465e0e211b3c11e69cb71f89988eb45622dd72
Reviewed-on: https://code.wireshark.org/review/27141
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-30 11:14:44 +00:00
Gerald Combs 1d030928ef Remove some GTK+-only code.
Change-Id: Ic2498c7acd6a1a522be45094148402ee34a6b4d1
Reviewed-on: https://code.wireshark.org/review/26958
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>
2018-04-17 03:44:47 +00:00
Stig Bjørlykke 5e7cd2dfc6 Qt: Rename packet_list_enable_color
Rename packet_list_enable_color() to packet_list_recolor_packets()
to reflect what it does.

Remove the call from where it's not needed.

Change-Id: I55dd1a9af8f5b1dbd83b06136a5bbcfddea06cdb
Reviewed-on: https://code.wireshark.org/review/26959
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-16 20:16:00 +00:00
Gerald Combs 6208796b9e Qt: Disable collapsible children in the main window.
Set the childrenCollapsible property to false in the main window
splitters. Set the minimum size for the packet list, proto tree, and
byte views to a small (one em), consistent, and nonzero value. Otherwise
it's easy to inadvertently end up with a hidden main window view.

Bug: 14478
Change-Id: I07a352cf2cf0375829ae2e0cb53b2a7d717dbb7d
Reviewed-on: https://code.wireshark.org/review/26847
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2018-04-11 01:21:46 +00:00
Roland Knall 3a928f1f87 Qt: Remove checks for version below 5.2
This stops the main source from being buildable by Qt 4.x

Change-Id: I61edbae04ac2b3bf0ae8ee8e09d335083945c176
Reviewed-on: https://code.wireshark.org/review/26756
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-04-05 18:48:57 +00:00
Gerald Combs bbe5fc1028 Epan+Qt: Invalidate cached column strings.
Add col_data_changed, which checks to see if we have updated column
info. Add col_append_frame_number, which adds a frame number and sets
col_data_changed. Call col_append_frame_number instead of
col_append_fstr from some dissectors.

Add PacketListRecord::invalidateAllRecords, which invalidates any cached
record data. Add PacketListModel::invalidateAllColumnStrings which calls
invalidateAllRecords and signals that our data has changed. Call
invalidateAllColumnStrings when we have new name resolution or column
information.

Bug: 11414
Bug: 11468
Change-Id: I2671594a722f4f9436fe1df84d43489a148e0cee
Reviewed-on: https://code.wireshark.org/review/26373
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-03-15 12:19:23 +00:00
Graham Bloice bf4c2fd82b Windows: Remove cruft for unsupported versons
Remove all the existing LoadDLL\GetProcAddress combinations
that allowed conditional Win32 API usage if supported on the
running OS version.

All the required functions are present in the versions we support.

Change-Id: Ibc43e51cefcd1c7562d4e251784362509f224ed6
Reviewed-on: https://code.wireshark.org/review/26215
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2018-03-01 22:32:04 +00:00
Peter Wu 61d033645d Qt/USB: Allow USB src/dst addresses to be selected for columns
Make "Prepare a Filter" from the Source and Destination columns work for
USB source and destination address, this value must be quoted as well.

Change-Id: Ib7a772050c204e716781cc27f9eddbdb7971e547
Reviewed-on: https://code.wireshark.org/review/26096
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-27 09:09:35 +00:00