diff options
-rw-r--r-- | ui/qt/main_window.cpp | 2 | ||||
-rw-r--r-- | ui/qt/main_window.ui | 24 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 50 | ||||
-rw-r--r-- | ui/qt/packet_list.cpp | 18 | ||||
-rw-r--r-- | ui/qt/packet_list.h | 2 | ||||
-rw-r--r-- | ui/qt/proto_tree.cpp | 10 |
6 files changed, 51 insertions, 55 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 1be6b20f1b..c91ec7020a 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -200,6 +200,8 @@ MainWindow::MainWindow(QWidget *parent) : main_ui_(new Ui::MainWindow), cur_layout_(QVector<unsigned>()), df_combo_box_(new DisplayFilterCombo()), + packet_list_(NULL), + proto_tree_(NULL), previous_focus_(NULL), show_hide_actions_(NULL), time_display_actions_(NULL), diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index 019acb70ec..d1fb5530f9 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -116,7 +116,7 @@ <x>0</x> <y>0</y> <width>960</width> - <height>18</height> + <height>22</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -2295,16 +2295,6 @@ <string>SCTP</string> </property> </action> - <action name="actionApply_as_Filter"> - <property name="text"> - <string>Apply as Filter</string> - </property> - </action> - <action name="actionPrepare_a_Filter"> - <property name="text"> - <string>Prepare a Filter</string> - </property> - </action> <action name="actionCopy"> <property name="text"> <string>Copy</string> @@ -2601,12 +2591,6 @@ <header>search_frame.h</header> </customwidget> <customwidget> - <class>AddressEditorFrame</class> - <extends>QFrame</extends> - <header>address_editor_frame.h</header> - <container>1</container> - </customwidget> - <customwidget> <class>ColumnEditorFrame</class> <extends>QFrame</extends> <header>column_editor_frame.h</header> @@ -2618,6 +2602,12 @@ <header>preference_editor_frame.h</header> <container>1</container> </customwidget> + <customwidget> + <class>AddressEditorFrame</class> + <extends>QFrame</extends> + <header>address_editor_frame.h</header> + <container>1</container> + </customwidget> </customwidgets> <resources> <include location="../../image/toolbar.qrc"/> diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index bbbed3db8d..be8235c82a 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -987,6 +987,8 @@ void MainWindow::setMenusForSelectedPacket() than one time reference frame or the current frame isn't a time reference frame). (XXX - why check frame_selected?) */ bool another_is_time_ref = false; + /* We have a valid filter expression */ + bool have_filter_expr = false; if (capture_file_.capFile()) { frame_selected = capture_file_.capFile()->current_frame != NULL; @@ -1005,6 +1007,10 @@ void MainWindow::setMenusForSelectedPacket() proto_get_frame_protocols(capture_file_.capFile()->edt->pi.layers, &is_ip, &is_tcp, NULL, &is_sctp, NULL, &is_rtp); } } + + if (packet_list_) { + have_filter_expr = !packet_list_->getFilterFromRowAndColumn().isEmpty(); + } // if (cfile.edt && cfile.edt->tree) { // GPtrArray *ga; // header_field_info *hfinfo; @@ -1057,6 +1063,20 @@ void MainWindow::setMenusForSelectedPacket() main_ui_->actionEditPreviousTimeReference->setEnabled(another_is_time_ref); main_ui_->actionEditTimeShift->setEnabled(have_frames); + main_ui_->actionAnalyzeAAFSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzeAAFNotSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzeAAFAndSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzeAAFOrSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzeAAFAndNotSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzeAAFOrNotSelected->setEnabled(have_filter_expr); + + main_ui_->actionAnalyzePAFSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzePAFNotSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzePAFAndSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzePAFOrSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzePAFAndNotSelected->setEnabled(have_filter_expr); + main_ui_->actionAnalyzePAFOrNotSelected->setEnabled(have_filter_expr); + main_ui_->actionViewColorizeConversation1->setEnabled(frame_selected); main_ui_->actionViewColorizeConversation2->setEnabled(frame_selected); main_ui_->actionViewColorizeConversation3->setEnabled(frame_selected); @@ -1106,8 +1126,6 @@ void MainWindow::setMenusForSelectedPacket() connect(conv_action, SIGNAL(triggered()), this, SLOT(applyConversationFilter())); } -// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/FollowUDPStream", -// frame_selected ? is_udp : FALSE); // set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ConversationFilter/PN-CBA", // frame_selected ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE); // set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ColorizeConversation", @@ -1139,19 +1157,9 @@ void MainWindow::setMenusForSelectedPacket() // properties); // set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/Copy", // frame_selected); -// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ApplyAsFilter", -// frame_selected); -// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/PrepareaFilter", -// frame_selected); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ResolveName", // frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name || // gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns)); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowTCPStream", -// frame_selected ? is_tcp : FALSE); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowUDPStream", -// frame_selected ? is_udp : FALSE); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/AnalyzeMenu/FollowSSLStream", -// frame_selected ? is_ssl : FALSE); // set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/NameResolution/ResolveName", // frame_selected && (gbl_resolv_flags.mac_name || gbl_resolv_flags.network_name || // gbl_resolv_flags.transport_name || gbl_resolv_flags.concurrent_dns)); @@ -1182,6 +1190,10 @@ void MainWindow::setMenusForSelectedPacket() void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { // XXX Add commented items below + // The ProtoTree either doesn't exist yet or emitted protoItemSelected as + // a result of a packet list selection. Don't assume control of the menu. + if (!proto_tree_ || !proto_tree_->hasFocus()) return; + if (capture_file_.capFile()) { capture_file_.capFile()->finfo_selected = fi; } @@ -1214,8 +1226,6 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { // hfinfo->type != FT_NONE); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", // proto_can_match_selected(cf->finfo_selected, cf->edt)); -// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences", -// properties); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", // (id == -1) ? FALSE : proto_can_toggle_protocol(id)); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", @@ -1292,11 +1302,7 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { // "/TreeViewPopup/GotoCorrespondingPacket", FALSE); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", FALSE); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/CreateAColumn", FALSE); -// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ApplyAsFilter", FALSE); -// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/PrepareaFilter", FALSE); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ColorizewithFilter", FALSE); -// set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ProtocolPreferences", -// FALSE); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/DisableProtocol", FALSE); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/ExpandSubtrees", FALSE); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/WikiProtocolPage", @@ -2371,21 +2377,17 @@ void MainWindow::on_actionViewReload_triggered() // Analyze Menu -// XXX This should probably be somewhere else. void MainWindow::matchFieldFilter(FilterAction::Action action, FilterAction::ActionType filter_type) { QString field_filter; - char* tmp_field; - if (packet_list_->contextMenuActive()) { + if (packet_list_->contextMenuActive() || packet_list_->hasFocus()) { field_filter = packet_list_->getFilterFromRowAndColumn(); } else if (capture_file_.capFile() && capture_file_.capFile()->finfo_selected) { - tmp_field = proto_construct_match_selected_string(capture_file_.capFile()->finfo_selected, + char *tmp_field = proto_construct_match_selected_string(capture_file_.capFile()->finfo_selected, capture_file_.capFile()->edt); field_filter = QString(tmp_field); wmem_free(NULL, tmp_field); - } else { - return; } if (field_filter.isEmpty()) { diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 999b18ec8d..45755c67fc 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -288,8 +288,8 @@ PacketList::PacketList(QWidget *parent) : ctx_menu_.addSeparator(); - action = window()->findChild<QAction *>("actionApply_as_Filter"); - submenu = new QMenu(action->text()); + 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")); @@ -298,8 +298,8 @@ PacketList::PacketList(QWidget *parent) : submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected")); - action = window()->findChild<QAction *>("actionPrepare_a_Filter"); - submenu = new QMenu(action->text()); + 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")); @@ -383,9 +383,6 @@ PacketList::PacketList(QWidget *parent) : // " <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"); @@ -583,9 +580,14 @@ void PacketList::contextMenuEvent(QContextMenuEvent *event) decode_as_->setData(qVariantFromValue(true)); ctx_column_ = columnAt(event->x()); + + // Set menu sensitivity for the current column + emit packetSelectionChanged(); + ctx_menu_.exec(event->globalPos()); ctx_column_ = -1; decode_as_->setData(QVariant()); + } // Auto scroll if: @@ -842,7 +844,7 @@ bool PacketList::contextMenuActive() return ctx_column_ >= 0 ? true : false; } -QString &PacketList::getFilterFromRowAndColumn() +const QString &PacketList::getFilterFromRowAndColumn() { frame_data *fdata; QString &filter = *new QString(); diff --git a/ui/qt/packet_list.h b/ui/qt/packet_list.h index 67b9022d65..da0673dc1c 100644 --- a/ui/qt/packet_list.h +++ b/ui/qt/packet_list.h @@ -64,7 +64,7 @@ public: void clear(); void writeRecent(FILE *rf); bool contextMenuActive(); - QString &getFilterFromRowAndColumn(); + const QString &getFilterFromRowAndColumn(); void resetColorized(); QString packetComment(); void setPacketComment(QString new_comment); diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index 8360725037..7dc9048bf8 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -164,7 +164,7 @@ ProtoTree::ProtoTree(QWidget *parent) : // Assume we're a child of the main window. // XXX We might want to reimplement setParent() and fill in the context // menu there. - QMenu *submenu, *subsubmenu; + QMenu *main_menu_item, *submenu, *subsubmenu; QAction *action; ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandSubtrees")); @@ -176,8 +176,8 @@ ProtoTree::ProtoTree(QWidget *parent) : ctx_menu_.addAction(action); ctx_menu_.addSeparator(); - action = window()->findChild<QAction *>("actionApply_as_Filter"); - submenu = new QMenu(action->text()); + 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")); @@ -186,8 +186,8 @@ ProtoTree::ProtoTree(QWidget *parent) : submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFAndNotSelected")); submenu->addAction(window()->findChild<QAction *>("actionAnalyzeAAFOrNotSelected")); - action = window()->findChild<QAction *>("actionPrepare_a_Filter"); - submenu = new QMenu(action->text()); + 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")); |