diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 9b4e251191..057945262a 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -484,8 +484,6 @@ MainWindow::MainWindow(QWidget *parent) : this, SIGNAL(frameSelected(int))); connect(this, SIGNAL(frameSelected(int)), this, SLOT(setMenusForSelectedPacket())); - connect(packet_list_->packetListModel(), SIGNAL(bgColorizationProgress(int, int)), - main_ui_->wirelessTimelineWidget, SLOT(bgColorizationProgress(int, int))); proto_tree_ = new ProtoTree(&master_split_); proto_tree_->installEventFilter(this); @@ -635,16 +633,6 @@ MainWindow::MainWindow(QWidget *parent) : this, SLOT(openPacketDialog())); connect(packet_list_, SIGNAL(packetListScrolled(bool)), main_ui_->actionGoAutoScroll, SLOT(setChecked(bool))); - connect(packet_list_->packetListModel(), SIGNAL(pushBusyStatus(QString)), - main_ui_->statusBar, SLOT(pushBusyStatus(QString))); - connect(packet_list_->packetListModel(), SIGNAL(popBusyStatus()), - main_ui_->statusBar, SLOT(popBusyStatus())); - connect(packet_list_->packetListModel(), SIGNAL(pushProgressStatus(QString, bool, bool, gboolean*)), - main_ui_->statusBar, SLOT(pushProgressStatus(QString, bool, bool, gboolean*))); - connect(packet_list_->packetListModel(), SIGNAL(updateProgressStatus(int)), - main_ui_->statusBar, SLOT(updateProgressStatus(int))); - connect(packet_list_->packetListModel(), SIGNAL(popProgressStatus()), - main_ui_->statusBar, SLOT(popProgressStatus())); connect(proto_tree_, SIGNAL(openPacketInNewWindow(bool)), this, SLOT(openPacketDialog(bool))); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index af9dc9e10b..f7085f88e1 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1997,7 +1997,7 @@ void MainWindow::on_actionEditCopyAsFilter_triggered() void MainWindow::on_actionEditFindPacket_triggered() { - if (packet_list_->packetListModel()->rowCount() < 1) { + if (packet_list_->model()->rowCount() < 1) { return; } previous_focus_ = wsApp->focusWidget(); @@ -2366,7 +2366,7 @@ void MainWindow::on_actionViewNormalSize_triggered() void MainWindow::on_actionViewColorizePacketList_triggered(bool checked) { recent.packet_list_colorize = checked; packet_list_recolor_packets(); - packet_list_->packetListModel()->resetColorized(); + packet_list_->resetColorized(); } void MainWindow::on_actionViewColoringRules_triggered() @@ -2483,7 +2483,7 @@ void MainWindow::on_actionViewResetLayout_triggered() void MainWindow::on_actionViewResizeColumns_triggered() { - for (int col = 0; col < packet_list_->packetListModel()->columnCount(); col++) { + for (int col = 0; col < packet_list_->model()->columnCount(); col++) { packet_list_->resizeColumnToContents(col); recent_set_column_width(col, packet_list_->columnWidth(col)); } @@ -3472,7 +3472,7 @@ void MainWindow::on_actionHelpAbout_triggered() } void MainWindow::on_actionGoGoToPacket_triggered() { - if (packet_list_->packetListModel()->rowCount() < 1) { + if (packet_list_->model()->rowCount() < 1) { return; } previous_focus_ = wsApp->focusWidget(); diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp index 6c6f23af36..cbe7f075ed 100644 --- a/ui/qt/models/packet_list_model.cpp +++ b/ui/qt/models/packet_list_model.cpp @@ -26,6 +26,9 @@ #include #include "wireshark_application.h" +#include +#include +#include #include #include @@ -56,6 +59,35 @@ PacketListModel::PacketListModel(QObject *parent, capture_file *cf) : new_visible_rows_.reserve(1000); number_to_row_.reserve(reserved_packets_); + if (qobject_cast(wsApp->mainWindow())) + { + MainWindow *mw = qobject_cast(wsApp->mainWindow()); + MainStatusBar *ms = qobject_cast(mw->statusBar()); + + if (ms) + { + connect(this, SIGNAL(pushBusyStatus(QString)), + ms, SLOT(pushBusyStatus(QString))); + connect(this, SIGNAL(popBusyStatus()), + ms, SLOT(popBusyStatus())); + connect(this, SIGNAL(pushProgressStatus(QString, bool, bool, gboolean*)), + ms, SLOT(pushProgressStatus(QString, bool, bool, gboolean*))); + connect(this, SIGNAL(updateProgressStatus(int)), + ms, SLOT(updateProgressStatus(int))); + connect(this, SIGNAL(popProgressStatus()), + ms, SLOT(popProgressStatus())); + } + + QWidget * wtWidget = mw->findChild(); + if ( wtWidget && qobject_cast(wtWidget) ) + { + WirelessTimeline * wt = qobject_cast(wtWidget); + connect(this, SIGNAL(bgColorizationProgress(int, int)), + wt, SLOT(bgColorizationProgress(int, int))); + } + + } + connect(this, &PacketListModel::maxLineCountChanged, this, &PacketListModel::emitItemHeightChanged, Qt::QueuedConnection); @@ -693,7 +725,7 @@ void PacketListModel::dissectIdle(bool reset) } // report colorization progress - bgColorizationProgress(first+1, idle_dissection_row_+1); + emit bgColorizationProgress(first+1, idle_dissection_row_+1); } // XXX Pass in cinfo from packet_list_append so that we can fill in diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 07b5bde739..6d3970bdb7 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -96,12 +96,16 @@ packet_list_append(column_info *, frame_data *fdata) if (!gbl_cur_packet_list) return 0; + PacketListModel * model = qobject_cast(gbl_cur_packet_list->model()); + if ( ! model ) + 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); + visible_pos = model->appendPacket(fdata); return visible_pos; } @@ -128,10 +132,17 @@ packet_list_select_first_row(void) gboolean packet_list_select_row_from_data(frame_data *fdata_needle) { - gbl_cur_packet_list->packetListModel()->flushVisibleRows(); - int row = gbl_cur_packet_list->packetListModel()->visibleIndexOf(fdata_needle); + if ( !gbl_cur_packet_list ) + return FALSE; + + PacketListModel * model = qobject_cast(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,16 +186,21 @@ packet_list_thaw(void) void packet_list_recreate_visible_rows(void) { - if (gbl_cur_packet_list && gbl_cur_packet_list->packetListModel()) { - gbl_cur_packet_list->packetListModel()->recreateVisibleRows(); + if ( !gbl_cur_packet_list ) + return; + + PacketListModel * model = qobject_cast(gbl_cur_packet_list->model()); + + if (model) { + model->recreateVisibleRows(); } } frame_data * packet_list_get_row_data(gint row) { - if (gbl_cur_packet_list && gbl_cur_packet_list->packetListModel()) { - return gbl_cur_packet_list->packetListModel()->getRowFdata(row); + if (gbl_cur_packet_list) { + return gbl_cur_packet_list->getFDataForRow(row); } return NULL; } @@ -396,10 +412,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); @@ -844,6 +856,11 @@ bool PacketList::havePreviousHistory(bool update_cur) return false; } +frame_data *PacketList::getFDataForRow(int row) const +{ + return packet_list_model_->getRowFdata(row); +} + // prefs.col_list has changed. void PacketList::columnsChanged() { diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h index 9f07f17abd..9adf27b69e 100644 --- a/ui/qt/packet_list.h +++ b/ui/qt/packet_list.h @@ -33,7 +33,7 @@ class PacketList : public QTreeView Q_OBJECT public: explicit PacketList(QWidget *parent = 0); - PacketListModel *packetListModel() const; + QMenu *conversationMenu() { return &conv_menu_; } QMenu *colorizeMenu() { return &colorize_menu_; } void setProtoTree(ProtoTree *proto_tree); @@ -68,6 +68,8 @@ public: bool haveNextHistory(bool update_cur = false); bool havePreviousHistory(bool update_cur = false); + frame_data * getFDataForRow(int row) const; + protected: void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected); void contextMenuEvent(QContextMenuEvent *event); diff --git a/ui/qt/widgets/wireless_timeline.cpp b/ui/qt/widgets/wireless_timeline.cpp index c222bb14e3..c11000d299 100644 --- a/ui/qt/widgets/wireless_timeline.cpp +++ b/ui/qt/widgets/wireless_timeline.cpp @@ -495,9 +495,14 @@ WirelessTimeline::paintEvent(QPaintEvent *qpe) /* background of packets visible in packet_list is white */ int top = packet_list->indexAt(QPoint(0,0)).row(); int bottom = packet_list->indexAt(QPoint(0,packet_list->viewport()->height())).row(); - PacketListModel *model = packet_list->packetListModel(); - int x1 = top == -1 ? 0 : position(get_wlan_radio(model->getRowFdata(top)->num)->start_tsf, ratio); - int x2 = bottom == -1 ? width() : position(get_wlan_radio(model->getRowFdata(bottom)->num)->end_tsf, ratio); + + frame_data * topData = packet_list->getFDataForRow(top); + frame_data * botData = packet_list->getFDataForRow(bottom); + if ( ! topData || ! botData ) + return; + + int x1 = top == -1 ? 0 : position(get_wlan_radio(topData->num)->start_tsf, ratio); + int x2 = bottom == -1 ? width() : position(get_wlan_radio(botData->num)->end_tsf, ratio); p.fillRect(QRectF(x1/ratio, 0, (x2-x1+1)/ratio, TIMELINE_HEIGHT), Qt::white); /* background of current packet is blue */