#include "errorpopupdlg.h" #include "ui_errorpopupdlg.h" #include #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()) // 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(); }