Commit Graph

66 Commits

Author SHA1 Message Date
Gerald Combs 80de95ca71 Qt: Split MainApplication out from WiresharkApplication.
Move WiresharkApplication.{cpp,h} to MainApplication.{cpp,h}. Add back
WiresharkApplication as a thin superclass of MainApplication, similar to
LogsharkApplication. Change all of our wsApp references to mainApp. We
will likely have to change many or most of them back, but that's a
commit for another time.
2022-04-04 09:39:27 -07:00
Roland Knall 19f3a82ff8 Qt: ByteView make hover configurable
Allow the hover selection to be either configured via context menu
or by pressing the Ctrl key while moving the mouse. The configuration
is stored via profile
2021-09-13 15:33:46 +00:00
Gerald Combs d3f17ee08a Remove modelines in ui/qt.
Remove the editor modeline blocks from most of the source files in ui/qt
by running

    perl -i -p0e 's{ \n+ /[ *\n]+ editor \s+ modelines .* shiftwidth= .* \*/ \s+ } {\n}gsix' $( ag -g '\.(cpp|h)' )

then cleaning up the remaining files by hand.

This *shouldn't* affect anyone since

- All of the source files in ui/qt use 4 space indentation, which
  matches the default in our top-level .editorconfig

- The one notable editor that's likely to be used on these files and
  *doesn't* support EditorConfig (Qt Creator) defaults to 4 space
  indentation.
2021-03-08 18:11:32 +00:00
Stig Bjørlykke b8a330d2d5 Qt: Update ByteView recent settings on all tabs
The ByteView recent settings are common for all tabs. Ensure all
tabs are updated when display format or character encoding is changed.

This fixes an issue where the row_width is wrong and the menu action
checkmarks are out of sync after switching ByteView tab.

Change-Id: Ied25ac41467143f37327ccadcb821262eb86ef0a
Reviewed-on: https://code.wireshark.org/review/37655
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-07-03 06:11:56 +00:00
Stig Bjørlykke 1f6449c05d Qt: Fix a memory leak in ByteViewTab
FieldInformation::parentField() allocated a new FieldInformation,
so ensure to delete this when done.

Change-Id: Id0f538cc696551ec47169103be823eb1e55d1777
Reviewed-on: https://code.wireshark.org/review/36823
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2020-04-13 13:29:15 +00:00
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
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
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
Peter Wu 29fbbfb3d3 Qt/ByteViewTab: document potential pitfall
If ByteViewTab is related to a use-after-free crash, then the issue is
probably related to the backing buffer becoming invalid. Document this.

Change-Id: I7f7c8daaf86b42f00b7886de54507d425e5312f6
Reviewed-on: https://code.wireshark.org/review/29924
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-03 03:52:43 +00:00
Stig Bjørlykke cb002c597a Qt: Avoid crash for ByteViewTab with 0 bytes
A ByteViewTab with 0 bytes is not useful, but may happen.
The crash could be reproduced with the following Lua code:

  local t = ByteArray.new():tvb()

Change-Id: I256fd7fc2b91aa3c1161c46558c647308a3d564b
Reviewed-on: https://code.wireshark.org/review/29383
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-09-02 18:21:32 +00:00
Stig Bjørlykke 14720ace06 Fix comment end after SPDX identifier
Move */ to a separate line below the SPDX identifier.

Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f
Reviewed-on: https://code.wireshark.org/review/27211
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-01 06:56:37 +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
Peter Wu 9198448f9d Qt: fix crash in packet dialog on changing selection
"((capture_file_t *)cap_file_)->edt" is documented in cfile.h to cover
the currently selected packet (in the packet list). But in the packet
dialog, the packet selection is irrelevant and the data from a different
dissection tree must be used.

Change-Id: Ieaea3cf862d47540e7f6b6c84c1a2fa6945a877b
Fixes: v2.5.0rc0-1532-g56a130a152 ("ByteViewText: Remove epan dependancy")
Bug: 14246
Reviewed-on: https://code.wireshark.org/review/25437
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-02-14 08:03:10 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Dario Lombardo e52172c775 Qt: use SPDX identifiers.
Change-Id: I111945c08f99818c249a868c12d9a7b3a3df64b3
Reviewed-on: https://code.wireshark.org/review/25563
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-02 13:39:36 +00:00
Gerald Combs c84b0aeead Qt: More byte view and proto tree fixes.
47e1798762 broke byte view highlighting when selecting a proto tree
item. Switch back to emitting fieldSelected from selectionChanged. Force
a new selection in selectedFieldChanged, which does what we were trying
to do in 47e1798762.

