Commit Graph

27 Commits

Author SHA1 Message Date
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 d3f17ee08a Remove modelines in ui/qt.
Remove the editor modeline blocks from most of the source files in ui/qt
by running

    perl -i -p0e 's{ \n+ /[ *\n]+ editor \s+ modelines .* shiftwidth= .* \*/ \s+ } {\n}gsix' $( ag -g '\.(cpp|h)' )

then cleaning up the remaining files by hand.

This *shouldn't* affect anyone since

- All of the source files in ui/qt use 4 space indentation, which
  matches the default in our top-level .editorconfig

- The one notable editor that's likely to be used on these files and
  *doesn't* support EditorConfig (Qt Creator) defaults to 4 space
  indentation.
2021-03-08 18:11:32 +00:00
Jaap Keuter 33bb4b0c22 Qt: Add window title settings the preferences dialog
In case of multiple instances it can be helpful to have an extra identifier
in the window title. These facilities are present and working, yet the
identifiers are not easily modifiable (only through the Advanced preference
page). This changes exposes these setting in the normal Appearance
preference page.

Change-Id: Ib6d7b18d29932edaed7419b44e4edc2f99134cbf
Reviewed-on: https://code.wireshark.org/review/36068
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-10 07:45:57 +00:00
Michael Mann 6db67117b5 Add ability to disable autocomplete suggestions for filter controls.
Add a preference (enabled by default) that can enable/disable the ability for Wireshark to autocomplete display and capture filter controls.

Bug: 14368
Change-Id: Ib2b688bb75c4465dab14a6a635a870d7e5c4fe80
Reviewed-on: https://code.wireshark.org/review/30320
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-22 04:45:59 +00:00
Guy Harris 09698df0b4 Get rid of some no-longer-supported GUI preferences.
Make them obsolete preferences; if they had any use, it was with the
now-removed GTK+ UI.

Change-Id: I2b514148c8066c5c79cb402493f47a21d3679819
Reviewed-on: https://code.wireshark.org/review/29912
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-29 01:24:27 +00:00
Gerald Combs 62999cc677 Windows: Make sure more native dialogs handle HiDPI.
Add a WiresharkFileDialog class, which is a thin wrapper around a few
QFileDialog functions that sets per-monitor v2 DPI awareness before
showing native dialogs and resets the awareness context afterward.
Use it where we call QFileDialog::getXXX.

Change-Id: Ib711a70aa94b693a2515804a729f666ea7fbd673
Reviewed-on: https://code.wireshark.org/review/27568
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-05-16 04:22:20 +00:00
Peter Wu c1b7c8f9d2 Qt: ensure field is visible on selection from bytes view
Ensure that a selected field (via selectedFieldChanged) becomes visible
in the packet details view when selected from the bytes view (or when
found via a search).

As making a field always visible seems a desirable feature (and in the
interest of simplifying preferences), enable this by default using the
smarter EnsureVisible hint.

Remove the associated preferences and mark them GTK+ only.

Change-Id: I05a918c1e09135c0b4e10f04024bff092756e55c
Fixes: v2.5.0rc0-2383-g6b2764a41e ("ProtoTree behavior fixes.")
Reviewed-on: https://code.wireshark.org/review/26509
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-18 00:30:49 +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
Michael Mann d239da264c Convert preference dialog to use more models.
Convert Advanced view and Modules view to use a single base model,
loading the preferences once and then filter and display what they
need with QSortFilterProxyModel derived classes.

Convert the PreferencePane "types" to just strings.  This allows
a more straightforward relationship between the "special" modules
that need custom widgets for preference manipulation and it also
removes dependency on preferences_dialog.h for many files.

Change-Id: I091deb3061564aa4d1564e9ca1c792715961b083
Reviewed-on: https://code.wireshark.org/review/25134
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-01-04 21:20:59 +00:00
Ahmad Fatoum 9d49e13166 Remove superfluous null-checks before strdup/free
NULL checks were removed for following free functions:

- g_free "If mem is NULL it simply returns"
  https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free

- g_slist_free(_full)? "NULL is considered to be the empty list"
  https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html

- g_strfreev "If str_array is NULL, this function simply returns."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev

- g_slice_free "If mem is NULL, this macro does nothing."
  https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free

- g_match_info_free "not NULL... otherwise does nothing"
  https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free

- dfilter_free defined in Wireshark code. Returns early when passed NULL
  epan/dfilter/dfilter.c

They were also removed around calls to g_strdup where applicable:

- g_strdup "If str is NULL it returns NULL."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup

Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04
Reviewed-on: https://code.wireshark.org/review/23406
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-15 12:38:51 +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
Michael Mann 21a3b8cc71 Internalize struct preference
Move "struct preference" into prefs.c, essentially creating a "private"
structure to handle preferences. The 2 motivating factors were:
1. Better memory management so that clients/users of API don't have to worry
about it.
2. Hide the ugliness of the union stuff and make it transparent to the API.

A few bugs related to preference <-> Decode As integration were fixed
while in the neighborhood.

Change-Id: I509b9a236235d066b139c98222b701475e0ed365
Reviewed-on: https://code.wireshark.org/review/19578
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-22 10:43:57 +00:00
Guy Harris 232b2de7bb Use "system" for "use system language", and don't try to print a null string.
Add a #define USE_SYSTEM_LANGUAGE for the language string meaning "use
the system setting", and use that instead of hardcoding "system" in
various places.

