Commit Graph

91 Commits

Author SHA1 Message Date
Jeff Morriss a748f8f41a Clean up the new-file selection criteria in the GUI.
Inspired by looking into
https://ask.wireshark.org/question/8009/wireshark-ring-buffer-settings-from-command-line/

... in which the user was confused because a duration set on the command
line was not reflected in the GUI.  That's because
I0180c43843f5d2f0c2f50153c9ce42ac7fa5aeae added the `interval` ring-buffer
option and made the GUI use this rather than `duration`.  This was not at all
clear in the GUI, though.

Since `duration` and `interval` have quite different use cases, expose both in
the GUI.

Try to clean up and unify the tooltips at the same time.  I'm not entirely
convinced the tooltips need to be on the checkbox, the spinbox, and the
combobox but leave it that way for now.

Add some to the man page description of the interval option to hopefully make
it clearer what the option does.

Change-Id: I3b45fe71c33af64d980dffb5e5ba93e2a15a6b96
Reviewed-on: https://code.wireshark.org/review/32526
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-23 13:27:31 +00:00
Stig Bjørlykke 1df39d65f5 Qt: Fix removal of "Capture to a permanent file" setting
Make it possible to remove the "Capture to a permanent file" setting
in Capture Interfaces Output dialog by turning off saving_to_file in
updateInterfaces().

Also make sure to free the old values for save_file and orig_save_file
to avoid memory leaks.

Set orig_save_file to the same as save_file from the '-w' option to
fill in the current "Capture to a permanent file" value correctly.

Change-Id: I1f4df8cfa279f934eff028f32838b9734b627af1
Reviewed-on: https://code.wireshark.org/review/32111
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-20 04:22:51 +00:00
Gerald Combs 11a9a501fb Dumpcap+Qt: Add support for `-a packets:NUM` and `-b packets:NUM`.
Add the ability to rotate files after a specified number of packets (`-b
packets:NUM`). Move some condition checks to capture_loop_write_packet_cb.

Add `-a packets:NUM` in order to be consistent. It is functionally
equivalent to the `-c` flag.

Add a corresponding "packets" option to the Capture Interfaces dialog
Output tab.

Add initial tests for autostop and ringbuffer conditions.

Change-Id: I66eb968927ed287deb8edb96db96d7c73526c257
Reviewed-on: https://code.wireshark.org/review/30534
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-11-09 05:55:11 +00:00
Stig Bjørlykke 5af98d9be5 prefs: Remove prefs.gui_use_pref_save
This setting was only used in GTK.

Change-Id: If184c61e4e081992e517f480b4faf129b81508c1
Reviewed-on: https://code.wireshark.org/review/29388
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-09-02 18:36:25 +00:00
Joerg Mayer f1c410275f Get rid of some occurrences of Q_UNUSED
- Trivial by just doing it the C++ way
- Non-Trivial where the whole function can be put into the #ifdef instead of the variable use case

Change-Id: I034751b8a3c70211173f0c06c954def94450db46
Reviewed-on: https://code.wireshark.org/review/28311
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2018-06-18 16:22:43 +00:00
Guy Harris 3c9c2c6534 If device->active_dlt = -1, show "Unknown" rather than "DLT -1".
It means we don't know the active link-layer header type - probably
because the device can't be opened, so we can't get the default linktype
or the list of available linktypes - so show it as "Unknown".

Bug: 14847
Change-Id: I5a1ad360d2ae461e8db57e387679700a566b0949
Reviewed-on: https://code.wireshark.org/review/28185
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-10 02:43:15 +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
Stig Bjørlykke 14720ace06 Fix comment end after SPDX identifier
Move */ to a separate line below the SPDX identifier.

Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f
Reviewed-on: https://code.wireshark.org/review/27211
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-01 06:56:37 +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
Dario Lombardo e52172c775 Qt: use SPDX identifiers.
Change-Id: I111945c08f99818c249a868c12d9a7b3a3df64b3
Reviewed-on: https://code.wireshark.org/review/25563
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-02 13:39:36 +00:00
Dario Lombardo 43833239fc Qt: change obsolete qVariantFromValue into QVariant::fromValue.
Change-Id: I767b06c0e316347cdb28b769f1032e6d44cba45b
Reviewed-on: https://code.wireshark.org/review/25321
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-15 12:20:32 +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
Peter Wu 1dea7f3dc1 Rename ui_util.h -> ws_ui_util.h
In preparation for possibly using AUTOUIC in CMake which treats "ui_*.h"
files specially, rename ui_util.h. No other changes.

