Commit Graph

154 Commits

Author SHA1 Message Date
Guy Harris 19f7e572a4 Work around macOS running applications in /.
If an application is launched from the Finder, it appears to get / as
its current directory.  This causes Wireshark open/save dialogs to open
up / if the user hasn't already opened a file in another directory, so
that there's no "last open directory" in the recent file.

Have get_persdatafile_dir(), on UN*X, cache the personal data directory
just as it does on Windows and, if nothing's been cached, have it fetch
the current directory and, if that succeeds *and* it's not the root
directory, use that.  Otherwise, use the user's home directory.

Fixes #9862.

In addition, separate the notion of "last open directory" and "open
dialog initial directory", where the latter is the last open directory
*if* a file has been opened in this session or the recent file has the
last open directory from a previous session, otherwise it's the user's
personal data directory.

Use the latter notion in file open/save dialogs; use the former notion
when reading from and writing to the recent file.

This means we don't need to set the "last open directory" at startup
time.  That way, running Wireshark without opening a file won't cause
the "last open directory" to be set, so that if a user runs it from a
directory, the "open dialog initial directory" won't be the last
directory from which Wireshark was run.
2023-11-12 06:53:36 +00:00
John Thacker 520f0d8e26 Qt: Enforce Minimum Qt version 5.11
We already strongly recommend Qt version 5.12 and enforce 5.10.
Commit 06cd84a6e9 said "[a]lthough
build support for 5.10 and 5.11 is not being removed at this point,
it might be for 4.x at a later time."

Move to enforcing 5.11, and update macos-setup for that as well.
Remove the QT_VERSION_CHECKs for 5.10 and 5.11 (except in
qcustomplot.)

Hold off on enforcing 5.12 for now, because there isn't any code
that needs 5.12 or greater (there are two places for a workaround
for Qt 5.12.0 through 5.12.5), and because Debian Buster is on
Qt 5.11.3. There are not any known supported OS distributions on
Qt 5.10.
2023-11-02 15:28:01 +00:00
Daniël van Eeden 4d27035fa6 Add option to copy bytes as Go literal 2023-10-24 18:04:05 +00:00
Jaap Keuter ad140e5e14 Qt: uninit class member in constructor (CID 1530129) 2023-09-23 15:32:55 +00:00
Gerald Combs 0573bbaed6 Qt: Dark mode updates
For all platforms, use QStyleHints::colorScheme to check for a dark
theme if it's available.

On Windows + Qt >= 6.5, use the fusion style for dark mode as described at

https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5

Although the blog post specifically mentions Windows 11, this seems to
work fine here on Windows 10.

Fixes #16221
2023-09-08 11:52:01 +00:00
John Thacker 1acc3ae5ad Qt: Call EditResolvedName from the PacketList
Allow Edit Resolved Name to be called from the packet details,
for fields that are IPv4 or IPv6 addresses.

Add to the combobox of possible addresses to edit all (non hidden)
IPv4 or IPv6 fields. Set the index of the combobox to the selected
column (if it is an address, and the packet list has focus or was
selected), or to the currently selected field (if selected from
the packet details, and an IP address.) Check other types of
address columns (such as network address and custom columns) to
see if they match the unresolved string for an IP address.

Don't both redissecting the packets if the network resolution is
off, because it won't do anything. There's a use case for editing
several names before turning on the preference to avoid processor
intensive redissects.

Fix #17284
2023-09-03 07:23:50 +00:00
João Valverde 09009b68e4 MAC Blocks: Use a proxy model to implement filtering
Implement the search as a QSortFilterProxyModel filter, instead of
using a simpler binary search.

The only practical difference is that the dialog now shows all
entries when the input is empty, instead of an empty table.
2023-08-04 15:54:48 +01:00
João Valverde 2a96b3e1d1 Qt: Replace copy "...as Printable Text" context action
Remove the "printable text" action because it never does the right thing.
Copying bytes as text needs an encoding. Either this eats some bytes
silently, which is already bad, or it actually produces UTF-8
encoding errors by omitting values outside the ASCII range.

Copying as "printable text" is already correctly supported using the
copy "Value" context option. This is guaranteed to be valid UTF-8
(modulo any bugs).

Replace it with a C-style format using ASCII and escape sequences,
that is somewhat in the spirit on printable text, produces
valid output and should be really useful.

I opted to remove the "Escaped String" option too because it
is very similar to the C string added above and IMO less
friendly, but this is just opinion and if people really like
this format over escaped ASCII for some reason it can and
should be added back.

While here rename the "Raw Bytes" menu option to be more
meaningful.
2023-06-27 16:16:01 +00:00
João Valverde d456cc761a ftypes: Rename IS_FT_* macros
Rename IS_FT_*() to FT_IS_*(). I find it to be more natural and
a better namespace for a public interface.
2023-06-20 00:22:57 +01:00
Preben Guldberg 40fdd67664 View bytes as decimal or octal
An attempt at implementing request in issue #18615. Adding octal view
while at it, in case anybody happens to prefer that or compare with
reference data in octal.

Both decimal and octal view have three byte wide columns, which is
visually distinctive from hex view. Decimal uses leading spaces, which
makes it clearly different from octal view.

Some ternary operators previously done based on BYTES_HEX are now using
BYTES_BITS. This change is done as the new BYTES_DEC and BYTES_OCT have
more in common with BYTES_HEX and are either equivalent in context or
closer linked to BYTES_HEX (e.g. for calculating column widths).

While translations should be updated, I am unsure if this is automated.
Also, if attempted, lupdate picks up changes from unrelated commits.
2023-05-16 07:53:12 +00:00
John Thacker 66e3ea9519 Qt: Ensure AudioRoutingFilter is freed
Call the base constructor so that the AudioRoutingFilter is
parented, and make the comment in rtp_audio_stream.cpp regarding
temp_file_ being released by audio_output_ true.
2023-05-15 08:15:16 -04:00
John Thacker 3a0b4a8d10 Qt: Ensure the AudioSilenceGenerator is freed
Have AudioSilenceGenerator inherit the QIODevice constructor that
takes a parent, and pass the parent into the constructor when
creating it in RtpPlayerDialog. This ensures that it is deleted
appropriately when marker_stream_ is deleted.
2023-05-15 11:55:30 +00:00
Alexander Clouter ee7d3507eb qt: Ignore gcc 12.1 optimization bug with Qt (more e1a6913a) 2022-12-31 20:45:15 +00:00
João Valverde ae14849864 Windows: Use SpeexDSP binary package
Remove bundled code and use vcpkg binary library instead.
2022-12-16 11:11:28 +00:00
John Thacker 5362cc9b3e Fix build on OpenSUSE 15.3
On older Qt versions (5.12?) QVector needs to be included,
not just QObject. (It isn't needed on 5.15, possibly because
QVector is an alias for QList in newer Qt versions.)
2022-11-16 08:21:13 +00:00
John Thacker b7ed46288a Qt: Speed up ProtoTreeModel with lots of items
When creating a ProtoNode, count the (non-hidden) children and put
them in a QVector. This saves time having to iterate through all
of a node's children (or the parent's children) each time the
model or view wants to get the row or index number. Create and
delete the needed ProtoNodes when the root node is changed, instead
of recreating them on demand from the proto_nodes (since they're no
longer a thin wrapper.)

