aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-09-12 21:37:47 +0000
committerGerald Combs <gerald@wireshark.org>2013-09-12 21:37:47 +0000
commit07c3d057b8a2a1184734e2f516a0576441c171f2 (patch)
treef9e38bfae949887a662ade2692300d4fc8b0e33f /ui/qt
parent467f128306df3ff058c702b39f3941026f61813f (diff)
Add previous/next stream navigation to the TCP stream graph dialog.
Add get_tcp_stream_count() to the TCP dissector and modify graph_segment_list_get() to allow matching based solely on a stream. Use text instead of icons for the mouse click behavior buttons. Remove their PNG resources since we aren't using them any more. Fix setting the cursor in the graph widget. svn path=/trunk/; revision=51989
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/tcp_stream_dialog.cpp79
-rw-r--r--ui/qt/tcp_stream_dialog.h6
-rw-r--r--ui/qt/tcp_stream_dialog.ui133
3 files changed, 164 insertions, 54 deletions
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp
index 8a6000ea7f..904f1c8652 100644
--- a/ui/qt/tcp_stream_dialog.cpp
+++ b/ui/qt/tcp_stream_dialog.cpp
@@ -96,8 +96,14 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
ui->graphTypeComboBox->setCurrentIndex(-1);
ui->graphTypeComboBox->setUpdatesEnabled(true);
- ui->mouseHorizontalLayout->setContentsMargins(0, 0, 0, 0);
- ui->dragToolButton->setChecked(mouse_drags_);
+ if (QIcon::hasThemeIcon("go-previous") && QIcon::hasThemeIcon("go-next")) {
+ ui->prevStreamPushButton->setText(QString());
+ ui->prevStreamPushButton->setIcon(QIcon::fromTheme("go-previous"));
+ ui->nextStreamPushButton->setText(QString());
+ ui->nextStreamPushButton->setIcon(QIcon::fromTheme("go-next"));
+ }
+
+ ui->dragRadioButton->setChecked(mouse_drags_);
memset (&graph_, 0, sizeof(graph_));
graph_.type = graph_type;
@@ -215,6 +221,13 @@ void TCPStreamDialog::keyPressEvent(QKeyEvent *event)
resetAxes();
break;
+ case Qt::Key_PageDown:
+ on_prevStreamPushButton_clicked();
+ break;
+ case Qt::Key_PageUp:
+ on_nextStreamPushButton_clicked();
+ break;
+
case Qt::Key_D:
on_otherDirectionButton_clicked();
break;
@@ -233,9 +246,9 @@ void TCPStreamDialog::keyPressEvent(QKeyEvent *event)
break;
case Qt::Key_Z:
if (mouse_drags_) {
- ui->selectToolButton->toggle();
+ ui->selectRadioButton->toggle();
} else {
- ui->dragToolButton->toggle();
+ ui->dragRadioButton->toggle();
}
break;
@@ -317,6 +330,11 @@ void TCPStreamDialog::fillGraph()
sequence_num_map_.clear();
graph_segment_list_free(&graph_);
tracer_->setGraph(NULL);
+
+ ui->streamNumberLabel->setText(QString("Stream %1").arg(graph_.stream));
+ ui->prevStreamPushButton->setEnabled(graph_.stream > 0);
+ ui->nextStreamPushButton->setEnabled(graph_.stream < get_tcp_stream_count() - 1);
+
// We need at least one graph, so don't bother deleting the first one.
for (int i = 0; i < sp->graphCount(); i++) {
sp->graph(i)->clearData();
@@ -662,8 +680,12 @@ QRectF TCPStreamDialog::getZoomRanges(QRect zoom_rect)
void TCPStreamDialog::graphClicked(QMouseEvent *event)
{
Q_UNUSED(event)
+ QCustomPlot *sp = ui->streamPlot;
if (mouse_drags_) {
+ if (sp->axisRect()->rect().contains(event->pos())) {
+ sp->setCursor(QCursor(Qt::ClosedHandCursor));
+ }
if (tracer_->visible() && cap_file_ && packet_num_ > 0) {
emit goToPacket(packet_num_);
}
@@ -717,6 +739,27 @@ void TCPStreamDialog::axisClicked(QCPAxis *axis, QCPAxis::SelectablePart part, Q
// using a QTimer instead.
void TCPStreamDialog::mouseMoved(QMouseEvent *event)
{
+ QCustomPlot *sp = ui->streamPlot;
+ Qt::CursorShape shape = Qt::ArrowCursor;
+ if (event) {
+ if (event->buttons() & Qt::LeftButton == Qt::LeftButton) {
+ if (mouse_drags_) {
+ shape = Qt::ClosedHandCursor;
+ } else {
+ shape = Qt::CrossCursor;
+ }
+ } else {
+ if (sp->axisRect()->rect().contains(event->pos())) {
+ if (mouse_drags_) {
+ shape = Qt::OpenHandCursor;
+ } else {
+ shape = Qt::CrossCursor;
+ }
+ }
+ }
+ }
+ sp->setCursor(QCursor(shape));
+
if (mouse_drags_) {
double tr_key = tracer_->position->key();
struct segment *packet_seg = NULL;
@@ -790,6 +833,8 @@ void TCPStreamDialog::mouseReleased(QMouseEvent *event)
sp->replot();
}
}
+ } else if (ui->streamPlot->cursor().shape() == Qt::ClosedHandCursor) {
+ ui->streamPlot->setCursor(QCursor(Qt::OpenHandCursor));
}
}
@@ -861,6 +906,26 @@ void TCPStreamDialog::setCaptureFile(capture_file *cf)
}
}
+void TCPStreamDialog::on_prevStreamPushButton_clicked()
+{
+ if (graph_.stream > 0) {
+ graph_.stream--;
+ graph_.src_address.type = AT_NONE;
+ graph_.dst_address.type = AT_NONE;
+ fillGraph();
+ }
+}
+
+void TCPStreamDialog::on_nextStreamPushButton_clicked()
+{
+ if (graph_.stream < get_tcp_stream_count() - 1) {
+ graph_.stream++;
+ graph_.src_address.type = AT_NONE;
+ graph_.dst_address.type = AT_NONE;
+ fillGraph();
+ }
+}
+
void TCPStreamDialog::on_otherDirectionButton_clicked()
{
address tmp_addr;
@@ -876,21 +941,19 @@ void TCPStreamDialog::on_otherDirectionButton_clicked()
fillGraph();
}
-void TCPStreamDialog::on_dragToolButton_toggled(bool checked)
+void TCPStreamDialog::on_dragRadioButton_toggled(bool checked)
{
if (checked) mouse_drags_ = true;
ui->streamPlot->setInteractions(
QCP::iRangeDrag |
QCP::iRangeZoom
);
- ui->streamPlot->setCursor(QCursor(Qt::OpenHandCursor));
}
-void TCPStreamDialog::on_selectToolButton_toggled(bool checked)
+void TCPStreamDialog::on_selectRadioButton_toggled(bool checked)
{
if (checked) mouse_drags_ = false;
ui->streamPlot->setInteractions(0);
- ui->streamPlot->setCursor(QCursor(Qt::CrossCursor));
}
/*
diff --git a/ui/qt/tcp_stream_dialog.h b/ui/qt/tcp_stream_dialog.h
index 481bb2bb20..7be1e2fc07 100644
--- a/ui/qt/tcp_stream_dialog.h
+++ b/ui/qt/tcp_stream_dialog.h
@@ -104,9 +104,11 @@ private slots:
void on_buttonBox_accepted();
void on_graphTypeComboBox_currentIndexChanged(int index);
void on_resetButton_clicked();
+ void on_prevStreamPushButton_clicked();
+ void on_nextStreamPushButton_clicked();
void on_otherDirectionButton_clicked();
- void on_dragToolButton_toggled(bool checked);
- void on_selectToolButton_toggled(bool checked);
+ void on_dragRadioButton_toggled(bool checked);
+ void on_selectRadioButton_toggled(bool checked);
};
#endif // TCP_STREAM_DIALOG_H
diff --git a/ui/qt/tcp_stream_dialog.ui b/ui/qt/tcp_stream_dialog.ui
index b9e139129e..d4980ece16 100644
--- a/ui/qt/tcp_stream_dialog.ui
+++ b/ui/qt/tcp_stream_dialog.ui
@@ -44,6 +44,8 @@
&lt;tr&gt;&lt;th&gt;&lt;i&gt;Shift+&lt;/i&gt;←&lt;/th&gt;&lt;td&gt;Move left 10%&lt;/td&gt;&lt;/th&gt;
&lt;tr&gt;&lt;th&gt;&lt;i&gt;Shift+&lt;/i&gt;↑&lt;/th&gt;&lt;td&gt;Move up 10%&lt;/td&gt;&lt;/th&gt;
&lt;tr&gt;&lt;th&gt;&lt;i&gt;Shift+&lt;/i&gt;↓&lt;/th&gt;&lt;td&gt;Move down 10%&lt;/td&gt;&lt;/th&gt;
+&lt;tr&gt;&lt;th&gt;&lt;i&gt;Pg Up&lt;/i&gt;&lt;/th&gt;&lt;td&gt;Next stream&lt;/td&gt;&lt;/th&gt;
+&lt;tr&gt;&lt;th&gt;&lt;i&gt;Pg Dn&lt;/i&gt;&lt;/th&gt;&lt;td&gt;Previous stream&lt;/td&gt;&lt;/th&gt;
&lt;tr&gt;&lt;th&gt;0&lt;/th&gt;&lt;td&gt;Reset graph to its initial state&lt;/td&gt;&lt;/th&gt;
&lt;tr&gt;&lt;th&gt;d&lt;/th&gt;&lt;td&gt;Switch direction (swap TCP endpoints)&lt;/td&gt;&lt;/th&gt;
&lt;tr&gt;&lt;th&gt;g&lt;/th&gt;&lt;td&gt;Go to packet under cursor&lt;/td&gt;&lt;/th&gt;
@@ -60,7 +62,7 @@
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
@@ -85,57 +87,36 @@
</spacer>
</item>
<item>
- <layout class="QHBoxLayout" name="mouseHorizontalLayout">
- <item>
- <widget class="QToolButton" name="dragToolButton">
- <property name="toolTip">
- <string>Drag using the mouse button.</string>
- </property>
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/graph/openhand-16.png</normaloff>:/graph/openhand-16.png</iconset>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">mouseButtonGroup</string>
- </attribute>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="selectToolButton">
- <property name="toolTip">
- <string>Select using the mouse button.</string>
- </property>
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/graph/rubberband-16.png</normaloff>:/graph/rubberband-16.png</iconset>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <attribute name="buttonGroup">
- <string notr="true">mouseButtonGroup</string>
- </attribute>
- </widget>
- </item>
- </layout>
+ <widget class="QPushButton" name="prevStreamPushButton">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Go to the previous TCP stream.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>⇦</string>
+ </property>
+ </widget>
</item>
<item>
- <widget class="QPushButton" name="resetButton">
+ <widget class="QLabel" name="streamNumberLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="nextStreamPushButton">
<property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reset the graph to its initial state.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Go to the next TCP stream.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
- <string>Reset</string>
+ <string>⇨</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="otherDirectionButton">
<property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Switch the direction of the connection (swap the TCP endpoints).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Switch the direction of the connection (view the opposite flow).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Switch Direction</string>
@@ -145,6 +126,72 @@
</layout>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="mouseLabel">
+ <property name="text">
+ <string>Mouse</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="dragRadioButton">
+ <property name="toolTip">
+ <string>Drag using the mouse button.</string>
+ </property>
+ <property name="text">
+ <string>drags</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">mouseButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="selectRadioButton">
+ <property name="toolTip">
+ <string>Select using the mouse button.</string>
+ </property>
+ <property name="text">
+ <string>selects</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">mouseButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <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="QPushButton" name="resetButton">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reset the graph to its initial state.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -169,9 +216,7 @@
<header>elided_label.h</header>
</customwidget>
</customwidgets>
- <resources>
- <include location="../../image/toolbar.qrc"/>
- </resources>
+ <resources/>
<connections>
<connection>
<sender>buttonBox</sender>