Change-Id: Id026572c000b713ff0e9388dc7fff8d81d4df73e
Reviewed-on: https://code.wireshark.org/review/23916
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-10-15 01:14:26 +00:00
Mikael Kanstrup 879920a2eb iface_lists: Remove locked field
It seems the locked field of interface_t was used to avoid
simultaneous updates of interface entries from either multiple
threads or most likely the recursive UI update callbacks
case later identified.

Since 802362e ("Avoid recursive scan_local_interfaces operation")
the recursive callback behavior is no longer happening. And as
code does not have consistent checks the locked field can anyway
hardly protect a multi-threaded case if such a case exists.

Remove the unnecessary locked field.

Ping-Bug: 13864
Change-Id: Idc393f702b82aa6014dd636572d00f0d67120bf3
Reviewed-on: https://code.wireshark.org/review/23262
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:32 +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
Roland Knall 02e80019f2 Qt: Create models directory
Following the move for widgets and utils directory, moving models
and delegates to the utils directory. Guidelines for this directory are:

 - Implementation of a model
 - Implementation of a delegate
 - Utility class for data storage used by a model

Note: additionally all includes affected by this move have been changed
to absolute path includes, instead of relative ones.

Change-Id: I3bb868af7d3570437682b722a0cd46c906628570
Reviewed-on: https://code.wireshark.org/review/22790
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-07-26 12:22:04 +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
Roland Knall ee699eb720 Qt: Move all utility widgets to widgets subdirectory
Move all utility widgets to the widgets subdirectory and
add separate source_group for their files

Correct some alphabetization in ui/qt/CMakeLists.txt noticed
during compare.

Change-Id: I2d664edc2b32f126438fb673ea53a5ae94cd43d1
Reviewed-on: https://code.wireshark.org/review/22531
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-11 21:30:29 +00:00
Sake Blok 3803e00367 Add option to use wall-clock intervals
Add the "interval" option to "-b". Each new capture starts at the
exact start of a time interval. For instance, using -b interval:3600
will start a new capture file at each whole hour.

Changed the duration option in the GUI interfaces to use the new
interval option.

Change-Id: I0180c43843f5d2f0c2f50153c9ce42ac7fa5aeae
Reviewed-on: https://code.wireshark.org/review/22428
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Sake Blok <sake.blok@SYN-bit.nl>
2017-07-03 16:41:37 +00:00
Guy Harris d0865fd619 Allow bigger snapshot lengths for D-Bus captures.
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except
for D-Bus captures.  Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for
them, because that's the largest possible D-Bus message size.  See

	https://bugs.freedesktop.org/show_bug.cgi?id=100220

for an example of the problems caused by limiting the snapshot length to
256KB for D-Bus.

Have a snapshot length of 0 in a capture_file structure mean "there is
no snapshot length for the file"; we don't need the has_snap field in
that case, a value of 0 mean "no, we don't have a snapshot length".

In dumpcap, start out with a pipe buffer size of 2KB, and grow it as
necessary.  When checking for a too-big packet from a pipe, check
against the appropriate maximum - 128MB for DLT_DBUS, 256KB for
everything else.

Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20
Reviewed-on: https://code.wireshark.org/review/21952
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-05 05:28:26 +00:00
Stig Bjørlykke 30d98d1ea9 Qt: Remove semicolon behind Q_UNUSED macro
Change-Id: I75ff975216da23447b94bc513671ac269c52b7dc
Reviewed-on: https://code.wireshark.org/review/21342
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-04-26 06:11:32 +00:00
Guy Harris f8c870eee2 Throw in a cast to squelch a compiler warning.
MSVC warns that comparing a gboolean (which is a typedef for int) to a
bool is unsafe; convert the gboolean to a bool (the post-C++11 draft C++
standard I have says that the conversion from integral to bool does
pretty much what you'd expect - zero goes to false, non-zero goes to
true - and is exactly what we want).

