-
Notifications
You must be signed in to change notification settings - Fork 5
/
mainwindow.cpp
100 lines (88 loc) · 2.8 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "gui_newperson.h"
#include "icfcontroller.h"
#include "gui_showperson.h"
#include <QString>
#include <QDebug>
#include <QMessageBox>
#include "gui_report.h"
#include <QSettings>
#include <QPixmap>
#include "gui_settings.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QCoreApplication::setOrganizationName("ICF_Report");
QCoreApplication::setApplicationName("ICF_Report");
QSettings settings;
QString baseDir = settings.value("baseDir").toString();
icfController = new ICFController(baseDir);
connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close()));
connect(ui->pushButtonPat,SIGNAL(clicked()),this,SLOT(on_actionManage_Patients_triggered()));
connect(ui->pushButtonTher,SIGNAL(clicked()),this,SLOT(on_actionManage_Therapists_triggered()));
connect(ui->pushButtonRepNew,SIGNAL(clicked(bool)),this,SLOT(on_actionManage_Reports_triggered()));
}
MainWindow::~MainWindow()
{
delete ui;
delete icfController;
}
void MainWindow::on_actionAbout_triggered()
{
QMessageBox box(QMessageBox::Question, "About ICF Report", "ICF Report is used to easily create short ICF Reports. It also includes a simple"
" patient management system.\nCreated by loaded 2014");
box.setIconPixmap(QPixmap(":/Built_with_Qt_RGB_logo_vertical.png"));
box.resize(600, 300);
box.exec();
}
void MainWindow::closeEvent(QCloseEvent *event)
{
event->ignore();
QMessageBox box;
box.setWindowTitle("Save before exit?");
box.setText("Click Yes for Saving current data.");
box.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
box.setDefaultButton(QMessageBox::Yes);
int ret = box.exec();
if (ret == QMessageBox::Yes)
icfController->save();
event->accept();
}
void MainWindow::on_actionSave_All_triggered()
{
icfController->save();
}
void MainWindow::on_actionManage_Therapists_triggered()
{
GUI_ShowPerson* form = new GUI_ShowPerson(icfController,'t',this);
form->setWindowTitle("Manage Therapists");
form->exec();
delete form;
}
void MainWindow::on_actionManage_Patients_triggered()
{
GUI_ShowPerson* form = new GUI_ShowPerson(icfController,'p',this);
form->setWindowTitle("Manage Patients");
form->exec();
delete form;
}
void MainWindow::on_actionSet_Xml_Directory_triggered()
{
GUI_Settings dialog;
if (dialog.exec()) {
QSettings settings;
settings.setValue("baseDir",dialog.getDirectory());
QMessageBox box;
box.setText("Settings saved.");
box.exec();
}
}
void MainWindow::on_actionManage_Reports_triggered()
{
GUI_Report* repForm = new GUI_Report(icfController,this);
repForm->exec();
delete repForm;
}