Clear our marked byte offset in the byte view when we mark a field. Emit
byteSelected whenever we click the mouse.

Don't highlight anything when a tree item is deselected. Deselect a tree
item if we click on something that's not a byte in the byte view.

Change-Id: Ibf419ccb005d69f733b2fe12ce674e1fe504bb96
Reviewed-on: https://code.wireshark.org/review/25541
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-02-01 14:04:25 +00:00
Gerald Combs 0c7bbc7536 Qt: Avoid a potentially large memdup.
Use QByteArray::fromRawData + tvb_get_ptr to create our ByteViewText
data instead of tvb_memdup. If our tvb lifetime is shorter than our
ByteViewText lifetime then that's a bug.

Change-Id: Iede275578a1493b8658308e0778f7f0799d6c6cd
Reviewed-on: https://code.wireshark.org/review/25534
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-01 02:05:06 +00:00
Gerald Combs 3efcc9bd53 Qt: Create byte views at the proper zoom level.
Add a zoomed argument to WiresharkApplication::monospaceFont so that we
can easily fetch the font at its current zoom level. Set the zoomed font
when we create new ByteViewTexts.

Change-Id: I1293f206e37bb798247b1ac4b314fdfe88d4c55c
Reviewed-on: https://code.wireshark.org/review/25371
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-01-21 14:19:10 +00:00
Gerald Combs d1254247b7 Qt: ByteViewText hover fixes & updates.
Add back field highlighting during hover.

Instead of marking hovered bytes using an underline+overline, draw a
border rect.

Change-Id: I574dd074cfa021ac0dec3cdea6c5f9b0b4da6d0e
Reviewed-on: https://code.wireshark.org/review/25348
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-01-17 11:37:49 +00:00
Dario Lombardo 282436a762 Qt: rename index to tab_index to pacify checkAPI.
Change-Id: Ib171c835ca1e2a3b00ac6d6d495b41c70084b52f
Reviewed-on: https://code.wireshark.org/review/25325
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-15 12:21:11 +00:00
Dario Lombardo 43833239fc Qt: change obsolete qVariantFromValue into QVariant::fromValue.
Change-Id: I767b06c0e316347cdb28b769f1032e6d44cba45b
Reviewed-on: https://code.wireshark.org/review/25321
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-15 12:20:32 +00:00
Gerald Combs 6f84e1b5f3 Qt: Fixup fieldSelected behavior.
Check the originating sender of fieldSelected in a couple of places so
that we don't re-emit it. This fixes an issue that was keeping the byte
view from marking the protocol.

Remove duplicate signal+slot connections in MainWindow.

Remove an unused member function.

Change-Id: Ia876bb4117d1e30a56f4c335a65f6976c8058f9d
Reviewed-on: https://code.wireshark.org/review/25077
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-31 08:48:22 +00:00
Gerald Combs bdb6baa740 Qt: Switch ProtoTree to a treeview+model.
Add a ProtoTreeModel and use it in ProtoTree. This should make the UI
more responsive when we have lots of items in the tree.

Change-Id: Id26e6bcff84663867a8da17fd9ae86ff639b633f
Reviewed-on: https://code.wireshark.org/review/24774
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>
2017-12-15 20:58:14 +00:00
Gerald Combs be8a400053 Qt: Use QTextLayout in ByteViewText.
Use QTextLayout to draw each line in ByteViewText instead of drawing
fragments ourselves. Build our pixel-to-byte-offset map when we draw our
first line, which should hopefully make it more accurate. This should
fix layout and hover issues on some systems.

Start moving common code to DataPrinter.

Mark prefs.gui_hex_dump_highlight_style GTK+ only.

Bug: 11844
Change-Id: Ifda16ae7dc1a5ea22570c0bfd0eb20cee621bfc9
Reviewed-on: https://code.wireshark.org/review/24717
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>
2017-12-07 19:00:35 +00:00
Guy Harris ccc55bc80c Put the structure of a capture_file back in cfile.h.
The split isn't necessary now that epan no longer uses the capture_file
structure.