Change-Id: Ia7d7b62baf87ca3a29da5140f68c2c5b38b2d6de
Reviewed-on: https://code.wireshark.org/review/20787
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-29 16:45:58 +00:00
Peter Wu 601fe5e351 Qt: propagate selection from main screen to dialog
Ensure that the selection in main screen is updated on refreshing
interfaces (InterfaceFrame::interfaceListChanged). Add additional
patches to ensure that selection changes from the main screen propagate
to the dialog and be careful to avoid infinite recursions.

Life of a signal for InterfaceFrame:

    ui->interfaceTree->selectionModel emits selectionChanged
    -> slot InterfaceFrame::interfaceTreeSelectionChanged
      -> emits InterfaceFrame::itemSelectionChanged
        -> slot MainWelcome::interfaceSelected
           -> emits MainWelcome::interfacesChanged
              -> slot CaptureInterfacesDialog::interfaceSelected
                 (updats dialog selection)

Life of a signal for CaptureInterfacesDialog:

    ui->interfaceTree emits itemSelectionChanged
    -> slot CaptureInterfacesDialog::interfaceSelected
       (emission of next signal because sender is ui->interfaceTree)
       -> emits CaptureInterfacesDialog::interfacesChanged
          -> slot InterfaceFrame::updateSelectedInterfaces
             (updates main screen selection)

This should probably be updated to model/view with shared selection
model in the future.

Change-Id: Ibb32c201a92bd2f1310523b3e6e63b03209c9ce4
Reviewed-on: https://code.wireshark.org/review/20487
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-29 15:16:56 +00:00
Peter Wu 721182b09b Qt: fix closing editor in capture interfaces dialog
Whenever (every second) the points list is updated, a dataChanged signal
is emitted and Qt decides to close all editors. Workaround this issue by
disabling the dataChanged signal. (Alternatively, we could change the
list into a pointer-to-list again.)

Change-Id: Ie06d118d011a72f5be5608c2324ca2715a3f97c7
Fixes: v2.3.0rc0-2014-gf8dc2346df ("Qt: fix memleak of PointList in interface statistics")
Reviewed-on: https://code.wireshark.org/review/20530
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-03-28 05:09:39 +00:00
Pascal Quantin 4cc0d1e728 Qt: the maximum packet size is WTAP_MAX_PACKET_SIZE, not 65535
Also ensure that the update of sparkline does not lose focus of the
spinbox currently edited.

Change-Id: Icf7dd180fe3cb1d8bfab9017f923bf38e6210554
Reviewed-on: https://code.wireshark.org/review/20749
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-03-28 01:35:54 +00:00
Gerald Combs dcfc288130 Qt: Enable/disable Capture Interfaces buttons consistently.
The "Compile BPFs" and "Start" buttons need to be enabled and disabled
at the same time and according to the same criteria. Make sure we do so.

Change-Id: I708886564dcf569cd71f936119195209ef6dcbd5
Reviewed-on: https://code.wireshark.org/review/20265
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-02-26 17:51:33 +00:00
Gerald Combs d84577fe1a Yell at the user less.
Our user-facing messages should have a helpful (or at the very least
neutral) tone. In English, exclamation points are neither. Replace a
bunch of them with periods.

Change-Id: I29c3b2f84c25e06aae5b559860224559053a0378
Reviewed-on: https://code.wireshark.org/review/20189
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-20 16:53:17 +00:00
Peter Wu f8dc2346df Qt: fix memleak of PointList in interface statistics
The list of points (for interface traffic statistics) is part of the
interface tree model/view. Remove the pointer indirection to simplify
cleanup and avoid leaking a PointList.

Note that the SparkLineDelegate is used in two different places
(CaptureInterfacesDialog and InterfaceTreeModel).

