-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguardshiftsiteinfopage.cpp
More file actions
157 lines (144 loc) · 5.92 KB
/
guardshiftsiteinfopage.cpp
File metadata and controls
157 lines (144 loc) · 5.92 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#include <QtGui>
#include <QFormLayout>
#include <QGroupBox>
#include <QScrollArea>
#include <QScrollBar>
#include "snowloadcountwiz.h"
#include "guardshiftsiteinfopage.h"
GuardShiftSiteInfoPage::GuardShiftSiteInfoPage(QWidget *parent, WizData *tmpWizData) :
QWizardPage(parent)
{
wizData = tmpWizData;
setTitle(tr("Guard Shift and Site Info"));
timeDisplayFormat = QString("HH:mm");
shiftStartTime = QTime::currentTime (); //QTime(23,59);
shiftStartTimeEdit = new QTimeEdit();
shiftStartTimeEdit->setDisplayFormat(timeDisplayFormat);
shiftStartTimeEdit->setTime(shiftStartTime);
shiftEndTime = QTime( QTime::currentTime().hour() + 8,QTime::currentTime().minute() ); //QTime(23,59);
shiftEndTimeEdit = new QTimeEdit();
shiftEndTimeEdit->setDisplayFormat(timeDisplayFormat);
shiftEndTimeEdit->setTime(shiftEndTime);
dateDisplayFormat = QString("dd.MM.yyyy");
shiftStartDate = QDate::currentDate();
shiftStartDateEdit = new QDateEdit();
shiftStartDateEdit->setDisplayFormat(dateDisplayFormat);
shiftStartDateEdit->setDate(shiftStartDate);
guardNameLineEdit = new QLineEdit();
guardLicenceNumberLineEdit = new QLineEdit();
guardShiftCommentsLineEdit = new QLineEdit();
QVBoxLayout *myVboxLayout3 = new QVBoxLayout();
myVboxLayout3->addWidget(new QLabel(tr("Shift Start Time:")));
myVboxLayout3->addWidget(shiftStartTimeEdit);
myVboxLayout3->addWidget(new QLabel(tr("Shift End Time:")));
myVboxLayout3->addWidget(shiftEndTimeEdit);
myVboxLayout3->addWidget(new QLabel(tr("Shift Start Date:")));
myVboxLayout3->addWidget(shiftStartDateEdit);
myVboxLayout3->addWidget(new QLabel(tr("Guard Name:")));
myVboxLayout3->addWidget(guardNameLineEdit);
myVboxLayout3->addWidget(new QLabel(tr("Guard License #:")));
myVboxLayout3->addWidget(guardLicenceNumberLineEdit);
myVboxLayout3->addWidget(new QLabel(tr("Shift Comments:")));
myVboxLayout3->addWidget(guardShiftCommentsLineEdit);
myVboxLayout3->addWidget(new QLabel(tr("Counting At Location:")));
conroyRadio = new QRadioButton(tr("&Conroy"));
michaelRadio = new QRadioButton(tr("&Micheal"));
strandherdRadio = new QRadioButton(tr("&Strandherd"));
innesRadio = new QRadioButton(tr("&Innes"));
clydeRadio = new QRadioButton(tr("Cl&yde"));
QHBoxLayout *myHboxLayout = new QHBoxLayout();
myHboxLayout->addWidget(conroyRadio);
myHboxLayout->addWidget(michaelRadio);
myHboxLayout->addWidget(strandherdRadio);
myHboxLayout->addWidget(innesRadio);
myHboxLayout->addWidget(clydeRadio);
QGroupBox *locationGroupBox = new QGroupBox(tr("Location"));
locationGroupBox->setLayout(myHboxLayout);
myVboxLayout3->addWidget(locationGroupBox);
myVboxLayout3->addWidget(new QLabel(tr("Counting Totals For:")));
passesRadio = new QRadioButton(tr("&Passes"));
ticketsRadio = new QRadioButton(tr("&Tickets"));
QHBoxLayout *myHboxLayout2 = new QHBoxLayout();
myHboxLayout2->addWidget(passesRadio);
myHboxLayout2->addWidget(ticketsRadio);
QGroupBox *countForItemTypeGroupBox = new QGroupBox(tr("Item Type"));
countForItemTypeGroupBox->setLayout(myHboxLayout2);
myVboxLayout3->addWidget(countForItemTypeGroupBox);
setLayout(myVboxLayout3);
}
int GuardShiftSiteInfoPage::nextId() const
{
return SnowLoadCountWiz::Page_TruckTypeCount;
}
bool GuardShiftSiteInfoPage::validatePage()
{
logtimeDisplayFormat = QString("HHmm");
logdateDisplayFormat = QString("ddMMyyyy");
logFileName = "snowLoadCountLog";
logFileName += shiftStartTimeEdit->time().toString(logtimeDisplayFormat);
logFileName += shiftStartDateEdit->date().toString(logdateDisplayFormat);
logFileName += ".txt";
wizData->logFileName = logFileName;
wizData->shiftStartTime = shiftStartTimeEdit->time().toString(logtimeDisplayFormat);
wizData->shiftEndTime = shiftEndTimeEdit->time().toString(logtimeDisplayFormat);
wizData->shiftStartDate = shiftStartDateEdit->date().toString(logdateDisplayFormat);
wizData->guardName = guardNameLineEdit->text();
wizData->guardLicenseNumber = guardLicenceNumberLineEdit->text();
wizData->shiftComment = guardShiftCommentsLineEdit->text();
wizData->countLocation = getLocationSelected();
wizData->countForItemType = getCountForItemType();
//wizData->debugDataFields();
//open a log file "snowLoadCountLoghhmmDDMMYYYY.txt"
//then write the guardshift and siteinfo to the log
return true;
}
QString GuardShiftSiteInfoPage::getLocationSelected()
{
QString theLocation;
if (conroyRadio->isChecked())
{
theLocation = "Conroy";
}
else if(michaelRadio->isChecked())
{
theLocation = "Michael";
}
else if(strandherdRadio->isChecked())
{
theLocation = "Strandherd";
}
else if(innesRadio->isChecked())
{
theLocation = "Innes";
}
else if(clydeRadio->isChecked())
{
theLocation = "Clyde";
}
return (theLocation);
}
QString GuardShiftSiteInfoPage::getCountForItemType()
{
QString theCountForItemType;
if(passesRadio->isChecked())
{
theCountForItemType = "passes";
}
else if(ticketsRadio->isChecked())
{
theCountForItemType = "tickets";
}
return (theCountForItemType);
}
void GuardShiftSiteInfoPage::debugPageFields()
{
qDebug() << "Log file name:" << logFileName;
qDebug() << "Shift Start Time:" << shiftStartTimeEdit->time().toString(logtimeDisplayFormat);
qDebug() << "Shift End Time:" << shiftEndTimeEdit->time().toString(logtimeDisplayFormat);
qDebug() << "Shift Start Date:" << shiftStartDateEdit->date().toString(logdateDisplayFormat);
qDebug() << "Guard Name:" << guardNameLineEdit->text();
qDebug() << "Guard License#:" << guardLicenceNumberLineEdit->text();
qDebug() << "Shift Comment:" << guardShiftCommentsLineEdit->text();
qDebug() << "Location:" << getLocationSelected();
qDebug() << "Counting totals for:" << getCountForItemType();
}