-
Notifications
You must be signed in to change notification settings - Fork 0
/
commondialog.cpp
82 lines (67 loc) · 1.96 KB
/
commondialog.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
#include "commondialog.h"
#include "ui_commondialog.h"
#include <QDebug>
#include "debug_log.h"
#include "blockchain.h"
#include "ErrorTranslator.h"
CommonDialog::CommonDialog(commonDialogType type, QWidget *parent) :
QDialog(parent),
ui(new Ui::CommonDialog)
{
DLOG_QT_WALLET_FUNCTION_BEGIN;
ui->setupUi(this);
setParent(Blockchain::getInstance()->mainFrame);
move(Blockchain::getInstance()->mainFrame->pos());
Blockchain::getInstance()->appendCurrentDialogVector(this);
setAttribute(Qt::WA_TranslucentBackground, true);
setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
ui->widget->setObjectName("widget");
ui->widget->setStyleSheet("#widget{background-color:rgba(10, 10, 10,100);}");
ui->containerWidget->setObjectName("containerwidget");
setStyleSheet("#containerwidget{background-color: rgb(246, 246, 246);border:1px groove rgb(180,180,180);}");
yesOrNO = false;
ui->okBtn->setText(tr("Ok"));
ui->cancelBtn->setText(tr("Cancel"));
if( type == OkAndCancel)
{
}
else if( type == OkOnly)
{
ui->cancelBtn->hide();
ui->okBtn->move(101,96);
}
else if( type == YesOrNo)
{
ui->okBtn->setText(tr("Yes"));
ui->cancelBtn->setText(tr("No"));
}
DLOG_QT_WALLET_FUNCTION_END;
}
CommonDialog::~CommonDialog()
{
DLOG_QT_WALLET_FUNCTION_BEGIN;
qDebug() << "CommonDialog delete ";
delete ui;
Blockchain::getInstance()->removeCurrentDialogVector(this);
DLOG_QT_WALLET_FUNCTION_END;
}
void CommonDialog::on_okBtn_clicked()
{
yesOrNO = true;
close();
}
void CommonDialog::on_cancelBtn_clicked()
{
yesOrNO = false;
close();
}
bool CommonDialog::pop()
{
DLOG_QT_WALLET_FUNCTION_BEGIN;
exec();
return yesOrNO;
}
void CommonDialog::setText(QString text, QString info)
{
ui->textLabel->setText(text+ ErrorTranslator::Translate(info));
}