void PacketList::selectionChanged (const QItemSelection & selected, const QItemSelection & deselected) { QTreeView::selectionChanged(selected, deselected); if (!cap_file_) return; int row = selected.first().top(); cf_select_packet(cap_file_, row); related_packet_delegate_.clear(); if (!cap_file_->edt) return; if (proto_tree_ && cap_file_->edt->tree) { proto_tree_->fillProtocolTree(cap_file_->edt->tree); packet_info *pi = &cap_file_->edt->pi; conversation_t *conv = find_conversation(pi->fd->num, &pi->src, &pi->dst, pi->ptype, pi->srcport, pi->destport, 0); if (conv) { related_packet_delegate_.setConversationSpan(conv->setup_frame, conv->last_frame); } viewport()->update(); } if (byte_view_tab_) { GSList *src_le; struct data_source *source; byte_view_tab_->clear(); for (src_le = cap_file_->edt->pi.data_src; src_le != NULL; src_le = src_le->next) { source = (struct data_source *)src_le->data; byte_view_tab_->addTab(get_data_source_name(source), get_data_source_tvb(source), cap_file_->edt->tree, proto_tree_, (packet_char_enc)cap_file_->current_frame->flags.encoding); } byte_view_tab_->setCurrentIndex(0); } }
void PacketList::selectionChanged (const QItemSelection & selected, const QItemSelection & deselected) { QTreeView::selectionChanged(selected, deselected); if (!cap_file_) return; if (proto_tree_) { int row = selected.first().top(); cf_select_packet(cap_file_, row); if (!cap_file_->edt && !cap_file_->edt->tree) { return; } proto_tree_->fillProtocolTree(cap_file_->edt->tree); } if (byte_view_tab_ && cap_file_->edt) { GSList *src_le; struct data_source *source; byte_view_tab_->clear(); for (src_le = cap_file_->edt->pi.data_src; src_le != NULL; src_le = src_le->next) { source = (struct data_source *)src_le->data; byte_view_tab_->addTab(get_data_source_name(source), get_data_source_tvb(source), cap_file_->edt->tree, proto_tree_, (packet_char_enc)cap_file_->current_frame->flags.encoding); } byte_view_tab_->setCurrentIndex(0); } }
PacketDialog::PacketDialog(QWidget &parent, CaptureFile &cf, frame_data *fdata) : WiresharkDialog(parent, cf), ui(new Ui::PacketDialog), packet_data_(NULL) { ui->setupUi(this); ui->hintLabel->setSmallText(); // XXX Use recent settings instead resize(parent.width() * 4 / 5, parent.height() * 4 / 5); setWindowSubtitle(tr("Packet %1").arg(fdata->num)); phdr_ = cap_file_.capFile()->phdr; packet_data_ = (guint8 *) g_memdup(ws_buffer_start_ptr(&(cap_file_.capFile()->buf)), fdata->cap_len); if (!cf_read_record(cap_file_.capFile(), fdata)) reject(); /* proto tree, visible. We need a proto tree if there's custom columns */ epan_dissect_init(&edt_, cap_file_.capFile()->epan, TRUE, TRUE); col_custom_prime_edt(&edt_, &(cap_file_.capFile()->cinfo)); epan_dissect_run(&edt_, cap_file_.capFile()->cd_t, &phdr_, frame_tvbuff_new(fdata, packet_data_), fdata, &(cap_file_.capFile()->cinfo)); epan_dissect_fill_in_columns(&edt_, TRUE, TRUE); proto_tree_ = new ProtoTree(ui->packetSplitter); proto_tree_->fillProtocolTree(edt_.tree); proto_tree_->expandAll(); byte_view_tab_ = new ByteViewTab(ui->packetSplitter); byte_view_tab_->setCaptureFile(cap_file_.capFile()); byte_view_tab_->clear(); GSList *src_le; for (src_le = edt_.pi.data_src; src_le != NULL; src_le = src_le->next) { struct data_source *source; char* source_name; source = (struct data_source *)src_le->data; source_name = get_data_source_name(source); byte_view_tab_->addTab(source_name, get_data_source_tvb(source), edt_.tree, proto_tree_, cap_file_.capFile()->current_frame->flags.encoding); wmem_free(NULL, source_name); } byte_view_tab_->setCurrentIndex(0); ui->packetSplitter->setStretchFactor(0, 5); ui->packetSplitter->setStretchFactor(1, 1); QStringList col_parts; for (int i = 0; i < cap_file_.capFile()->cinfo.num_cols; ++i) { // ElidedLabel doesn't support rich text / HTML col_parts << QString("%1: %2") .arg(get_column_title(i)) .arg(cap_file_.capFile()->cinfo.col_data[i]); } col_info_ = col_parts.join(" " UTF8_MIDDLE_DOT " "); setHintText(); connect(this, SIGNAL(monospaceFontChanged(QFont)), proto_tree_, SLOT(setMonospaceFont(QFont))); connect(this, SIGNAL(monospaceFontChanged(QFont)), byte_view_tab_, SLOT(setMonospaceFont(QFont))); connect(proto_tree_, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), byte_view_tab_, SLOT(protoTreeItemChanged(QTreeWidgetItem*))); connect(byte_view_tab_, SIGNAL(byteFieldHovered(QString&)), this, SLOT(setHintText(QString&))); }