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