-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommondialog.cpp
97 lines (78 loc) · 2.34 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "commondialog.h"
#include "ui_commondialog.h"
#include <QDebug>
#include "debug_log.h"
#include "goopal.h"
CommonDialog::CommonDialog(commonDialogType type, QWidget *parent) :
QDialog(parent),
ui(new Ui::CommonDialog)
{
DLOG_QT_WALLET_FUNCTION_BEGIN;
ui->setupUi(this);
setParent(Goopal::getInstance()->mainFrame);
move(Goopal::getInstance()->mainFrame->pos());
// Goopal::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->checkBox->hide();
ui->containerWidget->setObjectName("containerwidget");
setStyleSheet("#containerwidget{background-color: rgb(246, 246, 246);border:1px groove rgb(180,180,180);}");
yesOrNO = false;
ui->okBtn->setStyleSheet("QToolButton{background-color:#469cfc;color:#ffffff;border:0px solid rgb(64,153,255);border-radius:3px;}"
"QToolButton:hover{background-color:#62a9f8;}");
ui->okBtn->setText(tr("Ok"));
ui->cancelBtn->setStyleSheet("QToolButton{background-color:#ffffff;color:#282828;border:1px solid #62a9f8;border-radius:3px;}"
"QToolButton:hover{color:#62a9f8;}");
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;
// Goopal::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();
if (!ui->checkBox->isHidden()) {
return ui->checkBox->isChecked();
}
return yesOrNO;
}
void CommonDialog::setText(QString text)
{
ui->textLabel->setText(text);
}
void CommonDialog::showTips()
{
ui->checkBox->show();
}