-
Notifications
You must be signed in to change notification settings - Fork 3
/
dialogindicator.cpp
72 lines (55 loc) · 1.83 KB
/
dialogindicator.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
#include "dialogindicator.h"
#include "ui_dialogindicator.h"
int Do = 0; // активация по-умолчанию
int Progress = 0;
DialogIndicator::DialogIndicator(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogIndicator)
{
ui->setupUi(this);
// выключаем кнопку выхода
ui->ExitDialog->setEnabled(false);
ui->Log->clear();
}
DialogIndicator::~DialogIndicator()
{
delete ui;
}
void DialogIndicator::SetDo(int i)
{
if(i==0) {
// Активируем
ActivateAP *t1 = new ActivateAP();
connect(t1, SIGNAL(reset_status_active()), this, SLOT(FromIndicator()));
connect(t1, SIGNAL(setPercent(int)), this, SLOT(PercentGet(int)));
connect(t1, SIGNAL(send_step(QString)), this, SLOT(getSrep(QString)));
connect(t1, SIGNAL(toLog(QString)), this, SLOT(FromThreadToLog(QString)));
t1->start();
t1->exit();
} else {
// диактивируем
DisActiveAP *t2 = new DisActiveAP();
connect(t2, SIGNAL(reset_status_disactive()), this, SLOT(FromIndicator()));
connect(t2, SIGNAL(setPercent(int)), this, SLOT(PercentGet(int)));
connect(t2, SIGNAL(send_step(QString)), this, SLOT(getSrep(QString)));
connect(t2, SIGNAL(toLog(QString)), this, SLOT(FromThreadToLog(QString)));
t2->start();
t2->exit();
}
}
void DialogIndicator::getSrep(QString text) {
// Получаем сообщение из потока
// устанавлием его в лейбел
ui->Log->setText(text);
text.clear();
}
void DialogIndicator::PercentGet(int val) {
ui->ProgressDo->setValue(val);
}
void DialogIndicator::FromIndicator(){
emit to_Mainwindow();
ui->ExitDialog->setEnabled(true);
}
void DialogIndicator::FromThreadToLog(QString str){
emit toLogInMainWindow(str);
}