-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion.cpp
56 lines (47 loc) · 1 KB
/
question.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
#include "question.h"
#include "ui_question.h"
#include "mainwindow.h"
#include "database.h"
Question::Question(QWidget *parent) :
QDialog(parent),
ui(new Ui::Question)
{
ui->setupUi(this);
ui->label->setWordWrap(true);
}
Question::~Question()
{
delete ui;
}
void Question::closeEvent(QCloseEvent *event)
{
this->parentWidget()->show();
}
void Question::showEvent(QShowEvent *event)
{
ui->label->setText(QString::fromLocal8Bit("Добавлен ли ваш пользователь в файл sudoers?")/*db->get_question()*/);
}
void Question::answer_click(int answer)
{
db->add_answer(answer);
if (db->get_solution() == "nope")
ui->label->setText(db->get_question());
else
ui->groupBox->hide();
}
void Question::on_pushButton_clicked()
{
answer_click(1);
}
void Question::on_pushButton_2_clicked()
{
answer_click(2);
}
void Question::on_pushButton_3_clicked()
{
answer_click(3);
}
void Question::on_pushButton_4_clicked()
{
answer_click(4);
}