Commit Graph

216 Commits

Author SHA1 Message Date
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
Gerald Combs 76d92ba7e7 Qt: Updates for 5.15.
Fix the following deprecation issues for Qt 5.15:

Use Qt::WindowFlags() instead of 0 in Qt >= 5.6.

Pass Qt::SkipEmptyParts instead of QString::SkipEmptyParts to QString::split() in Qt >= 5.15.

Use QMultiMap instead of QMap where we were using QMap::uniqeKeys().

Use QCP::Interactions() instead of 0.

Use '\n' instead of QTextStream::endl.

Use QWheelEvent::angleDelta() instead of QWheelEvent::angle().

Change-Id: Ie2d69d3a396c0821c2c34f506ddad6f8e22f7049
Reviewed-on: https://code.wireshark.org/review/37334
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-05-30 06:45:07 +00:00
Guy Harris 464d5688cc Don't build code to handle capturing if we don't have pcap.
Only build the capture information dialog if we're going to support
capturing; otherwise, that dialog never pops up.

Don't include ui/capture.h in ui/qt/wireshark_application.cpp if we
don't have pcap, either; it's not needed, and breaks compilation.

Change-Id: If9a52239fd2c81c37663be8044ecd67f4569d61b
Reviewed-on: https://code.wireshark.org/review/36585
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-03-26 08:33:50 +00:00
Gerald Combs 82032fe375 Qt+Windows: Remove the DBAR check.
Remove the check for Dell Backup and Recovery. The check was hacky and
obnoxious. At this point it's hopefully safe to assume systems with DBAR
installed are either running Windows 7 and no longer supported or have
upgraded to a safer version.

Change-Id: I458172885870edc34ec707a7748280e0eeed59b9
Reviewed-on: https://code.wireshark.org/review/35815
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-01-15 04:48:04 +00:00
Gerald Combs 8b9f718dee Qt: Set AA_DisableWindowContextHelpButton.
Set the Qt::AA_DisableWindowContextHelpButton attribute so that dialogs
don't show a help button in their title bars.

Bug: 16327
Change-Id: Iae1005cc9bd1b426ab6b3144ae54964171322419
Reviewed-on: https://code.wireshark.org/review/35781
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-01-13 20:57:16 +00:00
Gerald Combs 48024b102d Qt: Make sure shortcuts are visible in context menus.
As of Qt 5.10, context menu shortcuts can be hidden:

https://bugreports.qt.io/browse/QTBUG-61181

Add set_action_shortcuts_visible_in_context_menu to qt_ui_utils and call
it for our context menus as needed. For Qt 5.{10,11,12} it calls
QAction::setShortcutVisibleInContextMenu(true).

For Qt 5.13 and later, call
QStyleHints::setShowShortcutsInContextMenus(true) in
WiresharkApplication.

Change-Id: Ie8941951c3a9801b4642f4ce15ac217e37d1300f
Reviewed-on: https://code.wireshark.org/review/35761
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-01-13 18:58:28 +00:00
Orgad Shaneh bc8140be0b Fix build and deprecation warnings with Qt 5.14
Change-Id: I1fa6b5d3105288d25717a9fe4ae93ad3f471aaca
Reviewed-on: https://code.wireshark.org/review/35727
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2020-01-10 08:42:21 +00:00
Jim Young 8fbe28b1f0 profiles: Try to better sync on disk config state
Profile specific column settings are split across the `preferences'
file and the `recent' file.  At any given moment the GUI column
settings held within the `preferences' file and the `recent' file
may be inconsistent with one another and with the GUI itself. These
inconsistencies occur because of when the GUI chooses to write
config changes to disk.

If Wireshark is not shutdown gracefully (for example when killed
or should crash) the column preferences saved on disk may not be
consistent between the current profile's `preferences` and `recent`
files and the most recently used profile may not be recorded within
the `recent_common' file. On restarting Wireshark these config file
inconsistencies can lead to unexpected artifacts.

Normally the column config state saved within the current profile's
`preferences' and `recent` files are made consistent when a
different profile is selected or when Wireshark is closed
gracefully.

