mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-15 04:22:27 -04:00
fixed RTT graph. Added colors, and new options to RSGraphWidget. Still needs to draw names for different colors
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7610 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1757a85e57
commit
3d49af2b2b
5 changed files with 59 additions and 25 deletions
|
@ -173,7 +173,7 @@ RttStatistics::RttStatistics(QWidget *parent)
|
|||
|
||||
m_bProcessSettings = false;
|
||||
|
||||
_tunnel_statistics_F->setWidget( _tst_CW = new RttStatisticsGraph() ) ;
|
||||
_tunnel_statistics_F->setWidget( _tst_CW = new RttStatisticsGraph(this) ) ;
|
||||
_tunnel_statistics_F->setWidgetResizable(true);
|
||||
_tunnel_statistics_F->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
_tunnel_statistics_F->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
|
@ -217,7 +217,11 @@ void RttStatistics::processSettings(bool bLoad)
|
|||
|
||||
}
|
||||
|
||||
void RttGraphSource::getValues(std::map<std::string,float>& vals)
|
||||
QString RttGraphSource::unitName() const
|
||||
{
|
||||
return QObject::tr("secs") ;
|
||||
}
|
||||
void RttGraphSource::getValues(std::map<std::string,float>& vals) const
|
||||
{
|
||||
std::list<RsPeerId> idList;
|
||||
rsPeers->getOnlineList(idList);
|
||||
|
@ -229,10 +233,28 @@ void RttGraphSource::getValues(std::map<std::string,float>& vals)
|
|||
{
|
||||
rsRtt->getPongResults(*it, 1, results);
|
||||
|
||||
vals[(*it).toStdString()] = results.front().mRTT ;
|
||||
vals[(*it).toStdString()] = results.back().mRTT ;
|
||||
}
|
||||
}
|
||||
|
||||
RttStatisticsGraph::RttStatisticsGraph(QWidget *parent)
|
||||
: RSGraphWidget(parent)
|
||||
{
|
||||
RttGraphSource *src = new RttGraphSource() ;
|
||||
|
||||
src->setCollectionTimeLimit(10*60*1000) ; // 10 mins
|
||||
src->setCollectionTimePeriod(1000) ; // collect every second
|
||||
src->start() ;
|
||||
|
||||
addSource(src) ;
|
||||
|
||||
setTimeScale(2.0f) ; // 1 pixels per second of time.
|
||||
setScaleParams(2) ;
|
||||
|
||||
resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ;
|
||||
resetFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ;
|
||||
}
|
||||
|
||||
//void RttStatistics::updateDisplay()
|
||||
//{
|
||||
// std::map<RsPeerId, std::list<RsRttPongResult> > info;
|
||||
|
|
|
@ -32,17 +32,16 @@ class RttStatisticsWidget ;
|
|||
class RttGraphSource: public RSGraphSource
|
||||
{
|
||||
public:
|
||||
RttGraphSource() ;
|
||||
RttGraphSource() {}
|
||||
|
||||
virtual void getValues(std::map<std::string,float>& vals) ;
|
||||
virtual void getValues(std::map<std::string,float>& vals) const ;
|
||||
virtual QString unitName() const ;
|
||||
};
|
||||
|
||||
class RttStatisticsGraph: public RSGraphWidget
|
||||
{
|
||||
public:
|
||||
RttStatisticsGraph()
|
||||
{
|
||||
}
|
||||
public:
|
||||
RttStatisticsGraph(QWidget *parent);
|
||||
};
|
||||
|
||||
class RttStatistics: public MainPage, public Ui::RttStatistics
|
||||
|
|
|
@ -68,7 +68,10 @@ DhtGraph::DhtGraph(QWidget *parent)
|
|||
addSource(src) ;
|
||||
|
||||
setTimeScale(1.0f) ; // 1 pixels per second of time.
|
||||
setScaleParams(0) ;
|
||||
|
||||
resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ;
|
||||
setFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue