mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
commit
2f2715b240
@ -144,6 +144,23 @@ RsServiceInfo p3turtle::getServiceInfo()
|
|||||||
TURTLE_MIN_MINOR_VERSION);
|
TURTLE_MIN_MINOR_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void p3turtle::getItemNames(std::map<uint8_t,std::string>& 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)
|
void p3turtle::setEnabled(bool b)
|
||||||
{
|
{
|
||||||
|
@ -293,6 +293,8 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
|
|||||||
///
|
///
|
||||||
virtual int tick();
|
virtual int tick();
|
||||||
|
|
||||||
|
virtual void getItemNames(std::map<uint8_t,std::string>& names) const;
|
||||||
|
|
||||||
/************* from p3Config *******************/
|
/************* from p3Config *******************/
|
||||||
virtual RsSerialiser *setupSerialiser() ;
|
virtual RsSerialiser *setupSerialiser() ;
|
||||||
virtual bool saveList(bool& cleanup, std::list<RsItem*>&) ;
|
virtual bool saveList(bool& cleanup, std::list<RsItem*>&) ;
|
||||||
|
@ -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_SEARCH_RESULT = 0x02 ;
|
||||||
const uint8_t RS_TURTLE_SUBTYPE_OPEN_TUNNEL = 0x03 ;
|
const uint8_t RS_TURTLE_SUBTYPE_OPEN_TUNNEL = 0x03 ;
|
||||||
const uint8_t RS_TURTLE_SUBTYPE_TUNNEL_OK = 0x04 ;
|
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_REQUEST = 0x07 ;
|
||||||
const uint8_t RS_TURTLE_SUBTYPE_FILE_DATA = 0x08 ;
|
const uint8_t RS_TURTLE_SUBTYPE_FILE_DATA = 0x08 ;
|
||||||
const uint8_t RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST = 0x09 ;
|
const uint8_t RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST = 0x09 ;
|
||||||
|
@ -259,6 +259,7 @@ RSGraphWidget::RSGraphWidget(QWidget *parent)
|
|||||||
_maxPoints = getNumPoints();
|
_maxPoints = getNumPoints();
|
||||||
_maxValue = MINUSER_SCALE;
|
_maxValue = MINUSER_SCALE;
|
||||||
|
|
||||||
|
_linewidthscale = 1.0f;
|
||||||
_opacity = 0.6 ;
|
_opacity = 0.6 ;
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
_time_scale = 5.0f ; // in pixels per second.
|
_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
|
/* Plot the bandwidth as solid lines. If the graph style is currently an
|
||||||
* area graph, we end up outlining the integrals. */
|
* area graph, we end up outlining the integrals. */
|
||||||
|
|
||||||
|
if(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS)
|
||||||
|
paintDots(points, getColor(i));
|
||||||
|
else
|
||||||
paintLine(points, getColor(i));
|
paintLine(points, getColor(i));
|
||||||
}
|
}
|
||||||
if(_maxValue > 0.0f)
|
if(_maxValue > 0.0f)
|
||||||
{
|
{
|
||||||
if(_flags & RSGRAPH_FLAGS_LOG_SCALE_Y)
|
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
|
else
|
||||||
_y_scale = _rec.height()*0.8/_maxValue ;
|
_y_scale = _rec.height()*0.8/_maxValue ;
|
||||||
}
|
}
|
||||||
@ -539,11 +544,27 @@ void RSGraphWidget::paintLine(const QVector<QPointF>& points, QColor color, Qt::
|
|||||||
{
|
{
|
||||||
/* Save the current brush, plot the line, and restore the old brush */
|
/* Save the current brush, plot the line, and restore the old brush */
|
||||||
QPen oldPen = _painter->pen();
|
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->drawPolyline(points.data(), points.size());
|
||||||
_painter->setPen(oldPen);
|
_painter->setPen(oldPen);
|
||||||
}
|
}
|
||||||
|
void RSGraphWidget::paintDots(const QVector<QPointF>& 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;i<points.size();++i)
|
||||||
|
_painter->drawEllipse(QRect(points[i].x(),points[i].y(),5*_linewidthscale,5*_linewidthscale)) ;
|
||||||
|
|
||||||
|
_painter->setPen(oldPen);
|
||||||
|
_painter->setBrush(oldBrush);
|
||||||
|
}
|
||||||
/** Paints selected total indicators on the graph. */
|
/** Paints selected total indicators on the graph. */
|
||||||
void RSGraphWidget::paintTotals()
|
void RSGraphWidget::paintTotals()
|
||||||
{
|
{
|
||||||
@ -641,6 +662,11 @@ void RSGraphWidget::wheelEvent(QWheelEvent *e)
|
|||||||
_time_filter *= 1.1 ;
|
_time_filter *= 1.1 ;
|
||||||
else
|
else
|
||||||
_time_filter /= 1.1 ;
|
_time_filter /= 1.1 ;
|
||||||
|
else if(e->modifiers() & Qt::ControlModifier)
|
||||||
|
if(e->delta() > 0)
|
||||||
|
_linewidthscale *= 1.2 ;
|
||||||
|
else
|
||||||
|
_linewidthscale /= 1.2 ;
|
||||||
else
|
else
|
||||||
if(e->delta() > 0)
|
if(e->delta() > 0)
|
||||||
_time_scale *= 1.1 ;
|
_time_scale *= 1.1 ;
|
||||||
|
@ -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_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_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_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. */
|
/** Bandwidth graph style. */
|
||||||
enum GraphStyle
|
enum GraphStyle
|
||||||
@ -191,8 +192,11 @@ private:
|
|||||||
void pointsFromData(const std::vector<QPointF>& values, QVector<QPointF> &points ) ;
|
void pointsFromData(const std::vector<QPointF>& values, QVector<QPointF> &points ) ;
|
||||||
|
|
||||||
/** Paints a line with the data in <b>points</b>. */
|
/** Paints a line with the data in <b>points</b>. */
|
||||||
void paintLine(const QVector<QPointF>& points, QColor color,
|
void paintLine(const QVector<QPointF>& points, QColor color, Qt::PenStyle lineStyle = Qt::SolidLine);
|
||||||
Qt::PenStyle lineStyle = Qt::SolidLine);
|
|
||||||
|
/** Paint a series of large dots **/
|
||||||
|
void paintDots(const QVector<QPointF>& points, QColor color);
|
||||||
|
|
||||||
/** Paints an integral using the supplied data. */
|
/** Paints an integral using the supplied data. */
|
||||||
void paintIntegral(const QVector<QPointF>& points, QColor color, qreal alpha = 1.0);
|
void paintIntegral(const QVector<QPointF>& points, QColor color, qreal alpha = 1.0);
|
||||||
|
|
||||||
@ -214,6 +218,7 @@ private:
|
|||||||
|
|
||||||
qreal _time_scale ; // horizontal scale in pixels per sec.
|
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)
|
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. */
|
/** Show the respective lines and counters. */
|
||||||
//bool _showRSDHT;
|
//bool _showRSDHT;
|
||||||
|
@ -201,11 +201,13 @@ void BandwidthStatsWidget::updateUnitSelection(int n)
|
|||||||
if(n==0)
|
if(n==0)
|
||||||
{
|
{
|
||||||
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
|
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_KILOBYTES) ;
|
||||||
|
ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_DOTS);
|
||||||
ui.legend_CB->setItemText(1,tr("Average"));
|
ui.legend_CB->setItemText(1,tr("Average"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_COUNT) ;
|
ui.bwgraph_BW->setUnit(BWGraphSource::UNIT_COUNT) ;
|
||||||
|
ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_DOTS);
|
||||||
ui.legend_CB->setItemText(1,tr("Total"));
|
ui.legend_CB->setItemText(1,tr("Total"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user