aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/qt/expert_info_dialog.cpp34
-rw-r--r--ui/qt/expert_info_dialog.h5
-rw-r--r--ui/qt/expert_info_dialog.ui3
3 files changed, 29 insertions, 13 deletions
diff --git a/ui/qt/expert_info_dialog.cpp b/ui/qt/expert_info_dialog.cpp
index e1423e7b3d..8472727871 100644
--- a/ui/qt/expert_info_dialog.cpp
+++ b/ui/qt/expert_info_dialog.cpp
@@ -91,8 +91,8 @@ public:
class ExpertPacketTreeWidgetItem : public QTreeWidgetItem
{
public:
- ExpertPacketTreeWidgetItem(QTreeWidgetItem *parent, expert_info_t *expert_info = NULL) :
- QTreeWidgetItem (parent, packet_type_),
+ ExpertPacketTreeWidgetItem(expert_info_t *expert_info = NULL) :
+ QTreeWidgetItem (packet_type_),
packet_num_(0),
hf_id_(-1)
{
@@ -143,10 +143,13 @@ ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) :
// Clicking on an item jumps to its associated packet. Make the dialog
// narrow so that we avoid obscuring the packet list.
// XXX Use recent settings instead
- int dlg_width = parent.width() / 2;
+ int dlg_width = parent.width() * 3 / 5;
if (dlg_width < width()) dlg_width = width();
resize(dlg_width, parent.height());
+ int one_em = fontMetrics().height();
+ ui->expertInfoTreeWidget->setColumnWidth(severity_col_, one_em * 25); // Arbitrary
+
severity_actions_ = QList<QAction *>() << ui->actionShowError << ui->actionShowWarning
<< ui->actionShowNote << ui->actionShowChat
<< ui->actionShowComment;
@@ -199,8 +202,7 @@ ExpertInfoDialog::ExpertInfoDialog(QWidget &parent, CaptureFile &capture_file) :
}
setDisplayFilter();
- retapPackets();
-
+ QTimer::singleShot(0, this, SLOT(retapPackets()));
}
ExpertInfoDialog::~ExpertInfoDialog()
@@ -220,6 +222,7 @@ void ExpertInfoDialog::clearAllData()
need_show_hide_ = false;
ei_to_ti_.clear();
+ gti_packets_.clear();
}
void ExpertInfoDialog::setDisplayFilter(const QString &display_filter)
@@ -261,14 +264,22 @@ void ExpertInfoDialog::retapPackets()
cap_file_.retapPackets();
- updateWidgets();
-
+ 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 (group_ti->childCount() <= auto_expand_threshold_) {
- group_ti->setExpanded(true);
+ if (gti_packets_.contains(group_ti)) {
+ group_ti->addChildren(gti_packets_[group_ti]);
+ if (group_ti->childCount() <= auto_expand_threshold_) {
+ group_ti->setExpanded(true);
+ }
}
}
+ setUpdatesEnabled(true);
+
+ updateWidgets();
}
void ExpertInfoDialog::addExpertInfo(struct expert_info_s *expert_info)
@@ -313,9 +324,10 @@ void ExpertInfoDialog::addExpertInfo(struct expert_info_s *expert_info)
}
}
ei_to_ti_[key] = group_ti;
+ gti_packets_[group_ti] = QList<QTreeWidgetItem *>();
}
- new ExpertPacketTreeWidgetItem(group_ti, expert_info);
+ gti_packets_[group_ti] << new ExpertPacketTreeWidgetItem(expert_info);
// XXX Use plain colors until our users demand to be blinded.
// if (background.isValid()) {
@@ -346,7 +358,7 @@ gboolean ExpertInfoDialog::tapPacket(void *eid_ptr, struct _packet_info *pinfo,
expert_info_t *expert_info = (expert_info_t *) data;
gboolean draw_required = FALSE;
- if (!pinfo || !eid || !expert_info) return 0;
+ if (!pinfo || !eid || !expert_info) return FALSE;
eid->addExpertInfo(expert_info);
diff --git a/ui/qt/expert_info_dialog.h b/ui/qt/expert_info_dialog.h
index 802b52dcde..95144acaa9 100644
--- a/ui/qt/expert_info_dialog.h
+++ b/ui/qt/expert_info_dialog.h
@@ -70,12 +70,11 @@ private:
QMenu ctx_menu_;
QHash<QString, QTreeWidgetItem*> ei_to_ti_;
+ QHash<QTreeWidgetItem*, QList<QTreeWidgetItem *> > gti_packets_;
QList<QAction *> severity_actions_;
QString display_filter_;
- void retapPackets();
-
// Called from tapPacket
void addExpertInfo(struct expert_info_s *expert_info);
// Called from tapDraw
@@ -87,6 +86,8 @@ private:
static void tapDraw(void *eid_ptr);
private slots:
+ void retapPackets();
+
void updateWidgets();
void actionShowToggled();
diff --git a/ui/qt/expert_info_dialog.ui b/ui/qt/expert_info_dialog.ui
index 689b64faac..e47543c7ae 100644
--- a/ui/qt/expert_info_dialog.ui
+++ b/ui/qt/expert_info_dialog.ui
@@ -16,6 +16,9 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTreeWidget" name="expertInfoTreeWidget">
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>