diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/models/packet_list_model.cpp | 2 | ||||
-rw-r--r-- | ui/qt/models/packet_list_record.cpp | 25 | ||||
-rw-r--r-- | ui/qt/models/packet_list_record.h | 2 |
3 files changed, 28 insertions, 1 deletions
diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp index 50d929d569..2d62689ee0 100644 --- a/ui/qt/models/packet_list_model.cpp +++ b/ui/qt/models/packet_list_model.cpp @@ -760,7 +760,7 @@ void PacketListModel::ensureRowColorized(int row) if (!record) return; if (!record->colorized()) { - record->columnString(cap_file_, 1, true); + record->ensureColorized(cap_file_); } } diff --git a/ui/qt/models/packet_list_record.cpp b/ui/qt/models/packet_list_record.cpp index c5bc05b741..9be07c1035 100644 --- a/ui/qt/models/packet_list_record.cpp +++ b/ui/qt/models/packet_list_record.cpp @@ -46,6 +46,26 @@ PacketListRecord::~PacketListRecord() col_text_.clear(); } +void PacketListRecord::ensureColorized(capture_file *cap_file) +{ + // packet_list_store.c:packet_list_get_value + Q_ASSERT(fdata_); + + if (!cap_file) { + return; + } + + // + // XXX - do we need to check whether the data versions match? + // If the record's color is already correct, we shouldn't need + // to redissect it to colorize it. + // + bool dissect_color = !colorized_ || ( color_ver_ != rows_color_ver_ ); + if (data_ver_ != col_data_ver_ || dissect_color) { + dissect(cap_file, dissect_color); + } +} + // We might want to return a const char * instead. This would keep us from // creating excessive QByteArrays, e.g. in PacketListModel::recordLessThan. const QString PacketListRecord::columnString(capture_file *cap_file, int column, bool colorized) @@ -57,6 +77,11 @@ const QString PacketListRecord::columnString(capture_file *cap_file, int column, return QString(); } + // + // XXX - do we still need to check the colorization, given that we now + // have the ensureColorized() method to ensure that the record is + // properly colorized? + // bool dissect_color = ( colorized && !colorized_ ) || ( color_ver_ != rows_color_ver_ ); if (column >= col_text_.count() || col_text_.at(column).isNull() || data_ver_ != col_data_ver_ || dissect_color) { dissect(cap_file, dissect_color); diff --git a/ui/qt/models/packet_list_record.h b/ui/qt/models/packet_list_record.h index c649f3f96c..62d15e80b2 100644 --- a/ui/qt/models/packet_list_record.h +++ b/ui/qt/models/packet_list_record.h @@ -32,6 +32,8 @@ public: PacketListRecord(frame_data *frameData); virtual ~PacketListRecord(); + // Ensure that the record is colorized. + void ensureColorized(capture_file *cap_file); // Return the string value for a column. Data is cached if possible. const QString columnString(capture_file *cap_file, int column, bool colorized = false); frame_data *frameData() const { return fdata_; } |