Raven Core  3.0.0
P2P Digital Currency
trafficgraphwidget.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_QT_TRAFFICGRAPHWIDGET_H
7 #define RAVEN_QT_TRAFFICGRAPHWIDGET_H
8 
9 #include <QWidget>
10 #include <QQueue>
11 
12 class ClientModel;
13 
14 QT_BEGIN_NAMESPACE
15 class QPaintEvent;
16 class QTimer;
17 QT_END_NAMESPACE
18 
19 class TrafficGraphWidget : public QWidget
20 {
21  Q_OBJECT
22 
23 public:
24  explicit TrafficGraphWidget(QWidget *parent = 0);
25  void setClientModel(ClientModel *model);
26  int getGraphRangeMins() const;
27 
28 protected:
29  void paintEvent(QPaintEvent *);
30 
31 public Q_SLOTS:
32  void updateRates();
33  void setGraphRangeMins(int mins);
34  void clear();
35 
36 private:
37  void paintPath(QPainterPath &path, QQueue<float> &samples);
38 
39  QTimer *timer;
40  float fMax;
41  int nMins;
42  QQueue<float> vSamplesIn;
43  QQueue<float> vSamplesOut;
44  quint64 nLastBytesIn;
45  quint64 nLastBytesOut;
47 };
48 
49 #endif // RAVEN_QT_TRAFFICGRAPHWIDGET_H
void paintPath(QPainterPath &path, QQueue< float > &samples)
ClientModel * clientModel
QQueue< float > vSamplesIn
QQueue< float > vSamplesOut
void paintEvent(QPaintEvent *)
Model for Raven network client.
Definition: clientmodel.h:39
void setGraphRangeMins(int mins)
void setClientModel(ClientModel *model)
TrafficGraphWidget(QWidget *parent=0)