If "language" is null, don't try to write it to the file with fprintf()
- on *most* systems, that prints "(null)", but on some systems, such as
Solaris, it *crashes*.  Write USE_SYSTEM_LANGUAGE instead.  Check for
"(null)" and treat it as meaning "use the system language".

Map "auto" to "use the system language" as well, for backwards
compatibility.

Change-Id: Iba9be540a5139e9cca8bddd0761ee4cbf0f79a49
Reviewed-on: https://code.wireshark.org/review/15147
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-28 19:34:02 +00:00
Stig Bjørlykke 25e417f01a Qt: Fix Confirm unsaved capture files preference.
Set initial value for confirmUnsavedCheckBox.

Change-Id: I7dfebf21e516a9d1be1bd3f543a00834222c9ff7
Reviewed-on: https://code.wireshark.org/review/12739
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-12-20 20:31:23 +00:00
Alexis La Goutte ac2008c46f Qt (Recent Files): Fix typo on variable name
Wrong variable (display field max) is updated when set max recent files

Change-Id: Ie995192ffbf56cbf6bd9cea5b029ab16ff547d2f
Ping-Bug:11748
Reviewed-on: https://code.wireshark.org/review/12046
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-24 02:04:02 +00:00
Joerg Mayer 51a37b666a Continuing to remove Q_UNUSED
Change-Id: I54bc4a1b7d39abd1bb88ee361b0de5fcbca1efe8
Reviewed-on: https://code.wireshark.org/review/9546
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2015-07-07 21:50:17 +00:00
Martin Kaiser 534d1d5eae Qt: use <> for including the generated ui_*.h files
this should make Visual Studio pick up the generated include files
from the build directory instead of the source directory (which may
contain lefovers from an in-tree build)

Change-Id: Ie3de4cdd85a2865e203118a42ab10f443372f03b
Reviewed-on: https://code.wireshark.org/review/9129
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-25 17:11:19 +00:00
Pascal Quantin 72f035d094 Qt: fix crash when opening Preferences window on Windows
Do not use delete on g_allocated memory

Change-Id: I84e0adc65c45520916adb9b2f6d46ca3f144486e
Reviewed-on: https://code.wireshark.org/review/6207
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-01-01 17:52:36 +00:00
Gerald Combs e4b0141769 Qt: Obey main toolbar icon preferences.
Remove the preferences for the filter toolbar and mark them GTK+-only.

Change-Id: Ie48b19aee29a1cfcea4c41ca6c08ddbba3102377
Reviewed-on: https://code.wireshark.org/review/5693
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-10 01:51:09 +00:00
Peter Wu cd14ff3288 qt: use qstring_strdup
Replaces the more verbose `g_strdup(foo.toUtf8().constData())` by
`qstring_strdup(foo)`. While at it, plug a minor memleak in
MainWindow dialogs.

Change-Id: I32b53f972b4e3998ac9beabd98647a381b7b42e3
Reviewed-on: https://code.wireshark.org/review/5531
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-01 01:13:54 +00:00
Guy Harris 72c70b6abe Call the default language preference setting "Use system setting".
That more correctly describes it - it doesn't do any form of automatic
detection of anything, it just picks up the system settings from
wherever Qt picks them up.

Change-Id: I62d40719728cc9735e3b8f3e4202b7e61fc3f43b
Reviewed-on: https://code.wireshark.org/review/5165
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-07 00:47:32 +00:00
Michal Labedzki 5025bc258c Qt: Dynamic languages
- get language as soon as possible (before creating any Qt objects) to make all
  translations working
- dynamic list of supported languages
- runtime change of GUI language (no need to restart application)
- add flags icons support
- search for *.qm languages in buildin resources, then
  data dir called "languages" (main directory in sources or
  /usr/share/wireshark/languages), then user directory
  (UNIX: ~/.wireshark/languages); "languages" directory should contains
  files wireshark_xx.qm where xx is language code (en, en_GB, etc.),
  and optional xx.svg for flag icon
- try to fix some untranslated manually-created UI items
  (need manual reset text of those components)

Change-Id: I62ca8a8cddce47cec9dbcad6b0bd68b6cfd92229
Reviewed-on: https://code.wireshark.org/review/5041
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-11-04 08:21:55 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Alexis La Goutte fe4407ebc7 Add Preference to change Language (in QtShark)
Need restart application to change language

svn path=/trunk/; revision=51869
2013-09-09 16:20:45 +00:00
Gerald Combs 6ef1fc5002 GTK+:
Get rid of user-hostile behavior. In the layout preferences pane 2 & 3
radio buttons overrode the user's selection if a duplicate item was
selected. Now we assume that the user knows what he or she is doing and
steal duplicate selections from the other panes.

Qt:

Match the new GTK+ behavior in the layout preferences. Add padding
around the layout images. Add toolbar style preferences to the
Appearance pane (instead of the layout pane).

All:

Remove the selection mode and scrollbar placement prefs and mark them
obsolete as recently discussed on -dev.

Adjust the layout images yet again after more Awful Monitor Testing.

svn path=/trunk/; revision=47214
2013-01-22 18:27:18 +00:00
Gerald Combs 5fcf513161 Add an initial layout preference pane. Set SVN properties.
svn path=/trunk/; revision=47190
2013-01-21 05:29:14 +00:00
Gerald Combs 2c5ce01f33 Add an "Appearance" (aka "User Interface") preference pane. Having an
"Advanced" pane gives us the luxury of omitting some items in favor of
simplicity so do that.

svn path=/trunk/; revision=47158
2013-01-19 00:57:57 +00:00