-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.cpp
272 lines (210 loc) · 7.34 KB
/
mainwindow.cpp
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center());
this->p = new Patient;
this->appointmentsLog = new QVector<Appointment>;
this->cancelledAppointmentsLog = new QVector<Appointment>;
this->arrDoc = new QVector<Doctor>;
this->emergencyVisitLog = new QVector<EmergencyVisit>;
this->roomLog = new QVector<Room>;
this->homeVisitLog = new QVector<HomeVisit>;
this->feedbackLog = new QVector<Feedback>;
this->p_userLoginTitle = ui->userLoginTitle;
Doctor d1("Ahmed", 121, 3.4, 1050, "Cardio");
Doctor d2("Tarek", 122, 3.3, 1500, "Emergency");
Doctor d3("Youssef", 123, 4.4, 1350, "Cardio");
Doctor d4("Ziad", 124, 3.4, 1100, "Blood");
Doctor d5("Ali", 125, 3.6, 1200, "Neurology");
Doctor d6("Farah", 126, 4.5, 1950, "Neurology");
Doctor d7("Kiro", 127, 4.4, 1900, "Blood");
Doctor d8("Nour", 128, 3.7, 1700, "Emergency");
Doctor d9("Hasan", 129, 3.3, 900, "Nutrition");
Doctor d10("Omar", 130, 4.2, 1300, "Nutrition");
arrDoc->push_back(d1);
arrDoc->push_back(d2);
arrDoc->push_back(d3);
arrDoc->push_back(d4);
arrDoc->push_back(d5);
arrDoc->push_back(d6);
arrDoc->push_back(d7);
arrDoc->push_back(d8);
arrDoc->push_back(d9);
arrDoc->push_back(d10);
Patient Admin;
this->p->userMap.insert(pair<QString, Patient>(Admin.getUsername(), Admin));
paymentsLogFile.open("paymentsLogFile.txt", ios::out);
paymentsLogFile.close();
remove("paymentsLogFile.txt");
PatchNotesWindow patchwin;
patchwin.setModal(true);
patchwin.exec();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_loginButton_clicked()
{
UserLoginWindow userloginwin;
userloginwin.setModal(true);
userloginwin.p = this->p;
userloginwin.appointmentsLog = this->appointmentsLog;
userloginwin.arrDoc = this->arrDoc;
userloginwin.p_userLoginTitle = this->p_userLoginTitle;
userloginwin.exec();
}
void MainWindow::on_showPatientInformationButton_clicked()
{
if (this->p->getLoggedIn() == false)
{
QMessageBox::about(this, "Error", "Please log in first");
}
else
{
ShowPatientInformation showpatientinfo;
showpatientinfo.setModal(true);
showpatientinfo.p = this->p;
showpatientinfo.appointmentsLog = this->appointmentsLog;
showpatientinfo.arrDoc = this->arrDoc;
showpatientinfo.exec();
}
}
void MainWindow::on_bookAppointmentButton_clicked()
{
BookAppointmentWindow bookappointmentwin;
bookappointmentwin.setModal(true);
bookappointmentwin.p = this->p;
bookappointmentwin.appointmentsLog = this->appointmentsLog;
bookappointmentwin.cancelledAppointmentsLog = this->cancelledAppointmentsLog;
bookappointmentwin.arrDoc = this->arrDoc;
bookappointmentwin.roomLog = this->roomLog;
bookappointmentwin.exec();
this->appointmentsLog = bookappointmentwin.appointmentsLog;
}
void MainWindow::on_showAppointmentsButton_clicked()
{
ui->appointmentsTitle->setText("");
if (this->appointmentsLog->size() == 0 && this->emergencyVisitLog->size() == 0 && this->roomLog->size() == 0 && this->homeVisitLog->size() == 0)
{
ui->appointmentsTitle->setText("No current bookings.");
return;
}
for (int i = 0; i < this->emergencyVisitLog->size(); i++)
{
ui->appointmentsTitle->setText(ui->appointmentsTitle->text() + "\nEmergency Visit #" + QString::number((i + 1)) + " " + this->emergencyVisitLog->at(i).showVisit());
}
for (int i = 0; i < this->appointmentsLog->size(); i++)
{
ui->appointmentsTitle->setText(ui->appointmentsTitle->text() + "\nAppointment #" + QString::number((i + 1)) + " " + this->appointmentsLog->at(i).showAppointment());
}
for (int i = 0; i < this->cancelledAppointmentsLog->size(); i++)
{
ui->appointmentsTitle->setText(ui->appointmentsTitle->text() + "\nCancelled Appointment #" + QString::number((i + 1)) + " " + this->cancelledAppointmentsLog->at(i).showAppointment());
}
for (int i = 0; i < this->roomLog->size(); i++)
{
ui->appointmentsTitle->setText(ui->appointmentsTitle->text() + "\nRoom #" + QString::number((i + 1)) + " " + this->roomLog->at(i).showRoom());
}
for (int i = 0; i < this->homeVisitLog->size(); i++)
{
ui->appointmentsTitle->setText(ui->appointmentsTitle->text() + "\nHome Visit #" + QString::number((i + 1)) + " " + this->homeVisitLog->at(i).showHomeVisit());
}
}
void MainWindow::on_bookRoomButton_clicked()
{
BookRoomWindow bookroomwin;
bookroomwin.setModal(true);
bookroomwin.p = this->p;
bookroomwin.appointmentsLog = this->appointmentsLog;
bookroomwin.arrDoc = this->arrDoc;
bookroomwin.roomLog = this->roomLog;
bookroomwin.exec();
this->roomLog = bookroomwin.roomLog;
}
void MainWindow::on_emergencyVisitButton_clicked()
{
bookEmergencyVisitWindow bookemervisit;
bookemervisit.setModal(true);
bookemervisit.p = this->p;
bookemervisit.appointmentsLog = this->appointmentsLog;
bookemervisit.arrDoc = this->arrDoc;
bookemervisit.emergencyVisitLog = this->emergencyVisitLog;
bookemervisit.exec();
}
void MainWindow::on_rechargeButton_clicked()
{
if (this->p->getLoggedIn() == false)
{
QMessageBox::about(this, "Error", "Please log in first");
}
else
{
rechargeBalanceWindow rechargewin;
rechargewin.setModal(true);
rechargewin.p = this->p;
rechargewin.exec();
}
}
void MainWindow::on_doBloodTestButton_clicked()
{
doBloodTestWindow doBTestwin;
doBTestwin.setModal(true);
doBTestwin.p = this->p;
doBTestwin.exec();
}
void MainWindow::on_bookHomeVisitButton_clicked()
{
bookHomeVisitWindow bookHVisitWin;
bookHVisitWin.setModal(true);
bookHVisitWin.p = this->p;
bookHVisitWin.homeVisitLog = this->homeVisitLog;
bookHVisitWin.exec();
}
void MainWindow::on_helpAndPricingsButton_clicked()
{
HelpAndPricingsWindow helpwin;
helpwin.setModal(true);
helpwin.exec();
}
void MainWindow::on_openEmailInboxButton_clicked()
{
EmailInboxWindow emailwin;
emailwin.setModal(true);
emailwin.p = this->p;
emailwin.appointmentsLog = this->appointmentsLog;
emailwin.cancelledAppointmentsLog = this->cancelledAppointmentsLog;
emailwin.arrDoc = this->arrDoc;
emailwin.emergencyVisitLog = this->emergencyVisitLog;
emailwin.roomLog = this->roomLog;
emailwin.homeVisitLog = this->homeVisitLog;
emailwin.exec();
}
void MainWindow::on_shortestPathButton_clicked()
{
ShortestPathWindow pathwin;
pathwin.setModal(true);
pathwin.exec();
}
void MainWindow::on_complexSearch_clicked()
{
ComplexSearchWindow searchwin;
searchwin.setModal(true);
searchwin.p = this->p;
searchwin.appointmentsLog = this->appointmentsLog;
searchwin.arrDoc = this->arrDoc;
searchwin.emergencyVisitLog = this->emergencyVisitLog;
searchwin.roomLog = this->roomLog;
searchwin.homeVisitLog = this->homeVisitLog;
searchwin.exec();
}
void MainWindow::on_contactUsButton_clicked()
{
ContactUsWindow contactwin;
contactwin.setModal(true);
contactwin.feedbackLog = this->feedbackLog;
contactwin.exec();
}