forked from osmocom/wireshark
Qt: Cleanup PacketList
Cleanup various smaller issues with PacketList Change-Id: I39581da486c415b6269eeabd4363a323f9436c04 Reviewed-on: https://code.wireshark.org/review/33831 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
eae522d9cc
commit
cab175e03e
|
@ -143,8 +143,8 @@ void PacketListModel::clear() {
|
|||
void PacketListModel::invalidateAllColumnStrings()
|
||||
{
|
||||
PacketListRecord::invalidateAllRecords();
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
headerDataChanged(Qt::Horizontal, 0, columnCount() - 1);
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit headerDataChanged(Qt::Horizontal, 0, columnCount() - 1);
|
||||
}
|
||||
|
||||
void PacketListModel::resetColumns()
|
||||
|
@ -152,8 +152,8 @@ void PacketListModel::resetColumns()
|
|||
if (cap_file_) {
|
||||
PacketListRecord::resetColumns(&cap_file_->cinfo);
|
||||
}
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
headerDataChanged(Qt::Horizontal, 0, columnCount() - 1);
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit headerDataChanged(Qt::Horizontal, 0, columnCount() - 1);
|
||||
}
|
||||
|
||||
void PacketListModel::resetColorized()
|
||||
|
@ -161,7 +161,7 @@ void PacketListModel::resetColorized()
|
|||
foreach (PacketListRecord *record, physical_rows_) {
|
||||
record->resetColorized();
|
||||
}
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void PacketListModel::toggleFrameMark(const QModelIndex &fm_index)
|
||||
|
@ -179,7 +179,7 @@ void PacketListModel::toggleFrameMark(const QModelIndex &fm_index)
|
|||
else
|
||||
cf_mark_frame(cap_file_, fdata);
|
||||
|
||||
dataChanged(fm_index, fm_index);
|
||||
emit dataChanged(fm_index, fm_index);
|
||||
}
|
||||
|
||||
void PacketListModel::setDisplayedFrameMark(gboolean set)
|
||||
|
@ -191,7 +191,7 @@ void PacketListModel::setDisplayedFrameMark(gboolean set)
|
|||
cf_unmark_frame(cap_file_, record->frameData());
|
||||
}
|
||||
}
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void PacketListModel::toggleFrameIgnore(const QModelIndex &i_index)
|
||||
|
@ -219,7 +219,7 @@ void PacketListModel::setDisplayedFrameIgnore(gboolean set)
|
|||
cf_unignore_frame(cap_file_, record->frameData());
|
||||
}
|
||||
}
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void PacketListModel::toggleFrameRefTime(const QModelIndex &rt_index)
|
||||
|
@ -244,7 +244,7 @@ void PacketListModel::toggleFrameRefTime(const QModelIndex &rt_index)
|
|||
cap_file_->displayed_count--;
|
||||
}
|
||||
record->resetColumns(&cap_file_->cinfo);
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void PacketListModel::unsetAllFrameRefTime()
|
||||
|
@ -262,22 +262,22 @@ void PacketListModel::unsetAllFrameRefTime()
|
|||
cap_file_->ref_time_count = 0;
|
||||
cf_reftime_packets(cap_file_);
|
||||
PacketListRecord::resetColumns(&cap_file_->cinfo);
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void PacketListModel::applyTimeShift()
|
||||
{
|
||||
resetColumns();
|
||||
dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
void PacketListModel::setMaximiumRowHeight(int height)
|
||||
void PacketListModel::setMaximumRowHeight(int height)
|
||||
{
|
||||
max_row_height_ = height;
|
||||
// As the QTreeView uniformRowHeights documentation says,
|
||||
// "The height is obtained from the first item in the view. It is
|
||||
// updated when the data changes on that item."
|
||||
dataChanged(index(0, 0), index(0, columnCount() - 1));
|
||||
emit dataChanged(index(0, 0), index(0, columnCount() - 1));
|
||||
}
|
||||
|
||||
//void PacketListModel::setMonospaceFont(const QFont &mono_font, int row_height)
|
||||
|
@ -345,7 +345,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
|
|||
sort_column_is_numeric_ = isNumericColumn(sort_column_);
|
||||
std::sort(physical_rows_.begin(), physical_rows_.end(), recordLessThan);
|
||||
|
||||
beginResetModel();
|
||||
emit beginResetModel();
|
||||
visible_rows_.resize(0);
|
||||
number_to_row_.fill(0);
|
||||
foreach (PacketListRecord *record, physical_rows_) {
|
||||
|
@ -359,7 +359,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
|
|||
number_to_row_[fdata->num] = visible_rows_.count();
|
||||
}
|
||||
}
|
||||
endResetModel();
|
||||
emit endResetModel();
|
||||
|
||||
if (!col_title.isEmpty()) {
|
||||
emit popBusyStatus();
|
||||
|
@ -649,7 +649,7 @@ void PacketListModel::flushVisibleRows()
|
|||
gint pos = visible_rows_.count();
|
||||
|
||||
if (new_visible_rows_.count() > 0) {
|
||||
beginInsertRows(QModelIndex(), pos, pos + new_visible_rows_.count());
|
||||
emit beginInsertRows(QModelIndex(), pos, pos + new_visible_rows_.count());
|
||||
foreach (PacketListRecord *record, new_visible_rows_) {
|
||||
frame_data *fdata = record->frameData();
|
||||
|
||||
|
@ -659,7 +659,7 @@ void PacketListModel::flushVisibleRows()
|
|||
}
|
||||
number_to_row_[fdata->num] = visible_rows_.count();
|
||||
}
|
||||
endInsertRows();
|
||||
emit endInsertRows();
|
||||
new_visible_rows_.resize(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
void unsetAllFrameRefTime();
|
||||
void applyTimeShift();
|
||||
|
||||
void setMaximiumRowHeight(int height);
|
||||
void setMaximumRowHeight(int height);
|
||||
|
||||
signals:
|
||||
void goToPacket(int);
|
||||
|
|
|
@ -58,7 +58,7 @@ void *PacketListRecord::operator new(size_t size)
|
|||
const QByteArray PacketListRecord::columnString(capture_file *cap_file, int column, bool colorized)
|
||||
{
|
||||
// packet_list_store.c:packet_list_get_value
|
||||
g_assert(fdata_);
|
||||
Q_ASSERT(fdata_);
|
||||
|
||||
if (!cap_file || column < 0 || column > cap_file->cinfo.num_cols) {
|
||||
return QByteArray();
|
||||
|
|
|
@ -265,7 +265,7 @@ PacketList::PacketList(QWidget *parent) :
|
|||
setModel(packet_list_model_);
|
||||
sortByColumn(-1, Qt::AscendingOrder);
|
||||
|
||||
g_assert(gbl_cur_packet_list == NULL);
|
||||
Q_ASSERT(gbl_cur_packet_list == Q_NULLPTR);
|
||||
gbl_cur_packet_list = this;
|
||||
|
||||
connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int)));
|
||||
|
@ -987,7 +987,7 @@ void PacketList::freeze()
|
|||
frozen_row_ = -1;
|
||||
}
|
||||
selectionModel()->clear();
|
||||
setModel(NULL);
|
||||
setModel(Q_NULLPTR);
|
||||
// It looks like GTK+ sends a cursor-changed signal at this point but Qt doesn't
|
||||
// call selectionChanged.
|
||||
related_packet_delegate_.clear();
|
||||
|
@ -1543,7 +1543,7 @@ void PacketList::updateRowHeights(const QModelIndex &ih_index)
|
|||
}
|
||||
|
||||
if (max_height > 0) {
|
||||
packet_list_model_->setMaximiumRowHeight(max_height);
|
||||
packet_list_model_->setMaximumRowHeight(max_height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue