If the capture.no_extcap preference is set, really don't load the
extcap interfaces. Previously, the extcap interfaces were loaded
before the preference was read, because otherwise the extcap
preferences wouldn't be registered and properly read out of the
configuration file.
Wait until after that preference is read to register the
extcap preferences and then re-read just the extcap module
preferences from the configuration files. Make sure to check
other times when the preference may be changed, such as
switching profiles.
Write extcap prefs to a separate file so that they don't get lost
if the extcap interfaces aren't loaded and the prefs are then
written out. Continue writing them to the main file for backwards
compability.
Related to #15295. Cuts ~100 ms off the loading time of Wireshark
in a normal situation if the capture.no_extcap preference is set,
more if an extcap has some kind of issue that makes it take a long
time to load.
The solution to #12331 makes command line options that change
preferences be reapplied when reloading Lua plugins.
The command line preference overrides should be either reapplied
or dropped when changing configuration profiles. Doing neither,
as currently, means that they are not reapplied when switching
but are reapplied when subsequently reloading Lua plugins, which
is confusing. Drop them, but we could change that decision.
Make sure that we set the pointer to NULL when freeing so that
we don't double-free.
commandline.h requires cfile.h to get the search direction enum.
The changes in bc64efa538 reverted
issue #13753. The main application needs to signal that the
display filter (packet matching expressions) grammar has changed
after reloading the display filter macros so that the display filter
line edit updates its status, we don't try to apply an invalid filter
if we're doing a live capture, etc.
Fix#13753 again
Apparently in Qt6 closing the main window can exit the Qt event loop,
which means that WinSparkle never gets the notifications it needs to
proceed.
WinSparkle will call quit() shortly thereafter via the shutdown
request callback, so the main window will still close at approximately
the same time.
See discussion in https://github.com/vslavik/winsparkle/issues/237Fix#19568
Use the welcome mode to fill in the interface list and start
the stats at the same time, instead of two calls.
Also now restart the stats when refreshing the interface list
because an interface has changed.
Add a comment that there are still some situations where we don't
trigger an interface refresh on a interface monitor notification
on Linux
Related to #15082
Since global_capture_opts is always already init'ed in
scan_local_interfaces_filtered, call the get_iface_list
callback instead of the generic capture_interface_list there.
Cached the interface list returned from capture_interface_list
and store it in the MainApplication. On subsequent calls
to the capture opts get_iface_list callback, return the cached
list if it exists.
When Refresh Local Interfaces is called (either manually by the
user, or by a notification from iface_monitor), clear the cached
interface list and set it to NULL so that a new capture_interface_list
call will happen.
This prevents multiple privileged dumpcap calls when parsing
multiple interface options, or when retrieving the entire interface
list after having already done so to parse an interface command
line option.
Related to #15082
The recent files are read from recent_common in main.cpp, which
happens before the prefs are read. (This is largely unavoidable,
as we need some things in recent first, notably the last used
preference Configuration Profile.)
That means we add the recent files before we've read the preference
that determines the maximum number of recent files, so it still
has its initial value of 10 - the number of files in recent_common
will be whatever value the last used Configuration Profile had
for the preference, and could be greater (or lesser) than 10.
It could also be different than the value for the preference
after the preferences are loaded, if Wireshark is started with
command line options like -C, -o, or -P.
Add a parameter so that on initial startup, when recent_common is
read, we add all the files to the list heedless of the pref value.
Add connections so that the Menu and the Welcome Page list update the
list of recent files whenever the Preferences are changed
(including from changing Configuration Profiles), because
that might change the max number of recent files.
Add a few guards for putting too many items in the recent common
file or the menu, for when the preference changes so that the
maximum count is lower than it was previously.
Fix#16782
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.
Do not read the capture filter list unless needed.
Do not use a static list because the capture filter list can change during program execution
and we want to be able to read multiple copies whenever.
Improve the public API function names.
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.
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
Freeze the packet list early when changing profile and when closing
the preferences dialog to avoid updating column data before doing a
full redissection.
The packet list will be thawed when redissection is done.
Related to #19079.
Always start with a new mono_font_ when setting the default font in
setMonospaceFont(), both when font_string is not given and when the
font name does not exist.
On macOS this will avoid getting .AppleSystemUIFont, which is not
a monospace font and not what we want.
Qt5's QFont::fromString() isn't compatible with Qt6's QFont::toString().
If we were built with Qt5, don't try to process a font preference that
was created by Qt6.
Fixes#18553
This removes the last dependency of the logging subsystem on the
preferences module. The latter is started much later than the former
and this is an issue.
The Windows-only preference "gui.console_open" is stored in the
registry as HKEY_LOCAL_USER\Software\Wireshark\ConsoleOpen. The semantics
are exactly the same. The preference is read by the logging subsystem
for initialization and then again by the preferences (read/write) so
the user can configure it as before.
The code to store the preference also in the preferences file was
kept, for backward compatibility and because it is not incompatible
with using the Registry concurrently.
The elimination of the prefs dependency also allows moving the Windows
console logic to wsutil and add the functionality to wslog directly,
thereby eliminating the superfluous Wireshark/Logray custom log handler.
To be able to read the ws_log_console_open global variable from
libwireshark it becomes necessary to add a new export macro
symbol called WSUTIL_EXPORT.
Add lricon.svg and lriconinst.svg, which provide the core graphic
element for the various Logray icons. Add lricon*.png, which were
created using the templates at
https://developer.apple.com/design/resources/. Add Logray.icns,
logray.ico, and lograyinst.ico, and use them in various packaging
resources.
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.
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.