diff options
author | Roland Knall <rknall@gmail.com> | 2019-07-04 14:54:27 +0200 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2019-07-04 16:34:29 +0000 |
commit | 2fd549551cf97fefaa578af7855bd3c9e6a665ea (patch) | |
tree | 750f8de42771fd76b487d428dae510dc66abbe16 /ui/qt/packet_list.cpp | |
parent | 62ca0a609bf7a705c09730c5613abf1931c880f5 (diff) |
Qt: Properly hide the choosen model from external views
This moves the append function to the model, where it makes more sense.
Change-Id: Iea9ccaf0672e8ad05454b4c35c303ca7dc2e6373
Reviewed-on: https://code.wireshark.org/review/33843
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/packet_list.cpp')
-rw-r--r-- | ui/qt/packet_list.cpp | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 0d353187cb..68941f5bb2 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -90,20 +90,6 @@ const int max_comments_to_fetch_ = 20000000; // Arbitrary const int tail_update_interval_ = 100; // Milliseconds. const int overlay_update_interval_ = 100; // 250; // Milliseconds. -guint -packet_list_append(column_info *, frame_data *fdata) -{ - if (!gbl_cur_packet_list) - return 0; - - /* fdata should be filled with the stuff we need - * strings are built at display time. - */ - guint visible_pos; - - visible_pos = gbl_cur_packet_list->packetListModel()->appendPacket(fdata); - return visible_pos; -} // Copied from ui/gtk/packet_list.c void packet_list_resize_column(gint col) @@ -128,13 +114,18 @@ packet_list_select_first_row(void) gboolean packet_list_select_row_from_data(frame_data *fdata_needle) { - if ( !gbl_cur_packet_list ) + if ( ! gbl_cur_packet_list || ! gbl_cur_packet_list->model()) return FALSE; - gbl_cur_packet_list->packetListModel()->flushVisibleRows(); - int row = gbl_cur_packet_list->packetListModel()->visibleIndexOf(fdata_needle); + PacketListModel * model = qobject_cast<PacketListModel *>(gbl_cur_packet_list->model()); + + if ( ! model ) + return FALSE; + + model->flushVisibleRows(); + int row = model->visibleIndexOf(fdata_needle); if (row >= 0) { - gbl_cur_packet_list->setCurrentIndex(gbl_cur_packet_list->packetListModel()->index(row, 0)); + gbl_cur_packet_list->setCurrentIndex(model->index(row, 0)); return TRUE; } @@ -175,19 +166,6 @@ packet_list_thaw(void) packets_bar_update(); } -void -packet_list_recreate_visible_rows(void) -{ - if ( !gbl_cur_packet_list ) - return; - - PacketListModel * model = qobject_cast<PacketListModel *>(gbl_cur_packet_list->model()); - - if (model) { - model->recreateVisibleRows(); - } -} - frame_data * packet_list_get_row_data(gint row) { @@ -404,10 +382,6 @@ void PacketList::setProtoTree (ProtoTree *proto_tree) { &related_packet_delegate_, SLOT(addRelatedFrame(int,ft_framenum_type_t))); } -PacketListModel *PacketList::packetListModel() const { - return packet_list_model_; -} - void PacketList::selectionChanged (const QItemSelection & selected, const QItemSelection & deselected) { QTreeView::selectionChanged(selected, deselected); |