You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

trafficgraphwidget.h 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright (c) 2011-2015 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef STARWELS_QT_TRAFFICGRAPHWIDGET_H
  5. #define STARWELS_QT_TRAFFICGRAPHWIDGET_H
  6. #include <QWidget>
  7. #include <QQueue>
  8. class ClientModel;
  9. QT_BEGIN_NAMESPACE
  10. class QPaintEvent;
  11. class QTimer;
  12. QT_END_NAMESPACE
  13. class TrafficGraphWidget : public QWidget
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit TrafficGraphWidget(QWidget *parent = 0);
  18. void setClientModel(ClientModel *model);
  19. int getGraphRangeMins() const;
  20. protected:
  21. void paintEvent(QPaintEvent *);
  22. public Q_SLOTS:
  23. void updateRates();
  24. void setGraphRangeMins(int mins);
  25. void clear();
  26. private:
  27. void paintPath(QPainterPath &path, QQueue<float> &samples);
  28. QTimer *timer;
  29. float fMax;
  30. int nMins;
  31. QQueue<float> vSamplesIn;
  32. QQueue<float> vSamplesOut;
  33. quint64 nLastBytesIn;
  34. quint64 nLastBytesOut;
  35. ClientModel *clientModel;
  36. };
  37. #endif // STARWELS_QT_TRAFFICGRAPHWIDGET_H