Basic "Go to Packet" implementation.
svn path=/trunk/; revision=44594
This commit is contained in:
parent
66115d1200
commit
2f9b5d31e4
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue