2015-07-10 03:24:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "retroshare/rsconfig.h"
|
|
|
|
#include <gui/common/RSGraphWidget.h>
|
|
|
|
|
|
|
|
class BWGraphSource: public RSGraphSource
|
|
|
|
{
|
|
|
|
public:
|
2015-07-12 04:04:18 +00:00
|
|
|
struct TrafficHistoryChunk
|
|
|
|
{
|
|
|
|
time_t time_stamp;
|
|
|
|
std::list<RSTrafficClue> out_rstcl ;
|
|
|
|
std::list<RSTrafficClue> in_rstcl ;
|
|
|
|
};
|
|
|
|
|
2015-07-10 03:24:39 +00:00
|
|
|
enum { SELECTOR_TYPE_FRIEND=0x00, SELECTOR_TYPE_SERVICE=0x01 };
|
2015-07-12 04:04:18 +00:00
|
|
|
enum { GRAPH_TYPE_SINGLE=0x00, GRAPH_TYPE_ALL=0x01, GRAPH_TYPE_SUM=0x02 };
|
|
|
|
enum { UNIT_KILOBYTES=0x00, UNIT_COUNT=0x01 };
|
2015-07-10 03:24:39 +00:00
|
|
|
|
|
|
|
// re-derived from RSGraphSource
|
|
|
|
|
|
|
|
virtual void getValues(std::map<std::string,float>& values) const;
|
|
|
|
virtual QString displayValue(float v) const;
|
|
|
|
virtual QString legend(int i,float v) const;
|
2015-07-12 04:04:18 +00:00
|
|
|
virtual void update();
|
2015-07-10 03:24:39 +00:00
|
|
|
QString unitName() const ;
|
|
|
|
|
|
|
|
// own methdods to control what's used to create displayed info
|
|
|
|
|
|
|
|
void setSelector(int selector_class,int selector_type,const std::string& selector_client_string = std::string()) ;
|
|
|
|
|
2015-07-12 04:04:18 +00:00
|
|
|
protected:
|
|
|
|
void convertTrafficClueToValues(const std::list<RSTrafficClue> &lst, std::map<std::string, float> &vals) const;
|
|
|
|
|
|
|
|
private:
|
2015-07-10 03:24:39 +00:00
|
|
|
QString niceNumber(float v) const;
|
|
|
|
|
|
|
|
mutable float _total_sent ;
|
|
|
|
mutable float _total_recv ;
|
2015-07-12 04:04:18 +00:00
|
|
|
|
|
|
|
int _friend_graph_type ;
|
|
|
|
int _service_graph_type ;
|
|
|
|
|
|
|
|
RsPeerId _current_selected_friend ;
|
|
|
|
std::string _current_selected_friend_name ;
|
|
|
|
uint16_t _current_selected_service ;
|
|
|
|
int _current_unit ;
|
|
|
|
|
|
|
|
std::list<TrafficHistoryChunk> mTrafficHistory ;
|
2015-07-10 03:24:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BWGraph: public RSGraphWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BWGraph(QWidget *parent);
|
|
|
|
|
|
|
|
BWGraphSource *source() ;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BWGraphSource *_local_source ;
|
|
|
|
};
|