aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/io_graph_dialog.cpp
diff options
context:
space:
mode:
authorJim Young <jyoung@gsu.edu>2015-10-09 01:19:21 -0400
committerGerald Combs <gerald@wireshark.org>2015-10-10 01:15:14 +0000
commit460e1d8728d65b39d2f3f15ae62318f9ed9b3d40 (patch)
treec67dcf62aac1a29d8f69b4a7a2474ca4cf489697 /ui/qt/io_graph_dialog.cpp
parent911da8b9d5e2215e7851e0874f0cdffac5961c73 (diff)
Qt: Horizontal- and vertical-only zoom modifier keys for IO and TCP Stream graphs.
Use lower case "x" or upper case "X" (Shift-X) to zoom in or out respectively only the horizontal (X) axis. Use lower case "y" or upper case "Y" (Shift-Y) to zoom in or out respectively only the vertical (Y) axis. Change-Id: I2f4de3c81795c289a626cc917d46ec0b1d620f49 Reviewed-on: https://code.wireshark.org/review/10894 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/io_graph_dialog.cpp')
-rw-r--r--ui/qt/io_graph_dialog.cpp69
1 files changed, 68 insertions, 1 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);