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 @@ 0 + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 900000000; + + + + + + + Go to packet + + + + + + + Cancel + + + + + + + @@ -114,6 +154,7 @@ Go + @@ -441,6 +482,17 @@ Ctrl+Left + + + Go to Packet... + + + Go to specified packet + + + Ctrl+G + + 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(); 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)) {