This patch set attempts to improve the constancy of the on disk
config state with the GUI state by invoking the functions to write
the `recent' and `recent_common' files in a more timely manner.

Fix a typo while here.

Change-Id: I2af9d9eb2dcf9cc0d422e9840aa05f4f6b1aa086
Reviewed-on: https://code.wireshark.org/review/35407
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jim Young <jim.young.ws@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-12-16 05:34:28 +00:00
Roland Knall c55dd79d2c Qt: Further cleanup goToPacket
Change-Id: Idf98deb3f7c34adff8e58ea243c63aa094234f46
Reviewed-on: https://code.wireshark.org/review/35181
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-21 15:28:23 +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
Gerald Combs 02057200fd macOS: Add support for automatic updates using Sparkle.
Add support for automatic updates using the Sparkle framework. Add
FindSparkle.cmake and associated CMake plumbing. Add a public key and
other info to Info.plist.in. Add ui/macosx/sparkle_bridge.{h,m}, which
wraps the Sparkle API. Make code that's specific to WinSparkle
Windows-only.

Add Sparkle installation steps to the macos-setup scripts. Sparkle
prints a warning if your bundle is unsigned (which is the case during
development) so disable installing it by default.

Updating here takes a long time. We might be able to fix that by
shipping our DSYMs separately.

Change-Id: I6cc6671db5657dadc514bda6bf6e1c8bbc9468a5
Reviewed-on: https://code.wireshark.org/review/35090
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-11-15 18:39:04 +00:00
Roland Knall 3c8c392b9d Qt: Cleanup push/pop Infos
Currently push pop is propagated by a massive load of signals
which partly are also propagated through parent objects.

This moves the status handling to WiresharkApplication, also
pathlining future moves to move status to different classes or
use additional methods of status information

Change-Id: Ibcb2c98688f1adf40dce1483f336596ef992bb06
Reviewed-on: https://code.wireshark.org/review/35071
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>
2019-11-12 22:03:23 +00:00
Roland Knall e0ddc7ad9c Qt: Move CaptureEdit to FilterListModel
Move CaptureFilterEdit to FilterListModel and do cleanup

Change-Id: I9fdd37fda5698a3389f9bc4e550f2e56077675ec
Reviewed-on: https://code.wireshark.org/review/34959
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-04 15:45:23 +00:00
Roland Knall 04bb48bf2c Qt: Fix various issues with the bookmark menu
Odering differed from the manage filter expression. Also, managing
filter expressions is called "Filter Button Preferences.." throughout
other functions. And finally it did not properly update the information
about the selected filter, if a new filter was saved or an existing
filter removed.

Change-Id: I005028cd0b741587f4c5f2f39612e36d5d7d6c25
Reviewed-on: https://code.wireshark.org/review/34958
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-04 15:04:01 +00:00
Guy Harris 5cf3fd03f1 HTTPS In More Places, update some URLs.
Change-Id: Ice2e1e2e4d94f6c9da7c651866cfa1a8ac4a31d8
Reviewed-on: https://code.wireshark.org/review/34096
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-27 07:55:36 +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
Mikael Kanstrup b08003309b Remove the periodic interface update in wireless toolbar
The wireless toolbar retrieves the full list of network interfaces
every 1.5 seconds to keep its list of interfaces updated. This
not only adds unnecessary load on the system it also generates
plenty of netlink traffic. When capturing packets on nlmon
interfaces they are flooded with packets generated by Wireshark
itself making it hard to understand the traffic that's really present
on the system.

Remove the periodic interface update and instead listen to network
interface change events and update only when something has changed.

The wireless toolbar need to know all when wireless interfaces are
added/removed, not only whether an interface is 'up' or not so
iface_monitor changes were also necessary.

Bug: 15576
Change-Id: I8fb19fd919dfef1b6b35bf48790b105ecd2b60a8
Reviewed-on: https://code.wireshark.org/review/32350
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-08 07:30:04 +00:00
Roland Knall 57bf7e4347 Qt: Fix memory leak for CaptureEvent
Make the argument to the events a non-memory object

