forked from osmocom/wireshark
Add keyboard shortcuts for the packet list.
svn path=/trunk/; revision=44462
This commit is contained in:
parent
e211327f65
commit
603787f0ad
|
@ -35,7 +35,6 @@
|
||||||
#include "ui/main_statusbar.h"
|
#include "ui/main_statusbar.h"
|
||||||
|
|
||||||
#include "wireshark_application.h"
|
#include "wireshark_application.h"
|
||||||
#include "packet_list.h"
|
|
||||||
#include "proto_tree.h"
|
#include "proto_tree.h"
|
||||||
#include "byte_view_tab.h"
|
#include "byte_view_tab.h"
|
||||||
#include "capture_file_dialog.h"
|
#include "capture_file_dialog.h"
|
||||||
|
@ -86,7 +85,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
splitterV->setObjectName(QString::fromUtf8("splitterV"));
|
splitterV->setObjectName(QString::fromUtf8("splitterV"));
|
||||||
splitterV->setOrientation(Qt::Vertical);
|
splitterV->setOrientation(Qt::Vertical);
|
||||||
|
|
||||||
PacketList *packetList = new PacketList(splitterV);
|
m_packetList = new PacketList(splitterV);
|
||||||
|
|
||||||
ProtoTree *protoTree = new ProtoTree(splitterV);
|
ProtoTree *protoTree = new ProtoTree(splitterV);
|
||||||
protoTree->setHeaderHidden(true);
|
protoTree->setHeaderHidden(true);
|
||||||
|
@ -95,10 +94,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
byteViewTab->setTabPosition(QTabWidget::South);
|
byteViewTab->setTabPosition(QTabWidget::South);
|
||||||
byteViewTab->setDocumentMode(true);
|
byteViewTab->setDocumentMode(true);
|
||||||
|
|
||||||
packetList->setProtoTree(protoTree);
|
m_packetList->setProtoTree(protoTree);
|
||||||
packetList->setByteViewTab(byteViewTab);
|
m_packetList->setByteViewTab(byteViewTab);
|
||||||
|
|
||||||
splitterV->addWidget(packetList);
|
splitterV->addWidget(m_packetList);
|
||||||
splitterV->addWidget(protoTree);
|
splitterV->addWidget(protoTree);
|
||||||
splitterV->addWidget(byteViewTab);
|
splitterV->addWidget(byteViewTab);
|
||||||
|
|
||||||
|
@ -138,6 +137,12 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event->key() == Qt::Key_F7) {
|
||||||
|
m_packetList->goToPrev();
|
||||||
|
} else if (event->key() == Qt::Key_F8) {
|
||||||
|
m_packetList->goToNext();
|
||||||
|
}
|
||||||
|
|
||||||
QMainWindow::keyPressEvent(event);
|
QMainWindow::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,9 +196,26 @@ void MainWindow::captureFileClosing(const capture_file *cf) {
|
||||||
// gtk_widget_show(expert_info_none);
|
// gtk_widget_show(expert_info_none);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Help Menu */
|
// Go Menu
|
||||||
void MainWindow::on_actionHelpWebsite_triggered() {
|
|
||||||
|
|
||||||
|
void MainWindow::on_actionGoNextPacket_triggered() {
|
||||||
|
m_packetList->goToNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionGoPreviousPacket_triggered() {
|
||||||
|
m_packetList->goToPrev();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionGoFirstPacket_triggered() {
|
||||||
|
m_packetList->goToFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionGoLastPacket_triggered() {
|
||||||
|
m_packetList->goToLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Help Menu
|
||||||
|
void MainWindow::on_actionHelpWebsite_triggered() {
|
||||||
QDesktopServices::openUrl(QUrl("http://www.wireshark.org"));
|
QDesktopServices::openUrl(QUrl("http://www.wireshark.org"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include "main_welcome.h"
|
#include "main_welcome.h"
|
||||||
|
#include "packet_list.h"
|
||||||
#include "display_filter_combo.h"
|
#include "display_filter_combo.h"
|
||||||
#include "progress_bar.h"
|
#include "progress_bar.h"
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ private:
|
||||||
MainWelcome *mainWelcome;
|
MainWelcome *mainWelcome;
|
||||||
DisplayFilterCombo *dfComboBox;
|
DisplayFilterCombo *dfComboBox;
|
||||||
capture_file *capFile;
|
capture_file *capFile;
|
||||||
|
PacketList *m_packetList;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void showProgress(progdlg_t **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct);
|
void showProgress(progdlg_t **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct);
|
||||||
|
@ -77,6 +79,10 @@ private slots:
|
||||||
void updateRecentFiles();
|
void updateRecentFiles();
|
||||||
void openCaptureFile(QString& cfPath = *new QString());
|
void openCaptureFile(QString& cfPath = *new QString());
|
||||||
void recentActionTriggered();
|
void recentActionTriggered();
|
||||||
|
void on_actionGoNextPacket_triggered();
|
||||||
|
void on_actionGoPreviousPacket_triggered();
|
||||||
|
void on_actionGoFirstPacket_triggered();
|
||||||
|
void on_actionGoLastPacket_triggered();
|
||||||
void on_actionHelpWebsite_triggered();
|
void on_actionHelpWebsite_triggered();
|
||||||
void on_actionHelpFAQ_triggered();
|
void on_actionHelpFAQ_triggered();
|
||||||
void on_actionHelpAsk_triggered();
|
void on_actionHelpAsk_triggered();
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>960</width>
|
<width>960</width>
|
||||||
<height>23</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
@ -110,8 +110,19 @@
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionHelpAbout"/>
|
<addaction name="actionHelpAbout"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuGo">
|
||||||
|
<property name="title">
|
||||||
|
<string>Go</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionGoNextPacket"/>
|
||||||
|
<addaction name="actionGoPreviousPacket"/>
|
||||||
|
<addaction name="actionGoFirstPacket"/>
|
||||||
|
<addaction name="actionGoLastPacket"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuEdit"/>
|
<addaction name="menuEdit"/>
|
||||||
|
<addaction name="menuGo"/>
|
||||||
<addaction name="menuCapture"/>
|
<addaction name="menuCapture"/>
|
||||||
<addaction name="menuHelp"/>
|
<addaction name="menuHelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -331,6 +342,50 @@
|
||||||
<string>Ask (Q&&A)</string>
|
<string>Ask (Q&&A)</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionGoNextPacket">
|
||||||
|
<property name="text">
|
||||||
|
<string>Next Packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Go to the next packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Down</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionGoPreviousPacket">
|
||||||
|
<property name="text">
|
||||||
|
<string>Previous Packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Go to the previous packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Up</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionGoFirstPacket">
|
||||||
|
<property name="text">
|
||||||
|
<string>First Packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Go to the first packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Home</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionGoLastPacket">
|
||||||
|
<property name="text">
|
||||||
|
<string>Last Packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Go to the last packet</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+End</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -94,27 +94,19 @@ g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: new_packet_list_resize_column %d", col);
|
||||||
void
|
void
|
||||||
new_packet_list_select_first_row(void)
|
new_packet_list_select_first_row(void)
|
||||||
{
|
{
|
||||||
cur_packet_list->setCurrentIndex(cur_packet_list->packetListModel()->index(0,0));
|
if (!cur_packet_list)
|
||||||
|
return;
|
||||||
|
cur_packet_list->goToFirst();
|
||||||
cur_packet_list->setFocus();
|
cur_packet_list->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
new_packet_list_select_last_row(void)
|
new_packet_list_select_last_row(void)
|
||||||
{
|
{
|
||||||
g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: new_packet_list_select_last_row");
|
if (!cur_packet_list)
|
||||||
// GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(packetlist->view));
|
return;
|
||||||
// GtkTreeIter iter;
|
cur_packet_list->goToLast();
|
||||||
// gint children;
|
cur_packet_list->setFocus();
|
||||||
// guint last_row;
|
|
||||||
|
|
||||||
// if((children = gtk_tree_model_iter_n_children(model, NULL)) == 0)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// last_row = children-1;
|
|
||||||
// if(!gtk_tree_model_iter_nth_child(model, &iter, NULL, last_row))
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// scroll_to_and_select_iter(model, NULL, &iter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -224,32 +216,8 @@ new_packet_list_get_row_data(gint row)
|
||||||
void
|
void
|
||||||
new_packet_list_moveto_end(void)
|
new_packet_list_moveto_end(void)
|
||||||
{
|
{
|
||||||
// GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(packetlist->view));
|
if (cur_packet_list)
|
||||||
// GtkTreeIter iter;
|
cur_packet_list->goToLast();
|
||||||
// GtkTreePath *path;
|
|
||||||
// gint children;
|
|
||||||
// guint last_row;
|
|
||||||
|
|
||||||
g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: new_packet_list_moveto_end");
|
|
||||||
|
|
||||||
// if((children = gtk_tree_model_iter_n_children(model, NULL)) == 0)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// last_row = children-1;
|
|
||||||
// if(!gtk_tree_model_iter_nth_child(model, &iter, NULL, last_row))
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// path = gtk_tree_model_get_path(model, &iter);
|
|
||||||
|
|
||||||
// gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(packetlist->view),
|
|
||||||
// path,
|
|
||||||
// NULL,
|
|
||||||
// TRUE, /* use_align */
|
|
||||||
// 0.5, /* row_align determines where the row is placed, 0.5 means center */
|
|
||||||
// 0); /* The horizontal alignment of the column */
|
|
||||||
|
|
||||||
// gtk_tree_path_free(path);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw the packet list *and* currently-selected detail */
|
/* Redraw the packet list *and* currently-selected detail */
|
||||||
|
@ -410,3 +378,21 @@ void PacketList::writeRecent(FILE *rf) {
|
||||||
fprintf (rf, "\n");
|
fprintf (rf, "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
void PacketList::goToNext(void) {
|
||||||
|
setCurrentIndex(moveCursor(MoveDown, Qt::NoModifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PacketList::goToPrev(void) {
|
||||||
|
setCurrentIndex(moveCursor(MoveUp, Qt::NoModifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PacketList::goToFirst(void) {
|
||||||
|
setCurrentIndex(moveCursor(MoveHome, Qt::NoModifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PacketList::goToLast(void) {
|
||||||
|
setCurrentIndex(moveCursor(MoveEnd, Qt::NoModifier));
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,10 @@ public:
|
||||||
void setByteViewTab(ByteViewTab *byteViewTab);
|
void setByteViewTab(ByteViewTab *byteViewTab);
|
||||||
void clear();
|
void clear();
|
||||||
void writeRecent(FILE *rf);
|
void writeRecent(FILE *rf);
|
||||||
|
void goToNext();
|
||||||
|
void goToPrev();
|
||||||
|
void goToFirst();
|
||||||
|
void goToLast();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent (QShowEvent *event);
|
void showEvent (QShowEvent *event);
|
||||||
|
|
Loading…
Reference in New Issue