forked from osmocom/wireshark
Qt: Add go to next + previous packet in conversation.
Add "Go→Next Packet in Conversation" and "Go→Previous Packet in Conversation" menu items. Make sure the shortucts ("Ctrl+." and "Ctrl+,") don't get switched to "Cmd+." and "Cmd+," on OS X. "Cmd+," is already taken by the preferences dialog. Change-Id: Iab9c7f60fdcf55f12c055b4d0948019bf667ebc9 Reviewed-on: https://code.wireshark.org/review/11771 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
acbf7d5725
commit
661c9771f6
|
@ -1684,6 +1684,12 @@ void MainWindow::initMainToolbarIcons()
|
|||
main_ui_->actionGoGoToPacket->setIcon(StockIcon("go-jump"));
|
||||
main_ui_->actionGoFirstPacket->setIcon(StockIcon("go-first"));
|
||||
main_ui_->actionGoLastPacket->setIcon(StockIcon("go-last"));
|
||||
main_ui_->actionGoPreviousConversationPacket->setIcon(StockIcon("go-previous"));
|
||||
main_ui_->actionGoNextConversationPacket->setIcon(StockIcon("go-next"));
|
||||
#if defined(Q_OS_MAC)
|
||||
main_ui_->actionGoPreviousConversationPacket->setShortcut(QKeySequence(Qt::META | Qt::Key_Comma));
|
||||
main_ui_->actionGoNextConversationPacket->setShortcut(QKeySequence(Qt::META | Qt::Key_Period));
|
||||
#endif
|
||||
main_ui_->actionGoAutoScroll->setIcon(StockIcon("x-stay-last"));
|
||||
|
||||
main_ui_->actionViewColorizePacketList->setIcon(StockIcon("x-colorize-packets"));
|
||||
|
|
|
@ -203,6 +203,7 @@ private:
|
|||
|
||||
void addMenuActions(QList<QAction *> &actions, int menu_group);
|
||||
void removeMenuActions(QList<QAction *> &actions, int menu_group);
|
||||
void goToConversationFrame(bool go_next);
|
||||
|
||||
signals:
|
||||
void setCaptureFile(capture_file *cf);
|
||||
|
@ -415,6 +416,8 @@ private slots:
|
|||
|
||||
void on_actionGoGoToPacket_triggered();
|
||||
void on_actionGoGoToLinkedPacket_triggered();
|
||||
void on_actionGoNextConversationPacket_triggered();
|
||||
void on_actionGoPreviousConversationPacket_triggered();
|
||||
void on_actionGoAutoScroll_toggled(bool checked);
|
||||
void resetPreviousFocus();
|
||||
|
||||
|
|
|
@ -238,6 +238,8 @@
|
|||
<addaction name="actionGoPreviousPacket"/>
|
||||
<addaction name="actionGoFirstPacket"/>
|
||||
<addaction name="actionGoLastPacket"/>
|
||||
<addaction name="actionGoNextConversationPacket"/>
|
||||
<addaction name="actionGoPreviousConversationPacket"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionGoAutoScroll"/>
|
||||
</widget>
|
||||
|
@ -938,6 +940,28 @@
|
|||
<string>Ctrl+Up</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoNextConversationPacket">
|
||||
<property name="text">
|
||||
<string>Next Packet in Conversation</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Go to the next packet in this conversation</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoPreviousConversationPacket">
|
||||
<property name="text">
|
||||
<string>Previous Packet in Conversation</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Go to the previous packet in this conversation</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+,</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoFirstPacket">
|
||||
<property name="text">
|
||||
<string>First Packet</string>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include "wsutil/file_util.h"
|
||||
#include "wsutil/filesystem.h"
|
||||
#include <wsutil/str_util.h>
|
||||
#include "wsutil/str_util.h"
|
||||
|
||||
#include "epan/addr_resolv.h"
|
||||
#include "epan/dissector_filters.h"
|
||||
|
@ -3277,6 +3277,64 @@ void MainWindow::on_actionGoGoToLinkedPacket_triggered()
|
|||
packet_list_->goToPacket(packet_num);
|
||||
}
|
||||
|
||||
// gtk/main_menubar.c:goto_conversation_frame
|
||||
void MainWindow::goToConversationFrame(bool go_next) {
|
||||
gchar *filter = NULL;
|
||||
dfilter_t *dfcode = NULL;
|
||||
gboolean found_packet = FALSE;
|
||||
packet_info *pi = &(capture_file_.capFile()->edt->pi);
|
||||
conversation_filter_t* conv_filter;
|
||||
|
||||
/* Try to build a conversation
|
||||
* filter in the order TCP, UDP, IP, Ethernet and apply the
|
||||
* coloring */
|
||||
conv_filter = find_conversation_filter("tcp");
|
||||
if ((conv_filter != NULL) && (conv_filter->is_filter_valid(pi)))
|
||||
filter = conv_filter->build_filter_string(pi);
|
||||
conv_filter = find_conversation_filter("udp");
|
||||
if ((conv_filter != NULL) && (conv_filter->is_filter_valid(pi)))
|
||||
filter = conv_filter->build_filter_string(pi);
|
||||
conv_filter = find_conversation_filter("ip");
|
||||
if ((conv_filter != NULL) && (conv_filter->is_filter_valid(pi)))
|
||||
filter = conv_filter->build_filter_string(pi);
|
||||
conv_filter = find_conversation_filter("ipv6");
|
||||
if ((conv_filter != NULL) && (conv_filter->is_filter_valid(pi)))
|
||||
filter = conv_filter->build_filter_string(pi);
|
||||
|
||||
if( filter == NULL ) {
|
||||
main_ui_->statusBar->pushTemporaryStatus(tr("Unable to build conversation filter."));
|
||||
g_free(filter);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dfilter_compile(filter, &dfcode, NULL)) {
|
||||
/* The attempt failed; report an error. */
|
||||
main_ui_->statusBar->pushTemporaryStatus(tr("Error compiling filter for this conversation."));
|
||||
g_free(filter);
|
||||
return;
|
||||
}
|
||||
|
||||
found_packet = cf_find_packet_dfilter(capture_file_.capFile(), dfcode, go_next ? SD_FORWARD : SD_BACKWARD);
|
||||
|
||||
if (!found_packet) {
|
||||
/* We didn't find a packet */
|
||||
main_ui_->statusBar->pushTemporaryStatus(tr("No previous/next packet in conversation."));
|
||||
}
|
||||
|
||||
dfilter_free(dfcode);
|
||||
g_free(filter);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGoNextConversationPacket_triggered()
|
||||
{
|
||||
goToConversationFrame(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGoPreviousConversationPacket_triggered()
|
||||
{
|
||||
goToConversationFrame(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGoAutoScroll_toggled(bool checked)
|
||||
{
|
||||
packet_list_->setAutoScroll(checked);
|
||||
|
|
Loading…
Reference in New Issue