2015-12-13 14:51:43 +01:00
|
|
|
// Copyright (c) 2011-2015 The Bitcoin Core developers
|
2014-12-13 05:09:33 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-11-04 16:20:43 +01:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#ifndef BITCOIN_QT_TRAFFICGRAPHWIDGET_H
|
|
|
|
#define BITCOIN_QT_TRAFFICGRAPHWIDGET_H
|
2013-08-22 18:09:32 +02:00
|
|
|
|
Qt: bug fixes and enhancement to traffic graph widget (#1429)
* clear trafficgraph on clear button click
* set default sample height
set default sample height so after clearing traffic graph have some
scale
* reduce available traffic graph ranges, add optimized graph data storage
reduce available traffic graph ranges to 10
(5m,10m,15m,30m,1h,2h,3h,6h,12h,24h),
store graph data so range change is possible,
data storage contains only necessary data to create graphs for all
supported ranges
eg. for 10m range storage only half of 10m samples - the second half is
calculated from 5m range samples,
encapsulate all traffic graph related data into one class
* code formatting corrections
2017-05-28 15:49:34 +02:00
|
|
|
#include "trafficgraphdata.h"
|
|
|
|
|
|
|
|
#include <boost/function.hpp>
|
|
|
|
|
2013-08-22 18:09:32 +02:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QQueue>
|
|
|
|
|
|
|
|
class ClientModel;
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QPaintEvent;
|
|
|
|
class QTimer;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
class TrafficGraphWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TrafficGraphWidget(QWidget *parent = 0);
|
|
|
|
void setClientModel(ClientModel *model);
|
|
|
|
int getGraphRangeMins() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
|
2015-07-14 13:59:05 +02:00
|
|
|
public Q_SLOTS:
|
2013-08-22 18:09:32 +02:00
|
|
|
void updateRates();
|
Qt: bug fixes and enhancement to traffic graph widget (#1429)
* clear trafficgraph on clear button click
* set default sample height
set default sample height so after clearing traffic graph have some
scale
* reduce available traffic graph ranges, add optimized graph data storage
reduce available traffic graph ranges to 10
(5m,10m,15m,30m,1h,2h,3h,6h,12h,24h),
store graph data so range change is possible,
data storage contains only necessary data to create graphs for all
supported ranges
eg. for 10m range storage only half of 10m samples - the second half is
calculated from 5m range samples,
encapsulate all traffic graph related data into one class
* code formatting corrections
2017-05-28 15:49:34 +02:00
|
|
|
void setGraphRangeMins(int value);
|
2013-08-22 18:09:32 +02:00
|
|
|
void clear();
|
|
|
|
|
|
|
|
private:
|
Qt: bug fixes and enhancement to traffic graph widget (#1429)
* clear trafficgraph on clear button click
* set default sample height
set default sample height so after clearing traffic graph have some
scale
* reduce available traffic graph ranges, add optimized graph data storage
reduce available traffic graph ranges to 10
(5m,10m,15m,30m,1h,2h,3h,6h,12h,24h),
store graph data so range change is possible,
data storage contains only necessary data to create graphs for all
supported ranges
eg. for 10m range storage only half of 10m samples - the second half is
calculated from 5m range samples,
encapsulate all traffic graph related data into one class
* code formatting corrections
2017-05-28 15:49:34 +02:00
|
|
|
typedef boost::function<float(const TrafficSample&)> SampleChooser;
|
|
|
|
void paintPath(QPainterPath &path, const TrafficGraphData::SampleQueue &queue, SampleChooser chooser);
|
2013-08-22 18:09:32 +02:00
|
|
|
|
|
|
|
QTimer *timer;
|
|
|
|
float fMax;
|
|
|
|
int nMins;
|
|
|
|
ClientModel *clientModel;
|
Qt: bug fixes and enhancement to traffic graph widget (#1429)
* clear trafficgraph on clear button click
* set default sample height
set default sample height so after clearing traffic graph have some
scale
* reduce available traffic graph ranges, add optimized graph data storage
reduce available traffic graph ranges to 10
(5m,10m,15m,30m,1h,2h,3h,6h,12h,24h),
store graph data so range change is possible,
data storage contains only necessary data to create graphs for all
supported ranges
eg. for 10m range storage only half of 10m samples - the second half is
calculated from 5m range samples,
encapsulate all traffic graph related data into one class
* code formatting corrections
2017-05-28 15:49:34 +02:00
|
|
|
TrafficGraphData trafficGraphData;
|
2013-08-22 18:09:32 +02:00
|
|
|
};
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#endif // BITCOIN_QT_TRAFFICGRAPHWIDGET_H
|