Fix #18625
2022-11-14 06:28:16 -05:00
Roland Knall fd7716542c Qt: Move generic methods to utils
Move the utils for checking for the last used directory and storing
it out of ProfileDialog, as they are not Profiles specific
2022-11-01 18:12:07 +00:00
John Thacker 87441e45d8 Qt: minizip and minizip-ng size compatibility issues
MS-DOS Date and MS-DOS Time are packed 16-bit values
(https://learn.microsoft.com/en-us/windows/win32/sysinfo/ms-dos-date-and-time)
and when combined they make a 32-bit value.

In the original minizip that comes with zlib, the combined dosDate
parameter is a uLong, which is 64 bits on LP64 platforms. In minizip-ng,
it is a uint32_t.

At one point, minizip-ng renamed the dosDate struct member of
zip_fileinfo to dos_date, but more recent versions changed it back
to dosDate for compatibility, except the size remains different,
so our compatibility check can't distinguish the size.

clang (and possibly other compilers) complain about shortening a 64 bit
unsigned long to a uint32_t so make the return value from our
qDateToDosDate a uint32_t as it should be to avoid warnings on
distributions with minizip-ng

Also the maximum year value that can be stored in the format is
127, since it occupies bits 9-15 of the MS-DOS Date. (There was
probably some confusion since the maximum year is 2107, but its
offset from 1980, not 1900.)
2022-10-12 22:03:34 -04:00
Gerald Combs f3f1556d45 Qt: Properly truncate our FieldInformation strings.
As the Qt6 QString::QString(const QByteArray &ba) documenation says:

"Note: any null ('\0') bytes in the byte array will be included in this
string, converted to Unicode null characters (U+0000). This behavior is
different from Qt 5.x."

Make sure FieldInformation::toString() truncates its display label byte
array before converting it to a QString.

Fixes #18428
2022-10-11 16:59:32 +00:00
Ming Chen 01a3a19e15 Add copy as a Base64 string 2022-10-04 12:36:25 +00:00
Jaap Keuter b092fa05da Replace the last of PROTO_ITEM_ macro calls with function calls 2022-09-29 05:59:12 +00:00
Roland Knall 06cd84a6e9 Qt: Recommend 5.12 and enforce 5.10
In order to phase out older versions, we recommed 5.12 as a
minimum Qt version going forward. Although build support for
5.10 and 5.11 is not being removed at this point, it might
be for 4.x at a later time.
2022-07-13 21:26:46 +00:00
John Thacker 13075b4ff0 Require Qt 5.9 or later
Increase the minimum required version of Qt from 5.6 to the next
LTS version, 5.9. The various Linux distributions that have not
released an update to 5.9 or later (SLES 12, Debian stretch) are
nearing end of support, and can be supported by the Wireshark 3.6 LTS
release.

Qt 5.9 requires macOS 10.0, so make that the minimum macOS version
as well.

Remove unneeded version checks (except from QCustomPlot).
2022-04-20 18:59:32 -04: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 bcd3d05a3e Qt: Fix more Qt6-related warnings. 2022-03-25 12:48:01 -07:00
Gerald Combs f8d3ebe0e2 Qt: Handle qsizetype.
Qt 5.10 added qsizetype, aka an ssize_t and Qt 6 makes extensive use of
it. Add a compatibility typedef and use it where we can. Cast it away
where we can't.
2022-03-25 16:51:55 +00:00
Jim Young 59b5c83e4c Qt: Refactor to avoid deprecation warning on Windows 2022-02-14 09:24:02 +00:00
Roland Knall 81f220ae80 Qt: Fix open explorer
Apparently on Windows, if a dialog contains spaces it is not properly
opened via /select. But opening the file via QDesktopServices leads to
the file not being selected in the open explorer windows (expectation by
the user). Therefore the original change is restored, but with a
differenc call which should handle the space issue in most cases better
than before. See
https://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt
for a short explanation (bottom of post)

Fixes #17927
2022-02-07 15:57:59 +00:00
Roland Knall 5b6bf0b4f3 Qt: Fix show in folder issue
Opening a folder on Windows lead to undesired behaviour

Fixes: #17927
2022-02-07 10:54:38 +01:00
Pascal Quantin adca11dd5c range_string: follow-up of 893290c 2022-01-05 20:34:15 +00:00
Gerald Combs 6d319297ae Qt: Add a common hover color. 2022-01-03 19:03:46 +00:00
Gerald Combs 20ebe853d1 Qt: Make utils more independent.
Use qApp instead of wsApp in ColorUtils and StockIcon.
2021-12-22 19:00:13 -08:00
Moshe Kaplan 3953ddcf57 Add UI header files to Doxygen
Add @file markers for UI
header files so that Doxygen will
generate documentation for them.
2021-11-30 08:01:36 -05:00
João Valverde 504de90a3c wsutil: Split format_size() enum
Use an enum to select units and a bit flag for the other options,
currently only prefix type.
2021-11-29 22:13:32 +00:00
Tomasz Moń 890555b8bd Qt: Qt6.2 compatibility fixes
Wireshark successfully compiles on Windows with Qt6.2 with following
cmake options:
  -DUSE_qt6=ON -DDISABLE_ERROR=ON

QCustomPlot QT 6.2 patch is taken from QCustomPlot forum post by miccs.
2021-11-29 04:55:12 +00:00
João Valverde b30a2112e8 regex: Prefer C99/POSIX types
Replace 'gssize' with 'ssize_t'.

Add a CMake configure check for ssize_t.

Fix missing "config.h" includes.
2021-11-15 02:41:59 +00:00
Gerald Combs 7a30021aef Revert "Qt: Fix epan cleanup exit crash"
This reverts commit 5f50fad289.
2021-11-10 11:48:09 -08:00
Tomasz Moń 5f50fad289 Qt: Fix epan cleanup exit crash
Do not keep epan_dissect_t instance hanging until FrameInformation
destructor is called. Simply copy the tvb data into local buffer and
cleanup epan_dissect_t instance as soon as possible.

Fixes #17590
2021-11-09 10:54:49 +00:00
Gerald Combs 991fc16e85 Qt: Remove Q_OBJECT in a few places where it's not needed.
Q_OBJECT is only needed for signals+slots, translations, and other
meta-object services. Remove it in some classes, since having it means
we're generating and compiling code unnecessarily.
2021-10-08 03:29:30 +00:00
João Valverde f4c283298f Add compatibility fix for Minizip dependency 2021-09-23 14:19:02 +00:00
Guy Harris 76b08ea083 Fix spelling errors.
The Ubuntu build commented on some spelling errors in executable code
files.  Fix the errors that don't come from external files containing
the spelling errors (USB product and vendor IDs, PCI IDs, ASN.1
specifications), and fix some errors that don't show up in the
executable code files (e.g., in comments and variable names).
2021-09-11 10:01:27 +00:00
Dr. Lars Völker 8e2cd4f652 UI: Import profiles from ZIP supporting bigger files (Bugfix)
This patch allows the profile importer to recover from a file too large
to import as well as adjusts the maximum allowed config file size.

Closes: #17504
2021-08-25 13:40:12 +00:00
Jirka Novak 4c7c377d42 RTP Player: Player is able to skip silence during playback
Code is NOT able to do VAD (Voice Activity Detection) so audio silence
(sequence of equal samples) nor noise are not recognized as silence. Just
missing RTP (Confort Noise, interupted RTP, ...) and muted streams are
recognized as silence for this feature.
User can control duration of shortest silence to skip.
Updated documentation.
2021-05-03 21:38:48 +00:00
Gerald Combs f80227861f Qt: Fix some documentation warnings. 2021-04-30 22:25:17 +00:00
Jirka Novak c1084fe97e RTP Player: Settings for enabling use of disk as temporarly store
New advanced settings are created:
- rtp_player_use_disk1 - controls if decoded samples are stored in
  memory or on disk.
- rtp_player_use_disk2 - controls if dictionary for decoded samples
is stored in memory or on disk.
- documentation updated
2021-04-26 10:57:22 +02:00
Jirka Novak 71bd81efd4 RTP Player: Fix of clang compilation error 2021-04-25 22:08:49 +02:00
Jirka Novak 54b7886a5e RTP Player: Memory consumption improvements
Audio for play is now decoded and stored without silence parts.

Changes:
- ui/qt/utils/rtp_audio_file.cpp created to handle silence skipping
- ui/qt/rtp_audio_stream.cpp refactored to support it
- Fixed issue with exporting streams: File synchronized export was missing
leading silence.
- No line is shown in waveform graph if there is silence
2021-04-25 19:34:52 +02:00
j.novak@netsystem.cz 0048142ea1 RTP Player: Added button 'Refresh streams' for live capture 2021-04-22 19:33:11 +00:00
Jirka Novak a8ccb67921 VoIP Calls: Streams related to calls can be selected in RTP Streams
When user press S(elect)/D(eselect) key, all RTP streams related to
selected call/calls are selected/deselected in RTP Streams window. If
window is not shown, it is opened.
Documentation updated.
2021-04-19 20:04:05 +00:00
Gerald Combs f7e5fb6952 Qt: Fix various missing prototype warnings.
Fix some noisy documentation bugs while we're here.
2021-04-16 22:25:22 +00:00