From a748f8f41a64e1f3990c11fd4648362f41016c03 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Fri, 22 Mar 2019 14:49:41 -0400 Subject: [PATCH] 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 Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- doc/dumpcap.pod | 3 +- doc/tshark.pod | 3 +- ui/qt/capture_interfaces_dialog.cpp | 22 ++++++- ui/qt/capture_interfaces_dialog.ui | 90 +++++++++++++++++++++++++---- 4 files changed, 101 insertions(+), 17 deletions(-) diff --git a/doc/dumpcap.pod b/doc/dumpcap.pod index e25bda829b..5cb459a823 100644 --- a/doc/dumpcap.pod +++ b/doc/dumpcap.pod @@ -122,7 +122,8 @@ B:I switch to the next file after it reaches a size of I kB. Note that the filesize is limited to a maximum value of 2 GiB. B:I switch to the next file when the time is an exact -multiple of I seconds +multiple of I seconds. For example, use 3600 to switch to a new file +every hour on the hour. B:I switch to the next file after it contains I packets. diff --git a/doc/tshark.pod b/doc/tshark.pod index 6f746927ff..de0226c630 100644 --- a/doc/tshark.pod +++ b/doc/tshark.pod @@ -269,7 +269,8 @@ B:I switch to the next file after it reaches a size of I kB. Note that the filesize is limited to a maximum value of 2 GiB. B:I switch to the next file when the time is an exact -multiple of I seconds +multiple of I seconds. For example, use 3600 to switch to a new file +every hour on the hour. B:I switch to the next file after it contains I packets. diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp index f3bdcbab72..cb837d4af2 100644 --- a/ui/qt/capture_interfaces_dialog.cpp +++ b/ui/qt/capture_interfaces_dialog.cpp @@ -554,7 +554,6 @@ void CaptureInterfacesDialog::updateInterfaces() ui->PktSpinBox->setValue(global_capture_opts.file_packets); } ui->MBCheckBox->setChecked(global_capture_opts.has_autostop_filesize); - ui->SecsCheckBox->setChecked(global_capture_opts.has_file_interval); if (global_capture_opts.has_autostop_filesize) { int value = global_capture_opts.autostop_filesize; if (value > 1000000) { @@ -586,8 +585,10 @@ void CaptureInterfacesDialog::updateInterfaces() } } } - if (global_capture_opts.has_file_interval) { - int value = global_capture_opts.file_interval; + + ui->SecsCheckBox->setChecked(global_capture_opts.has_file_duration); + if (global_capture_opts.has_file_duration) { + int value = global_capture_opts.file_duration; if (value > 3600 && value % 3600 == 0) { ui->SecsSpinBox->setValue(value / 3600); ui->SecsComboBox->setCurrentIndex(2); @@ -600,6 +601,21 @@ void CaptureInterfacesDialog::updateInterfaces() } } + ui->IntervalSecsCheckBox->setChecked(global_capture_opts.has_file_interval); + if (global_capture_opts.has_file_interval) { + int value = global_capture_opts.file_interval; + if (value > 3600 && value % 3600 == 0) { + ui->IntervalSecsSpinBox->setValue(value / 3600); + ui->IntervalSecsComboBox->setCurrentIndex(2); + } else if (value > 60 && value % 60 == 0) { + ui->IntervalSecsSpinBox->setValue(value / 60); + ui->IntervalSecsComboBox->setCurrentIndex(1); + } else { + ui->IntervalSecsSpinBox->setValue(value); + ui->IntervalSecsComboBox->setCurrentIndex(0); + } + } + if (global_capture_opts.has_ring_num_files) { ui->RbSpinBox->setValue(global_capture_opts.ring_num_files); ui->RbCheckBox->setCheckState(Qt::Checked); diff --git a/ui/qt/capture_interfaces_dialog.ui b/ui/qt/capture_interfaces_dialog.ui index eb0b915f5a..3755c6f3b7 100644 --- a/ui/qt/capture_interfaces_dialog.ui +++ b/ui/qt/capture_interfaces_dialog.ui @@ -250,10 +250,10 @@ - <html><head/><body><p>Instead of using a single capture file, multiple files will be created.</p><p>The generated file names will contain an incrementing number and the start time of the capture.</p></body></html> + <html><head/><body><p>Instead of using a single capture file, multiple files will be created.</p><p>The generated file names will contain an incrementing number and the start time of the capture.</p><p>NOTE: If enabled, at least one of the new-file criteria MUST be selected.</p></body></html> - Create a new file automatically after… + Create a new file automatically… true @@ -278,7 +278,10 @@ - + after + + + Switch to the next file after the specified number of packets have been captured. @@ -308,14 +311,17 @@ - + after + + + Switch to the next file after the file size exceeds the specified file size. - <html><head/><body><p>If the selected file size is exceeded, capturing switches to the next file.</p><p>PLEASE NOTE: One option MUST be selected.</p></body></html> + Switch to the next file after the file size exceeds the specified file size. true @@ -337,8 +343,7 @@ - If the selected file size is exceeded, capturing switches to the next file. -PLEASE NOTE: One option MUST be selected. + Switch to the next file after the file size exceeds the specified file size. @@ -360,15 +365,17 @@ PLEASE NOTE: One option MUST be selected. - + after + + + Switch to the next file when the time capturing to the current file exceeds the specified time. - If the selected file size is exceeded, capturing switches to the next file. -PLEASE NOTE: One option MUST be selected. + Switch to the next file when the time capturing to the current file exceeds the specified time. true @@ -390,8 +397,7 @@ PLEASE NOTE: One option MUST be selected. - If the selected file size is exceeded, capturing switches to the next file. -PLEASE NOTE: One option MUST be selected. + Switch to the next file when the time capturing to the current file exceeds the specified time. @@ -410,6 +416,66 @@ PLEASE NOTE: One option MUST be selected. + + + + when time is a multiple of + + + Switch to the next file when the (wall clock) time is an even multiple of the specified interval. +For example, use 1 hour to have a new file created every hour on the hour. + + + + + + + Switch to the next file when the (wall clock) time is an even multiple of the specified interval. +For example, use 1 hour to have a new file created every hour on the hour. + + + true + + + QAbstractSpinBox::PlusMinus + + + 1 + + + 1000000 + + + 1 + + + + + + + Switch to the next file when the (wall clock) time is an even multiple of the specified interval. +For example, use 1 hour to have a new file created every hour on the hour. + + + + seconds + + + + + minutes + + + + + hours + + + + 2 + + +