-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertdialog.cpp
More file actions
executable file
·53 lines (48 loc) · 1.4 KB
/
insertdialog.cpp
File metadata and controls
executable file
·53 lines (48 loc) · 1.4 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
#include "insertdialog.h"
#include "ui_insertdialog.h"
InsertDialog::InsertDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::InsertDialog)
{
ui->setupUi(this);
btn_group = new QButtonGroup;
btn_group->setExclusive(true);
btn_group->addButton(ui->L1_radioButton, 1);
btn_group->addButton(ui->L2_radioButton, 2);
}
InsertDialog::~InsertDialog()
{
delete ui;
}
void InsertDialog::on_finish_pushButton_clicked()
{
QString name = ui->Stuff_lineEdit->text();
QString id = ui->ID_lineEdit->text();
int permission = btn_group->checkedId();
if(name.isEmpty() && id.isEmpty())
{
util::person_info new_person;
emit get_person_finished(new_person);
QMessageBox::warning(this, "Warning","use default guest info");
QDialog::accept();
}
else if(name.length() > 10 || id.length() != 6)
{
emit get_person_error();
QMessageBox::warning(this, "Warning","please check your name and id");
QDialog::reject();
}
else
{
util::person_info new_info(id, name, permission);
emit get_person_finished(new_info);
QString msg = QString("name: %1 id: %2 permission: %3 ").arg(name).arg(id).arg(permission);
QMessageBox::information(this, "Info", msg);
QDialog::accept();
}
}
void InsertDialog::on_close_pushButton_clicked()
{
// emit get_person_canceled();
QDialog::reject();
}