This repository has been archived by the owner on Sep 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainDialog.cpp
executable file
·72 lines (71 loc) · 2.07 KB
/
MainDialog.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
#include <QtGui>
#include <QString>
#include <stdio.h>
#include "MainDialog.h"
#include "StudentDialog.h"
#include "GetNoDialog.h"
#include "RegisterDialog.h"
#include "CourseDialog.h"
#include "GradeDialog.h"
#include "FindDialog.h"
#include "TableViewDialog.h"
MainDialog::MainDialog(QWidget *parent):QDialog(parent){
setupUi(this);
connect(studentButton,SIGNAL(clicked()),this,SLOT(Student()));
connect(registerButton,SIGNAL(clicked()),this,SLOT(Register()));
connect(courseButton,SIGNAL(clicked()),this,SLOT(Course()));
connect(resetButton,SIGNAL(clicked()),this,SLOT(Reset()));
connect(findButton,SIGNAL(clicked()),this,SLOT(Find()));
connect(gradeButton,SIGNAL(clicked()),this,SLOT(Grade()));
connect(tableViewButton,SIGNAL(clicked()),this,SLOT(TableView()));
}
void MainDialog::Student(){
StudentDialog dialog(this);
dialog.exec();
}
void MainDialog::Register(){
GetNoDialog *dialog=new GetNoDialog("Student Number",this);
if(dialog->exec()){
QString no=(dialog->lineEdit)->text();
delete dialog;
RegisterDialog *reg=new RegisterDialog(this,no.toInt());
reg->exec();
delete reg;
}
}
void MainDialog::Grade(){
GetNoDialog *dialog=new GetNoDialog("Course Number",this);
if(dialog->exec()){
QString no=(dialog->lineEdit)->text();
delete dialog;
GradeDialog *grade=new GradeDialog(no.toInt(),this);
grade->exec();
delete grade;
}
}
void MainDialog::Course(){
CourseDialog dialog(this);
dialog.exec();
}
void MainDialog::Reset(){
int resault=QMessageBox::warning(this,tr("Reset"),tr("This clear your data.\nDo you want to continue ?"),QMessageBox::Yes,QMessageBox::No|QMessageBox::Default|QMessageBox::Escape);
if(resault==QMessageBox::Yes){
system("rm students/*");
system("rm courses/*");
system("rm students.txt courses.txt");
}
}
void MainDialog::Find(){
FindDialog dialog(this);
dialog.exec();
}
void MainDialog::TableView(){
GetNoDialog *dialog=new GetNoDialog("Course Number",this);
if(dialog->exec()){
QString no=(dialog->lineEdit)->text();
delete dialog;
TableViewDialog *view=new TableViewDialog(no.toInt(),this);
view->exec();
delete view;
}
}