forked from osmocom/wireshark
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>
This commit is contained in:
parent
911da8b9d5
commit
460e1d8728
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -37,6 +37,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>
|
||||
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue