diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 1cfbc2cbd..215e68c25 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -144,6 +144,23 @@ RsServiceInfo p3turtle::getServiceInfo() TURTLE_MIN_MINOR_VERSION); } +void p3turtle::getItemNames(std::map& names) const +{ + names.clear(); + + names[RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST ] = "Search request"; + names[RS_TURTLE_SUBTYPE_SEARCH_RESULT ] = "Search result"; + names[RS_TURTLE_SUBTYPE_OPEN_TUNNEL ] = "Tunnel request"; + names[RS_TURTLE_SUBTYPE_TUNNEL_OK ] = "Tunnel response"; + names[RS_TURTLE_SUBTYPE_FILE_REQUEST ] = "Data request"; + names[RS_TURTLE_SUBTYPE_FILE_DATA ] = "Data chunk"; + names[RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST ] = "RegExp search"; + names[RS_TURTLE_SUBTYPE_GENERIC_DATA ] = "Generic data"; + names[RS_TURTLE_SUBTYPE_FILE_MAP ] = "Chunk map"; + names[RS_TURTLE_SUBTYPE_FILE_MAP_REQUEST ] = "Chunk map request"; + names[RS_TURTLE_SUBTYPE_CHUNK_CRC ] = "Chunk CRC"; + names[RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST ] = "Chunk CRC request"; +} void p3turtle::setEnabled(bool b) { diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index d9d51456b..36324f941 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -293,6 +293,8 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config /// virtual int tick(); + virtual void getItemNames(std::map& names) const; + /************* from p3Config *******************/ virtual RsSerialiser *setupSerialiser() ; virtual bool saveList(bool& cleanup, std::list&) ; diff --git a/libretroshare/src/turtle/rsturtleitem.h b/libretroshare/src/turtle/rsturtleitem.h index 78f6155d8..d4d061865 100644 --- a/libretroshare/src/turtle/rsturtleitem.h +++ b/libretroshare/src/turtle/rsturtleitem.h @@ -19,8 +19,6 @@ const uint8_t RS_TURTLE_SUBTYPE_STRING_SEARCH_REQUEST = 0x01 ; const uint8_t RS_TURTLE_SUBTYPE_SEARCH_RESULT = 0x02 ; const uint8_t RS_TURTLE_SUBTYPE_OPEN_TUNNEL = 0x03 ; const uint8_t RS_TURTLE_SUBTYPE_TUNNEL_OK = 0x04 ; -const uint8_t RS_TURTLE_SUBTYPE_CLOSE_TUNNEL = 0x05 ; -const uint8_t RS_TURTLE_SUBTYPE_TUNNEL_CLOSED = 0x06 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_REQUEST = 0x07 ; const uint8_t RS_TURTLE_SUBTYPE_FILE_DATA = 0x08 ; const uint8_t RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST = 0x09 ; diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.cpp b/retroshare-gui/src/gui/common/RSGraphWidget.cpp index b7759d846..d0bbaa1dc 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.cpp +++ b/retroshare-gui/src/gui/common/RSGraphWidget.cpp @@ -259,6 +259,7 @@ RSGraphWidget::RSGraphWidget(QWidget *parent) _maxPoints = getNumPoints(); _maxValue = MINUSER_SCALE; + _linewidthscale = 1.0f; _opacity = 0.6 ; _flags = 0; _time_scale = 5.0f ; // in pixels per second. @@ -414,12 +415,16 @@ void RSGraphWidget::paintData() /* Plot the bandwidth as solid lines. If the graph style is currently an * area graph, we end up outlining the integrals. */ - paintLine(points, getColor(i)); + + if(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS) + paintDots(points, getColor(i)); + else + paintLine(points, getColor(i)); } if(_maxValue > 0.0f) { if(_flags & RSGRAPH_FLAGS_LOG_SCALE_Y) - _y_scale = _rec.height()*0.8 / log(_maxValue) ; + _y_scale = _rec.height()*0.8 / log(std::max(2.0,_maxValue)) ; else _y_scale = _rec.height()*0.8/_maxValue ; } @@ -539,11 +544,27 @@ void RSGraphWidget::paintLine(const QVector& points, QColor color, Qt:: { /* Save the current brush, plot the line, and restore the old brush */ QPen oldPen = _painter->pen(); - _painter->setPen(QPen(color, lineStyle)); + + QPen newPen(color, lineStyle); + newPen.setWidth(2.0f*_linewidthscale); + _painter->setPen(newPen); _painter->drawPolyline(points.data(), points.size()); _painter->setPen(oldPen); } +void RSGraphWidget::paintDots(const QVector& points, QColor color) +{ + /* Save the current brush, plot the line, and restore the old brush */ + QPen oldPen = _painter->pen(); + _painter->setPen(QPen(color, oldPen.style())); + QBrush oldBrush = _painter->brush(); + _painter->setBrush(QBrush(color)); + for(int i=0;idrawEllipse(QRect(points[i].x(),points[i].y(),5*_linewidthscale,5*_linewidthscale)) ; + + _painter->setPen(oldPen); + _painter->setBrush(oldBrush); +} /** Paints selected total indicators on the graph. */ void RSGraphWidget::paintTotals() { @@ -641,6 +662,11 @@ void RSGraphWidget::wheelEvent(QWheelEvent *e) _time_filter *= 1.1 ; else _time_filter /= 1.1 ; + else if(e->modifiers() & Qt::ControlModifier) + if(e->delta() > 0) + _linewidthscale *= 1.2 ; + else + _linewidthscale /= 1.2 ; else if(e->delta() > 0) _time_scale *= 1.1 ; diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.h b/retroshare-gui/src/gui/common/RSGraphWidget.h index 2159ba0dc..b57833d51 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.h +++ b/retroshare-gui/src/gui/common/RSGraphWidget.h @@ -126,6 +126,7 @@ public: static const uint32_t RSGRAPH_FLAGS_SHOW_LEGEND = 0x0010 ;// show legend in the graph static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_FLAT = 0x0020 ;// do not interpolate, and draw flat colored boxes static const uint32_t RSGRAPH_FLAGS_LEGEND_CUMULATED = 0x0040 ;// show the total in the legend rather than current values + static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_DOTS = 0x0080 ;// use dots /** Bandwidth graph style. */ enum GraphStyle @@ -191,8 +192,11 @@ private: void pointsFromData(const std::vector& values, QVector &points ) ; /** Paints a line with the data in points. */ - void paintLine(const QVector& points, QColor color, - Qt::PenStyle lineStyle = Qt::SolidLine); + void paintLine(const QVector& points, QColor color, Qt::PenStyle lineStyle = Qt::SolidLine); + + /** Paint a series of large dots **/ + void paintDots(const QVector& points, QColor color); + /** Paints an integral using the supplied data. */ void paintIntegral(const QVector& points, QColor color, qreal alpha = 1.0); @@ -214,6 +218,7 @@ private: qreal _time_scale ; // horizontal scale in pixels per sec. qreal _time_filter ; // time filter. Goes from 0 to infinity. Will be converted into 1-1/(1+f) + float _linewidthscale ; /** Show the respective lines and counters. */ //bool _showRSDHT; diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp index 6ae112803..9fd2dfa3c 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp @@ -201,11 +201,13 @@ void BandwidthStatsWidget::updateUnitSelection(int n) if(n==0) { ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ; + ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_DOTS); ui.legend_CB->setItemText(1,tr("Average")); } else { ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_COUNT) ; + ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_DOTS); ui.legend_CB->setItemText(1,tr("Total")); } }