Commit Graph

21 Commits

Author SHA1 Message Date
Tomasz Moń d1f7aa5acb
Qt: Do not spin new event loop on menu show
There is no need for nesting event loops when showing menus. Show menus
asynchronously to limit possibilities of hard to debug problems related
to re-entering event loop.
2022-07-03 13:41:30 +02:00
Roland Knall b4e041a619 Qt: Fix packet diagram cleanup
After selecting field values to be shown or not shown
residues of the former diagram may reside until the next
scroll event. This updates the viewport to trigger the
paintEvent earlier.

Fixes #17997
2022-05-17 11:37:33 +02:00
Gerald Combs d8008cb89e Qt: Split MainWindow into WiresharkMainWindow and LogwolfMainWindow.
Rename the main_window class and UIC files to wireshark_main_window and
the MainWindow class to WiresharkMainWindow. Copy wireshark_main_window
/ WiresharkMainWindow to logwolf_main_window / LogwolfMainWindow.

Remove the Wireless menu from Logwolf.
2022-04-04 09:39:27 -07:00
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
Gerald Combs eda588d1a6 Revert "Qt: fix memory leaks found by Visual Leak Detector"
This reverts commit c2edb44a9a.

While we should definitely avoid leaking memory, this runs up against
the Qt code's assumption that it will always have valid epan data.

Fixes #17590.
Fixes #17719.
2021-11-10 11:48:26 -08:00
Tomasz Moń c2edb44a9a Qt: fix memory leaks found by Visual Leak Detector
Set PacketDiagram as parent of QGraphicsScene so the scene is destroyed
together with PacketDiagram.

Dynamically allocate WiresharkApplication and explicitly call its
destructor when no longer needed. This results in deletion of
FunnelAction objects created in register_menu_cb() and QAction objects
created in TapParameterDialog::registerDialog(). For some reason, when
breakpoint was set inside WiresharkApplication destructor it would not
get triggered on exit, and so the child objects would get reported as
memory leaks.

Delete main window and application only after epan_cleanup(). This makes
lua plugins actually call ops during cleanup (e.g. destroy_text_window)
and makes it possible to free the memory allocated in FunnelStatistics
constructor.
2021-08-29 08:50:57 +00:00
Stig Bjørlykke 44a615e854 Qt: Give a directory to wsApp->setLastOpenDir()
Use wsApp->setLastOpenDirFromFilename() to convert a filename
to a directory name before calling wsApp->setLastOpenDir().

This will ensure to always store a directory instead of a filename
in the recent gui.fileopen_remembered_dir.
2021-06-07 13:52:59 +00:00
Gerald Combs b1d18e41db Qt: Add a recent item for packet diagram field values.
Fixes #16957.
2020-10-28 20:11:25 +00:00
Gerald Combs d2da4c7afb Qt: Use … instead of UTF8_HORIZONTAL_ELLIPSIS in translated strings.
Run

$ gsed -i -e 's/\(tr *(.*".*\)" *UTF8_HORIZONTAL_ELLIPSIS/\1…"/' $( ag -l 'tr *\(.*" *UTF8_HORIZONTAL_ELLIPSIS' )
$ gsed -i -e 's/\(tr *( *\)UTF8_HORIZONTAL_ELLIPSIS *"/\1"…/' $( ag -l 'tr *\( *UTF8_HORIZONTAL_ELLIPSIS *"' )

