summaryrefslogtreecommitdiffstats
path: root/statisticsdialog.h
blob: 27de9fad180dde8d400b273de4dc1da312e71cb5 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version
  2 of the License, or (at your option) any later version.
*/

#ifndef STATISTICSDIALOG_H
#define STATISTICSDIALOG_H

#include <QList>
#include <QVariant>
#include <QSize>
#include <QFont>
#include <QTextDocument>

#include "smdialog.h"

class QPaintEvent;

class StatisticsDialog : public SmDialog {
	Q_OBJECT
	public:
		StatisticsDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
		~StatisticsDialog() {}

	private:
		QList<QList<QVariant> > queryData(const QString &query) const;
		QString generalStatistics() const;
};

class GraphWidget : public QWidget {
	Q_OBJECT
	public:
		GraphWidget(const QList<QList<QVariant> > data, const QString header, QWidget *parent = 0);
		GraphWidget(const QString &text, const QString header, QWidget *parent = 0);
		virtual ~GraphWidget() {}
		virtual QSize sizeHint() const;

	protected:
		virtual void paintEvent(QPaintEvent *event);

	private:
		QList<QList<QVariant> > mData;
		int mDescWidth;
		const int mBarHeight;
		const int mMargin;
		const QString mHeader;
		QSize mHeaderSize;
		QFont mHeaderFont;
		QFont mDataFont;
		int mMaxValue;
		int mPercentageWidth;
		int mTotal;
		const QString mText;
		bool mIsText;
		QTextDocument mDoc;
};

#endif