Change-Id: Ia232712a2fb5db511865805518e8d03509b2167f
Reviewed-on: https://code.wireshark.org/review/24693
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-04 05:35:36 +00:00
Guy Harris eb8ffb74e2 Use cfile.h to define the capture_file type.
Have cfile-int.h declare the structure, and use it in files that
directly access the structure.

Have cfile.h just incompletely declare the structure and include it
rather than explicitly declaring it in source files or other header
files.

Never directly refer to struct _capture_file except when typedeffing
capture_file.

Add #includes as necessary, now that cfile.h doesn't drag in a ton of

Change-Id: I7931c8039d75ff7c980b0f2a6e221f20e602a556
Reviewed-on: https://code.wireshark.org/review/24686
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-03 18:54:37 +00:00
Peter Wu bb4726abf2 Qt: fix crash when selecting field with composite data
The HTTP2 decompressed headers tab is composed from multiple TVBs, these
have a null "real_data" pointer. Do not access it directly but use an
accessor which Does The Right Thing™.

Change-Id: Ib974fed9782d60aa2b91e3e712ba737000b79b4b
Fixes: v2.5.0rc0-1627-g8a6ea0e454 ("Qt: Further cleanup ByteView")
Reviewed-on: https://code.wireshark.org/review/24658
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Alexander Gryanko <xpahos@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-11-30 02:53:34 +00:00
Roland Knall 18d49f467d Qt: Properly reset the byteview
Reset the byteview on every load of a capture file, and on every
start/reset of a capture

Change-Id: I0edd30ffddc64484bc6f009d99dfc6fc1a3ceb59
Reviewed-on: https://code.wireshark.org/review/24468
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>
2017-11-18 07:23:48 +00:00
Stig Bjørlykke 3105382bed Qt: Show ByteView for first packet
Change-Id: Ie5b09f0ac8db0adb999633f3367339b8f50eabe9
Reviewed-on: https://code.wireshark.org/review/24395
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-12 19:47:12 +00:00
Roland Knall e13e2df9a1 Qt: Rename packetSelection to frameSelected
In order to consolidate the interfaces between certain parts of the UI,
the signal emitted after a frame change has occured, has to include the
number of the frame. This led to two signals for frame change, and therefore
packetSelection is to be removed.

Change-Id: I24e0e0890291d2243935b0c48387beb66904bfa3
Reviewed-on: https://code.wireshark.org/review/24377
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-11-12 17:18:44 +00:00
Peter Wu bce5b50f73 Qt: Fix use-after-free crashes when changing packets
QTabWidget::clear() is documented to remove all tabs without deleting
them. As a result, findByteViewTextForTvb will still find ByteViewText
children with freed tvbs. Fix this by deleting the tabs too.

Change-Id: I5b4fdc7154a3804e3bd5f360749e95d178ffe580
Bug: 14199
Fixes: v2.5.0rc0-1532-g56a130a152 ("ByteViewText: Remove epan dependancy")
Reviewed-on: https://code.wireshark.org/review/24339
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-11 08:59:28 +00:00
Roland Knall 8a6ea0e454 Qt: Further cleanup ByteView
This further separates ByteView and the rest of the system.

Using FieldInformation and DataPrinter, this is the final cleanup
of the ByteViewTab

Change-Id: If41521167527cf5664c2564cdd0d45fea0f3f612
Reviewed-on: https://code.wireshark.org/review/22783
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-11-08 20:20:31 +00:00
Roland Knall 649c81b83c Qt: ByteViewTab Fix tabs creation
Fix creation of tabs

Change-Id: I11b22a3964f7c25c0c88b8ecd4eec1ad480fe800
Reviewed-on: https://code.wireshark.org/review/24202
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-10-31 14:45:21 +00:00
Roland Knall 56a130a152 ByteViewText: Remove epan dependancy
Remove all dependancy for the byte_view_text from the epan system,
and therefore cleanly separate data and display for further separation
of dissection and view

Change-Id: Id1ee91b93da4511afa95f24da4cbbf39cbb89b1f
Reviewed-on: https://code.wireshark.org/review/24050
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-10-31 11:42:21 +00:00
Roland Knall ddfc1d37cc Qt: Move utils to separate utils directory
Following the move for widgets directory, moving utils
to the utils directory. Guidelines for this directory are:

 - Generic use but not a widget
 - Utility functionality used by many classes
 
 Note: additionally all includes affected by this move have been changed
 to absolute path includes, instead of relative ones.