in ui/qt. As discussed in #16812, the UTF8_ macros were required at one
time because we only allowed ASCII in our source code. However, that
requirement has since been relaxed and Qt's translation framework
doesn't handle concatenating strings and macros very well.
2020-10-01 06:40:14 +00:00
Gerald Combs c34bc0cf4c Qt: Handle palette changes in the packet diagram.
Handle ApplicationPaletteChange (e.g. dark / light mode switching)
events in the packet diagram. Add resetScene() and call it where needed.
2020-09-28 23:56:08 +00:00
Gerald Combs d1f29ee338 Qt: Fix the packet diagram start offset arithmetic.
572c1ae5a3 introduced a bug that allowed for negative diagram item start
values. Fixup our arithmetic so that that doesn't happen.
2020-09-26 12:23:54 -07:00
Gerald Combs 8b9ec1b5a5 Qt: Reset the packet diagram between captures.
QGraphicsScene::clear() doesn't reset the scene's the size and scroll
position. This is useful when we switch between packets, but we should
do a hard reset when switching between captures.
2020-09-26 11:34:21 -07:00
Gerald Combs 572c1ae5a3 Qt: Collapse packet diagram items correctly.
Move our overlap and gap adjustments to the first pass and offset our
item start bits based on our collapsed length. Collapse 64-bit items
correctly.
2020-09-25 00:57:58 +00:00
Gerald Combs 3426b25621 Qt: Make sure the packet diagram's FT_NONE label exists.
Gap items have a null field_info pointer, so set "Unknown" as the
default representation string and fill it in after we've established
that field_info is valid. Closes #16851.
2020-09-15 19:40:35 +00:00
Ronnie Sahlberg 72921f8867 packet_diagram: use a better label for FT_NONE items
FT_NONE items all have the name "Text Item" which makes it look
poor in the packet diagram.
For these fields, switch to use ->representation insead of ->name
to make these fields look more meaningful.

SMB2 is a protocol that consists of two FT_NONE expansions,
one for the Header and a second for the actual Command.
This makes packet diagram show this much nicer.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2020-09-15 03:31:44 +00:00
Gerald Combs 3b9656780b Qt: Don't fill in the packet diagram if it's not visible.
Don't bother filling in our scene if the widget isn't visible.
2020-09-15 03:03:11 +00:00
Martin Kaiser adfded498a Qt: FieldInformationGraphicsItem: fix a memory leak
FieldInformationGraphicsItem's constructor allocates a FieldInformation
which is never freed.

Opening MTP3 statistics for any capture file causes memory leaks.

Indirect leak of 1120 byte(s) in 10 object(s) allocated from:
    #0 0x55e32cf19a42 in operator new(unsigned long)
    #1 0x7f4cca598661 in QObject::QObject(QObject*)
    #2 0x55e32d5f397f in PacketDiagram::addDiagram(_proto_node*)
...

Indirect leak of 400 byte(s) in 10 object(s) allocated from:
    #0 0x55e32cf19a42 in operator new(unsigned long) ...
    #1 0x55e32d5fce04 in FieldInformationGraphicsItem::FieldInformationGraphicsItem(...)
    #2 0x55e32d5f397f in PacketDiagram::addDiagram(_proto_node*)
...

Add a FieldInformationGraphicsItem destructor and delete FieldInformation there.
2020-09-14 21:51:11 +00:00
Gerald Combs 97a6146d81 Qt: Fixup packet diagram tick label placement.
Try to place the labels one space away from the nearest big tick mark.
2020-09-12 22:00:50 +00:00
Gerald Combs 6a08695e3e Qt: Remove an unused value.
Remove an unused value in packet_diagram.cpp. Fixes CID 1466402.
2020-09-09 04:56:33 +00:00
Gerald Combs b1753ce511 Qt: Add debugging ifdefs for the packet diagram.
The PacketDiagram widget prints debugging information about items that
it skips and resizes. Make this conditional, similar to what we do
elsewhere.

Bug: 16769
Change-Id: Id7fbedbdac6096cbca8d997688d489eac4729f52
Reviewed-on: https://code.wireshark.org/review/38121
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>
2020-08-11 17:38:23 +00:00
Gerald Combs 9b07412277 Qt: Add a packet diagram view.
Add a new top-level view that shows each packet as a series of diagrams
similar to what you'd find in a networking textook or an RFC.

Add proto_item_set_bits_offset_len so that we can display some diagram
fields correctly.

Bugs / to do:
  - Make this a separate dialog instead of a main window view?
  - Handle bitfields / flags

Change-Id: Iba4897a5bf1dcd73929dde6210d5483cf07f54df
Reviewed-on: https://code.wireshark.org/review/37497
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>
2020-08-10 18:17:50 +00:00