errorpopupdlg.cpp
1.55 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
54
55
56
57
58
59
60
61
62
63
#include "errorpopupdlg.h"
#include "ui_errorpopupdlg.h"
#include <QDebug>
#include "soundplayer.h"
#include "udphandler.h"
ErrorPopupDlg::ErrorPopupDlg(QWidget *parent, const QString &MsgDesc, const QString &MsgTitle, bool sendClrCmd,int erridx, int errsound) :
QDialog(parent),
ui(new Ui::ErrorPopupDlg)
{
ui->setupUi(this);
this->setAttribute( Qt::WA_TranslucentBackground);
this->setAttribute( Qt::WA_DeleteOnClose);
this->setWindowFlags(Qt::FramelessWindowHint);
//ui->centralwidget->setWindowFlags(Qt::FramelessWindowHint);
//if(MsgDesc.length()> )
qDebug() << "msgdesc length is " << MsgDesc.length();
if(MsgDesc.size()>100){
QFont font = ui->ctrlWarnDescription->font();
font.setPointSize(font.pointSize() - 1);
ui->ctrlWarnDescription->setFont(font);
}
ui->ctrlWarnDescription->setText(MsgDesc);
ui->ctrlWarnTitle->setText(MsgTitle);
m_pParent = parent;
// foreach (QPushButton *button, findChildren<QPushButton *>())
// connect(button, &QPushButton::pressed, SoundPlayer::playClick);
m_bClrCmd = sendClrCmd;
m_nErrIdx = erridx;
if(errsound == 1){
SoundPlayer::repeatError1();
}
else if(errsound ==2){
SoundPlayer::repeatError2();
}
}
ErrorPopupDlg::~ErrorPopupDlg()
{
delete ui;
}
void ErrorPopupDlg::on_ctrlOkBtn_clicked()
{
SoundPlayer::stop();
emit closedErrorPopup(m_nErrIdx);
qApp->setActiveWindow(m_pParent);
this->hide();
if(m_bClrCmd) UdpHandler::getInstance()->set(TG_ERROR_CLEAR,0xCECE);
close();
}