aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/qt/io_graph_dialog.cpp69
-rw-r--r--ui/qt/io_graph_dialog.h6
-rw-r--r--ui/qt/io_graph_dialog.ui48
-rw-r--r--ui/qt/tcp_stream_dialog.cpp66
-rw-r--r--ui/qt/tcp_stream_dialog.h6
-rw-r--r--ui/qt/tcp_stream_dialog.ui49
6 files changed, 241 insertions, 3 deletions
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp
index 18722564df..0605cb81ce 100644
--- a/ui/qt/io_graph_dialog.cpp
+++ b/ui/qt/io_graph_dialog.cpp
@@ -219,7 +219,11 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf) :
ui->dragRadioButton->setChecked(mouse_drags_);
ctx_menu_.addAction(ui->actionZoomIn);
+ ctx_menu_.addAction(ui->actionZoomInX);
+ ctx_menu_.addAction(ui->actionZoomInY);
ctx_menu_.addAction(ui->actionZoomOut);
+ ctx_menu_.addAction(ui->actionZoomOutX);
+ ctx_menu_.addAction(ui->actionZoomOutY);
ctx_menu_.addAction(ui->actionReset);
ctx_menu_.addSeparator();
ctx_menu_.addAction(ui->actionMoveRight10);
@@ -478,7 +482,20 @@ void IOGraphDialog::keyPressEvent(QKeyEvent *event)
case Qt::Key_I: // GTK+
zoomAxes(true);
break;
-
+ case Qt::Key_X: // Zoom X axis only
+ if(event->modifiers() & Qt::ShiftModifier){
+ zoomXAxis(false); // upper case X -> Zoom out
+ } else {
+ zoomXAxis(true); // lower case x -> Zoom in
+ }
+ break;
+ case Qt::Key_Y: // Zoom Y axis only
+ if(event->modifiers() & Qt::ShiftModifier){
+ zoomYAxis(false); // upper case Y -> Zoom out
+ } else {
+ zoomYAxis(true); // lower case y -> Zoom in
+ }
+ break;
case Qt::Key_Right:
case Qt::Key_L:
panAxes(pan_pixels, 0);
@@ -591,6 +608,36 @@ void IOGraphDialog::zoomAxes(bool in)
iop->replot();
}
+void IOGraphDialog::zoomXAxis(bool in)
+{
+ QCustomPlot *iop = ui->ioPlot;
+ double h_factor = iop->axisRect()->rangeZoomFactor(Qt::Horizontal);
+
+ auto_axes_ = false;
+
+ if (!in) {
+ h_factor = pow(h_factor, -1);
+ }
+
+ iop->xAxis->scaleRange(h_factor, iop->xAxis->range().center());
+ iop->replot();
+}
+
+void IOGraphDialog::zoomYAxis(bool in)
+{
+ QCustomPlot *iop = ui->ioPlot;
+ double v_factor = iop->axisRect()->rangeZoomFactor(Qt::Vertical);
+
+ auto_axes_ = false;
+
+ if (!in) {
+ v_factor = pow(v_factor, -1);
+ }
+
+ iop->yAxis->scaleRange(v_factor, iop->yAxis->range().center());
+ iop->replot();
+}
+
void IOGraphDialog::panAxes(int x_pixels, int y_pixels)
{
QCustomPlot *iop = ui->ioPlot;
@@ -1361,11 +1408,31 @@ void IOGraphDialog::on_actionZoomIn_triggered()
zoomAxes(true);
}
+void IOGraphDialog::on_actionZoomInX_triggered()
+{
+ zoomXAxis(true);
+}
+
+void IOGraphDialog::on_actionZoomInY_triggered()
+{
+ zoomYAxis(true);
+}
+
void IOGraphDialog::on_actionZoomOut_triggered()
{
zoomAxes(false);
}
+void IOGraphDialog::on_actionZoomOutX_triggered()
+{
+ zoomXAxis(false);
+}
+
+void IOGraphDialog::on_actionZoomOutY_triggered()
+{
+ zoomYAxis(false);
+}
+
void IOGraphDialog::on_actionMoveUp10_triggered()
{
panAxes(0, 10);
diff --git a/ui/qt/io_graph_dialog.h b/ui/qt/io_graph_dialog.h
index b46b6f95e8..281ecf1d98 100644
--- a/ui/qt/io_graph_dialog.h
+++ b/ui/qt/io_graph_dialog.h
@@ -190,6 +190,8 @@ private:
// void fillGraph();
void zoomAxes(bool in);
+ void zoomXAxis(bool in);
+ void zoomYAxis(bool in);
void panAxes(int x_pixels, int y_pixels);
QIcon graphColorIcon(int color_idx);
void toggleTracerStyle(bool force_default = false);
@@ -225,7 +227,11 @@ private slots:
void on_zoomRadioButton_toggled(bool checked);
void on_actionReset_triggered();
void on_actionZoomIn_triggered();
+ void on_actionZoomInX_triggered();
+ void on_actionZoomInY_triggered();
void on_actionZoomOut_triggered();
+ void on_actionZoomOutX_triggered();
+ void on_actionZoomOutY_triggered();
void on_actionMoveUp10_triggered();
void on_actionMoveLeft10_triggered();
void on_actionMoveRight10_triggered();
diff --git a/ui/qt/io_graph_dialog.ui b/ui/qt/io_graph_dialog.ui
index e51e23ada6..f50431719a 100644
--- a/ui/qt/io_graph_dialog.ui
+++ b/ui/qt/io_graph_dialog.ui
@@ -34,6 +34,10 @@
<tr><th>+</th><td>Zoom in</td></th>
<tr><th>-</th><td>Zoom out</td></th>
+<tr><th>x</th><td>Zoom in X axis</td></th>
+<tr><th>X</th><td>Zoom out X axis</td></th>
+<tr><th>y</th><td>Zoom in Y axis</td></th>
+<tr><th>Y</th><td>Zoom out Y axis</td></th>
<tr><th>0</th><td>Reset graph to its initial state</td></th>
<tr><th>→</th><td>Move right 10 pixels</td></th>
@@ -452,6 +456,50 @@
<string>Space</string>
</property>
</action>
+ <action name="actionZoomInX">
+ <property name="text">
+ <string>Zoom In X Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom In X Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>X</string>
+ </property>
+ </action>
+ <action name="actionZoomOutX">
+ <property name="text">
+ <string>Zoom Out X Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom Out X Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>Shift+X</string>
+ </property>
+ </action>
+ <action name="actionZoomInY">
+ <property name="text">
+ <string>Zoom In Y Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom In Y Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>Y</string>
+ </property>
+ </action>
+ <action name="actionZoomOutY">
+ <property name="text">
+ <string>Zoom Out Y Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom Out Y Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>Shift+Y</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/ui/qt/tcp_stream_dialog.cpp b/ui/qt/tcp_stream_dialog.cpp
index 1a2bf5e238..4362577cd2 100644
--- a/ui/qt/tcp_stream_dialog.cpp
+++ b/ui/qt/tcp_stream_dialog.cpp
@@ -47,7 +47,6 @@
// - Make the crosshairs tracer a vertical band?
// - Implement File->Copy
// - Add UDP graphs
-// - Add horizontal- and vertical-only zoom via modifier keys?
// - Make the first throughput MA period a dotted/dashed line?
// - Add range scroll bars?
// - ACK & RWIN segment ticks in tcptrace graph
@@ -125,7 +124,11 @@ TCPStreamDialog::TCPStreamDialog(QWidget *parent, capture_file *cf, tcp_graph_ty
ui->dragRadioButton->setChecked(mouse_drags_);
ctx_menu_.addAction(ui->actionZoomIn);
+ ctx_menu_.addAction(ui->actionZoomInX);
+ ctx_menu_.addAction(ui->actionZoomInY);
ctx_menu_.addAction(ui->actionZoomOut);
+ ctx_menu_.addAction(ui->actionZoomOutX);
+ ctx_menu_.addAction(ui->actionZoomOutY);
ctx_menu_.addAction(ui->actionReset);
ctx_menu_.addSeparator();
ctx_menu_.addAction(ui->actionMoveRight10);
@@ -248,7 +251,20 @@ void TCPStreamDialog::keyPressEvent(QKeyEvent *event)
case Qt::Key_I: // GTK+
zoomAxes(true);
break;
-
+ case Qt::Key_X: // Zoom X axis only
+ if(event->modifiers() & Qt::ShiftModifier){
+ zoomXAxis(false); // upper case X -> Zoom out
+ } else {
+ zoomXAxis(true); // lower case x -> Zoom in
+ }
+ break;
+ case Qt::Key_Y: // Zoom Y axis only
+ if(event->modifiers() & Qt::ShiftModifier){
+ zoomYAxis(false); // upper case Y -> Zoom out
+ } else {
+ zoomYAxis(true); // lower case y -> Zoom in
+ }
+ break;
case Qt::Key_Right:
case Qt::Key_L:
panAxes(pan_pixels, 0);
@@ -451,6 +467,32 @@ void TCPStreamDialog::zoomAxes(bool in)
sp->replot();
}
+void TCPStreamDialog::zoomXAxis(bool in)
+{
+ QCustomPlot *sp = ui->streamPlot;
+ double h_factor = sp->axisRect()->rangeZoomFactor(Qt::Horizontal);
+
+ if (!in) {
+ h_factor = pow(h_factor, -1);
+ }
+
+ sp->xAxis->scaleRange(h_factor, sp->xAxis->range().center());
+ sp->replot();
+}
+
+void TCPStreamDialog::zoomYAxis(bool in)
+{
+ QCustomPlot *sp = ui->streamPlot;
+ double v_factor = sp->axisRect()->rangeZoomFactor(Qt::Vertical);
+
+ if (!in) {
+ v_factor = pow(v_factor, -1);
+ }
+
+ sp->yAxis->scaleRange(v_factor, sp->yAxis->range().center());
+ sp->replot();
+}
+
void TCPStreamDialog::panAxes(int x_pixels, int y_pixels)
{
QCustomPlot *sp = ui->streamPlot;
@@ -1071,11 +1113,31 @@ void TCPStreamDialog::on_actionZoomIn_triggered()
zoomAxes(true);
}
+void TCPStreamDialog::on_actionZoomInX_triggered()
+{
+ zoomXAxis(true);
+}
+
+void TCPStreamDialog::on_actionZoomInY_triggered()
+{
+ zoomYAxis(true);
+}
+
void TCPStreamDialog::on_actionZoomOut_triggered()
{
zoomAxes(false);
}
+void TCPStreamDialog::on_actionZoomOutX_triggered()
+{
+ zoomXAxis(false);
+}
+
+void TCPStreamDialog::on_actionZoomOutY_triggered()
+{
+ zoomYAxis(false);
+}
+
void TCPStreamDialog::on_actionReset_triggered()
{
on_resetButton_clicked();
diff --git a/ui/qt/tcp_stream_dialog.h b/ui/qt/tcp_stream_dialog.h
index f372126f04..1c2ba0fb7f 100644
--- a/ui/qt/tcp_stream_dialog.h
+++ b/ui/qt/tcp_stream_dialog.h
@@ -93,6 +93,8 @@ private:
void findStream();
void fillGraph();
void zoomAxes(bool in);
+ void zoomXAxis(bool in);
+ void zoomYAxis(bool in);
void panAxes(int x_pixels, int y_pixels);
void resetAxes();
void fillStevens();
@@ -119,7 +121,11 @@ private slots:
void on_dragRadioButton_toggled(bool checked);
void on_zoomRadioButton_toggled(bool checked);
void on_actionZoomIn_triggered();
+ void on_actionZoomInX_triggered();
+ void on_actionZoomInY_triggered();
void on_actionZoomOut_triggered();
+ void on_actionZoomOutX_triggered();
+ void on_actionZoomOutY_triggered();
void on_actionReset_triggered();
void on_actionMoveRight10_triggered();
void on_actionMoveLeft10_triggered();
diff --git a/ui/qt/tcp_stream_dialog.ui b/ui/qt/tcp_stream_dialog.ui
index d12b1ddf00..d8dc4cd8b6 100644
--- a/ui/qt/tcp_stream_dialog.ui
+++ b/ui/qt/tcp_stream_dialog.ui
@@ -37,6 +37,10 @@
&lt;tr&gt;&lt;th&gt;+&lt;/th&gt;&lt;td&gt;Zoom in&lt;/td&gt;&lt;/th&gt;
&lt;tr&gt;&lt;th&gt;-&lt;/th&gt;&lt;td&gt;Zoom out&lt;/td&gt;&lt;/th&gt;
+&lt;tr&gt;&lt;th&gt;x&lt;/th&gt;&lt;td&gt;Zoom in X axis&lt;/td&gt;&lt;/th&gt;
+&lt;tr&gt;&lt;th&gt;X&lt;/th&gt;&lt;td&gt;Zoom out X axis&lt;/td&gt;&lt;/th&gt;
+&lt;tr&gt;&lt;th&gt;y&lt;/th&gt;&lt;td&gt;Zoom in Y axis&lt;/td&gt;&lt;/th&gt;
+&lt;tr&gt;&lt;th&gt;Y&lt;/th&gt;&lt;td&gt;Zoom out Y axis&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;→&lt;/th&gt;&lt;td&gt;Move right 10 pixels&lt;/td&gt;&lt;/th&gt;
@@ -460,6 +464,50 @@
<string>4</string>
</property>
</action>
+ <action name="actionZoomInX">
+ <property name="text">
+ <string>Zoom In X Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom In X Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>X</string>
+ </property>
+ </action>
+ <action name="actionZoomOutX">
+ <property name="text">
+ <string>Zoom Out X Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom Out X Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>Shift+X</string>
+ </property>
+ </action>
+ <action name="actionZoomInY">
+ <property name="text">
+ <string>Zoom In Y Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom In Y Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>Y</string>
+ </property>
+ </action>
+ <action name="actionZoomOutY">
+ <property name="text">
+ <string>Zoom Out Y Axis</string>
+ </property>
+ <property name="toolTip">
+ <string>Zoom Out Y Axis</string>
+ </property>
+ <property name="shortcut">
+ <string>Shift+Y</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
@@ -469,6 +517,7 @@
<container>1</container>
</customwidget>
</customwidgets>
+ <resources/>
<connections>
<connection>
<sender>buttonBox</sender>