-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatsdialog.cpp
More file actions
90 lines (86 loc) · 2.58 KB
/
statsdialog.cpp
File metadata and controls
90 lines (86 loc) · 2.58 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "statsdialog.h"
#include "ui_statsdialog.h"
#include <nightcharts.h>
StatsDialog::StatsDialog(int statWindow, QWidget *parent) :
QDialog(parent),
ui(new Ui::StatsDialog)
{
ui->setupUi(this);
setStatWindow(statWindow);
setStatWindowTitles();
}
StatsDialog::~StatsDialog()
{
delete ui;
}
void StatsDialog::paintEvent(QPaintEvent *e)
{
QWidget::paintEvent(e);
QPainter painter;
QFont font;
painter.begin(this);
Nightcharts Histogram;
Histogram.setType(Nightcharts::Histogramm);
Histogram.setLegendType(Nightcharts::Vertical);
if (statWindow == 1)
{
Histogram.setCords(20, 20, this->width()/1.7,this->height()/1.2);
Histogram.addPiece("February", QColor(200,10,50), 45);
Histogram.addPiece("March", Qt::green, 67);
Histogram.addPiece("April", Qt::cyan, 85);
Histogram.addPiece("May", Qt::yellow, 8);
Histogram.draw(&painter);
Histogram.drawLegend(&painter);
}
else if (statWindow == 2)
{
Histogram.setCords(20, 20, this->width()/1.7,this->height()/1.2);
Histogram.addPiece("February", QColor(200,10,50), 45);
Histogram.addPiece("March", Qt::green, 65);
Histogram.addPiece("April", Qt::cyan, 87);
Histogram.addPiece("May", Qt::yellow, 6);
Histogram.draw(&painter);
Histogram.drawLegend(&painter);
}
else if (statWindow == 3)
{
Histogram.setCords(20, 20, this->width()/1.9,this->height()/1.2);
Histogram.addPiece("Last Week", QColor(200,10,50), 42);
Histogram.addPiece("This Week", Qt::green, 29);
Histogram.draw(&painter);
Histogram.drawLegend(&painter);
}
else if (statWindow == 4)
{
Histogram.setCords(20, 20, this->width()/1.9,this->height()/1.2);
Histogram.addPiece("Refrigerator", QColor(200,10,50), 34);
Histogram.addPiece("Microwave", Qt::green, 27);
Histogram.addPiece("Ironing Board", Qt::cyan, 38);
Histogram.addPiece("Mini-Bar", Qt::yellow, 14);
Histogram.draw(&painter);
Histogram.drawLegend(&painter);
}
}
void StatsDialog::setStatWindowTitles()
{
if (this->statWindow == 1)
{
this->setWindowTitle("Check Ins");
}
else if (this->statWindow == 2)
{
this->setWindowTitle("Check Outs");
}
else if (this->statWindow == 3)
{
this->setWindowTitle("Reservations");
}
else if (this->statWindow == 4)
{
this->setWindowTitle("Room Accomodations");
}
}
void StatsDialog::setStatWindow(int statWindow)
{
this->statWindow = statWindow;
}