Change-Id: I46d8c24415aa2bc48b2a2d3b1fccffa6956d08b5
Reviewed-on: https://code.wireshark.org/review/26671
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-17 13:16:46 +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
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
Peter Wu 0b49342156 Qt: ensure that taps are invoked on reload/rescan
Invoke the tap draw callback immediately after reloading a capture (or
changing a display filter) rather than waiting for a timer to expire.

Change-Id: I3d1549d1a18c8e173cd29d45f31ce7586e0d70fe
Reviewed-on: https://code.wireshark.org/review/26600
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-03-23 19:41:39 +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
Gerald Combs b5b5f08be1 Qt: Make we shut down cleanly when exiting early.
Add an exit_application() routine that calls wsApp->quit() + exit() in
the Qt UI and exit() in the GTK+ UI. Make sure we call it instead of
exit() when needed.

Bug: 14395
Change-Id: I171b5fd19ce4664db4a2ebb4b8c33e278dcec427
Reviewed-on: https://code.wireshark.org/review/26121
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-03-01 08:44:00 +00:00
Gerald Combs b443d4646e Qt+Windows: Adjust our DBAR check logic.
Don't bother fetching a file's version if its name doesn't match any of
the DBAR DLL list entries. Otherwise we try to open a bunch of DLLs we
don't care about.

Change-Id: Icab11450839195c1259bb307ae88988f52917487
Reviewed-on: https://code.wireshark.org/review/25973
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-22 05:12:03 +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
Stig Bjørlykke 55e74ba841 Qt: Write recent before applying profile changes
The selected profile may be renamed in apply_profile_changes()
so write the recent file before renaming the directory to ensure that
we reload the latest changes.

Change-Id: I8988a00647926d93b0a1903090aadc8c61f1a34e
Reviewed-on: https://code.wireshark.org/review/25516
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-31 04:53:39 +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
Dario Lombardo e80b40adbe extcap: remove conditional compilation.
Change-Id: Ia54bba388755cf27a343fe6d69d244bf1ab897f9
Reviewed-on: https://code.wireshark.org/review/25186
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-08 05:50:15 +00:00
Gerald Combs 0f3aa8522e Qt: Move sized toolbar images to stock_icons.
The sized (WWxHH) icons in the toolbar directory aren't limited to
toolbars. Create a "stock_icons" directory and move them and their
related SVGs there.

Change-Id: I2c1852499594aa738371c79542f24bd3351653bb
Reviewed-on: https://code.wireshark.org/review/25133
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-01-05 03:27:15 +00:00
Dario Lombardo ba3830e03b Qt: add conditional compilation in switches.
Compiling without pcap, the lack of all the cases causes an error.