Change-Id: I019ae4b6e6f6d06a5745a63ed195edbd36fb936b
Reviewed-on: https://code.wireshark.org/review/22602
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-07-26 10:11:55 +00:00
Stig Bjørlykke 7bacf534d8 Qt: Set tooltip on ByteViewTab
Set the tab name as tooltip on ByteViewTab.  This is useful when
having many tabs on a small screen.

Change-Id: Idb375f0b7d510ecb9b42cfccc6ebc4dd798f463b
Reviewed-on: https://code.wireshark.org/review/22549
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-07 23:16:30 +00:00
Roland Knall 3df81a0550 Qt: Remove unneccessary Q_DECLARE_METATYPE
Remove unnecessary Q_DECLARE_METATYPE macros and replace calls
to QVariant conversions with VariantPointer where necessary

Change-Id: Ia4690590095f930bf94644197de7fa30b00ee7ec
Reviewed-on: https://code.wireshark.org/review/19611
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-01-12 16:04:00 +00:00
Gilbert Ramirez e8e193694a Qt: Option to copy bytes to clipboard as Escaped String
Some users need to copy the bytes to a Python script for
sending out through a raw socket. While they can modify a
plain hex dump, having Wireshark copy directly as a Python
string makes their work easier. This format also works
with Bash, so it is called "Escaped String". E.g.:

	"\x55\xb5\xd4\x67\x03"

Change-Id: I0b6a5eb2e348f686397afda76095aaa2fb85c18d
Reviewed-on: https://code.wireshark.org/review/17696
Petri-Dish: Gilbert Ramirez <gram@alumni.rice.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-09-15 04:13:59 +00:00
Peter Wu 4de738f5a7 Fix byte pane not showing up in Packet dialog
When a packet dialog is being constructed, the layout is apparently not
fixed yet and the byte view is technically not visible. Fix the hidden
byte pane by not hiding it when it is not (yet) visible.

Bug: 11760
Change-Id: I0494fa16a5ed89ff31f934ba682a6bb884cc0e2e
Reviewed-on: https://code.wireshark.org/review/14713
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-03-31 07:29:12 +00:00
Stig Bjørlykke b5ac91399c Qt: Select matching tree item and bytes in Find Packet
Highlight the matching tree item and matching packet bytes when
doing a Find Packet.  Added cf->search_len to correctly highlight
the matching bytes when doing a regex search.

Bug: 12157
Change-Id: I84fbdb9b43be4355e24aff3cf5f8850f1119e2bf
Reviewed-on: https://code.wireshark.org/review/14086
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-02-23 18:30:48 +00:00
Gerald Combs 26c933b8cc Fix binary data copying.
As the QClipboard::setMimeData documentation says, "Ownership of the
data is transferred to the clipboard." Allocate the mime data object
accordingly.

Note the results of trying to paste into hex editors on Windows.
Frhed works. Hex Editor Neo and HxD do not.

Change-Id: I46691ba95bf1f5c38817cd42ded73e8e67e4ee97
Reviewed-on: https://code.wireshark.org/review/9837
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-07-31 20:50:05 +00:00
Gerald Combs 16b048d34b Packet list and detail context menu updates.
Add some missing items to the packet list and detail "Copy" context
menus. Don't nest the "Copy" items so deeply. Add YAML to the supported
summary formats.

Note that "Copy as Binary" copies to the clipboard as
application/octet-stream, which is a) arguably correct, and b) not very
useful. Fixes welcome.

Enable and disable packet detail context menu items from a set of
booleans similar to the packet list.

Change-Id: Iaa931c766aa476c33f27de089e5c4dbaf9ce74d6
Ping-Bug: 9320
Bug: 10831
Reviewed-on: https://code.wireshark.org/review/9825
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-07-30 19:13:38 +00:00
Gerald Combs 5265bc3fce Make sure the byte view maintains visibility.
In ByteViewTab::clear, make sure we stay hidden or visible as
appropriate.

Bug: 11313
Change-Id: I12fa5169e840dbc4d27b6525fe6be72e13acce5d
Reviewed-on: https://code.wireshark.org/review/9155
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-06-25 21:21:23 +00:00
Evan Huus 69cdfe9410 Remove another batch of deprecated tvb_length calls
Change-Id: Icfdde38e40cca05d0705a081153a4ea3e8782ee7
Reviewed-on: https://code.wireshark.org/review/9086
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-24 04:30:35 +00:00
Gerald Combs 4ba148771b Qt: Always draw a byte view.
When we clear the ByteViewTab add an placeholder ByteViewText.

