void JobView::setSpeed(qlonglong bytesPerSecond) { if (m_speed != bytesPerSecond) { m_speed = bytesPerSecond; setData("speed", speedString()); setData("numericSpeed", m_speed); if (m_bytesUnitId > -1) { updateEta(); } scheduleUpdate(); } }
void JobView::setSuspended(bool suspended) { if (suspended) { if (m_state != Suspended) { m_state = Suspended; setData("state", "suspended"); setData("speed", QVariant()); setData("numericSpeed", QVariant()); scheduleUpdate(); } } else if (m_state != Running) { m_state = Running; setData("state", "running"); setData("speed", speedString()); setData("numericSpeed", m_speed); scheduleUpdate(); } }
void WiGPS::parseGPRMC(GPRMC* str){ /* * Save all data from the GPRMC string * in a numeric format in memory. */ //Serial.println("GPS GPRMC parsing."); hours = str->UTCtime().substring(0,2).toInt(); minutes = str->UTCtime().substring(2,4).toInt(); seconds = str->UTCtime().substring(4,6).toInt(); day = str->UTCdate().substring(0,2).toInt(); month = str->UTCdate().substring(2,4).toInt(); year = str->UTCdate().substring(4,6).toInt(); latitudeDeg = str->latitudeDeg().substring(0,2).toInt(); latitudeMin = str->latitudeDeg().substring(2,4).toInt(); latitudeSecf = (float) str->latitudeDeg().substring(5,10).toInt() * CONV_TO_SEC; // convert from .mm to sec latitudeSec = (int) round(latitudeSecf); latitudeRef = str->latitudeRef().charAt(0); longitudeDeg = str->longitudeDeg().substring(0,3).toInt(); longitudeMin = str->longitudeDeg().substring(3,5).toInt(); longitudeSecf = (float) str->longitudeDeg().substring(6,11).toInt() * CONV_TO_SEC; // convert from .mm to sec longitudeSec = (int) round(longitudeSecf); longitudeRef = str->longitudeRef().charAt(0); String speedString(str->speed()); int speedDot = speedString.indexOf('.'); Speed = (int) round(speedString.substring(0,speedDot).toInt() * KNOTS_TO_MS); String courseString(str->course()); int courseDot = courseString.indexOf('.'); Course = courseString.substring(0,courseDot).toInt(); return; }
void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector<std::vector<std::string> >& /*hashes_info*/, const std::vector<std::vector<std::string> >& /*tunnels_info*/, const std::vector<TurtleRequestDisplayInfo >& search_reqs_info, const std::vector<TurtleRequestDisplayInfo >& tunnel_reqs_info, const RsTurtle *turtle) { static const int cellx = 6 ; static const int celly = 10+4 ; QPixmap tmppixmap(maxWidth, maxHeight); tmppixmap.fill(this, 0, 0); setFixedHeight(maxHeight); QPainter painter(&tmppixmap); painter.initFrom(this); maxHeight = 500 ; // std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl; // draw... int ox=5,oy=5 ; TRHistogram(search_reqs_info).draw(&painter,ox,oy,tr("Search requests repartition") + ":") ; painter.setPen(QColor::fromRgb(70,70,70)) ; painter.drawLine(0,oy,maxWidth,oy) ; oy += celly ; TRHistogram(tunnel_reqs_info).draw(&painter,ox,oy,tr("Tunnel requests repartition") + ":") ; // now give information about turtle traffic. // TurtleTrafficStatisticsInfo info ; turtle->getTrafficStatistics(info) ; painter.setPen(QColor::fromRgb(70,70,70)) ; painter.drawLine(0,oy,maxWidth,oy) ; oy += celly ; painter.drawText(ox,oy+celly,tr("Turtle router traffic")+":") ; oy += celly*2 ; painter.drawText(ox+2*cellx,oy+celly,tr("Tunnel requests Up")+"\t: " + speedString(info.tr_up_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Tunnel requests Dn")+"\t: " + speedString(info.tr_dn_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Incoming file data")+"\t: " + speedString(info.data_dn_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Outgoing file data")+"\t: " + speedString(info.data_up_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Forwarded data ")+"\t: " + speedString(info.unknown_updn_Bps) ) ; oy += celly ; QString prob_string ; for(uint i=0;i<info.forward_probabilities.size();++i) prob_string += QString::number(info.forward_probabilities[i],'g',2) + " (" + QString::number(i) + ") " ; painter.drawText(ox+2*cellx,oy+celly,tr("TR Forward probabilities")+"\t: " + prob_string ) ; oy += celly ; oy += celly ; // update the pixmap // pixmap = tmppixmap; maxHeight = oy ; }
void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector<std::vector<std::string> >& /*hashes_info*/, const std::vector<std::vector<std::string> >& /*tunnels_info*/, const std::vector<TurtleRequestDisplayInfo >& search_reqs_info, const std::vector<TurtleRequestDisplayInfo >& tunnel_reqs_info) { QPixmap tmppixmap(maxWidth, maxHeight); tmppixmap.fill(Qt::transparent); setFixedHeight(maxHeight); QPainter painter(&tmppixmap); painter.initFrom(this); // extracts the height of the fonts in pixels. This is used to callibrate the size of the objects to draw. float fontHeight = QFontMetricsF(font()).height(); float fact = fontHeight/14.0; maxHeight = 500*fact ; int cellx = 6*fact ; int celly = (10+4)*fact ; // std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl; // draw... int ox=5*fact,oy=5*fact ; TRHistogram(search_reqs_info).draw(&painter,ox,oy,tr("Search requests repartition") + ":",fontHeight) ; painter.setPen(QColor::fromRgb(70,70,70)) ; painter.drawLine(0,oy,maxWidth,oy) ; oy += celly ; TRHistogram(tunnel_reqs_info).draw(&painter,ox,oy,tr("Tunnel requests repartition") + ":",fontHeight) ; // now give information about turtle traffic. // TurtleTrafficStatisticsInfo info ; rsTurtle->getTrafficStatistics(info) ; painter.setPen(QColor::fromRgb(70,70,70)) ; painter.drawLine(0,oy,maxWidth,oy) ; oy += celly ; painter.drawText(ox,oy+celly,tr("Turtle router traffic")+":") ; oy += celly*2 ; painter.drawText(ox+2*cellx,oy+celly,tr("Tunnel requests Dn")+"\t: " + speedString(info.tr_dn_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Tunnel requests Up")+"\t: " + speedString(info.tr_up_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Incoming file data")+"\t: " + speedString(info.data_dn_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Outgoing file data")+"\t: " + speedString(info.data_up_Bps) ) ; oy += celly ; painter.drawText(ox+2*cellx,oy+celly,tr("Forwarded data")+" \t: " + speedString(info.unknown_updn_Bps) ) ; oy += celly ; QString prob_string ; for(uint i=0;i<info.forward_probabilities.size();++i) prob_string += QString::number(info.forward_probabilities[i],'g',2) + " (" + QString::number(i) + ") " ; painter.drawText(ox+2*cellx,oy+celly,tr("TR Forward probabilities")+"\t: " + prob_string ) ; oy += celly ; oy += celly ; // update the pixmap // pixmap = tmppixmap; maxHeight = oy ; }