aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2012-08-20 04:34:23 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2012-08-20 04:34:23 +0000
commitbfa80ff7893d68f8fe3d39e0b4d3db03a6ce23fd (patch)
treeae12019f9b9b46bd4d640c0f53e2c8e6e5c6a02f
parent3ae154565e02c2d9f90d16ebff3c08b306b04ccf (diff)
Basic "Go to Packet" implementation.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@44594 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--ui/qt/main_window.cpp41
-rw-r--r--ui/qt/main_window.h4
-rw-r--r--ui/qt/main_window.ui52
-rw-r--r--ui/qt/packet_list.cpp4
-rw-r--r--ui/qt/proto_tree.cpp2
5 files changed, 98 insertions, 5 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index f85b99d6fc..8a5e2b341a 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -82,6 +82,10 @@ MainWindow::MainWindow(QWidget *parent) :
#endif
main_ui_->mainToolBar->addWidget(df_combo_box_);
+ main_ui_->utilityToolBar->hide();
+
+ main_ui_->goToFrame->hide();
+
splitter_v_ = new QSplitter(main_ui_->mainStack);
splitter_v_->setObjectName(QString::fromUtf8("splitterV"));
splitter_v_->setOrientation(Qt::Vertical);
@@ -157,9 +161,10 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
// The user typed some text. Start filling in a filter.
// XXX We need to install an event filter for the packet list and proto tree
- if ((event->modifiers() == Qt::NoModifier || event->modifiers() == Qt::ShiftModifier) && event->text().length() > 0) {
- QApplication::sendEvent(df_combo_box_, event);
- }
+ // XXX Disabled for now. For some reason we crash here when pressing enter in "go to packet".
+// if ((event->modifiers() == Qt::NoModifier || event->modifiers() == Qt::ShiftModifier) && event->text().length() > 0) {
+// QApplication::sendEvent(df_combo_box_, event);
+// }
// Move up & down the packet list.
if (event->key() == Qt::Key_F7) {
@@ -417,3 +422,33 @@ void MainWindow::recentActionTriggered() {
openRecentCaptureFile(cfPath);
}
}
+
+void MainWindow::on_actionGoGoToPacket_triggered() {
+ if (packet_list_->model()->rowCount() < 1) {
+ return;
+ }
+ main_ui_->goToFrame->show();
+ main_ui_->goToLineEdit->setFocus();
+}
+
+void MainWindow::on_goToCancel_clicked()
+{
+ main_ui_->goToFrame->hide();
+}
+
+
+void MainWindow::on_goToGo_clicked()
+{
+ int packet_num = main_ui_->goToLineEdit->text().toInt();
+
+ main_ui_->goToFrame->hide();
+
+ if (packet_num > 0) {
+ packet_list_->goToPacket(packet_num);
+ }
+}
+
+void MainWindow::on_goToLineEdit_returnPressed()
+{
+ on_goToGo_clicked();
+}
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index e8e8449ec8..486ff6bb73 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -79,12 +79,16 @@ private slots:
void openRecentCaptureFile(QString& cfPath = *new QString());
void on_actionFileClose_triggered();
void recentActionTriggered();
+ void on_actionGoGoToPacket_triggered();
void on_actionHelpWebsite_triggered();
void on_actionHelpFAQ_triggered();
void on_actionHelpAsk_triggered();
void on_actionHelpDownloads_triggered();
void on_actionHelpWiki_triggered();
void on_actionHelpSampleCaptures_triggered();
+ void on_goToCancel_clicked();
+ void on_goToGo_clicked();
+ void on_goToLineEdit_returnPressed();
};
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index f0e019cb31..587f1bd6de 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -34,6 +34,46 @@
<number>0</number>
</property>
<item row="0" column="0">
+ <widget class="QFrame" name="goToFrame">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="goToLineEdit">
+ <property name="inputMask">
+ <string>900000000; </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="goToGo">
+ <property name="text">
+ <string>Go to packet</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="goToCancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
<widget class="QStackedWidget" name="mainStack">
<widget class="MainWelcome" name="welcomePage"/>
<widget class="QWidget" name="packetPage"/>
@@ -114,6 +154,7 @@
<property name="title">
<string>Go</string>
</property>
+ <addaction name="actionGoGoToPacket"/>
<addaction name="separator"/>
<addaction name="actionGoNextPacket"/>
<addaction name="actionGoPreviousPacket"/>
@@ -441,6 +482,17 @@
<string>Ctrl+Left</string>
</property>
</action>
+ <action name="actionGoGoToPacket">
+ <property name="text">
+ <string>Go to Packet...</string>
+ </property>
+ <property name="toolTip">
+ <string>Go to specified packet</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+G</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp
index 68b74f118b..fe46b42d4d 100644
--- a/ui/qt/packet_list.cpp
+++ b/ui/qt/packet_list.cpp
@@ -400,5 +400,7 @@ void PacketList::goLastPacket(void) {
}
void PacketList::goToPacket(int packet) {
- setCurrentIndex(packet_list_model_->index(packet, 0));
+ if (packet > 0 && packet <= packet_list_model_->rowCount()) {
+ setCurrentIndex(packet_list_model_->index(packet - 1, 0));
+ }
}
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index 1c490a3b47..a2c1cacde8 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -328,7 +328,7 @@ void ProtoTree::itemDoubleClick(QTreeWidgetItem *item, int column) {
fi = item->data(0, Qt::UserRole).value<field_info *>();
if(fi->hfinfo->type == FT_FRAMENUM) {
- emit goToFrame(fi->value.value.uinteger - 1);
+ emit goToFrame(fi->value.value.uinteger);
}
if(FI_GET_FLAG(fi, FI_URL) && IS_FT_STRING(fi->hfinfo->type)) {