mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-25 01:01:40 -04:00
created a generic class for graphs, and used it for DHT. The plan is to use the same class to draw all graphs.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7601 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fbb177dd66
commit
edd7bf7c31
6 changed files with 158 additions and 453 deletions
71
retroshare-gui/src/gui/statistics/dhtgraph.cpp
Normal file
71
retroshare-gui/src/gui/statistics/dhtgraph.cpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2014 RetroShare Team
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* Copyright (c) 2006, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <retroshare/rsdht.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
#include "dhtgraph.h"
|
||||
|
||||
class DHTGraphSource: public RSGraphSource
|
||||
{
|
||||
public:
|
||||
virtual int n_values() const
|
||||
{
|
||||
return 2 ;
|
||||
}
|
||||
virtual void getValues(std::vector<float>& values) const
|
||||
{
|
||||
RsConfigNetStatus config;
|
||||
rsConfig->getConfigNetStatus(config);
|
||||
|
||||
if (config.DHTActive && config.netDhtOk)
|
||||
{
|
||||
values.push_back(config.netDhtRsNetSize) ;
|
||||
values.push_back(config.netDhtNetSize) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
values.push_back(0.0f) ;
|
||||
values.push_back(0.0f) ;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** Default contructor */
|
||||
DhtGraph::DhtGraph(QWidget *parent)
|
||||
: RSGraphWidget(parent)
|
||||
{
|
||||
DHTGraphSource *src = new DHTGraphSource() ;
|
||||
|
||||
src->setCollectionTimeLimit(30*60*1000) ; // 30 mins
|
||||
src->setCollectionTimePeriod(1000) ; // collect every second
|
||||
src->start() ;
|
||||
|
||||
addSource(src) ;
|
||||
|
||||
setTimeScale(10.0f) ;
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue