void PacketList::setTimeReference() { if (!cap_file_) return; if (cap_file_->current_frame) { if(recent.gui_time_format != TS_RELATIVE && cap_file_->current_frame->flags.ref_time==0) { int ret = QMessageBox::question( this, tr("Change Time Display Format?"), tr("Time References don't work well with the currently selected Time Display Format.\n" "Do you want to switch to \"Seconds Since Beginning of Capture\" now?"), QMessageBox::Yes | QMessageBox::No ); if (ret == QMessageBox::Yes) { timestamp_set_type(TS_RELATIVE); recent.gui_time_format = TS_RELATIVE; cf_timestamp_auto_precision(cap_file_); setFrameReftime(!cap_file_->current_frame->flags.ref_time, cap_file_->current_frame); } } else { setFrameReftime(!cap_file_->current_frame->flags.ref_time, cap_file_->current_frame); } } redrawVisiblePackets(); }
void PacketList::unsetAllTimeReferences() { if (!cap_file_) return; /* XXX: we might need a progressbar here */ guint32 framenum; frame_data *fdata; for (framenum = 1; framenum <= cap_file_->count && cap_file_->ref_time_count > 0; framenum++) { fdata = frame_data_sequence_find(cap_file_->frames, framenum); if (fdata->flags.ref_time == 1) { setFrameReftime(FALSE, fdata); } } redrawVisiblePackets(); }
void PacketList::setPacketComment(QString new_comment) { int row = currentIndex().row(); frame_data *fdata; gchar *new_packet_comment = new_comment.toUtf8().data(); if (!cap_file_ || !packet_list_model_) return; fdata = packet_list_model_->getRowFdata(row); if (!fdata) return; /* Check if we are clearing the comment */ if(new_comment.isEmpty()) { new_packet_comment = NULL; } cf_set_user_packet_comment(cap_file_, fdata, new_packet_comment); redrawVisiblePackets(); }
PacketList::PacketList(QWidget *parent) : QTreeView(parent), proto_tree_(NULL), byte_view_tab_(NULL), cap_file_(NULL), decode_as_(NULL), ctx_column_(-1), create_near_overlay_(true), create_far_overlay_(true), capture_in_progress_(false), tail_timer_id_(0), rows_inserted_(false) { QMenu *main_menu_item, *submenu; QAction *action; setItemsExpandable(false); setRootIsDecorated(false); setSortingEnabled(true); setUniformRowHeights(true); setAccessibleName("Packet list"); setItemDelegateForColumn(0, &related_packet_delegate_); overlay_sb_ = new OverlayScrollBar(Qt::Vertical, this); setVerticalScrollBar(overlay_sb_); overlay_timer_id_ = startTimer(overlay_update_interval_); packet_list_model_ = new PacketListModel(this, cap_file_); setModel(packet_list_model_); sortByColumn(-1, Qt::AscendingOrder); // XXX We might want to reimplement setParent() and fill in the context // menu there. ctx_menu_.addAction(window()->findChild<QAction *>("actionEditMarkPacket")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditIgnorePacket")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditSetTimeReference")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditTimeShift")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditPacketComment")); ctx_menu_.addSeparator(); ctx_menu_.addAction(window()->findChild<QAction *>("actionViewEditResolvedName")); ctx_menu_.addSeparator(); main_menu_item = window()->findChild<QMenu *>("menuApplyAsFilter"); submenu = new QMenu(main_menu_item->title()); ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected")); main_menu_item = window()->findChild<QMenu *>("menuPrepareAFilter"); submenu = new QMenu(main_menu_item->title()); ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrNotSelected")); const char *conv_menu_name = "menuConversationFilter"; main_menu_item = window()->findChild<QMenu *>(conv_menu_name); conv_menu_.setTitle(main_menu_item->title()); conv_menu_.setObjectName(conv_menu_name); ctx_menu_.addMenu(&conv_menu_); const char *colorize_menu_name = "menuColorizeConversation"; main_menu_item = window()->findChild<QMenu *>(colorize_menu_name); colorize_menu_.setTitle(main_menu_item->title()); colorize_menu_.setObjectName(colorize_menu_name); ctx_menu_.addMenu(&colorize_menu_); main_menu_item = window()->findChild<QMenu *>("menuSCTP"); submenu = new QMenu(main_menu_item->title()); ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionSCTPAnalyseThisAssociation")); submenu->addAction(window()->findChild<QAction *>("actionSCTPShowAllAssociations")); submenu->addAction(window()->findChild<QAction *>("actionSCTPFilterThisAssociation")); main_menu_item = window()->findChild<QMenu *>("menuFollow"); submenu = new QMenu(main_menu_item->title()); ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowTCPStream")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowUDPStream")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowSSLStream")); ctx_menu_.addSeparator(); main_menu_item = window()->findChild<QMenu *>("menuEditCopy"); submenu = new QMenu(main_menu_item->title()); ctx_menu_.addMenu(submenu); action = submenu->addAction(tr("Summary as Text")); action->setData(copy_summary_text_); connect(action, SIGNAL(triggered()), this, SLOT(copySummary())); action = submenu->addAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as CSV")); action->setData(copy_summary_csv_); connect(action, SIGNAL(triggered()), this, SLOT(copySummary())); action = submenu->addAction(tr(UTF8_HORIZONTAL_ELLIPSIS "as YAML")); action->setData(copy_summary_yaml_); connect(action, SIGNAL(triggered()), this, SLOT(copySummary())); submenu->addSeparator(); submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter")); submenu->addSeparator(); action = window()->findChild<QAction *>("actionContextCopyBytesHexTextDump"); submenu->addAction(action); copy_actions_ << action; action = window()->findChild<QAction *>("actionContextCopyBytesHexDump"); submenu->addAction(action); copy_actions_ << action; action = window()->findChild<QAction *>("actionContextCopyBytesPrintableText"); submenu->addAction(action); copy_actions_ << action; action = window()->findChild<QAction *>("actionContextCopyBytesHexStream"); submenu->addAction(action); copy_actions_ << action; action = window()->findChild<QAction *>("actionContextCopyBytesBinary"); submenu->addAction(action); copy_actions_ << action; ctx_menu_.addSeparator(); ctx_menu_.addMenu(&proto_prefs_menu_); decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs"); ctx_menu_.addAction(decode_as_); // "Print" not ported intentionally action = window()->findChild<QAction *>("actionViewShowPacketInNewWindow"); ctx_menu_.addAction(action); initHeaderContextMenu(); g_assert(gbl_cur_packet_list == NULL); gbl_cur_packet_list = this; connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int))); connect(packet_list_model_, SIGNAL(itemHeightChanged(const QModelIndex&)), this, SLOT(updateRowHeights(const QModelIndex&))); connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePackets())); header()->setContextMenuPolicy(Qt::CustomContextMenu); connect(header(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showHeaderMenu(QPoint))); connect(header(), SIGNAL(sectionResized(int,int,int)), this, SLOT(sectionResized(int,int,int))); connect(header(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(sectionMoved(int,int,int))); connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), this, SLOT(vScrollBarActionTriggered(int))); connect(&proto_prefs_menu_, SIGNAL(showProtocolPreferences(QString)), this, SIGNAL(showProtocolPreferences(QString))); connect(&proto_prefs_menu_, SIGNAL(editProtocolPreference(preference*,pref_module*)), this, SIGNAL(editProtocolPreference(preference*,pref_module*))); }
void PacketList::setMonospaceFont(const QFont &mono_font) { packet_list_model_->setMonospaceFont(mono_font); redrawVisiblePackets(); }
void PacketList::markFramesReady() { packets_bar_update(); redrawVisiblePackets(); }
PacketList::PacketList(QWidget *parent) : QTreeView(parent), proto_tree_(NULL), byte_view_tab_(NULL), cap_file_(NULL), decode_as_(NULL), ctx_column_(-1) { QMenu *submenu, *subsubmenu; QAction *action; setItemsExpandable(false); setRootIsDecorated(false); setSortingEnabled(true); setUniformRowHeights(true); setAccessibleName("Packet list"); setItemDelegateForColumn(0, &related_packet_delegate_); packet_list_model_ = new PacketListModel(this, cap_file_); setModel(packet_list_model_); sortByColumn(-1, Qt::AscendingOrder); // XXX We might want to reimplement setParent() and fill in the context // menu there. ctx_menu_.addAction(window()->findChild<QAction *>("actionEditMarkPacket")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditIgnorePacket")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditSetTimeReference")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditTimeShift")); ctx_menu_.addAction(window()->findChild<QAction *>("actionEditPacketComment")); ctx_menu_.addSeparator(); action = window()->findChild<QAction *>("actionFollow"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowTCPStream")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowUDPStream")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeFollowSSLStream")); action = window()->findChild<QAction *>("actionSCTP"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); ctx_menu_.addMenu(submenu); submenu->addAction(window()->findChild<QAction *>("actionSCTPAnalyseThisAssociation")); submenu->addAction(window()->findChild<QAction *>("actionSCTPShowAllAssociations")); submenu->addAction(window()->findChild<QAction *>("actionSCTPFilterThisAssociation")); ctx_menu_.addSeparator(); // " <menuitem name='ManuallyResolveAddress' action='/ManuallyResolveAddress'/>\n" // ctx_menu_.addSeparator(); action = window()->findChild<QAction *>("actionApply_as_Filter"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected")); action = window()->findChild<QAction *>("actionPrepare_a_Filter"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFAndNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzePAFOrNotSelected")); // action = window()->findChild<QAction *>("actionColorize_with_Filter"); // submenu = new QMenu(); // action->setMenu(submenu); // ctx_menu_.addAction(action); // " <menu name= 'ConversationFilter' action='/Conversation Filter'>\n" // " <menuitem name='Ethernet' action='/Conversation Filter/Ethernet'/>\n" // " <menuitem name='IP' action='/Conversation Filter/IP'/>\n" // " <menuitem name='TCP' action='/Conversation Filter/TCP'/>\n" // " <menuitem name='UDP' action='/Conversation Filter/UDP'/>\n" // " <menuitem name='PN-CBA' action='/Conversation Filter/PN-CBA'/>\n" // " <menu name= 'ColorizeConversation' action='/Colorize Conversation'>\n" // " <menu name= 'Ethernet' action='/Colorize Conversation/Ethernet'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/Ethernet/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/Ethernet/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/Ethernet/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/Ethernet/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/Ethernet/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/Ethernet/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/Ethernet/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/Ethernet/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/Ethernet/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/Ethernet/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/Ethernet/New Coloring Rule'/>\n" // " <menu name= 'IP' action='/Colorize Conversation/IP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/IP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/IP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/IP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/IP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/IP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/IP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/IP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/IP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/IP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/IP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/IP/New Coloring Rule'/>\n" // " <menu name= 'TCP' action='/Colorize Conversation/TCP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/TCP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/TCP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/TCP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/TCP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/TCP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/TCP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/TCP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/TCP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/TCP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/TCP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/TCP/New Coloring Rule'/>\n" // " <menu name= 'UDP' action='/Colorize Conversation/UDP'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/UDP/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/UDP/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/UDP/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/UDP/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/UDP/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/UDP/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/UDP/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/UDP/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/UDP/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/UDP/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/UDP/New Coloring Rule'/>\n" // " <menu name= 'PN-CBA' action='/Colorize Conversation/PN-CBA'>\n" // " <menuitem name='Color1' action='/Colorize Conversation/PN-CBA/Color 1'/>\n" // " <menuitem name='Color2' action='/Colorize Conversation/PN-CBA/Color 2'/>\n" // " <menuitem name='Color3' action='/Colorize Conversation/PN-CBA/Color 3'/>\n" // " <menuitem name='Color4' action='/Colorize Conversation/PN-CBA/Color 4'/>\n" // " <menuitem name='Color5' action='/Colorize Conversation/PN-CBA/Color 5'/>\n" // " <menuitem name='Color6' action='/Colorize Conversation/PN-CBA/Color 6'/>\n" // " <menuitem name='Color7' action='/Colorize Conversation/PN-CBA/Color 7'/>\n" // " <menuitem name='Color8' action='/Colorize Conversation/PN-CBA/Color 8'/>\n" // " <menuitem name='Color9' action='/Colorize Conversation/PN-CBA/Color 9'/>\n" // " <menuitem name='Color10' action='/Colorize Conversation/PN-CBA/Color 10'/>\n" // " <menuitem name='NewColoringRule' action='/Colorize Conversation/PN-CBA/New Coloring Rule'/>\n" // " <menu name= 'SCTP' action='/SCTP'>\n" // " <menuitem name='AnalysethisAssociation' action='/SCTP/Analyse this Association'/>\n" // " <menuitem name='PrepareFilterforthisAssociation' action='/SCTP/Prepare Filter for this Association'/>\n" // " <menuitem name='FollowTCPStream' action='/Follow TCP Stream'/>\n" // " <menuitem name='FollowUDPStream' action='/Follow UDP Stream'/>\n" // " <menuitem name='FollowSSLStream' action='/Follow SSL Stream'/>\n" ctx_menu_.addSeparator(); action = window()->findChild<QAction *>("actionCopy"); submenu = new QMenu(); action->setMenu(submenu); ctx_menu_.addAction(action); // " <menuitem name='SummaryTxt' action='/Copy/SummaryTxt'/>\n" // " <menuitem name='SummaryCSV' action='/Copy/SummaryCSV'/>\n" submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter")); submenu->addSeparator(); action = window()->findChild<QAction *>("actionBytes"); subsubmenu = new QMenu(); action->setMenu(subsubmenu); submenu->addAction(action); // " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n" // " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n" // " <menuitem name='PrintableTextOnly' action='/Copy/Bytes/PrintableTextOnly'/>\n" // ctx_menu_.addSeparator(); // " <menuitem name='HexStream' action='/Copy/Bytes/HexStream'/>\n" // " <menuitem name='BinaryStream' action='/Copy/Bytes/BinaryStream'/>\n" ctx_menu_.addSeparator(); // " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n" decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs"); ctx_menu_.addAction(decode_as_); // " <menuitem name='Print' action='/Print'/>\n" // " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n" g_assert(gbl_cur_packet_list == NULL); gbl_cur_packet_list = this; connect(packet_list_model_, SIGNAL(goToPacket(int)), this, SLOT(goToPacket(int))); connect(wsApp, SIGNAL(addressResolutionChanged()), this, SLOT(redrawVisiblePackets())); }