aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-03-08 15:17:58 -0800
committerRoland Knall <rknall@gmail.com>2018-03-15 12:19:23 +0000
commitbbe5fc102821cc3fa9e661078311f681501025ef (patch)
treeb61de63e63e01e4b55d59dd7ba4d46db6b484bb4 /ui
parent03af5553eb1aaf38b2053e8b83a2be60097306d8 (diff)
Epan+Qt: Invalidate cached column strings.
Add col_data_changed, which checks to see if we have updated column info. Add col_append_frame_number, which adds a frame number and sets col_data_changed. Call col_append_frame_number instead of col_append_fstr from some dissectors. Add PacketListRecord::invalidateAllRecords, which invalidates any cached record data. Add PacketListModel::invalidateAllColumnStrings which calls invalidateAllRecords and signals that our data has changed. Call invalidateAllColumnStrings when we have new name resolution or column information. Bug: 11414 Bug: 11468 Change-Id: I2671594a722f4f9436fe1df84d43489a148e0cee Reviewed-on: https://code.wireshark.org/review/26373 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/models/packet_list_model.cpp7
-rw-r--r--ui/qt/models/packet_list_model.h7
-rw-r--r--ui/qt/models/packet_list_record.cpp2
-rw-r--r--ui/qt/models/packet_list_record.h1
-rw-r--r--ui/qt/packet_list.cpp10
-rw-r--r--ui/qt/wireshark_application.cpp12
-rw-r--r--ui/qt/wireshark_application.h5
7 files changed, 32 insertions, 12 deletions
diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp
index 4c5d4dc6e5..df94216544 100644
--- a/ui/qt/models/packet_list_model.cpp
+++ b/ui/qt/models/packet_list_model.cpp
@@ -136,6 +136,13 @@ void PacketListModel::clear() {
idle_dissection_row_ = 0;
}
+void PacketListModel::invalidateAllColumnStrings()
+{
+ PacketListRecord::invalidateAllRecords();
+ dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
+ headerDataChanged(Qt::Horizontal, 0, columnCount() - 1);
+}
+
void PacketListModel::resetColumns()
{
if (cap_file_) {
diff --git a/ui/qt/models/packet_list_model.h b/ui/qt/models/packet_list_model.h
index 9cd64df433..1b9635e274 100644
--- a/ui/qt/models/packet_list_model.h
+++ b/ui/qt/models/packet_list_model.h
@@ -51,6 +51,13 @@ public:
frame_data *getRowFdata(int row);
void ensureRowColorized(int row);
int visibleIndexOf(frame_data *fdata) const;
+ /**
+ * @brief Invalidate any cached column strings.
+ */
+ void invalidateAllColumnStrings();
+ /**
+ * @brief Rebuild columns from settings.
+ */
void resetColumns();
void resetColorized();
void toggleFrameMark(const QModelIndex &fm_index);
diff --git a/ui/qt/models/packet_list_record.cpp b/ui/qt/models/packet_list_record.cpp
index 8c1228b188..5c159fb2b6 100644
--- a/ui/qt/models/packet_list_record.cpp
+++ b/ui/qt/models/packet_list_record.cpp
@@ -72,7 +72,7 @@ const QByteArray PacketListRecord::columnString(capture_file *cap_file, int colu
void PacketListRecord::resetColumns(column_info *cinfo)
{
- col_data_ver_++;
+ invalidateAllRecords();
if (!cinfo) {
return;
diff --git a/ui/qt/models/packet_list_record.h b/ui/qt/models/packet_list_record.h
index a5a623d8ab..0bfc1a7273 100644
--- a/ui/qt/models/packet_list_record.h
+++ b/ui/qt/models/packet_list_record.h
@@ -45,6 +45,7 @@ public:
struct conversation *conversation() { return conv_; }
int columnTextSize(const char *str);
+ static void invalidateAllRecords() { col_data_ver_++; }
static void resetColumns(column_info *cinfo);
void resetColorized();
inline int lineCount() { return lines_; }
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 5934523c5b..40c02703e0 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -308,6 +308,7 @@ PacketList::PacketList(QWidget *parent) :
connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int)));
connect(packet_list_model_, SIGNAL(itemHeightChanged(const QModelIndex&)), this, SLOT(updateRowHeights(const QModelIndex&)));
connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePacketsDontSelectCurrent()));
+ connect(wsApp, SIGNAL(columnDataChanged()), this, SLOT(redrawVisiblePacketsDontSelectCurrent()));
header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), SIGNAL(customContextMenuRequested(QPoint)),
@@ -699,16 +700,14 @@ void PacketList::drawCurrentPacket()
// the UI to scroll to that packet).
// Called from many places.
void PacketList::redrawVisiblePackets() {
- update();
- header()->update();
+ redrawVisiblePacketsDontSelectCurrent();
drawCurrentPacket();
}
// Redraw the packet list and detail.
// Does not scroll back to the selected packet.
void PacketList::redrawVisiblePacketsDontSelectCurrent() {
- update();
- header()->update();
+ packet_list_model_->invalidateAllColumnStrings();
}
void PacketList::resetColumns()
@@ -874,6 +873,9 @@ void PacketList::captureFileReadFinished()
{
packet_list_model_->flushVisibleRows();
packet_list_model_->dissectIdle(true);
+ // Invalidating the column strings picks up and request/response
+ // tracking changes. We might just want to call it from flushVisibleRows.
+ packet_list_model_->invalidateAllColumnStrings();
}
void PacketList::freeze()
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 24a5232c85..87399a37db 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -21,6 +21,7 @@
#include "wsutil/filesystem.h"
#include "epan/addr_resolv.h"
+#include "epan/column-utils.h"
#include "epan/disabled_protos.h"
#include "epan/ftypes/ftypes.h"
#include "epan/prefs.h"
@@ -258,11 +259,12 @@ void WiresharkApplication::refreshRecentCaptures() {
}
}
-void WiresharkApplication::refreshAddressResolution()
+void WiresharkApplication::refreshPacketData()
{
- // Anything new show up?
if (host_name_lookup_process()) {
emit addressResolutionChanged();
+ } else if (col_data_changed()) {
+ emit columnDataChanged();
}
}
@@ -846,9 +848,9 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
connect(&recent_timer_, SIGNAL(timeout()), this, SLOT(refreshRecentCaptures()));
recent_timer_.start(2000);
- addr_resolv_timer_.setParent(this);
- connect(&addr_resolv_timer_, SIGNAL(timeout()), this, SLOT(refreshAddressResolution()));
- addr_resolv_timer_.start(1000);
+ packet_data_timer_.setParent(this);
+ connect(&packet_data_timer_, SIGNAL(timeout()), this, SLOT(refreshPacketData()));
+ packet_data_timer_.start(1000);
tap_update_timer_.setParent(this);
tap_update_timer_.setInterval(TAP_UPDATE_DEFAULT_INTERVAL);
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index fa359b441e..24d662b0ae 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -137,7 +137,7 @@ private:
QFont mono_font_;
QFont zoomed_font_;
QTimer recent_timer_;
- QTimer addr_resolv_timer_;
+ QTimer packet_data_timer_;
QTimer tap_update_timer_;
QList<QString> pending_open_files_;
QSocketNotifier *if_notifier_;
@@ -179,6 +179,7 @@ signals:
void packetDissectionChanged();
void preferencesChanged();
void addressResolutionChanged();
+ void columnDataChanged();
void checkDisplayFilter();
void fieldsChanged();
void reloadLuaPlugins();
@@ -209,7 +210,7 @@ private slots:
void cleanup();
void ifChangeEventsAvailable();
void itemStatusFinished(const QString filename = "", qint64 size = 0, bool accessible = false);
- void refreshAddressResolution();
+ void refreshPacketData();
};
extern WiresharkApplication *wsApp;