void SequenceDialog::fillDiagram() { QCustomPlot *sp = ui->sequencePlot; seq_analysis_info_t new_sa; new_sa = seq_analysis_; new_sa.list = NULL; new_sa.ht = NULL; new_sa.num_nodes = 0; sequence_analysis_list_get(cap_file_, &new_sa); num_items_ = sequence_analysis_get_nodes(&new_sa); seq_diagram_->setData(&new_sa); sequence_analysis_list_free(&seq_analysis_); seq_analysis_ = new_sa; QFontMetrics vfm = QFontMetrics(sp->xAxis2->labelFont()); node_label_w_ = 0; for (guint i = 0; i < seq_analysis_.num_nodes; i++) { int label_w = vfm.width(ep_address_to_display(&(seq_analysis_.nodes[i]))); if (node_label_w_ < label_w) { node_label_w_ = label_w; } } node_label_w_ = (node_label_w_ * 3 / 4) + one_em_; mouseMoved(NULL); resetAxes(); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
void SequenceDialog::fillDiagram() { if (!sainfo_ || file_closed_) return; QCustomPlot *sp = ui->sequencePlot; if (sainfo_->type == SEQ_ANALYSIS_VOIP) { seq_diagram_->setData(sainfo_); } else { seq_diagram_->clearData(); sequence_analysis_list_free(sainfo_); sequence_analysis_list_get(cap_file_.capFile(), sainfo_); num_items_ = sequence_analysis_get_nodes(sainfo_); seq_diagram_->setData(sainfo_); } QFontMetrics vfm = QFontMetrics(sp->xAxis2->labelFont()); char* addr_str; node_label_w_ = 0; for (guint i = 0; i < sainfo_->num_nodes; i++) { addr_str = (char*)address_to_display(NULL, &(sainfo_->nodes[i])); int label_w = vfm.width(addr_str); if (node_label_w_ < label_w) { node_label_w_ = label_w; } wmem_free(NULL, addr_str); } node_label_w_ = (node_label_w_ * 3 / 4) + one_em_; mouseMoved(NULL); resetAxes(); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
void LBMUIMFlowDialog::fillDiagram(void) { QCustomPlot * sp = m_ui->sequencePlot; seq_analysis_info_t new_sa; new_sa = m_sequence_analysis; new_sa.items = g_queue_new(); new_sa.ht = NULL; new_sa.num_nodes = 0; lbm_uimflow_get_analysis(m_capture_file, &new_sa); m_num_items = sequence_analysis_get_nodes(&new_sa); m_sequence_diagram->setData(&new_sa); sequence_analysis_list_free(&m_sequence_analysis); m_sequence_analysis = new_sa; QFontMetrics vfm = QFontMetrics(sp->xAxis2->labelFont()); m_node_label_width = 0; for (guint i = 0; i < m_sequence_analysis.num_nodes; i++) { QString addr_str = address_to_display_qstring(&(m_sequence_analysis.nodes[i])); int label_w = vfm.width(addr_str); if (m_node_label_width < label_w) { m_node_label_width = label_w; } } m_node_label_width = (m_node_label_width * 3 / 4) + m_one_em; mouseMoved(NULL); resetAxes(); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
void LteRlcGraphDialog::graphClicked(QMouseEvent *event) { QCustomPlot *rp = ui->rlcPlot; if (event->button() == Qt::RightButton) { // XXX We should find some way to get rlcPlot to handle a // contextMenuEvent instead. ctx_menu_->exec(event->globalPos()); } else if (mouse_drags_) { if (rp->axisRect()->rect().contains(event->pos())) { rp->setCursor(QCursor(Qt::ClosedHandCursor)); } on_actionGoToPacket_triggered(); } else { if (!rubber_band_) { rubber_band_ = new QRubberBand(QRubberBand::Rectangle, rp); } rb_origin_ = event->pos(); rubber_band_->setGeometry(QRect(rb_origin_, QSize())); rubber_band_->show(); } rp->setFocus(); }
void SequenceDialog::fillDiagram() { if (!info_->sainfo() || file_closed_) return; QCustomPlot *sp = ui->sequencePlot; if (info_->sainfo()->type == SEQ_ANALYSIS_VOIP) { seq_diagram_->setData(info_->sainfo()); } else { seq_diagram_->clearData(); sequence_analysis_list_free(info_->sainfo()); sequence_analysis_list_get(cap_file_.capFile(), info_->sainfo()); num_items_ = sequence_analysis_get_nodes(info_->sainfo()); seq_diagram_->setData(info_->sainfo()); } sequence_w_ = one_em_ * 15 ; // Arbitrary mouseMoved(NULL); resetAxes(); // XXX QCustomPlot doesn't seem to draw any sort of focus indicator. sp->setFocus(); }
// 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(); }
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(); }