Change-Id: I5fef7dadd44fdf58c07844fee269f509c712a36f
Reviewed-on: https://code.wireshark.org/review/19606
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-01-12 13:41:09 +00:00
Dario Lombardo 7849d29b24 Qt: make parameter unused when SHOW_BUFFER_COLUMN is undefined.
Change-Id: I87843f61d4c98fea90e49088f3d56df5aa801e58
Reviewed-on: https://code.wireshark.org/review/17946
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-10-03 09:29:59 +00:00
Roland Knall 99097dd3c6 Interface List: Change display to view/model
This changes the underlying model of the main interface tree.
Because of that, we can resort to a view/model approach, enlisting
the global interfaces list as only data source.

The interface list works identical to the old list, but allows
for filtering of the displayed interfaces by type. Only types, which
are present and whose interfaces are not hidden, are being displayed
for selection.

Change-Id: If8475b227daa026dc0ad3d25bc7fe050d5bf2ac3
Reviewed-on: https://code.wireshark.org/review/17940
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-10-01 13:18:51 +00:00
Roland Knall f8b32e5b4e checkAPIs.pl: Avoid false positive in header
This avoids the text index being identified as shadow variable

Bug:12956
Change-Id: I5565c5807e2c7d317d6849deeba9edd63c069397
Reviewed-on: https://code.wireshark.org/review/17953
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-09-27 22:06:17 +00:00
Gerald Combs 86bf0357fe Remove old Qt code.
Our minimum version has been 4.7 for a while. Remove dead
QT_VERSION_CHECK code.

Change-Id: Ia003c1aa4275eefdda707975774d886643ff1538
Reviewed-on: https://code.wireshark.org/review/16888
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>
2016-08-06 07:29:55 +00:00
Dario Lombardo 240f60577d Qt: add initializer (CID 1230901).
Change-Id: Ie7874ef90ce14978adb2c62f208dbcc2a636d3cf
Reviewed-on: https://code.wireshark.org/review/16289
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-04 22:11:20 +00:00
Gerald Combs 23d1fed59f Qt: Fix "applicable" capture interface behavior.
In the Capture Interfaces dialog, make sure we have exactly one of a
"not applicable" dash or a checkbox. Otherwise if your interface falsely
reports that it supports monitor mode you might end up with both.

Change-Id: I9b256f1ef0e8ff32626e7f2b526130f3c110d142
Reviewed-on: https://code.wireshark.org/review/15761
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-06-07 15:39:35 +00:00
Gerald Combs 4b216aea94 Qt: Use checkboxes in the capture options dialog.
Switch from enabled/disabled comboboxes to checkboxes. This requires
less clicking on the user's part and less translating.

Draw em dashes instead of "n/a" for non-applicable items, and use
the disabled palette when drawing them.

Change-Id: Ic97b6d44734b679bbeee00e9c2a322e7b8a67247
Reviewed-on: https://code.wireshark.org/review/15661
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-06-01 23:36:57 +00:00
Gerald Combs 99f4ccb7a0 Qt: Use a standard "Start" button in Capture Options.
QDialogButtonBox does a fine job of creating and managing buttons.
Instead of creating our own "Start" button, just rename the "OK" button.
This matches what we do elsewhere, e.g. in the Extcap Options dialog.

Change-Id: I3c5eec1f01925f7b82c4e7360d685acbe4bb2fea
Reviewed-on: https://code.wireshark.org/review/15653
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-05-31 22:09:05 +00:00
Gerald Combs 7f2de76c63 Qt: Monitor mode fixups.
When we update the monitor mode setting for an interface, update its
link type list.

Start filling in interface columns from a common function instead of
multiple places.

Rename some member function names to match
https://www.wireshark.org/docs/wsdg_html_chunked/ChUIQt.html#_coding_practices_and_naming_conventions

Bug: 11364
Change-Id: I26ac7e9719863169b62069e49ebf17ed97fbe516
Reviewed-on: https://code.wireshark.org/review/15583
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-05-31 19:27:45 +00:00
Stig Bjørlykke e13976339b Qt: Check for selected interface in filterEdited()
Add a check for selected filters in filterEdited() to avoid a
out-of-bounds index into ui->interfaceTree->selectedItems().

