aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-04-22 18:31:32 -0700
committerGuy Harris <guy@alum.mit.edu>2016-04-23 01:35:22 +0000
commit948342a487999fcf24913c4a76983c3c6d4df1d9 (patch)
treef5d0a8be115ac03088c45248b2a8ac360dd8a819
parent3db13c7bbbc2b8dfd864ffe7278c0f8f5491bfc7 (diff)
Forcibly update all items if name resolution is turned on or off.
This makes the display change if you turn the name resolution checkbox on or off. Change-Id: I873832b103b61e1e566523a1ae1c4211937c7bae Reviewed-on: https://code.wireshark.org/review/15063 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--ui/qt/conversation_dialog.cpp21
-rw-r--r--ui/qt/conversation_dialog.h2
-rw-r--r--ui/qt/endpoint_dialog.cpp21
-rw-r--r--ui/qt/endpoint_dialog.h4
-rw-r--r--ui/qt/traffic_table_dialog.cpp10
-rw-r--r--ui/qt/traffic_table_dialog.h4
6 files changed, 39 insertions, 23 deletions
diff --git a/ui/qt/conversation_dialog.cpp b/ui/qt/conversation_dialog.cpp
index bec94d3118..8b79c58824 100644
--- a/ui/qt/conversation_dialog.cpp
+++ b/ui/qt/conversation_dialog.cpp
@@ -331,10 +331,8 @@ public:
: TrafficTableTreeWidgetItem (parent, strings) {}
// Set column text to its cooked representation.
- void update(gboolean resolve_names) {
+ void update(gboolean resolve_names, bool force) {
conv_item_t *conv_item = data(ci_col_, Qt::UserRole).value<conv_item_t *>();
- bool ok;
- quint64 cur_packets = data(pkts_col_, Qt::UserRole).toULongLong(&ok);
char *src_addr, *dst_addr, *src_port, *dst_port;
if (!conv_item) {
@@ -342,8 +340,13 @@ public:
}
quint64 packets = conv_item->tx_frames + conv_item->rx_frames;
- if (ok && cur_packets == packets) {
- return;
+ if (!force) {
+ bool ok;
+ quint64 cur_packets = data(pkts_col_, Qt::UserRole).toULongLong(&ok);
+
+ if (ok && cur_packets == packets) {
+ return;
+ }
}
src_addr = get_conversation_address(NULL, &conv_item->src_address, resolve_names);
@@ -604,7 +607,7 @@ ConversationTreeWidget::ConversationTreeWidget(QWidget *parent, register_ct_t* t
connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered()));
}
- updateItems();
+ updateItems(false);
}
ConversationTreeWidget::~ConversationTreeWidget() {
@@ -628,7 +631,7 @@ void ConversationTreeWidget::tapDraw(void *conv_hash_ptr)
ConversationTreeWidget *conv_tree = static_cast<ConversationTreeWidget *>(hash->user_data);
if (!conv_tree) return;
- conv_tree->updateItems();
+ conv_tree->updateItems(false);
}
QMap<FilterAction::ActionDirection, conv_direction_e> fad_to_cd_;
@@ -650,7 +653,7 @@ void ConversationTreeWidget::initDirectionMap()
fad_to_cd_[FilterAction::ActionDirectionAnyFromB] = CONV_DIR_ANY_FROM_B;
}
-void ConversationTreeWidget::updateItems() {
+void ConversationTreeWidget::updateItems(bool force) {
title_ = proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(table_)));
if (hash_.conv_array && hash_.conv_array->len > 0) {
@@ -683,7 +686,7 @@ void ConversationTreeWidget::updateItems() {
QTreeWidgetItemIterator iter(this);
while (*iter) {
ConversationTreeWidgetItem *ci = static_cast<ConversationTreeWidgetItem *>(*iter);
- ci->update(resolve_names_);
+ ci->update(resolve_names_, force);
++iter;
}
setSortingEnabled(true);
diff --git a/ui/qt/conversation_dialog.h b/ui/qt/conversation_dialog.h
index 745020f78d..ff29db1e73 100644
--- a/ui/qt/conversation_dialog.h
+++ b/ui/qt/conversation_dialog.h
@@ -38,9 +38,9 @@ public:
private:
void initDirectionMap();
+ void updateItems(bool force);
private slots:
- void updateItems();
void filterActionTriggered();
};
diff --git a/ui/qt/endpoint_dialog.cpp b/ui/qt/endpoint_dialog.cpp
index a88e6cd345..1bbbe732df 100644
--- a/ui/qt/endpoint_dialog.cpp
+++ b/ui/qt/endpoint_dialog.cpp
@@ -223,10 +223,8 @@ public:
: TrafficTableTreeWidgetItem (parent, strings) {}
// Set column text to its cooked representation.
- void update(gboolean resolve_names) {
+ void update(gboolean resolve_names, bool force) {
hostlist_talker_t *endp_item = data(ei_col_, Qt::UserRole).value<hostlist_talker_t *>();
- bool ok;
- quint64 cur_packets = data(pkts_col_, Qt::UserRole).toULongLong(&ok);
char *addr_str, *port_str;
if (!endp_item) {
@@ -234,8 +232,13 @@ public:
}
quint64 packets = endp_item->tx_frames + endp_item->rx_frames;
- if (ok && cur_packets == packets) {
- return;
+ if (!force) {
+ bool ok;
+ quint64 cur_packets = data(pkts_col_, Qt::UserRole).toULongLong(&ok);
+
+ if (ok && cur_packets == packets) {
+ return;
+ }
}
addr_str = get_conversation_address(NULL, &endp_item->myaddress, resolve_names);
@@ -504,7 +507,7 @@ EndpointTreeWidget::EndpointTreeWidget(QWidget *parent, register_ct_t *table) :
connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered()));
}
- updateItems();
+ updateItems(false);
}
@@ -529,10 +532,10 @@ void EndpointTreeWidget::tapDraw(void *conv_hash_ptr)
EndpointTreeWidget *endp_tree = static_cast<EndpointTreeWidget *>(hash->user_data);
if (!endp_tree) return;
- endp_tree->updateItems();
+ endp_tree->updateItems(false);
}
-void EndpointTreeWidget::updateItems()
+void EndpointTreeWidget::updateItems(bool force)
{
title_ = proto_get_protocol_short_name(find_protocol_by_id(get_conversation_proto_id(table_)));
@@ -574,7 +577,7 @@ void EndpointTreeWidget::updateItems()
QTreeWidgetItemIterator iter(this);
while (*iter) {
EndpointTreeWidgetItem *ei = static_cast<EndpointTreeWidgetItem *>(*iter);
- ei->update(resolve_names_);
+ ei->update(resolve_names_, force);
++iter;
}
setSortingEnabled(true);
diff --git a/ui/qt/endpoint_dialog.h b/ui/qt/endpoint_dialog.h
index 9c78fc9a8b..d338ea7a5b 100644
--- a/ui/qt/endpoint_dialog.h
+++ b/ui/qt/endpoint_dialog.h
@@ -52,8 +52,10 @@ private:
bool has_geoip_data_;
#endif
+private:
+ void updateItems(bool force);
+
private slots:
- void updateItems();
void filterActionTriggered();
};
diff --git a/ui/qt/traffic_table_dialog.cpp b/ui/qt/traffic_table_dialog.cpp
index 6ab248b32e..727f9ca5cd 100644
--- a/ui/qt/traffic_table_dialog.cpp
+++ b/ui/qt/traffic_table_dialog.cpp
@@ -303,7 +303,7 @@ TrafficTableTreeWidget::TrafficTableTreeWidget(QWidget *parent, register_ct_t *t
setRootIsDecorated(false);
sortByColumn(0, Qt::AscendingOrder);
- connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateItems()));
+ connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateItemsForSettingChange()));
}
TrafficTableTreeWidget::~TrafficTableTreeWidget()
@@ -339,7 +339,7 @@ void TrafficTableTreeWidget::setNameResolutionEnabled(bool enable)
{
if (resolve_names_ != enable) {
resolve_names_ = enable;
- updateItems();
+ updateItems(true);
}
}
@@ -352,6 +352,12 @@ void TrafficTableTreeWidget::contextMenuEvent(QContextMenuEvent *event)
}
ctx_menu_.exec(event->globalPos());
+
+}
+
+void TrafficTableTreeWidget::updateItemsForSettingChange()
+{
+ updateItems(true);
}
/*
diff --git a/ui/qt/traffic_table_dialog.h b/ui/qt/traffic_table_dialog.h
index 3921b7e955..5496f5a5b8 100644
--- a/ui/qt/traffic_table_dialog.h
+++ b/ui/qt/traffic_table_dialog.h
@@ -85,9 +85,11 @@ protected:
void contextMenuEvent(QContextMenuEvent *event);
private:
+ virtual void updateItems(bool) {}
private slots:
- virtual void updateItems() {}
+ // Updates all items
+ void updateItemsForSettingChange();
signals:
void titleChanged(QWidget *tree, const QString &text);