aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeveloper Alexander <dev@alex-mails.de>2021-09-21 08:39:10 +0200
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-09-21 12:58:55 +0000
commit7866f43d8294bf9fc9a327c2d543352f8af4de7a (patch)
tree9d8e4823809a4870b55ffd405c45e416eb63e31f
parent543ea3968c2acc34e36a9a3983274498046e621a (diff)
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.
-rw-r--r--epan/prefs.c8
-rw-r--r--epan/prefs.h1
-rw-r--r--ui/qt/io_graph_dialog.cpp18
-rw-r--r--ui/qt/io_graph_dialog.h3
-rw-r--r--ui/qt/io_graph_dialog.ui20
5 files changed, 48 insertions, 2 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index d1cb9b9c82..2591931ea1 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -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;
}
/*
diff --git a/epan/prefs.h b/epan/prefs.h
index 09ffc190ef..0305759b04 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -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;
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index 53fd0b8925..97450a04fc 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -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();
diff --git a/ui/qt/io_graph_dialog.h b/ui/qt/io_graph_dialog.h
index b2bf751d6d..cdf7b2174e 100644
--- a/ui/qt/io_graph_dialog.h
+++ b/ui/qt/io_graph_dialog.h
@@ -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();
diff --git a/ui/qt/io_graph_dialog.ui b/ui/qt/io_graph_dialog.ui
index 6f4977de03..362ecf4e61 100644
--- a/ui/qt/io_graph_dialog.ui
+++ b/ui/qt/io_graph_dialog.ui
@@ -231,6 +231,26 @@
</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">
<enum>Qt::Horizontal</enum>