Change-Id: I9fbcd7e609c084d5724a30f80aa141b59ab1c0a1
Reviewed-on: https://code.wireshark.org/review/8688
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-05-30 00:05:38 +00:00
Alexis La Goutte 77f87b7a01 Byte view tab (Qt): Fix Dead Store (Dead assignement/Dead increment) warning found by Clang
Remove unused bmask variable

Change-Id: I44613f1d949dbaf8e559b3bfb2196609d821c4f3
Reviewed-on: https://code.wireshark.org/review/7496
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-04-07 18:34:38 +00:00
Peter Wu 6bc138c87a Qt: fix heap use-after-free wrt. data sources
When a different packet is changed, the packet scoped memory for tvbuff
is freed before clearing data source tabs. This results in
heap-use-after free when resizeEvent is called as a result of clearing
tabs for data sources.

Avoid resize events by hiding the tabs.

Caught with ASAN:

    ==18816==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060004cd970 at pc 0x7fffebf46618 bp 0x7fffffffbb10 sp 0x7fffffffbb00
    READ of size 4 at 0x6060004cd970 thread T0
        #0 0x7fffebf46617 in tvb_captured_length epan/tvbuff.c:423
        #1 0x773062 in ByteViewText::updateScrollbars() ui/qt/byte_view_text.cpp:489
        #2 0x76f307 in ByteViewText::resizeEvent(QResizeEvent*) ui/qt/byte_view_text.cpp:197
        ...
        #24 0x9f2348 in ByteViewText::~ByteViewText() ui/qt/byte_view_text.h:46
        #25 0x9f23f5 in ByteViewText::~ByteViewText() ui/qt/byte_view_text.h:46
        #26 0x76b9d6 in ByteViewTab::clear() ui/qt/byte_view_tab.cpp:54
        #27 0x5de685 in PacketList::selectionChanged(QItemSelection const&, QItemSelection const&) ui/qt/packet_list.cpp:477
        ...

    freed by thread T0 here:
        ...
        #5 0x53d763 in cf_select_packet file.c:3827
        #6 0x5ddfa5 in PacketList::selectionChanged(QItemSelection const&, QItemSelection const&) ui/qt/packet_list.cpp:454
        #7 0x7fffe58ec980 (/usr/lib/libQt5Widgets.so.5+0x3bc980)
        #8 0x7fffe4d55dd6 in QItemSelectionModel::selectionChanged(QItemSelection const&, QItemSelection const&) (/usr/lib/libQt5Core.so.5+0x23fdd6)
        ...

Change-Id: I9c1c01398713389de58259d13ebbaddd2d6e5c52
Reviewed-on: https://code.wireshark.org/review/7589
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-08 21:56:42 +00:00
Gerald Combs 8664de017f Qt: Constify a bunch of strings.
Change-Id: I601e429408fc042fc5b18a4750d40e260da47f43
Reviewed-on: https://code.wireshark.org/review/7535
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-05 20:17:29 +00:00
Gerald Combs 770ac9123b Qt: Fix a crash when changing the layout.
Freeze and thaw the packet list when changing the layout. This has the
side effect of clearing the proto tree and byte view, which avoids
reading a bad tvb pointer. Note that we might want to add a cleanup
callback to free_data_sources.

Save and restore the current row. Add CaptureFile::currentRow. Fix a
couple of comparisons in PacketList.

Change-Id: I26f9b97ae5a7cdb4fb6e5e6e675570884900e995
Reviewed-on: https://code.wireshark.org/review/7337
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-24 00:42:22 +00:00
Gerald Combs 931807ea61 Qt: Add the "new packet" window^Wdialog^Wwindow.
Allow persistence across files. Preserve the use of "window" even
though we're really a dialog.

Update ByteViewTab and ProtoTree to support multiple instances.

Remove the need for a cast in frame_data.

Add more forward declarations.

Change-Id: I50d3d9d1455b8ecc158a37218f9e41fe696d5ae2
Reviewed-on: https://code.wireshark.org/review/7086
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-12 23:32:54 +00:00