-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatid.cpp
More file actions
74 lines (62 loc) · 1.97 KB
/
Copy pathcreatid.cpp
File metadata and controls
74 lines (62 loc) · 1.97 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
#include "creatid.h"
#include "ui_creatid.h"
#include "QMessageBox"
#include "allclass.h"
#include <string>
#include <QString>
#include <QDebug>
creatid::creatid(QWidget *parent) :
QDialog(parent),
ui(new Ui::creatid)
{
ui->setupUi(this);
}
creatid::~creatid()
{
delete ui;
}
int stringtoint1(string s);
extern book_shelf library;
void creatid::on_pushButton_clicked()
{
string name = ui->name->text().toStdString();
string password = ui->password->text().toStdString();
string identity = ui->identity->text().toStdString();
string institute = ui->institute->currentText().toStdString();
QString clientname = ui->name->text();
QString clientpassword = ui->password->text();
QString clientidentity = ui->identity->text();
QString clientinstitute = ui->institute->currentText();
int iden = stringtoint1(identity);
if(clientname == NULL)
QMessageBox::warning(this, tr("提示!"),
tr("请输入用户名!"),
QMessageBox::Yes);
else if(clientpassword == NULL)
QMessageBox::warning(this, tr("提示!"),
tr("请输入用密码!"),
QMessageBox::Yes);
else if(clientidentity == NULL)
QMessageBox::warning(this, tr("提示!"),
tr("请输入用户身份信息!"),
QMessageBox::Yes);
else if(clientinstitute == NULL)
QMessageBox::warning(this, tr("提示!"),
tr("请输入用户x学院信息!"),
QMessageBox::Yes);
else
{
library.new_client(name,password,iden,institute);
QMessageBox::warning(this, tr("提示!"),
tr("用户添加成功!"),
QMessageBox::Yes);
this->close();
}
}
int stringtoint1(string s)//基本函数
{
int num;
stringstream ss(s);
ss>>num;
return num;
}