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>
This commit is contained in:
Jeff Morriss 2019-03-22 14:49:41 -04:00 committed by Anders Broman
parent 5a98368ad8
commit a748f8f41a
4 changed files with 101 additions and 17 deletions

View File

@ -122,7 +122,8 @@ B<filesize>:I<value> switch to the next file after it reaches a size of
I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB.
B<interval>:I<value> switch to the next file when the time is an exact
multiple of I<value> seconds
multiple of I<value> seconds. For example, use 3600 to switch to a new file
every hour on the hour.
B<packets>:I<value> switch to the next file after it contains I<value>
packets.

View File

@ -269,7 +269,8 @@ B<filesize>:I<value> switch to the next file after it reaches a size of
I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB.
B<interval>:I<value> switch to the next file when the time is an exact
multiple of I<value> seconds
multiple of I<value> seconds. For example, use 3600 to switch to a new file
every hour on the hour.
B<packets>:I<value> switch to the next file after it contains I<value>
packets.

View File

@ -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);

View File

@ -250,10 +250,10 @@
<item>
<widget class="QGroupBox" name="gbNewFileAuto">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Instead of using a single capture file, multiple files will be created.&lt;/p&gt;&lt;p&gt;The generated file names will contain an incrementing number and the start time of the capture.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Instead of using a single capture file, multiple files will be created.&lt;/p&gt;&lt;p&gt;The generated file names will contain an incrementing number and the start time of the capture.&lt;/p&gt;&lt;p&gt;NOTE: If enabled, at least one of the new-file criteria MUST be selected.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="title">
<string>Create a new file automatically after…</string>
<string>Create a new file automatically…</string>
</property>
<property name="flat">
<bool>true</bool>
@ -278,7 +278,10 @@
<item row="1" column="0">
<widget class="QCheckBox" name="PktCheckBox">
<property name="text">
<string/>
<string>after</string>
</property>
<property name="toolTip">
<string>Switch to the next file after the specified number of packets have been captured.</string>
</property>
</widget>
</item>
@ -308,14 +311,17 @@
<item row="2" column="0">
<widget class="QCheckBox" name="MBCheckBox">
<property name="text">
<string/>
<string>after</string>
</property>
<property name="toolTip">
<string>Switch to the next file after the file size exceeds the specified file size.</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="MBSpinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If the selected file size is exceeded, capturing switches to the next file.&lt;/p&gt;&lt;p&gt;PLEASE NOTE: One option MUST be selected.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Switch to the next file after the file size exceeds the specified file size.</string>
</property>
<property name="wrapping">
<bool>true</bool>
@ -337,8 +343,7 @@
<item row="2" column="2">
<widget class="QComboBox" name="MBComboBox">
<property name="toolTip">
<string>If the selected file size is exceeded, capturing switches to the next file.
PLEASE NOTE: One option MUST be selected.</string>
<string>Switch to the next file after the file size exceeds the specified file size.</string>
</property>
<item>
<property name="text">
@ -360,15 +365,17 @@ PLEASE NOTE: One option MUST be selected.</string>
<item row="3" column="0">
<widget class="QCheckBox" name="SecsCheckBox">
<property name="text">
<string/>
<string>after</string>
</property>
<property name="toolTip">
<string>Switch to the next file when the time capturing to the current file exceeds the specified time.</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="SecsSpinBox">
<property name="toolTip">
<string>If the selected file size is exceeded, capturing switches to the next file.
PLEASE NOTE: One option MUST be selected.</string>
<string>Switch to the next file when the time capturing to the current file exceeds the specified time.</string>
</property>
<property name="wrapping">
<bool>true</bool>
@ -390,8 +397,7 @@ PLEASE NOTE: One option MUST be selected.</string>
<item row="3" column="2">
<widget class="QComboBox" name="SecsComboBox">
<property name="toolTip">
<string>If the selected file size is exceeded, capturing switches to the next file.
PLEASE NOTE: One option MUST be selected.</string>
<string>Switch to the next file when the time capturing to the current file exceeds the specified time.</string>
</property>
<item>
<property name="text">
@ -410,6 +416,66 @@ PLEASE NOTE: One option MUST be selected.</string>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="IntervalSecsCheckBox">
<property name="text">
<string>when time is a multiple of</string>
</property>
<property name="toolTip">
<string>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.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="IntervalSecsSpinBox">
<property name="toolTip">
<string>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.</string>
</property>
<property name="wrapping">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::PlusMinus</enum>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="IntervalSecsComboBox">
<property name="toolTip">
<string>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.</string>
</property>
<item>
<property name="text">
<string>seconds</string>
</property>
</item>
<item>
<property name="text">
<string>minutes</string>
</property>
</item>
<item>
<property name="text">
<string>hours</string>
</property>
</item>
<property name="currentIndex">
<number>2</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>