summaryrefslogtreecommitdiffstats
path: root/src/graphwidget.h
diff options
context:
space:
mode:
authorSimon Rettberg2017-02-24 12:33:55 +0100
committerSimon Rettberg2017-02-24 12:33:55 +0100
commitd4f10f9fe446da2aff65088e5236d6ffcdd034b5 (patch)
tree5d7467a6f67272064619c000a14800e706368ac6 /src/graphwidget.h
downloadspeedcheck-d4f10f9fe446da2aff65088e5236d6ffcdd034b5.tar.gz
speedcheck-d4f10f9fe446da2aff65088e5236d6ffcdd034b5.tar.xz
speedcheck-d4f10f9fe446da2aff65088e5236d6ffcdd034b5.zip
initial commit
Diffstat (limited to 'src/graphwidget.h')
-rw-r--r--src/graphwidget.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/graphwidget.h b/src/graphwidget.h
new file mode 100644
index 0000000..f43e0db
--- /dev/null
+++ b/src/graphwidget.h
@@ -0,0 +1,33 @@
+#ifndef GRAPHWIDGET_H_
+#define GRAPHWIDGET_H_
+
+#include <QWidget>
+
+class IDataSource;
+
+class GraphWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ GraphWidget(QWidget* parent = NULL);
+ virtual ~GraphWidget();
+
+ void setDataSource(IDataSource* source);
+ void readNextValue();
+
+protected:
+ virtual void resizeEvent(QResizeEvent * event);
+ virtual void paintEvent(QPaintEvent * event);
+
+private:
+ static const int HISTSIZE = 2000;
+ static const QColor LINE_COLOR, BACK_COLOR, BAR_COLOR;
+ IDataSource* _source;
+ qint64 _history[HISTSIZE];
+ int _histPos;
+ float _vScale;
+ bool _doubleSpace;
+ QRect _updateRectSmall;
+};
+
+#endif /* GRAPHWIDGET_H_ */