// Respond to a key press. void LteRlcGraphDialog::keyPressEvent(QKeyEvent *event) { int pan_pixels = event->modifiers() & Qt::ShiftModifier ? 1 : 10; switch(event->key()) { case Qt::Key_Minus: case Qt::Key_Underscore: // Shifted minus on U.S. keyboards case Qt::Key_O: // GTK+ case Qt::Key_R: zoomAxes(false); break; case Qt::Key_Plus: case Qt::Key_Equal: // Unshifted plus on U.S. keyboards 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); break; case Qt::Key_Left: case Qt::Key_H: panAxes(-1 * pan_pixels, 0); break; case Qt::Key_Up: case Qt::Key_K: panAxes(0, pan_pixels); break; case Qt::Key_Down: case Qt::Key_J: panAxes(0, -1 * pan_pixels); break; case Qt::Key_PageUp: panAxes(0, 20 * pan_pixels); break; case Qt::Key_PageDown: panAxes(0, -20 * pan_pixels); break; case Qt::Key_Space: toggleTracerStyle(false); break; case Qt::Key_0: case Qt::Key_ParenRight: // Shifted 0 on U.S. keyboards case Qt::Key_Home: resetAxes(); break; case Qt::Key_G: on_actionGoToPacket_triggered(); break; case Qt::Key_T: // on_actionToggleTimeOrigin_triggered(); break; case Qt::Key_Z: on_actionDragZoom_triggered(); break; } WiresharkDialog::keyPressEvent(event); }
// Fill in graph data based upon what was read into the rlc_graph struct. void LteRlcGraphDialog::fillGraph() { QCustomPlot *sp = ui->rlcPlot; // We should always have 4 graphs, but cover case if no channel was chosen. if (sp->graphCount() < 1) { return; } tracer_->setGraph(NULL); base_graph_->setLineStyle(QCPGraph::lsNone); // dot reseg_graph_->setLineStyle(QCPGraph::lsNone); // dot acks_graph_->setLineStyle(QCPGraph::lsStepLeft); // to get step effect... nacks_graph_->setLineStyle(QCPGraph::lsNone); // dot, but bigger. // Will show all graphs with data we find. for (int i = 0; i < sp->graphCount(); i++) { sp->graph(i)->clearData(); sp->graph(i)->setVisible(true); } // N.B. ssDisc is really too slow. TODO: work out how to turn off aliasing, or experiment // with ssCustom. Other styles tried didn't look right. // GTK version was speeded up noticibly by turning down aliasing level... base_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, pkt_point_size_)); reseg_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, pkt_point_size_)); acks_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, pkt_point_size_)); // NACKs are shown bigger than others. nacks_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, pkt_point_size_*2)); // Map timestamps -> segments in first pass. time_stamp_map_.clear(); for (struct rlc_segment *seg = graph_.segments; seg != NULL; seg = seg->next) { if (!compareHeaders(seg)) { continue; } double ts = seg->rel_secs + seg->rel_usecs / 1000000.0; time_stamp_map_.insertMulti(ts, seg); } // Now sequence numbers. QVector<double> seq_time, seq, reseg_seq_time, reseg_seq, acks_time, acks, nacks_time, nacks; for (struct rlc_segment *seg = graph_.segments; seg != NULL; seg = seg->next) { double ts = seg->rel_secs + seg->rel_usecs / 1000000.0; if (compareHeaders(seg)) { if (!seg->isControlPDU) { // Data if (seg->isResegmented) { reseg_seq_time.append(ts); reseg_seq.append(seg->SN); } else { seq_time.append(ts); seq.append(seg->SN); } } else { // Status (ACKs/NACKs) acks_time.append(ts); acks.append(seg->ACKNo-1); for (int n=0; n < seg->noOfNACKs; n++) { nacks_time.append(ts); nacks.append(seg->NACKs[n]); } } } } // Add the data from the graphs. base_graph_->setData(seq_time, seq); reseg_graph_->setData(reseg_seq_time, reseg_seq); acks_graph_->setData(acks_time, acks); nacks_graph_->setData(nacks_time, nacks); sp->setEnabled(true); // Auto-size... mouseMoved(NULL); resetAxes(); tracer_->setGraph(base_graph_); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
// Copied from TCP graphs, seems like a kludge to get the graph resized immediately after it is built... void LteRlcGraphDialog::showEvent(QShowEvent *) { resetAxes(); }
void SequenceDialog::resizeEvent(QResizeEvent *) { resetAxes(true); }
void SequenceDialog::on_resetButton_clicked() { resetAxes(); }
void SequenceDialog::showEvent(QShowEvent *event) { Q_UNUSED(event); resetAxes(); }
void LLCoordFrame::reset() { mOrigin.setVec(0.0f, 0.0f, 0.0f); resetAxes(); }
void LBMUIMFlowDialog::showEvent(QShowEvent *) { resetAxes(); }
void LBMUIMFlowDialog::resizeEvent(QResizeEvent *) { resetAxes(true); }
void TCPStreamDialog::keyPressEvent(QKeyEvent *event) { int pan_pixels = event->modifiers() & Qt::ShiftModifier ? 1 : 10; // XXX - This differs from the main window but matches other applications (e.g. Mozilla and Safari) switch(event->key()) { case Qt::Key_Minus: case Qt::Key_Underscore: // Shifted minus on U.S. keyboards case Qt::Key_O: // GTK+ zoomAxes(false); break; case Qt::Key_Plus: case Qt::Key_Equal: // Unshifted plus on U.S. keyboards 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); break; case Qt::Key_Left: case Qt::Key_H: panAxes(-1 * pan_pixels, 0); break; case Qt::Key_Up: case Qt::Key_K: panAxes(0, pan_pixels); break; case Qt::Key_Down: case Qt::Key_J: panAxes(0, -1 * pan_pixels); break; case Qt::Key_Space: toggleTracerStyle(); break; case Qt::Key_0: case Qt::Key_ParenRight: // Shifted 0 on U.S. keyboards case Qt::Key_R: case Qt::Key_Home: resetAxes(); break; case Qt::Key_PageUp: on_actionNextStream_triggered(); break; case Qt::Key_PageDown: on_actionPreviousStream_triggered(); break; case Qt::Key_D: on_actionSwitchDirection_triggered(); break; case Qt::Key_G: on_actionGoToPacket_triggered(); break; case Qt::Key_S: on_actionToggleSequenceNumbers_triggered(); break; case Qt::Key_T: on_actionToggleTimeOrigin_triggered(); break; case Qt::Key_Z: on_actionDragZoom_triggered(); break; case Qt::Key_1: on_actionRoundTripTime_triggered(); break; case Qt::Key_2: on_actionThroughput_triggered(); break; case Qt::Key_3: on_actionStevens_triggered(); break; case Qt::Key_4: on_actionTcptrace_triggered(); break; case Qt::Key_5: on_actionWindowScaling_triggered(); break; // Alas, there is no Blade Runner-style Qt::Key_Enhance } QDialog::keyPressEvent(event); }
void TCPStreamDialog::fillGraph() { QCustomPlot *sp = ui->streamPlot; if (sp->graphCount() < 1) return; base_graph_->setLineStyle(QCPGraph::lsNone); tracer_->setGraph(NULL); // base_graph_ is always visible. for (int i = 0; i < sp->graphCount(); i++) { sp->graph(i)->clearData(); sp->graph(i)->setVisible(i == 0 ? true : false); } base_graph_->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, pkt_point_size_)); sp->xAxis->setLabel(time_s_label_); sp->xAxis->setNumberFormat("gb"); sp->xAxis->setNumberPrecision(6); sp->yAxis->setNumberFormat("f"); sp->yAxis->setNumberPrecision(0); sp->yAxis2->setVisible(false); sp->yAxis2->setLabel(QString()); if (!cap_file_) { QString dlg_title = QString(tr("No Capture Data")); setWindowTitle(dlg_title); title_->setText(dlg_title); sp->setEnabled(false); sp->yAxis->setLabel(QString()); sp->replot(); return; } ts_offset_ = 0; seq_offset_ = 0; bool first = true; guint64 bytes_fwd = 0; guint64 bytes_rev = 0; int pkts_fwd = 0; int pkts_rev = 0; time_stamp_map_.clear(); for (struct segment *seg = graph_.segments; seg != NULL; seg = seg->next) { if (!compareHeaders(seg)) { bytes_rev += seg->th_seglen; pkts_rev++; continue; } bytes_fwd += seg->th_seglen; pkts_fwd++; double ts = seg->rel_secs + seg->rel_usecs / 1000000.0; if (first) { if (ts_origin_conn_) ts_offset_ = ts; if (seq_origin_zero_) seq_offset_ = seg->th_seq; first = false; } time_stamp_map_.insertMulti(ts - ts_offset_, seg); } switch (graph_.type) { case GRAPH_TSEQ_STEVENS: fillStevens(); break; case GRAPH_TSEQ_TCPTRACE: fillTcptrace(); break; case GRAPH_THROUGHPUT: fillThroughput(); break; case GRAPH_RTT: fillRoundTripTime(); break; case GRAPH_WSCALE: fillWindowScale(); break; default: break; } sp->setEnabled(true); stream_desc_ = tr("%1 %2 pkts, %3 %4 %5 pkts, %6 ") .arg(UTF8_RIGHTWARDS_ARROW) .arg(gchar_free_to_qstring(format_size(pkts_fwd, format_size_unit_none|format_size_prefix_si))) .arg(gchar_free_to_qstring(format_size(bytes_fwd, format_size_unit_bytes|format_size_prefix_si))) .arg(UTF8_LEFTWARDS_ARROW) .arg(gchar_free_to_qstring(format_size(pkts_rev, format_size_unit_none|format_size_prefix_si))) .arg(gchar_free_to_qstring(format_size(bytes_rev, format_size_unit_bytes|format_size_prefix_si))); mouseMoved(NULL); resetAxes(); tracer_->setGraph(base_graph_); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
void TCPStreamDialog::showEvent(QShowEvent *) { resetAxes(); }
void TCPStreamDialog::on_resetButton_clicked() { resetAxes(); }
void SingleCellViewGraphPanelPlotWidget::on_actionResetZoom_triggered() { // Reset the zoom level by resetting our axes resetAxes(); }
void LteRlcGraphDialog::on_actionReset_triggered() { resetAxes(); }
void LBMUIMFlowDialog::on_resetButton_clicked(void) { resetAxes(); }
void LteRlcGraphDialog::on_resetButton_clicked() { resetAxes(); }
void SequenceDialog::showEvent(QShowEvent *) { resetAxes(); }
void SequenceDialog::resizeEvent(QResizeEvent *event) { Q_UNUSED(event); resetAxes(true); }
void TCPStreamDialog::showEvent(QShowEvent *event) { Q_UNUSED(event); resetAxes(); }