aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-08-12 15:24:25 -0400
committerJohn Thacker <johnthacker@gmail.com>2023-08-18 10:49:03 +0000
commit95c299a06544210b70051d855b130709fbe5213e (patch)
treed17018d77a465d12d33f2c7cd1ecdd5a35e56262
parentc5452afb8d99665af4b740d3e671375bcf9b35cf (diff)
Move autoscroll preference behavior to recent
Make whether or not we are autoscrolling a "recent" item. Make the selection of automatically scrolling in the Capture Options tab actually have an effect (right now it does nothing.) Switching to a recent also means that the command line "-l" option actually turns on automatic scrolling if the recent value is off (currently it has no effect because it is always later overridden by the preference value). Document our behavior that autoscrolling, if turned on, temporarily turns off when manually scrolling upwards or Go'ing directly to a packet (so that a user can examine a chosen packet.) This temporary effect does not change the "recent" status, which changes only when the user directly turns the behavior on or off (through the capture window, the button or menu item, or the -l command line option.)
-rw-r--r--doc/wireshark.adoc5
-rw-r--r--docbook/wsug_src/wsug_capture.adoc4
-rw-r--r--docbook/wsug_src/wsug_customize.adoc4
-rw-r--r--epan/prefs.c5
-rw-r--r--epan/prefs.h1
-rw-r--r--ui/commandline.c2
-rw-r--r--ui/logray/logray_main_window_slots.cpp17
-rw-r--r--ui/preference_utils.c5
-rw-r--r--ui/qt/capture_options_dialog.cpp5
-rw-r--r--ui/qt/capture_preferences_frame.cpp7
-rw-r--r--ui/qt/capture_preferences_frame.h1
-rw-r--r--ui/qt/capture_preferences_frame.ui10
-rw-r--r--ui/qt/packet_list.cpp10
-rw-r--r--ui/qt/wireshark_main_window_slots.cpp17
-rw-r--r--ui/recent.c8
-rw-r--r--ui/recent.h1
16 files changed, 48 insertions, 54 deletions
diff --git a/doc/wireshark.adoc b/doc/wireshark.adoc
index 49a6dc9533..2636019643 100644
--- a/doc/wireshark.adoc
+++ b/doc/wireshark.adoc
@@ -2130,11 +2130,6 @@ whether to put the interface in promiscuous mode when capturing.
The __Update list of packets in real time__ check box lets you specify
that the display should be updated as packets are seen.
-
-The __Automatic scrolling in live capture__ check box lets you specify
-whether, in an "Update list of packets in real time" capture, the packet
-list pane should automatically scroll to show the most recently captured
-packets.
--
Name Resolution Preferences::
diff --git a/docbook/wsug_src/wsug_capture.adoc b/docbook/wsug_src/wsug_capture.adoc
index c0a912e128..3f15ded062 100644
--- a/docbook/wsug_src/wsug_capture.adoc
+++ b/docbook/wsug_src/wsug_capture.adoc
@@ -228,8 +228,10 @@ When you check this, Wireshark captures in a separate process and feeds the capt
Automatically scroll during live capture:::
Scroll the packet list pane as new packets come in, so you are always looking at the most recent packet.
+Automatic scrolling is temporarily disabled when manually scrolling upwards or performing a <<ChUseTabGo,"Go" action>> so that the selected packet can be examined.
+It will resume upon manually scrolling to the end of the packet list.
If you do not specify this Wireshark adds new packets to the packet list but does not scroll the packet list pane.
-This option is greyed out if “Update list of packets in real-time” is disabled.
+This option has no effect if “Update list of packets in real-time” is disabled.
Show capture information during capture:::
If this option is enabled, the capture information dialog described in <<ChCapRunningSection>> will be shown while packets are captured.
diff --git a/docbook/wsug_src/wsug_customize.adoc b/docbook/wsug_src/wsug_customize.adoc
index 651e3640ab..829c1edfef 100644
--- a/docbook/wsug_src/wsug_customize.adoc
+++ b/docbook/wsug_src/wsug_customize.adoc
@@ -749,10 +749,6 @@ This does give an insight in the packets captured, although it takes processing
The preference _Interval between updates (ms)_ allows you to configure how often the packet list is updated during the packet capture process.
A higher interval reduces processing, but causes more delay between capture and display in the packet list.
-Selecting _Automatic scrolling in live capture_ causes the packet list to scroll up once the packet list is full (see previous item).
-To keep track of the current state of the capture process the packet list is scrolled down when packets are added.
-If only the start of the packet list is important this item can be unselected.
-
Selecting _Don't load interfaces on startup_ prevents Wireshark from spawning dumpcap to populate the list of capture interfaces on the local system.
This might be a time consuming operation delaying the start of the program, however on most systems this is not an issue.
The interface list can always be populated after Wireshark is started via menu:Capture[Refresh Interfaces].
diff --git a/epan/prefs.c b/epan/prefs.c
index 4d0ba37234..82c23a78e7 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -3628,9 +3628,7 @@ prefs_register_modules(void)
prefs_register_bool_preference(capture_module, "no_extcap", "Disable external capture interfaces",
"Disable external capture modules (extcap)", &prefs.capture_no_extcap);
- /* We might want to make this a "recent" setting. */
- prefs_register_bool_preference(capture_module, "auto_scroll", "Scroll packet list during capture",
- "Scroll packet list during capture?", &prefs.capture_auto_scroll);
+ prefs_register_obsolete_preference(capture_module, "auto_scroll");
prefs_register_bool_preference(capture_module, "show_info", "Show capture information dialog while capturing",
"Show capture information dialog while capturing?", &prefs.capture_show_info);
@@ -4187,7 +4185,6 @@ pre_init_prefs(void)
prefs.capture_real_time = TRUE;
prefs.capture_update_interval = DEFAULT_UPDATE_INTERVAL;
prefs.capture_no_extcap = FALSE;
- prefs.capture_auto_scroll = TRUE;
prefs.capture_show_info = FALSE;
if (!prefs.capture_columns) {
diff --git a/epan/prefs.h b/epan/prefs.h
index 50ea5fc03d..832f70380c 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -195,7 +195,6 @@ typedef struct _e_prefs {
gboolean capture_pcap_ng;
gboolean capture_real_time;
guint capture_update_interval;
- gboolean capture_auto_scroll; /* XXX - Move to recent */
gboolean capture_no_interface_load;
gboolean capture_no_extcap;
gboolean capture_show_info;
diff --git a/ui/commandline.c b/ui/commandline.c
index c203281bfc..c1963db48a 100644
--- a/ui/commandline.c
+++ b/ui/commandline.c
@@ -493,7 +493,7 @@ void commandline_other_options(int argc, char *argv[], gboolean opt_reset)
break;
case 'l': /* Automatic scrolling in live capture mode */
#ifdef HAVE_LIBPCAP
- auto_scroll_live = TRUE;
+ recent.capture_auto_scroll = TRUE;
#else
capture_option_specified = TRUE;
arg_error = TRUE;
diff --git a/ui/logray/logray_main_window_slots.cpp b/ui/logray/logray_main_window_slots.cpp
index f6aa442df2..481fd3b298 100644
--- a/ui/logray/logray_main_window_slots.cpp
+++ b/ui/logray/logray_main_window_slots.cpp
@@ -341,9 +341,6 @@ void LograyMainWindow::updatePreferenceActions()
main_ui_->actionViewNameResolutionPhysical->setChecked(gbl_resolv_flags.mac_name);
main_ui_->actionViewNameResolutionNetwork->setChecked(gbl_resolv_flags.network_name);
main_ui_->actionViewNameResolutionTransport->setChecked(gbl_resolv_flags.transport_name);
-
- // Should this be a "recent" setting?
- main_ui_->actionGoAutoScroll->setChecked(prefs.capture_auto_scroll);
}
void LograyMainWindow::updateRecentActions()
@@ -387,6 +384,8 @@ void LograyMainWindow::updateRecentActions()
main_ui_->actionViewTimeDisplaySecondsWithHoursAndMinutes->setChecked(recent.gui_seconds_format == TS_SECONDS_HOUR_MIN_SEC);
main_ui_->actionViewColorizePacketList->setChecked(recent.packet_list_colorize);
+
+ main_ui_->actionGoAutoScroll->setChecked(recent.capture_auto_scroll);
}
// Don't connect to this directly. Connect to or emit fiterAction(...) instead.
@@ -855,6 +854,7 @@ void LograyMainWindow::startCapture(QStringList interfaces _U_) {
showCapture();
/* XXX - we might need to init other pref data as well... */
+ main_ui_->actionGoAutoScroll->setChecked(recent.capture_auto_scroll);
/* XXX - can this ever happen? */
if (cap_session_.state != CAPTURE_STOPPED)
@@ -1598,7 +1598,7 @@ void LograyMainWindow::setFeaturesEnabled(bool enabled)
{
main_ui_->statusBar->clearMessage();
#ifdef HAVE_LIBPCAP
- main_ui_->actionGoAutoScroll->setChecked(auto_scroll_live);
+ main_ui_->actionGoAutoScroll->setChecked(recent.capture_auto_scroll);
#endif
}
else
@@ -2666,6 +2666,15 @@ void LograyMainWindow::connectGoMenuActions()
connect(main_ui_->actionGoPreviousHistoryPacket, &QAction::triggered,
packet_list_, &PacketList::goPreviousHistoryPacket);
+ // triggered is whenever the user clicks the button; save that as
+ // the new recent value
+ connect(main_ui_->actionGoAutoScroll, &QAction::triggered, this,
+ [](bool checked) { recent.capture_auto_scroll = checked; });
+
+ // toggled is whenever the value changes; if it changes programmatically
+ // (e.g., the user scrolls upwards so we stop auto scrolling) change
+ // whether the button is checked but don't save value to recent (it's
+ // a temporary change)
connect(main_ui_->actionGoAutoScroll, &QAction::toggled, this,
[this](bool checked) { packet_list_->setVerticalAutoScroll(checked); });
}
diff --git a/ui/preference_utils.c b/ui/preference_utils.c
index 270222ade1..751b47b886 100644
--- a/ui/preference_utils.c
+++ b/ui/preference_utils.c
@@ -30,10 +30,6 @@
#include "ui/preference_utils.h"
#include "ui/simple_dialog.h"
-#ifdef HAVE_LIBPCAP
-gboolean auto_scroll_live;
-#endif
-
/* Fill in capture options with values from the preferences */
void
prefs_to_capture_opts(void)
@@ -46,7 +42,6 @@ prefs_to_capture_opts(void)
global_capture_opts.show_info = prefs.capture_show_info;
global_capture_opts.real_time_mode = prefs.capture_real_time;
global_capture_opts.update_interval = prefs.capture_update_interval;
- auto_scroll_live = prefs.capture_auto_scroll;
#endif /* HAVE_LIBPCAP */
}
diff --git a/ui/qt/capture_options_dialog.cpp b/ui/qt/capture_options_dialog.cpp
index 064f82e4e1..21937f6b7b 100644
--- a/ui/qt/capture_options_dialog.cpp
+++ b/ui/qt/capture_options_dialog.cpp
@@ -37,6 +37,7 @@
#include "ui/util.h"
#include <wsutil/utf8_entities.h>
#include "ui/preference_utils.h"
+#include "ui/recent.h"
#include <cstdio>
#include <epan/prefs.h>
@@ -582,7 +583,7 @@ void CaptureOptionsDialog::on_cbUpdatePacketsRT_toggled(bool checked)
void CaptureOptionsDialog::on_cbAutoScroll_toggled(bool checked)
{
- auto_scroll_live = checked;
+ recent.capture_auto_scroll = checked;
}
void CaptureOptionsDialog::on_cbExtraCaptureInfo_toggled(bool checked)
@@ -759,7 +760,7 @@ void CaptureOptionsDialog::updateInterfaces()
}
ui->cbUpdatePacketsRT->setChecked(global_capture_opts.real_time_mode);
- ui->cbAutoScroll->setChecked(true);
+ ui->cbAutoScroll->setChecked(recent.capture_auto_scroll);
ui->cbExtraCaptureInfo->setChecked(global_capture_opts.show_info);
ui->cbResolveMacAddresses->setChecked(gbl_resolv_flags.mac_name);
diff --git a/ui/qt/capture_preferences_frame.cpp b/ui/qt/capture_preferences_frame.cpp
index c77015a779..361eb6566a 100644
--- a/ui/qt/capture_preferences_frame.cpp
+++ b/ui/qt/capture_preferences_frame.cpp
@@ -39,7 +39,6 @@ CapturePreferencesFrame::CapturePreferencesFrame(QWidget *parent) :
pref_pcap_ng_ = prefFromPrefPtr(&prefs.capture_pcap_ng);
pref_real_time_ = prefFromPrefPtr(&prefs.capture_real_time);
pref_update_interval_ = prefFromPrefPtr(&prefs.capture_update_interval);
- pref_auto_scroll_ = prefFromPrefPtr(&prefs.capture_auto_scroll);
pref_no_interface_load_ = prefFromPrefPtr(&prefs.capture_no_interface_load);
pref_no_extcap_ = prefFromPrefPtr(&prefs.capture_no_extcap);
@@ -128,7 +127,6 @@ void CapturePreferencesFrame::updateWidgets()
ui->captureUpdateIntervalLineEdit->setText(QString::number(prefs_get_uint_value_real(pref_update_interval_, pref_stashed)));
ui->captureUpdateIntervalLineEdit->setPlaceholderText(QString::number(prefs_get_uint_value_real(pref_update_interval_, pref_default)));
ui->captureUpdateIntervalLineEdit->setSyntaxState(SyntaxLineEdit::Empty);
- ui->captureAutoScrollCheckBox->setChecked(prefs_get_bool_value(pref_auto_scroll_, pref_stashed));
#endif // HAVE_LIBPCAP
ui->captureNoInterfaceLoad->setChecked(prefs_get_bool_value(pref_no_interface_load_, pref_stashed));
ui->captureNoExtcapCheckBox->setChecked(prefs_get_bool_value(pref_no_extcap_, pref_stashed));
@@ -175,11 +173,6 @@ void CapturePreferencesFrame::on_captureUpdateIntervalLineEdit_textChanged(const
prefs_set_uint_value(pref_update_interval_, new_uint, pref_stashed);
}
-void CapturePreferencesFrame::on_captureAutoScrollCheckBox_toggled(bool checked)
-{
- prefs_set_bool_value(pref_auto_scroll_, checked, pref_stashed);
-}
-
void CapturePreferencesFrame::on_captureNoInterfaceLoad_toggled(bool checked)
{
prefs_set_bool_value(pref_no_interface_load_, checked, pref_stashed);
diff --git a/ui/qt/capture_preferences_frame.h b/ui/qt/capture_preferences_frame.h
index 48f138829e..147ac5ecd0 100644
--- a/ui/qt/capture_preferences_frame.h
+++ b/ui/qt/capture_preferences_frame.h
@@ -35,7 +35,6 @@ private slots:
void on_capturePcapNgCheckBox_toggled(bool checked);
void on_captureRealTimeCheckBox_toggled(bool checked);
void on_captureUpdateIntervalLineEdit_textChanged(const QString &new_str);
- void on_captureAutoScrollCheckBox_toggled(bool checked);
void on_captureNoInterfaceLoad_toggled(bool checked);
void on_captureNoExtcapCheckBox_toggled(bool checked);
diff --git a/ui/qt/capture_preferences_frame.ui b/ui/qt/capture_preferences_frame.ui
index 9093885cdd..b5a0b4b88f 100644
--- a/ui/qt/capture_preferences_frame.ui
+++ b/ui/qt/capture_preferences_frame.ui
@@ -116,16 +116,6 @@
</layout>
</item>
<item>
- <widget class="QCheckBox" name="captureAutoScrollCheckBox">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Keep the packet list scrolled to the bottom while capturing.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string>Automatic scrolling in live capture</string>
- </property>
- </widget>
- </item>
- <item>
<widget class="QCheckBox" name="captureNoInterfaceLoad">
<property name="text">
<string>Don't load interfaces on startup</string>
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 44ecc2f682..2aa3a31341 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -773,11 +773,11 @@ void PacketList::ctxDecodeAsDialog()
// - It's been more than tail_update_interval_ ms since we last scrolled
// actionGoAutoScroll in the main UI:
-// - Is set to the value of prefs.capture_auto_scroll on startup or whenever
-// the preference is changed
+// - Is set to the value of recent.capture_auto_scroll on startup (possibly
+// affected by the -l command line flag) or whenever the recent is changed
// - Can be triggered manually by the user
// - Is turned on if the last user-set vertical scrollbar position is at the
-// end and prefs.capture_auto_scroll is enabled
+// end and recent.capture_auto_scroll is enabled
// - Is turned off if the last user-set vertical scrollbar is not at the end,
// or if one of the Go to Packet actions is used
@@ -1979,10 +1979,10 @@ void PacketList::scrollViewChanged(bool at_end)
{
if (capture_in_progress_) {
// We want to start auto scrolling when the user scrolls to (or past)
- // the end only if prefs.capture_auto_scroll is set.
+ // the end only if recent.capture_auto_scroll is set.
// We want to stop autoscrolling if the user scrolls up or uses
// Go to Packet regardless of the preference setting.
- if (prefs.capture_auto_scroll || !at_end) {
+ if (recent.capture_auto_scroll || !at_end) {
emit packetListScrolled(at_end);
}
}
diff --git a/ui/qt/wireshark_main_window_slots.cpp b/ui/qt/wireshark_main_window_slots.cpp
index 5b66875e24..27eded5a42 100644
--- a/ui/qt/wireshark_main_window_slots.cpp
+++ b/ui/qt/wireshark_main_window_slots.cpp
@@ -373,9 +373,6 @@ void WiresharkMainWindow::updatePreferenceActions()
main_ui_->actionViewNameResolutionPhysical->setChecked(gbl_resolv_flags.mac_name);
main_ui_->actionViewNameResolutionNetwork->setChecked(gbl_resolv_flags.network_name);
main_ui_->actionViewNameResolutionTransport->setChecked(gbl_resolv_flags.transport_name);
-
- // Should this be a "recent" setting?
- main_ui_->actionGoAutoScroll->setChecked(prefs.capture_auto_scroll);
}
void WiresharkMainWindow::updateRecentActions()
@@ -420,6 +417,8 @@ void WiresharkMainWindow::updateRecentActions()
main_ui_->actionViewTimeDisplaySecondsWithHoursAndMinutes->setChecked(recent.gui_seconds_format == TS_SECONDS_HOUR_MIN_SEC);
main_ui_->actionViewColorizePacketList->setChecked(recent.packet_list_colorize);
+
+ main_ui_->actionGoAutoScroll->setChecked(recent.capture_auto_scroll);
}
// Don't connect to this directly. Connect to or emit fiterAction(...) instead.
@@ -907,6 +906,7 @@ void WiresharkMainWindow::startCapture(QStringList interfaces _U_) {
showCapture();
/* XXX - we might need to init other pref data as well... */
+ main_ui_->actionGoAutoScroll->setChecked(recent.capture_auto_scroll);
/* XXX - can this ever happen? */
if (cap_session_.state != CAPTURE_STOPPED)
@@ -1708,7 +1708,7 @@ void WiresharkMainWindow::setFeaturesEnabled(bool enabled)
{
main_ui_->statusBar->clearMessage();
#ifdef HAVE_LIBPCAP
- main_ui_->actionGoAutoScroll->setChecked(auto_scroll_live);
+ main_ui_->actionGoAutoScroll->setChecked(recent.capture_auto_scroll);
#endif
}
else
@@ -2913,6 +2913,15 @@ void WiresharkMainWindow::connectGoMenuActions()
connect(main_ui_->actionGoPreviousHistoryPacket, &QAction::triggered,
packet_list_, &PacketList::goPreviousHistoryPacket);
+ // triggered is whenever the user clicks the button; save that as
+ // the new recent value
+ connect(main_ui_->actionGoAutoScroll, &QAction::triggered, this,
+ [](bool checked) { recent.capture_auto_scroll = checked; });
+
+ // toggled is whenever the value changes; if it changes programmatically
+ // (e.g., the user scrolls upwards so we stop auto scrolling) change
+ // whether the button is checked but don't save value to recent (it's
+ // a temporary change)
connect(main_ui_->actionGoAutoScroll, &QAction::toggled, this,
[this](bool checked) { packet_list_->setVerticalAutoScroll(checked); });
}
diff --git a/ui/recent.c b/ui/recent.c
index 1eb5b33654..a743a6a99c 100644
--- a/ui/recent.c
+++ b/ui/recent.c
@@ -42,6 +42,7 @@
#define RECENT_KEY_PACKET_DIAGRAM_SHOW "gui.packet_diagram_show"
#define RECENT_KEY_STATUSBAR_SHOW "gui.statusbar_show"
#define RECENT_KEY_PACKET_LIST_COLORIZE "gui.packet_list_colorize"
+#define RECENT_KEY_CAPTURE_AUTO_SCROLL "capture.auto_scroll"
#define RECENT_GUI_TIME_FORMAT "gui.time_format"
#define RECENT_GUI_TIME_PRECISION "gui.time_precision"
#define RECENT_GUI_SECONDS_FORMAT "gui.seconds_format"
@@ -867,6 +868,10 @@ write_profile_recent(void)
RECENT_KEY_PACKET_LIST_COLORIZE,
recent.packet_list_colorize);
+ write_recent_boolean(rf, "Auto scroll packet list when capturing",
+ RECENT_KEY_CAPTURE_AUTO_SCROLL,
+ recent.capture_auto_scroll);
+
write_recent_enum(rf, "Timestamp display format",
RECENT_GUI_TIME_FORMAT, ts_type_values,
recent.gui_time_format);
@@ -1083,6 +1088,8 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
parse_recent_boolean(value, &recent.statusbar_show);
} else if (strcmp(key, RECENT_KEY_PACKET_LIST_COLORIZE) == 0) {
parse_recent_boolean(value, &recent.packet_list_colorize);
+ } else if (strcmp(key, RECENT_KEY_CAPTURE_AUTO_SCROLL) == 0) {
+ parse_recent_boolean(value, &recent.capture_auto_scroll);
} else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) {
recent.gui_time_format = (ts_type)str_to_val(value, ts_type_values,
is_packet_configuration_namespace() ? TS_RELATIVE : TS_ABSOLUTE);
@@ -1365,6 +1372,7 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
recent.packet_diagram_show = TRUE;
recent.statusbar_show = TRUE;
recent.packet_list_colorize = TRUE;
+ recent.capture_auto_scroll = TRUE;
recent.gui_time_format = TS_RELATIVE;
recent.gui_time_precision = TS_PREC_AUTO;
recent.gui_seconds_format = TS_SECONDS_DEFAULT;
diff --git a/ui/recent.h b/ui/recent.h
index c53bf02f01..42ee40341b 100644
--- a/ui/recent.h
+++ b/ui/recent.h
@@ -106,6 +106,7 @@ typedef struct recent_settings_tag {
gboolean packet_diagram_show;
gboolean statusbar_show;
gboolean packet_list_colorize;
+ gboolean capture_auto_scroll;
ts_type gui_time_format;
gint gui_time_precision;
ts_seconds_type gui_seconds_format;