-
Notifications
You must be signed in to change notification settings - Fork 2
/
regist.cpp
77 lines (72 loc) · 1.76 KB
/
regist.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
#include "regist.h"
#include "ui_regist.h"
#include "class.h"
regist::regist(QWidget *parent) :
QDialog(parent),
ui(new Ui::regist)
{
ui->setupUi(this);
this->setAttribute(Qt::WA_TranslucentBackground, true);//透明
setWindowFlags(Qt::FramelessWindowHint);
}
regist::~regist()
{
delete ui;
}
void regist::clear()
{
}
void regist :: mousePressEvent(QMouseEvent *e)
{
last = e -> globalPos();
}
void regist :: mouseMoveEvent(QMouseEvent *e)
{
int dx = e -> globalX() - last.x();
int dy = e -> globalY() - last.y();
last = e -> globalPos();
move(x() + dx, y() + dy);
}
void regist :: mouseReleaseEvent(QMouseEvent *e)
{
int dx = e -> globalX() - last.x();
int dy = e -> globalY() - last.y();
move(x() + dx, y() + dy);
}
void regist::on_submit_but_clicked()
{
User user, tem;
if(ui -> id_edit -> text() == "")
{
doge_warning("Please input the ID");
return;
}
if(ui -> key_edit -> text() == "")
{
doge_warning("Please input the key");
return;
}
if(ui -> key_edit -> text() != ui -> confirm_edit -> text())
{
doge_warning("Two password is not the same");
return;
}
user.id = ui -> id_edit -> text();
user.key = make_password(ui -> key_edit -> text());
user.name = ui -> name_edit -> text();
user.phone = ui -> phone_edit -> text();
user.email = ui -> email_edit -> text();
user.level = (ui -> admin_edit -> text()) == admin_key;
if(search_user_id(tem, user.id) == 0)
doge_warning("Id exist");
else
{
doge_success("Success");
user_insert(user);
close();
}
}
void regist::on_exit_but_clicked()
{
close();
}