Bug: 12241
Bug: 12245
Change-Id: Ie18fc34a17427dd5330a5a617051cbc061555e0c
Reviewed-on: https://code.wireshark.org/review/14404
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-03-10 11:39:49 +00:00
Stig Bjørlykke 1a716800e3 Qt: Add dialog geometry restore
Add GeometryStateDialog class to handle load and save dialog geometry.
The QDialog class name will be used as window name.  For shared
classes the UAT name or the statistics title or abbr will be used.

Change-Id: I5a019598307fb3861518f41e733de834788184d8
Reviewed-on: https://code.wireshark.org/review/14139
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-02-28 18:25:50 +00:00
Guy Harris 4d22c44f65 Have the interface list unsorted by default.
That way, they initially show up in pcap's order, putting the preferred
interface at the top.  If the user wants to sort them by some column,
the user can click on the column in question.

Change-Id: I30ac38519c42ae5317d99fdd0a079b030e6af308
Reviewed-on: https://code.wireshark.org/review/14194
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-27 02:52:00 +00:00
Gerald Combs 070fc33e85 Qt: Update selected interface filter behavior.
Change the selected interface behavior in the main window and the
capture interfaces dialog to better handle multiple selections. Attempt
to document this at the top of interface_tree.cpp.

Move the default capture filter code from CaptureFilterEdit to
MainWelcome. Add a "conflicting filter" check to CaptureEdit which
updates the placeholder text.

Handle conflicting filters in the main welcome screen and the capture
interfaces dialog. Propagate interface selections and filter updates in
the capture interfaces dialog to the main welcome screen.

Consolidate some of the interface handling code in InterfaceTree and
CaptureInterfacesDialog.

Make sure CaptureInterfacesDialog manages the global capture options by
device name instead numeric index.

Start deprecating prefs.capture_devices_filter and
capture_dev_user_cfilter_find.

Change some member function names so that they're hopefully more clear
and consistent.

Ping-Bug: 11886
Change-Id: I63b06dbae29c2c45ee9252092ad54bdcbacae6e6
Reviewed-on: https://code.wireshark.org/review/14129
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-02-26 17:28:04 +00:00
Gerald Combs 7a9bd51e95 Qt: Capture Interfaces dialog geometry updates.
Widen CaptureInterfacesDialog. Manually set some column widths.

Change-Id: I84fd060d83b5f7bc186d79e22d5cc608dfdbd6c5
Reviewed-on: https://code.wireshark.org/review/14148
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-02-26 00:26:33 +00:00
Gerald Combs fd75aa2f3d Qt: Capture and display filter fixups.
In SyntaxLineEdit make sure we emit textEdited when we complete a
previously used filter. In CaptureInterfacesDialog, connect
captureFilterComboBox::activated to filterEdited. These enusre that we
fill in the capture filter column in CaptureInterfacesDialog.

Change-Id: Ibbf7ab223e37f8f73d8ec0289f8c32692a7e17d4
Reviewed-on: https://code.wireshark.org/review/14081
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-02-23 16:44:14 +00:00
Stig Bjørlykke 6e53a06678 Qt: No capture filter bookmarks in capture interfaces list
Change-Id: I4f53758c0fa4448656daac3ad186a6b0e687fc5c
Reviewed-on: https://code.wireshark.org/review/13593
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-01-29 08:24:36 +00:00
Gerald Combs e57bb1919c Make Qt UI capture filter behavior more closely match the GTK+ UI.
If the user enters a capture filter in the Capture Interfaces dialog and
presses "Start", make sure we copy the filter to the main welcome
screen.

Back out capture filter code from g0ce9ac4. Leave out the code that set
the global capture filter. Move the code that set individual capture
filters to the welcome screen.

Fix multiple interface selection in the welcome screen.

Rename allFilterComboBox in the capture interfaces dialog to
captureFilterComboBox to match the main welcome screen.

