Qt: Fixed more column issues when changing profile.

When changing profile without a loaded capture file we have to rebuild
cap_file_->cinfo when a capture is loaded.

Bug: 11493
Change-Id: I9b561a360236056c104cfdb478b855fa550325e2
Reviewed-on: https://code.wireshark.org/review/12068
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Stig Bjørlykke 2015-11-23 14:06:59 +01:00
parent 3438fe2dd9
commit 7324555c1f
2 changed files with 11 additions and 2 deletions

View File

@ -249,7 +249,8 @@ PacketList::PacketList(QWidget *parent) :
create_far_overlay_(true), create_far_overlay_(true),
capture_in_progress_(false), capture_in_progress_(false),
tail_timer_id_(0), tail_timer_id_(0),
rows_inserted_(false) rows_inserted_(false),
columns_changed_(false)
{ {
QMenu *main_menu_item, *submenu; QMenu *main_menu_item, *submenu;
QAction *action; QAction *action;
@ -635,7 +636,10 @@ void PacketList::redrawVisiblePackets() {
// prefs.col_list has changed. // prefs.col_list has changed.
void PacketList::columnsChanged() void PacketList::columnsChanged()
{ {
if (!cap_file_) return; if (!cap_file_) {
columns_changed_ = true;
return;
}
prefs.num_cols = g_list_length(prefs.col_list); prefs.num_cols = g_list_length(prefs.col_list);
col_cleanup(&cap_file_->cinfo); col_cleanup(&cap_file_->cinfo);
@ -643,6 +647,7 @@ void PacketList::columnsChanged()
setColumnVisibility(); setColumnVisibility();
create_far_overlay_ = true; create_far_overlay_ = true;
packet_list_model_->resetColumns(); packet_list_model_->resetColumns();
columns_changed_ = false;
} }
// Fields have changed, update custom columns // Fields have changed, update custom columns
@ -977,6 +982,9 @@ void PacketList::setCaptureFile(capture_file *cf)
header()->restoreState(column_state_); header()->restoreState(column_state_);
} }
cap_file_ = cf; cap_file_ = cf;
if (cap_file_ && columns_changed_) {
columnsChanged();
}
packet_list_model_->setCaptureFile(cf); packet_list_model_->setCaptureFile(cf);
create_near_overlay_ = true; create_near_overlay_ = true;
} }

View File

@ -116,6 +116,7 @@ private:
int tail_timer_id_; int tail_timer_id_;
bool tail_at_end_; bool tail_at_end_;
bool rows_inserted_; bool rows_inserted_;
bool columns_changed_;
void setFrameReftime(gboolean set, frame_data *fdata); void setFrameReftime(gboolean set, frame_data *fdata);
void setColumnVisibility(); void setColumnVisibility();