aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-10-29 10:53:37 -0700
committerGerald Combs <gerald@wireshark.org>2015-10-29 20:10:53 +0000
commitdb760bf52eafe728ab9be0e40760cda5e536572b (patch)
treed560bc2cb1d816f5a4eef03824eb21e414a0adb6 /ui
parentf449dcd8a590416aa33e5314f3db2bfc00134e9c (diff)
Qt: Allow Expert Information retapping.
The Expert Information dialog is open-ended. It adds a tap listener but doesn't remove it, which is useful during live captures. Make sure we add our second-level tree items each time taps are drawn and when tapping is finished. Change-Id: Ie06d60512644e540172f1b330b631db4e4e86897 Bug: 11644 Reviewed-on: https://code.wireshark.org/review/11407 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/expert_info_dialog.cpp57
-rw-r--r--ui/qt/expert_info_dialog.h3
2 files changed, 39 insertions, 21 deletions
diff --git a/ui/qt/expert_info_dialog.cpp b/ui/qt/expert_info_dialog.cpp
index 141e388c91..81c586576a 100644
--- a/ui/qt/expert_info_dialog.cpp
+++ b/ui/qt/expert_info_dialog.cpp
@@ -48,17 +48,18 @@
// down to one item, make sure it uses a single (or a few) base color(s), and generate
// icons on the fly.
-const int severity_col_ = 0;
-const int group_col_ = 1;
-const int protocol_col_ = 2;
-const int count_col_ = 3;
+enum {
+ severity_col_,
+ group_col_,
+ protocol_col_,
+ count_col_,
-const int packet_col_ = 0;
+ packet_col_ = severity_col_
+};
-const int group_type_ = 1000;
-const int packet_type_ = 1001;
+enum { group_type_ = 1000, packet_type_ = 1001 };
-const int auto_expand_threshold_ = 20; // Arbitrary
+static const int auto_expand_threshold_ = 20; // Arbitrary
class ExpertGroupTreeWidgetItem : public QTreeWidgetItem
{
@@ -201,6 +202,8 @@ ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) :
connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered()));
}
+ connect(&cap_file_, SIGNAL(captureFileRetapFinished()),
+ this, SLOT(retapFinished()));
setDisplayFilter();
QTimer::singleShot(0, this, SLOT(retapPackets()));
}
@@ -258,23 +261,17 @@ void ExpertInfoDialog::retapPackets()
}
cap_file_.retapPackets();
+}
- setUpdatesEnabled(false);
- // Adding a list of ExpertPacketTreeWidgetItems is much faster than
- // adding them individually. We still add ExpertGroupTreeWidgetItems
- // individually since that gives us a nice progress indicator.
+void ExpertInfoDialog::retapFinished()
+{
+ addPacketTreeItems();
for (int i = 0; i < ui->expertInfoTreeWidget->topLevelItemCount(); i++) {
QTreeWidgetItem *group_ti = ui->expertInfoTreeWidget->topLevelItem(i);
- if (gti_packets_.contains(group_ti)) {
- group_ti->addChildren(gti_packets_[group_ti]);
- if (group_ti->childCount() <= auto_expand_threshold_) {
- group_ti->setExpanded(true);
- }
+ if (group_ti->childCount() <= auto_expand_threshold_) {
+ group_ti->setExpanded(true);
}
}
- setUpdatesEnabled(true);
-
- updateWidgets();
}
void ExpertInfoDialog::addExpertInfo(struct expert_info_s *expert_info)
@@ -390,7 +387,25 @@ void ExpertInfoDialog::tapDraw(void *eid_ptr)
ExpertInfoDialog *eid = static_cast<ExpertInfoDialog *>(eid_ptr);
if (!eid) return;
- eid->updateWidgets();
+ eid->addPacketTreeItems();
+}
+
+void ExpertInfoDialog::addPacketTreeItems()
+{
+ setUpdatesEnabled(false);
+ // Adding a list of ExpertPacketTreeWidgetItems is much faster than
+ // adding them individually. We still add ExpertGroupTreeWidgetItems
+ // individually since that gives us a nice progress indicator.
+ for (int i = 0; i < ui->expertInfoTreeWidget->topLevelItemCount(); i++) {
+ QTreeWidgetItem *group_ti = ui->expertInfoTreeWidget->topLevelItem(i);
+ if (gti_packets_.contains(group_ti)) {
+ group_ti->addChildren(gti_packets_[group_ti]);
+ gti_packets_[group_ti].clear();
+ }
+ }
+ setUpdatesEnabled(true);
+
+ updateWidgets();
}
void ExpertInfoDialog::updateWidgets()
diff --git a/ui/qt/expert_info_dialog.h b/ui/qt/expert_info_dialog.h
index 95144acaa9..a5722cf8b3 100644
--- a/ui/qt/expert_info_dialog.h
+++ b/ui/qt/expert_info_dialog.h
@@ -85,8 +85,11 @@ private:
static gboolean tapPacket(void *eid_ptr, struct _packet_info *pinfo, struct epan_dissect *, const void *data);
static void tapDraw(void *eid_ptr);
+ void addPacketTreeItems();
+
private slots:
void retapPackets();
+ void retapFinished();
void updateWidgets();