If the user starts typing in captureFilterComboBox, make sure the
"Capture Filter" column is visible. Update the "Capture Filter" column
as the user types. Conversely, if the user edits the "Capture Filter"
column, update captureFilterComboBox accordingly.

If we're editing a per-interface filter make sure we commit its contents
before starting capture.

Map our device index directly to each tree item instead of using a
separate map which will no longer be valid any time our sort order
changes (which we do right away in our constructor).

Don't set prefs.capture_devices_filter in the Qt UI. The GTK+ UI doesn't
and doing so can lead to surprising behavior. Note that it's mostly
unused.

Note that we don't multiple selected filters very well.

Ping-Bug: 11886
Change-Id: I3c052f4f464411e2fb8fb7d96b218e1ce2bac3fd
Reviewed-on: https://code.wireshark.org/review/13410
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-01-27 16:13:19 +00:00
Stig Bjørlykke 720f57d000 ui: Code cleanup
Fixed code layout to use common style in the file.
Mostly whitespace changes.

Change-Id: Id37b57717a9e26248fad07322dff09b1d1f45ac2
Reviewed-on: https://code.wireshark.org/review/13504
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-23 23:15:54 +00:00
Gerald Combs 8fe1cf77eb Fix capture output options.
Remove the "permanent file" checkbox. We weren't properly checking its
value and it was extraneous. Add placeholder text about temporary files.

Move the filename above the other options. That's where it is in the
GTK+ UI and it's arguably the most important.

When capturing to multiple files the size and duration settings aren't
mutually exclusive.

Change-Id: I1da1d3524e3c2de2361050913281472a172faa3a
Reviewed-on: https://code.wireshark.org/review/13269
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>
2016-01-14 05:22:08 +00:00
Stig Bjørlykke ffb51b3afb Qt: Disable configurable interface settings for extcap
Disable promiscuous mode, snaplen, buffer size and monitor mode
settings for extcap interfaces.

Bug: 11865
Change-Id: I20c67815ece99b8e742e36c727f415931b87af1f
Reviewed-on: https://code.wireshark.org/review/13023
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-01-05 14:46:12 +00:00
Peter Wu e3dd3f97f1 Qt: fix memleaks related to interface dialog
Also fix a not-so-problematic recent files "leak" when quitting
Wireshark.

Change-Id: I8556b07c197f0934f93d6da8c573c47fbd3fc060
Reviewed-on: https://code.wireshark.org/review/12529
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-16 05:43:58 +00:00
Mikael Kanstrup 3120d1f801 Fix memory leaks in all_ifaces when interface list changes
Valgrind report leaks of several allocations like these:
590 bytes in 50 blocks are possibly lost in loss record 29,818 of 31,670
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0xCB9C8A7: __vasprintf_chk (vasprintf_chk.c:82)
   by 0xA3D8DCA: g_vasprintf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
   by 0xA3B846C: g_strdup_vprintf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
   by 0xA3B850B: g_strdup_printf (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
   by 0x6F4B51: scan_local_interfaces (iface_lists.c:254)
   by 0x6EF3D8: iface_mon_handler2 (iface_monitor.c:113)
   by 0xBE56F1D: ??? (in /lib/libnl-3.so.200.3.0)
   by 0xBA16F19: ??? (in /usr/lib/libnl-route-3.so.200.3.0)
   by 0xBE54E5E: nl_cache_parse (in /lib/libnl-3.so.200.3.0)
   by 0xBE585CA: nl_msg_parse (in /lib/libnl-3.so.200.3.0)
   by 0x6EF372: iface_mon_handler (iface_monitor.c:123)

When the list of network interfaces is updated allocations done
for global_capture_opts.all_ifaces elements leak memory. Fixed by
introducing a helper function to be used for removing an interface_t
element from all_ifaces array. While at it also fixed misc leaks when
updating individual allocated records of all_ifaces elements.

Change-Id: I035e6936a44edeef2ebe4780931c14cde99e93a4
Reviewed-on: https://code.wireshark.org/review/12209
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-12-11 10:38:32 +00:00