forked from osmocom/wireshark
Qt: Do not export the model of the packetlist
Exporting the model for the packetlist via a function prohibits implementing further models (sorting) inside the packetlist Change-Id: Ica159fc8f242ae1a5b657507a26e33827c366bee Reviewed-on: https://code.wireshark.org/review/33834 Reviewed-by: Roland Knall <rknall@gmail.com> Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
8b11de8a03
commit
66e92e7276
|
@ -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)));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
#include <ui/qt/utils/color_utils.h>
|
||||
#include "wireshark_application.h"
|
||||
#include <ui/qt/main_window.h>
|
||||
#include <ui/qt/main_status_bar.h>
|
||||
#include <ui/qt/widgets/wireless_timeline.h>
|
||||
|
||||
#include <QColor>
|
||||
#include <QElapsedTimer>
|
||||
|
@ -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<MainWindow *>(wsApp->mainWindow()))
|
||||
{
|
||||
MainWindow *mw = qobject_cast<MainWindow *>(wsApp->mainWindow());
|
||||
MainStatusBar *ms = qobject_cast<MainStatusBar *>(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<WirelessTimeline *>();
|
||||
if ( wtWidget && qobject_cast<WirelessTimeline *>(wtWidget) )
|
||||
{
|
||||
WirelessTimeline * wt = qobject_cast<WirelessTimeline *>(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
|
||||
|
|
|
@ -96,12 +96,16 @@ packet_list_append(column_info *, frame_data *fdata)
|
|||
if (!gbl_cur_packet_list)
|
||||
return 0;
|
||||
|
||||
PacketListModel * model = qobject_cast<PacketListModel *>(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<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,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<PacketListModel *>(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()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue