-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedituser.cpp
90 lines (76 loc) · 1.99 KB
/
edituser.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
#include "edituser.h"
#include "ui_edituser.h"
#include "Global.h"
#include "qmessagebox.h"
#include "admin.h"
EditUser::EditUser(QWidget *parent) :
QDialog(parent),
ui(new Ui::EditUser)
{
ui->setupUi(this);
this->setFixedSize(521,331);
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
}
EditUser::~EditUser()
{
delete ui;
}
void EditUser::set(int ind)
{
this->ind=ind;
Person x=Global::vec_person[ind];
ui->lineEdit_Name->setText(x.get_name());
ui->lineEdit_UesrName->setText(x.get_user_name());
ui->lineEdit_Address->setText(x.get_address());
ui->lineEdit_Phon->setText(x.get_phone_number());
ui->lineEdit_Email->setText(x.get_Mail());
}
void EditUser::on_pushButton_Save_clicked()
{
QString name=ui->lineEdit_Name->text();
QString user=ui->lineEdit_UesrName->text();
QString mail=ui->lineEdit_Email->text();
QString address=ui->lineEdit_Address->text();
QString phone=ui->lineEdit_Phon->text();
Global::vec_person[ind].set(name , user , phone , address , Global::vec_person[ind].get_password() ,mail,Global::vec_person[ind].get_ban(),Global::vec_person[ind].get_type(),Global::vec_person[ind].get_moneybags());
Global::save();
this->close();
}
void EditUser::on_pushButton_Delete_clicked()
{
Global::vec_person.remove(ind);
Global::save();
this->close();
}
void EditUser::on_pushButton_Ban_clicked()
{
bool o=Global::vec_person[ind].get_ban();
if(o)
{
QMessageBox *x=new QMessageBox;
x->setText("unbaned");
x->exec();
Global::vec_person[ind].setBan(0);
}
else
{
QMessageBox *x=new QMessageBox;
x->setText("baned");
x->exec();
Global::vec_person[ind].setBan(1);
}
Global::save();
this->close();
}
void EditUser::on_pushButton_Cancel_clicked()
{
this->close();
}
int EditUser::getIndex_vector() const
{
return index_vector;
}
void EditUser::setIndex_vector(int newIndex_vector)
{
index_vector = newIndex_vector;
}