../ui/qt/main_window_slots.cpp:756:13: error: enumeration values 'Capture',
'Update', and 'Fixed' not handled in switch [-Werror,-Wswitch]
    switch (ev->captureContext()) {
            ^
1 error generated.

Change-Id: I36c0bc854b1d864ebf54ac59ca15743918bc7d2b
Reviewed-on: https://code.wireshark.org/review/25127
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-01-04 13:20:26 +00:00
Roland Knall d5d815189d Qt: Redesign signal/slot concept of capture_file
This is in preparation to make it easier for other classes
to get the right signals from the capture file. Also the decision
on what signals to listen to now resides with the final classes,
not main window, and it no longer needs to be changed if the
statusbar or wsapp needs additional signals.

Change-Id: If366d42b07dc822636404ac44ba2306ec4418b4e
Reviewed-on: https://code.wireshark.org/review/24941
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-12-23 09:41:46 +00:00
Gerald Combs 50be2bde1a Qt: Handle RecentFileStatus destruction manually.
Restore the "deleteLater" behavior removed in 889aacae6e so that we
don't trigger an assert in debug builds.

Move the itemStatusFinished connection to RecentFileStatus while we're
here.

Bug: 14279
Change-Id: I79bc74d77fb3ad970c7c8a71037f680d55eac47c
Reviewed-on: https://code.wireshark.org/review/24875
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>
2017-12-17 23:59:43 +00:00
Gerald Combs 889aacae6e Qt: Update our recent status sooner at startup.
Update our recent file status as soon as we read recent_common.

Run recent stats updates in the global thread pool.

Revert 15a97b5986 since it's no longer needed.

Change-Id: If1b08ea640dfcad26affab5d20c80c90fbf133f2
Reviewed-on: https://code.wireshark.org/review/24862
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-17 08:04:03 +00:00
Gerald Combs 15a97b5986 Qt: Show our recent files earlier.
Show the recent file list before it's been scanned so that the welcome
screen layout will be complete by the time we're done initializing.

Change-Id: I09f0a68c6d36f30e7cdb2958f82af38f52444c34
Reviewed-on: https://code.wireshark.org/review/24849
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-12-16 00:31:40 +00:00
Gerald Combs cf5a58f72a Qt: Initialize QFontDatabase in a worker thread.
QFontDatabase uses an internal list of system fonts which might take a
while to initialize depending on your platform and hardware. On my
notebook here it takes about 45 to 50 ms. Create a worker thread for
QFontDatabase initialization similar to QMimeDatabase.

Change-Id: Ieff683b023537a6c104a80f2611ea1e966b65610
Reviewed-on: https://code.wireshark.org/review/24841
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-12-15 22:07:34 +00:00
Gerald Combs db740987ff Qt: Add and use qUtf8Printable.
Qt 5.4 introduced qUtf8Printable, a convenience macro for converting
QString to a UTF-8 const char *. Add a compatibility definition and
start using it.

Change-Id: I3cf88611b1ed1a34082cb2ba82394954e2e6c461
Reviewed-on: https://code.wireshark.org/review/24828
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-12-14 20:26:52 +00:00
Gerald Combs dd562b503f Qt: Move the MIME init thread to WiresharkApplication.
The Qt 4.8 "Starting a Thread" document at
http://doc.qt.io/qt-4.8/threads-starting.html says,

"Note that you must create the QApplication (or QCoreApplication) object
 before you can create a QThread."

It looks like this changed some time around Qt 5.5 or 5.6, e.g.
https://codereview.qt-project.org/#/c/120793/, but just to be safe move
the MIME database initialization thread to WiresharkApplication. We
start reading the database later than I'd like, but it's still early
enough to make a difference here.

QMimeDatabase was added in Qt 5.0. Add version checks.

Change-Id: Ic80ebb8692e93b1e4aea7a8670f4fcf45e385b29
Reviewed-on: https://code.wireshark.org/review/24512
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-11-20 22:08:09 +00:00
Gerald Combs 658578a5b9 Qt: Initialize QMimeDatabase in a worker thread.
As part of its initialization, QMimeDatabase parses the freedesktop.org
shared-mime-info database, which is a large-ish (2 - 4 MB) XML file.
This takes about 85 - 90 ms here.

We first access QMimeDatabase in our startup sequence when we load the
normal and capture application icons. Create a worker thread that
initializes QMimeDatabase as early as possible and load load the normal
and capture icons as late as possible.

Change-Id: I27e3d65d8ee1308a62d12d3ff7e1b95f82c2e75a
Reviewed-on: https://code.wireshark.org/review/24471
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-11-17 20:26:27 +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
Mikael Kanstrup 5a99830e21 Qt: Free dynamic menu actions at shutdown
Some menu actions registered at startup are not freed at shutdown
making Valgrind complain. Fix by clearing the lists holding them
and making sure all actions have a parent to free them.

Bug: 14071
Change-Id: I8d99d062d394a7262b0f9b7ddea4ed71049636ac
Reviewed-on: https://code.wireshark.org/review/23793
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-05 04:21:46 +00:00
Jens Kilian e9b8a5839f Qt: Fix errors when compiling for Qt4.
This allows Wireshark to be built on RedHat EL 7.2, with Qt 4.8.5.

Bug: 13909
Change-Id: Ia39a288cc342afa2bd0217cb59dac84c3227086c
Reviewed-on: https://code.wireshark.org/review/23322
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-31 12:02:41 +00:00
Mikael Kanstrup 8646596829 Fix leaks when active capture interface goes down
If an interface goes down while packet capture is ongoing
related interface_option element is not freed properly. Fix
by using the appropriate free function that both remove the
element and frees element members.

Ping-Bug: 13864
Change-Id: I66a11d64615dc9648441b532e4ff658ea42a5acf
Reviewed-on: https://code.wireshark.org/review/23205
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-08-28 16:53:26 +00:00
Mikael Kanstrup 3b16cc8b21 iface_lists: Access ifaces member by reference
Change access of ifaces elements from by val to by reference.
With this change unnecessary copying of the whole struct is avoided
but even more important is that elements no longer have to be
removed and inserted whenever data is updated.

This change aims to make it more clear that ifaces elements shall
never directly be removed from the array. Instead use function
capture_opts_del_iface

NOTE: Code for GTK UI not updated

Ping-Bug: 13864
Change-Id: I04b65d5ee36526b30d959b8e5a2a48a3c7c4f15b
Reviewed-on: https://code.wireshark.org/review/23204
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-28 14:43:13 +00:00
Mikael Kanstrup 8873c7e494 iface_lists: Access all_ifaces member by reference
Change access of all_ifaces elements from by val to by reference.
With this change unnecessary copying of the whole struct is avoided
but even more important is that elements no longer have to be
removed and inserted whenever data is updated.

This change aims to make it more clear that all_ifaces elements
shall never be removed from the array without freeing resources
via the capture_opts_free_interface_t function.

NOTE: Code for GTK UI not updated

Ping-Bug: 13864
Change-Id: I36742cb1d5c8daa136c9d3732a044a7c8e5c7fe7
Reviewed-on: https://code.wireshark.org/review/23201
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-28 14:41:43 +00:00
Gerald Combs f86f54eb90 Qt: SimpleDialog fixes and updates.
Add WiresharkApplication::mainWindow and use it to move the C
simple_dialog routines to simple_dialog.cpp.

In SimpleDialog, make sure our checkbox is initialized. Don't store our
parent widget (which might go away) in a static variable, just use
wsApp->mainWindow(). Make sure we use check boxes only in Qt 5.2 or
later.

Bug: 13275
Change-Id: I72a9715c59f2efd50f722197f416179e87bb6a8b
Reviewed-on: https://code.wireshark.org/review/22805
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-27 11:41:10 +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
Gerald Combs 6a37b542e4 Qt+prefs: Add a dark theme check and default colors.
Add prefs_set_gui_theme_is_dark and call it in the WiresharkApplication
constructor. Add a set of dark syntax color defaults.

We could alternatively add a preference for the syntax foreground color,
but that would imply adding a preference for the background color as
well.

Bug: 11131
Bug: 13738
Change-Id: Iefe135ed04e63372ed434c5b9759647c9f4046e3
Reviewed-on: https://code.wireshark.org/review/21827
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-01 08:07:05 +00:00
Peter Wu ab504191fc Qt: try harder to find a working monospace font
QFont::toString returned the default font (which might be unavailable),
leading to use of non-monospace fonts in the bytes view. Detect the
effective font instead and apply it to avoid this issue.

Add additional logic to invoke font detection when the configured font
is bad (for example, because of the bug or because a font has been
removed in meantime).

Bug: 13638
Change-Id: I8a625cf365c90119caebe8c4deada0df7426e53a
Reviewed-on: https://code.wireshark.org/review/21551
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Jörg Mayer <jmayer@loplof.de>
Reviewed-by: Ahmad Fatoum <ahmad@a3f.at>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-05-08 03:07:43 +00:00
Guy Harris 6b3714254d Pull all the "load settings" calls into a epan_load_settings() routine.
That way, nothing using libwireshark needs to know what settings need to
be loaded, they just call epan_load_settings().

Change-Id: I9390e259e286fc4f5acaeaac2767e4c3c4b656af
Reviewed-on: https://code.wireshark.org/review/20983
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-09 22:40:30 +00:00
Guy Harris 7d5ce06cbe Pull the error reporting into {read,save}_filter_list.
Change-Id: I4d9582661f2f1728d400eeb2a1b1dea98f32ce7f
Reviewed-on: https://code.wireshark.org/review/20982
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-09 17:57:52 +00:00