Commit Graph

30 Commits

Author SHA1 Message Date
John Thacker 4fb2ef8af8 extcap: Really don't load extcap interfaces if disabled
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.
2024-02-18 20:23:39 +00:00
John Thacker e540c8777e Qt: Drop command line options when changing configuration profiles
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.
2024-02-16 12:37:39 +00:00
John Thacker 3bbf468421 Qt: Indicate that the grammar has changed when reloading macros
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
2024-01-21 07:11:50 -05:00
Gerald Combs e68771714a Qt: Update some comments related to WinSparkle
[skip ci]
2024-01-04 14:14:15 -08:00
John Thacker 96b0a674c7 Qt+WinSparkle: Don't close the main window in the can shutdown callback
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/237

Fix #19568
2024-01-04 21:57:21 +00:00
John Thacker 54ed27e11a Qt: [Re]start the stats when filling the interface list
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
2023-12-22 10:50:49 +00:00
John Thacker 1724e23865 capture: More prep for retrieving and caching capabilities
Add some deserialization.
Add more checks to avoid retrieving capabilities twice

Related to #15082
2023-12-18 09:31:03 -05:00
John Thacker 0c9cceebe3 Qt: Cache the capture interface list in Wireshark and Logray
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
2023-12-10 13:01:02 +00:00
John Thacker bee7b2cb8e Qt: Fix Recent Files Max Count at startup
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
2023-11-15 08:57:36 +00:00
João Valverde 91465bcb8b Qt: Fix display filter macros when switching profiles
We need to reload the display filter macros when switching profiles.
This was done automatically before by the UAT sub-system.
2023-11-13 15:57:25 +00:00
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
João Valverde 177cc29ea6 wsutil: Make filter lists dynamic and on-demand
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.
2023-11-08 01:03:07 +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
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
Markku Leiniö 67af3d73be Change how system default locale is set 2023-08-17 05:07:35 +00:00
Gerald Combs b330bdb06d Qt: Really show our context menu shortcuts this time
Call setAttribute(Qt::AA_DontShowShortcutsInContextMenus, false) in
order to work around QTBUG-109590.
2023-06-28 09:59:49 -07:00
Stig Bjørlykke 5b64d1d65e Qt: Freeze packet list early on preferences change
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.
2023-06-20 11:27:05 +00:00
Stig Bjørlykke b0c582a82f Qt: Start with a new QFont in setMonospaceFont
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.
2023-05-29 21:37:08 +00:00
Stig Bjørlykke 1062e54fd5 prefs: Remove type of GUI preference
The type of GUI preference is unused.
Remove prefs.gui and rename prefs.gui_qt_* to prefs.gui_*.
2023-05-08 16:30:07 +00:00
João Valverde 7fd4e2e542 Move ui/filter_files.[ch] to wsutil 2023-02-10 20:59:22 +00:00
Gerald Combs 6459b5f6d1 Qt: Improve our font preference compatibility.
Qt5 font strings can have 10 or 11 fields.
2022-12-19 19:53:50 +00:00
Gerald Combs 0ae3315f53 Qt: Make sure our font setting is backward compatible.
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
2022-10-27 10:46:06 -07:00
Gerald Combs d560dd3948 Qt: Fix our default font size on Windows.
It looks like we need to adjust our monospace font size differently in
Qt6 on Windows.
2022-10-27 10:29:47 -07:00
João Valverde a19834b98c Windows: Store "gui.console_open" in the Windows registry
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.
2022-10-11 14:25:04 +01:00
Gerald Combs 8f34e3df98 Add Logray capture icons. 2022-09-10 23:35:27 +00:00
Gerald Combs ab4a4304ee Add Logray icons.
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.
2022-09-04 23:01:06 +00:00
Roland Knall 59e7c16425 Revert "Qt: remove unnecessary method from FunnelStatistics"
This reverts commit ddcb429979
2022-07-29 13:13:36 +00:00
Roland Knall ddcb429979 Qt: remove unnecessary method from FunnelStatistics 2022-07-18 15:08:23 +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