-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
93 lines (77 loc) · 3.18 KB
/
main.cpp
File metadata and controls
93 lines (77 loc) · 3.18 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
#include "mainwindow.h"
#include "login.h"
#include <QApplication>
#include <QFile>
#include <QString>
#include <QTextStream>
#include <QGraphicsDropShadowEffect>
#include <QLabel>
#include <QFrame>
#include <QVBoxLayout>
using namespace std;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setWindowIcon(QIcon(":/icons/icon/icon.ico"));
QFile style_file("://style.qss");
if (style_file.open(QFile::ReadOnly | QFile::Text))
{
QTextStream style_stream(&style_file);
a.setStyleSheet(style_stream.readAll());
style_file.close();
}
QLabel *label = new QLabel;
QPixmap pixmap("://");
label->setPixmap(pixmap);
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
effect->setBlurRadius(10);
effect->setXOffset(5);
effect->setYOffset(5);
label->setGraphicsEffect(effect);
ENSIA.setCourses(Courses::load());
ENSIA.setExams(Exams::load());
ENSIA.setTeachers(Teachers::load());
ENSIA.setStudents(Students::load());
login h;
h.setWindowTitle("Login");
if (h.exec() == QDialog::Rejected)
return 0;
string *Susername = new string(h.username);
string *Spassword = new string(h.password);
string *Semail = new string("admin@gmail.com");
string *Sphone = new string("0123456789");
string *Sproffession = new string(h.job);
QString userInfoHtml = QString(
"<head/>"
"<html>"
"<body>"
"<h1 align=\"center\" style=\" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
"<span style=\" font-size:xx-large; font-weight:700;\">User Information</span>"
"</h1>"
"<p align=\"center\"><span>Username: %1</span></p>"
"<p align=\"center\"><span>Email: %2</span></p>"
"<p align=\"center\"><span>Phone: %3</span></p>"
"<p align=\"center\"><span>Profession: %4</span></p>"
"<p align=\"center\"><span>Password: %5</span></p>"
"</body>"
"</html>")
.arg(QString::fromStdString(*Susername), QString::fromStdString(*Semail), QString::fromStdString(*Sphone), QString::fromStdString(*Sproffession), QString(QString::fromStdString(*Spassword).length(), '*'));
MainWindow w;
w.setWindowTitle("Academia Plus©");
if (h.job == "student")
{
QPixmap teacherImage("://icon/studentuser.png");
teacherImage = teacherImage.scaled(w.ui->userBig->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
w.ui->userBig->setPixmap(teacherImage);
}
else
{
QPixmap studentImage("://icon/teacheruser.png");
studentImage = studentImage.scaled(w.ui->userBig->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
w.ui->userBig->setPixmap(studentImage);
}
w.ui->userInfo->setText(userInfoHtml);
w.show();
return a.exec();
return 0;
}