IO Graph: Add checkbox to prevent automatic rescans

Adds a checkbox 'Automatic Update' to the IO Graph to enable or disable
rescans and recalculation of graph data temporarily. This is useful when
you want to modify settings of multiple graphs without triggering a rescan
with every change of a single setting. This becomes useful for large trace
files in particular.

Rescan or recalculation events are queued while 'Automatic Update' is not
active. Checking 'Automatic Update' triggers the queued updates.

The setting for 'Automatic Update' is stored in a preference.

A german translation for 'Automatic Update' is included.
This commit is contained in:
Developer Alexander 2021-09-21 08:39:10 +02:00 committed by Wireshark GitLab Utility
parent 543ea3968c
commit 7866f43d82
5 changed files with 48 additions and 2 deletions

View File

@ -3471,6 +3471,11 @@ prefs_register_modules(void)
"9 = Virtual",
&prefs.gui_interfaces_hide_types, PREF_STRING, NULL, TRUE);
prefs_register_bool_preference(gui_module, "io_graph_automatic_update",
"Enables automatic updates for IO Graph",
"Enables automatic updates for IO Graph",
&prefs.gui_io_graph_automatic_update);
/* Console
* These are preferences that can be read/written using the
* preference module API. These preferences still use their own
@ -4209,6 +4214,9 @@ pre_init_prefs(void)
prefs.st_sort_showfullname = FALSE;
prefs.display_hidden_proto_items = FALSE;
prefs.display_byte_fields_with_spaces = FALSE;
/* set the default values for the io graph dialog */
prefs.gui_io_graph_automatic_update = TRUE;
}
/*

View File

@ -185,6 +185,7 @@ typedef struct _e_prefs {
gchar *gui_interfaces_hide_types;
gboolean gui_interfaces_show_hidden;
gboolean gui_interfaces_remote_display;
gboolean gui_io_graph_automatic_update;
gchar *capture_device;
gchar *capture_devices_linktypes;
gchar *capture_devices_descr;

View File

@ -349,6 +349,8 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf, QString displayFi
close_bt->setDefault(true);
}
ui->automaticUpdateCheckBox->setChecked(prefs.gui_io_graph_automatic_update ? true : false);
stat_timer_ = new QTimer(this);
connect(stat_timer_, SIGNAL(timeout()), this, SLOT(updateStatistics()));
stat_timer_->start(stat_update_interval_);
@ -1141,13 +1143,13 @@ void IOGraphDialog::updateStatistics()
{
if (!isVisible()) return;
if (need_retap_ && !file_closed_) {
if (need_retap_ && !file_closed_ && prefs.gui_io_graph_automatic_update) {
need_retap_ = false;
cap_file_.retapPackets();
// The user might have closed the window while tapping, which means
// we might no longer exist.
} else {
if (need_recalc_ && !file_closed_) {
if (need_recalc_ && !file_closed_ && prefs.gui_io_graph_automatic_update) {
need_recalc_ = false;
need_replot_ = true;
int enabled_graphs = 0;
@ -1371,6 +1373,18 @@ void IOGraphDialog::on_logCheckBox_toggled(bool checked)
iop->replot();
}
void IOGraphDialog::on_automaticUpdateCheckBox_toggled(bool checked)
{
prefs.gui_io_graph_automatic_update = checked ? TRUE : FALSE;
prefs_main_write();
if(prefs.gui_io_graph_automatic_update)
{
updateStatistics();
}
}
void IOGraphDialog::on_actionReset_triggered()
{
on_resetButton_clicked();

View File

@ -15,6 +15,8 @@
#include <glib.h>
#include "epan/epan_dissect.h"
#include "epan/prefs.h"
#include "ui/preference_utils.h"
#include "ui/io_graph_item.h"
@ -224,6 +226,7 @@ private slots:
void on_resetButton_clicked();
void on_logCheckBox_toggled(bool checked);
void on_automaticUpdateCheckBox_toggled(bool checked);
void on_newToolButton_clicked();
void on_deleteToolButton_clicked();
void on_copyToolButton_clicked();

View File

@ -230,6 +230,26 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="automaticUpdateCheckBox">
<property name="text">
<string>Automatic Update</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">