diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/help_url.c | 4 | ||||
-rw-r--r-- | ui/help_url.h | 3 | ||||
-rw-r--r-- | ui/qt/CMakeLists.txt | 3 | ||||
-rw-r--r-- | ui/qt/Makefile.am | 2 | ||||
-rw-r--r-- | ui/qt/Makefile.common | 4 | ||||
-rw-r--r-- | ui/qt/Wireshark.pro | 3 | ||||
-rw-r--r-- | ui/qt/byte_view_tab.cpp | 2 | ||||
-rw-r--r-- | ui/qt/main_window.cpp | 4 | ||||
-rw-r--r-- | ui/qt/main_window.h | 15 | ||||
-rw-r--r-- | ui/qt/main_window.ui | 18 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 35 | ||||
-rw-r--r-- | ui/qt/packet_dialog.cpp | 163 | ||||
-rw-r--r-- | ui/qt/packet_dialog.h | 78 | ||||
-rw-r--r-- | ui/qt/packet_dialog.ui | 91 | ||||
-rw-r--r-- | ui/qt/packet_list.cpp | 6 | ||||
-rw-r--r-- | ui/qt/proto_tree.cpp | 103 |
16 files changed, 469 insertions, 65 deletions
diff --git a/ui/help_url.c b/ui/help_url.c index bbc724d2bb..0f9520a1b1 100644 --- a/ui/help_url.c +++ b/ui/help_url.c @@ -148,7 +148,7 @@ user_guide_url(const gchar *page) { } else { #endif /* ifdef DOC_DIR */ /* try to open the HTML page from wireshark.org instead */ - g_string_printf(url, "http://www.wireshark.org/docs/wsug_html_chunked/%s", page); + g_string_printf(url, "https://www.wireshark.org/docs/wsug_html_chunked/%s", page); #ifdef DOC_DIR } #endif /* ifdef DOC_DIR */ @@ -336,6 +336,8 @@ topic_action_url(topic_action_e action) case(HELP_RTP_ANALYSIS_DIALOG): url = user_guide_url("ChTelRTPAnalysis.html"); break; + case(HELP_NEW_PACKET_DIALOG): + return user_guide_url("ChapterWork.html#ChWorkPacketSepView"); case(TOPIC_ACTION_NONE): default: diff --git a/ui/help_url.h b/ui/help_url.h index aff98886b9..85ce20d488 100644 --- a/ui/help_url.h +++ b/ui/help_url.h @@ -111,7 +111,8 @@ typedef enum { HELP_TIME_SHIFT_DIALOG, HELP_FILTER_SAVE_DIALOG, HELP_TELEPHONY_VOIP_CALLS_DIALOG, - HELP_RTP_ANALYSIS_DIALOG + HELP_RTP_ANALYSIS_DIALOG, + HELP_NEW_PACKET_DIALOG } topic_action_e; /** Given a filename return a filesystem URL. Relative paths are prefixed with diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt index 22f4615179..459a1c5ff6 100644 --- a/ui/qt/CMakeLists.txt +++ b/ui/qt/CMakeLists.txt @@ -72,6 +72,7 @@ set(WIRESHARK_QT_HEADERS manage_interfaces_dialog.h module_preferences_scroll_area.h packet_comment_dialog.h + packet_dialog.h packet_format_group_box.h packet_list.h packet_list_model.h @@ -172,6 +173,7 @@ set(WIRESHARK_QT_SRC manage_interfaces_dialog.cpp module_preferences_scroll_area.cpp packet_comment_dialog.cpp + packet_dialog.cpp packet_format_group_box.cpp packet_list.cpp packet_list_model.cpp @@ -264,6 +266,7 @@ set(WIRESHARK_QT_UI manage_interfaces_dialog.ui module_preferences_scroll_area.ui packet_comment_dialog.ui + packet_dialog.ui packet_format_group_box.ui packet_range_group_box.ui preferences_dialog.ui diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am index dca950b8c8..2148d4a4cb 100644 --- a/ui/qt/Makefile.am +++ b/ui/qt/Makefile.am @@ -176,6 +176,8 @@ module_preferences_scroll_area.cpp module_preferences_scroll_area.h: ui_module_p packet_comment_dialog.cpp packet_comment_dialog.h: ui_packet_comment_dialog.h +packet_dialog.cpp packet_dialog.h: ui_packet_dialog.h + packet_format_group_box.cpp packet_format_group_box.h: ui_packet_format_group_box.h packet_range_group_box.cpp packet_range_group_box.h: ui_packet_range_group_box.h diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common index f2b5d16bdb..2ccabd9d2e 100644 --- a/ui/qt/Makefile.common +++ b/ui/qt/Makefile.common @@ -58,6 +58,7 @@ NODIST_GENERATED_HEADER_FILES = \ ui_manage_interfaces_dialog.h \ ui_module_preferences_scroll_area.h \ ui_packet_comment_dialog.h \ + ui_packet_dialog.h \ ui_packet_format_group_box.h \ ui_packet_range_group_box.h \ ui_preferences_dialog.h \ @@ -167,6 +168,7 @@ MOC_HDRS = \ manage_interfaces_dialog.h \ module_preferences_scroll_area.h \ packet_comment_dialog.h \ + packet_dialog.h \ packet_format_group_box.h \ packet_list.h \ packet_list_model.h \ @@ -241,6 +243,7 @@ UI_FILES = \ packet_format_group_box.ui \ packet_range_group_box.ui \ packet_comment_dialog.ui \ + packet_dialog.ui \ preferences_dialog.ui \ print_dialog.ui \ profile_dialog.ui \ @@ -372,6 +375,7 @@ WIRESHARK_QT_SRC = \ manage_interfaces_dialog.cpp \ module_preferences_scroll_area.cpp \ packet_comment_dialog.cpp \ + packet_dialog.cpp \ packet_format_group_box.cpp \ packet_list.cpp \ packet_list_model.cpp \ diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro index 778e14f1f3..26452c9248 100644 --- a/ui/qt/Wireshark.pro +++ b/ui/qt/Wireshark.pro @@ -234,6 +234,7 @@ FORMS += \ manage_interfaces_dialog.ui \ module_preferences_scroll_area.ui \ packet_comment_dialog.ui \ + packet_dialog.ui \ packet_format_group_box.ui \ packet_range_group_box.ui \ preferences_dialog.ui \ @@ -292,6 +293,7 @@ HEADERS += $$HEADERS_WS_C \ manage_interfaces_dialog.h \ module_preferences_scroll_area.h \ packet_comment_dialog.h \ + packet_dialog.h \ packet_format_group_box.h \ preferences_dialog.h \ print_dialog.h \ @@ -646,6 +648,7 @@ SOURCES += \ manage_interfaces_dialog.cpp \ module_preferences_scroll_area.cpp \ packet_comment_dialog.cpp \ + packet_dialog.cpp \ packet_format_group_box.cpp \ packet_list.cpp \ packet_list_model.cpp \ diff --git a/ui/qt/byte_view_tab.cpp b/ui/qt/byte_view_tab.cpp index 20d0df4455..4df8cb39a7 100644 --- a/ui/qt/byte_view_tab.cpp +++ b/ui/qt/byte_view_tab.cpp @@ -28,6 +28,8 @@ ByteViewTab::ByteViewTab(QWidget *parent) : QTabWidget(parent) { setAccessibleName(tr("Packet bytes")); + setTabPosition(QTabWidget::South); + setDocumentMode(true); addTab(); } diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 26e55f58bb..63d655cce0 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -48,6 +48,7 @@ #include "display_filter_edit.h" #include "export_dissection_dialog.h" #include "import_text_dialog.h" +#include "packet_list.h" #include "proto_tree.h" #include "simple_dialog.h" #include "stock_icon.h" @@ -274,12 +275,9 @@ MainWindow::MainWindow(QWidget *parent) : packet_list_ = new PacketList(&master_split_); proto_tree_ = new ProtoTree(&master_split_); - proto_tree_->setHeaderHidden(true); proto_tree_->installEventFilter(this); byte_view_tab_ = new ByteViewTab(&master_split_); - byte_view_tab_->setTabPosition(QTabWidget::South); - byte_view_tab_->setDocumentMode(true); packet_list_->setProtoTree(proto_tree_); packet_list_->setByteViewTab(byte_view_tab_); diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index b40bbd4c28..3ed5ae2a3f 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -48,7 +48,6 @@ # include <QSocketNotifier> #endif -#include "about_dialog.h" #include "capture_file.h" #include "capture_file_dialog.h" #include "capture_file_properties_dialog.h" @@ -57,9 +56,11 @@ #include "file_set_dialog.h" #include "filter_action.h" #include "follow_stream_dialog.h" -#include "main_welcome.h" -#include "packet_list.h" -#include "progress_bar.h" + +class ByteViewTab; +class MainWelcome; +class PacketList; +class ProtoTree; class QAction; class QActionGroup; @@ -175,7 +176,7 @@ private: QMenu* findOrAddMenu(QMenu *parent_menu, QString& menu_text); signals: - void showProgress(progdlg_t **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct); + void showProgress(struct progdlg **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct); void setCaptureFile(capture_file *cf); void setDissectedCaptureFile(capture_file *cf); void displayFilterSuccess(bool success); @@ -316,6 +317,10 @@ private slots: void on_actionViewColorizePacketList_triggered(bool checked); void on_actionViewColoringRules_triggered(); void on_actionViewResizeColumns_triggered(); + + void openPacketDialog(bool from_reference = false); + void on_actionViewShowPacketInNewWindow_triggered(); + void on_actionViewShowPacketReferenceInNewWindow_triggered(); void on_actionViewReload_triggered(); void on_actionGoGoToPacket_triggered(); diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index f6ef2fbc77..29a9efba84 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -97,7 +97,6 @@ <bool>true</bool> </property> <widget class="MainWelcome" name="welcomePage"/> - <widget class="QWidget" name="packetPage"/> </widget> </item> </layout> @@ -295,6 +294,7 @@ <addaction name="separator"/> <addaction name="actionViewResizeColumns"/> <addaction name="separator"/> + <addaction name="actionViewShowPacketInNewWindow"/> <addaction name="actionViewReload"/> </widget> <widget class="QMenu" name="menuAnalyze"> @@ -2277,6 +2277,22 @@ <string>Services</string> </property> </action> + <action name="actionViewShowPacketInNewWindow"> + <property name="text"> + <string>Show Packet in New &Window</string> + </property> + <property name="toolTip"> + <string>Show this packet in a separate window.</string> + </property> + </action> + <action name="actionViewShowPacketReferenceInNewWindow"> + <property name="text"> + <string>Show Packet Reference in New Window</string> + </property> + <property name="toolTip"> + <string>Show the linked packet in a separate window.</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <customwidgets> diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 7a5edfb001..8463d8301c 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -71,6 +71,7 @@ #include "ui/software_update.h" #endif +#include "about_dialog.h" #include "bluetooth_att_server_attributes_dialog.h" #include "capture_file_dialog.h" #include "capture_file_properties_dialog.h" @@ -86,6 +87,8 @@ #include "lbm_lbtrm_transport_dialog.h" #include "lbm_lbtru_transport_dialog.h" #include "packet_comment_dialog.h" +#include "packet_dialog.h" +#include "packet_list.h" #include "preferences_dialog.h" #include "print_dialog.h" #include "profile_dialog.h" @@ -986,10 +989,8 @@ void MainWindow::setMenusForSelectedPacket() // frame_selected); // set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ResetColoring1-10", // tmp_color_filters_used()); -// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/ShowPacketinNewWindow", -// frame_selected); -// set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ShowPacketinNewWindow", -// frame_selected); + + main_ui_->actionViewShowPacketInNewWindow->setEnabled(frame_selected); // set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/ManuallyResolveAddress", // frame_selected ? is_ip : FALSE); // set_menu_sensitivity(ui_manager_packet_list_menu, "/PacketListMenuPopup/SCTP", @@ -1097,8 +1098,9 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { } if (capture_file_.capFile() != NULL && fi != NULL) { + header_field_info *hfinfo = capture_file_.capFile()->finfo_selected->hfinfo; + /* - header_field_info *hfinfo = fi->hfinfo; const char *abbrev; char *prev_abbrev; @@ -1112,8 +1114,10 @@ void MainWindow::setMenusForSelectedTreeRow(field_info *fi) { properties = prefs_is_registered_protocol(abbrev); */ bool can_match_selected = proto_can_match_selected(capture_file_.capFile()->finfo_selected, capture_file_.capFile()->edt); + bool is_framenum = hfinfo && hfinfo->type == FT_FRAMENUM ? true : false; // set_menu_sensitivity(ui_manager_tree_view_menu, // "/TreeViewPopup/GotoCorrespondingPacket", hfinfo->type == FT_FRAMENUM); + main_ui_->actionViewShowPacketReferenceInNewWindow->setEnabled(is_framenum); // set_menu_sensitivity(ui_manager_tree_view_menu, "/TreeViewPopup/Copy", // TRUE); @@ -2002,6 +2006,27 @@ void MainWindow::on_actionViewResizeColumns_triggered() } } +void MainWindow::openPacketDialog(bool from_reference) +{ + PacketDialog *packet_dialog = new PacketDialog(*this, capture_file_, from_reference); + connect(this, SIGNAL(monospaceFontChanged(QFont)), + packet_dialog, SIGNAL(monospaceFontChanged(QFont))); + zoomText(); // Emits monospaceFontChanged + + packet_dialog->show(); +} + +void MainWindow::on_actionViewShowPacketInNewWindow_triggered() +{ + openPacketDialog(); +} + +// This is only used in ProtoTree. Defining it here makes more sense. +void MainWindow::on_actionViewShowPacketReferenceInNewWindow_triggered() +{ + openPacketDialog(true); +} + void MainWindow::on_actionViewReload_triggered() { cf_reload(CaptureFile::globalCapFile()); diff --git a/ui/qt/packet_dialog.cpp b/ui/qt/packet_dialog.cpp new file mode 100644 index 0000000000..c9b9c1176a --- /dev/null +++ b/ui/qt/packet_dialog.cpp @@ -0,0 +1,163 @@ +/* packet_dialog.cpp + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "packet_dialog.h" +#include "ui_packet_dialog.h" + +#include "epan/column.h" +#include "epan/ftypes/ftypes.h" + +#include "frame_tvbuff.h" + +#include "byte_view_tab.h" +#include "proto_tree.h" +#include "wireshark_application.h" + +#include <QTreeWidgetItemIterator> + +// To do: +// - Find a way to preserve the byte view after the file closes. +// - Copy over experimental packet editing code. +// - Fix ElidedText width. + +PacketDialog::PacketDialog(QWidget &parent, CaptureFile &cf, bool from_reference) : + WiresharkDialog(parent, cf), + ui(new Ui::PacketDialog), + packet_data_(NULL) +{ + ui->setupUi(this); + + // XXX Use recent settings instead + resize(parent.width() * 4 / 5, parent.height() * 4 / 5); + + frame_data * fdata = cap_file_.capFile()->current_frame; + + if(from_reference) { + guint32 framenum = fvalue_get_uinteger(&(cap_file_.capFile()->finfo_selected->value)); + if (framenum < 1) reject(); + + fdata = frame_data_sequence_find(cap_file_.capFile()->frames, framenum); + } + if (!fdata) reject(); + + 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) { + col_parts << QString("<b>%1</b>").arg(get_column_title(i)); + col_parts << cap_file_.capFile()->cinfo.col_data[i]; + } + col_info_ = col_parts.join(" "); + 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&))); +} + +PacketDialog::~PacketDialog() +{ + delete ui; + epan_dissect_cleanup(&edt_); + g_free(packet_data_); +} + +void PacketDialog::captureFileClosing() +{ + delete byte_view_tab_; + byte_view_tab_ = NULL; + + QTreeWidgetItemIterator iter(proto_tree_); + while (*iter) { + QTreeWidgetItem *item = (*iter); + item->setData(0, Qt::UserRole, QVariant()); + ++iter; + } + + setHintText(); + WiresharkDialog::captureFileClosing(); +} + +void PacketDialog::setHintText(QString &hint) +{ + ui->hintLabel->setText(QString("<small><i>%1</i></small>") + .arg(hint.isEmpty() ? col_info_ : hint)); +} + +void PacketDialog::on_buttonBox_helpRequested() +{ + wsApp->helpTopicAction(HELP_NEW_PACKET_DIALOG); +} + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/ui/qt/packet_dialog.h b/ui/qt/packet_dialog.h new file mode 100644 index 0000000000..adcadbfcc4 --- /dev/null +++ b/ui/qt/packet_dialog.h @@ -0,0 +1,78 @@ +/* packet_dialog.h + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef PACKET_DIALOG_H +#define PACKET_DIALOG_H + +#include "wireshark_dialog.h" + +#include "epan/epan_dissect.h" +#include "wiretap/wtap.h" + +class ByteViewTab; +class ProtoTree; + +namespace Ui { +class PacketDialog; +} + +class PacketDialog : public WiresharkDialog +{ + Q_OBJECT + +public: + explicit PacketDialog(QWidget &parent, CaptureFile &cf, bool from_reference = false); + ~PacketDialog(); + +signals: + void monospaceFontChanged(QFont); + +private slots: + void captureFileClosing(); + void setHintText() { QString empty; setHintText(empty); } + void setHintText(QString &hint); + void on_buttonBox_helpRequested(); + +private: + Ui::PacketDialog *ui; + + QString col_info_; + ProtoTree *proto_tree_; + ByteViewTab *byte_view_tab_; + epan_dissect_t edt_; + struct wtap_pkthdr phdr_; + guint8 *packet_data_; +}; + +#endif // PACKET_DIALOG_H + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/ui/qt/packet_dialog.ui b/ui/qt/packet_dialog.ui new file mode 100644 index 0000000000..b61aaea765 --- /dev/null +++ b/ui/qt/packet_dialog.ui @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PacketDialog</class> + <widget class="QDialog" name="PacketDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>641</width> + <height>450</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0,0"> + <item> + <widget class="QSplitter" name="packetSplitter"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="ElidedLabel" name="hintLabel"> + <property name="text"> + <string><small><i></i></small></string> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Close|QDialogButtonBox::Help</set> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>ElidedLabel</class> + <extends>QLabel</extends> + <header>elided_label.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>PacketDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>PacketDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index a11353563e..f4f5606b25 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -411,8 +411,10 @@ PacketList::PacketList(QWidget *parent) : // " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n" decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs"); ctx_menu_.addAction(decode_as_); -// " <menuitem name='Print' action='/Print'/>\n" + // "Print" not ported intentionally // " <menuitem name='ShowPacketinNewWindow' action='/ShowPacketinNewWindow'/>\n" + action = window()->findChild<QAction *>("actionViewShowPacketInNewWindow"); + ctx_menu_.addAction(action); initHeaderContextMenu(); @@ -496,7 +498,7 @@ void PacketList::selectionChanged (const QItemSelection & selected, const QItemS for (src_le = cap_file_->edt->pi.data_src; src_le != NULL; src_le = src_le->next) { 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), cap_file_->edt->tree, proto_tree_, (packet_char_enc)cap_file_->current_frame->flags.encoding); + byte_view_tab_->addTab(source_name, get_data_source_tvb(source), cap_file_->edt->tree, proto_tree_, cap_file_->current_frame->flags.encoding); wmem_free(NULL, source_name); } byte_view_tab_->setCurrentIndex(0); diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index 7414f0691d..2fa24e39af 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -163,35 +163,38 @@ ProtoTree::ProtoTree(QWidget *parent) : setAccessibleName(tr("Packet details")); setUniformRowHeights(true); - - // XXX We might want to reimplement setParent() and fill in the context - // menu there. - ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandSubtrees")); - ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandAll")); - ctx_menu_.addAction(window()->findChild<QAction *>("actionViewCollapseAll")); - ctx_menu_.addSeparator(); + setHeaderHidden(true); + + if (window()->findChild<QAction *>("actionViewExpandSubtrees")) { + // Assume we're a child of the main window. + // XXX We might want to reimplement setParent() and fill in the context + // menu there. + ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandSubtrees")); + ctx_menu_.addAction(window()->findChild<QAction *>("actionViewExpandAll")); + ctx_menu_.addAction(window()->findChild<QAction *>("actionViewCollapseAll")); + ctx_menu_.addSeparator(); // " <menuitem name='CreateAColumn' action='/Create a Column'/>\n" - 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 *>("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(); @@ -212,23 +215,23 @@ ProtoTree::ProtoTree(QWidget *parent) : // " <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); - submenu->addAction(window()->findChild<QAction *>("actionEditCopyDescription")); - submenu->addAction(window()->findChild<QAction *>("actionEditCopyFieldName")); - submenu->addAction(window()->findChild<QAction *>("actionEditCopyValue")); - submenu->addSeparator(); - submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter")); - - action = window()->findChild<QAction *>("actionBytes"); - subsubmenu = new QMenu(); - action->setMenu(subsubmenu); - submenu->addAction(action); - subsubmenu->addSeparator(); + ctx_menu_.addSeparator(); + + action = window()->findChild<QAction *>("actionCopy"); + submenu = new QMenu(); + action->setMenu(submenu); + ctx_menu_.addAction(action); + submenu->addAction(window()->findChild<QAction *>("actionEditCopyDescription")); + submenu->addAction(window()->findChild<QAction *>("actionEditCopyFieldName")); + submenu->addAction(window()->findChild<QAction *>("actionEditCopyValue")); + submenu->addSeparator(); + submenu->addAction(window()->findChild<QAction *>("actionEditCopyAsFilter")); + + action = window()->findChild<QAction *>("actionBytes"); + subsubmenu = new QMenu(); + action->setMenu(subsubmenu); + submenu->addAction(action); + subsubmenu->addSeparator(); // " <menu name= 'Bytes' action='/Copy/Bytes'>\n" // " <menuitem name='OffsetHexText' action='/Copy/Bytes/OffsetHexText'/>\n" // " <menuitem name='OffsetHex' action='/Copy/Bytes/OffsetHex'/>\n" @@ -245,11 +248,15 @@ ProtoTree::ProtoTree(QWidget *parent) : // " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n" // " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n" // ctx_menu_.addSeparator(); - decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs"); - ctx_menu_.addAction(decode_as_); + decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs"); + ctx_menu_.addAction(decode_as_); // " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n" // " <menuitem name='ResolveName' action='/ResolveName'/>\n" // " <menuitem name='GotoCorrespondingPacket' action='/GotoCorrespondingPacket'/>\n" + ctx_menu_.addAction(window()->findChild<QAction *>("actionViewShowPacketReferenceInNewWindow")); + } else { + ctx_menu_.clear(); + } connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(updateSelectionStatus(QTreeWidgetItem*))); @@ -266,6 +273,8 @@ void ProtoTree::clear() { void ProtoTree::contextMenuEvent(QContextMenuEvent *event) { + if (ctx_menu_.isEmpty()) return; // We're in a PacketDialog + decode_as_->setData(qVariantFromValue(true)); ctx_menu_.exec(event->globalPos()); decode_as_->setData(QVariant()); |