2014-12-17 02:47:57 +01:00
|
|
|
// Copyright (c) 2011-2013 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
|
|
|
|
|
|
|
#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();
|
|
|
|
void setGraphRangeMins(int mins);
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void paintPath(QPainterPath &path, QQueue<float> &samples);
|
|
|
|
|
|
|
|
QTimer *timer;
|
|
|
|
float fMax;
|
|
|
|
int nMins;
|
|
|
|
QQueue<float> vSamplesIn;
|
|
|
|
QQueue<float> vSamplesOut;
|
|
|
|
quint64 nLastBytesIn;
|
|
|
|
quint64 nLastBytesOut;
|
|
|
|
ClientModel *clientModel;
|
|
|
|
};
|
|
|
|
|
2014-11-03 16:16:40 +01:00
|
|
|
#endif // BITCOIN_QT_TRAFFICGRAPHWIDGET_H
|