summaryrefslogtreecommitdiffstats
path: root/src/graphwidget.h
blob: f43e0db0a9f5ca15ca2493578af8f963ebd564ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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_ */