aboutsummaryrefslogtreecommitdiff
path: root/src/qt/trafficgraphwidget.h
diff options
context:
space:
mode:
authorScott Ellis <sje397@gmail.com>2013-08-23 02:09:32 +1000
committerScott Ellis <sje397@gmail.com>2013-10-14 19:02:03 +1100
commitce14345a89dfa05992f8d2c7c9fe36315d4a67e6 (patch)
tree997e08222a82558e8720fa0ce0ba82438f161664 /src/qt/trafficgraphwidget.h
parent9269d0e96e621a6e02da8074785ac310ce64db73 (diff)
Add network traffic graph
Diffstat (limited to 'src/qt/trafficgraphwidget.h')
-rw-r--r--src/qt/trafficgraphwidget.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/qt/trafficgraphwidget.h b/src/qt/trafficgraphwidget.h
new file mode 100644
index 0000000000..b31d1d5b0a
--- /dev/null
+++ b/src/qt/trafficgraphwidget.h
@@ -0,0 +1,44 @@
+#ifndef TRAFFICGRAPHWIDGET_H
+#define TRAFFICGRAPHWIDGET_H
+
+#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 *);
+
+public slots:
+ 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;
+};
+
+#endif // TRAFFICGRAPHWIDGET_H