mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
83 lines
2.4 KiB
C++
83 lines
2.4 KiB
C++
#include <QTranslator>
|
|
#include "specialmessagebox.h"
|
|
#include "ui_specialmessagebox.h"
|
|
|
|
SpecMsgBox::SpecMsgBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) :
|
|
QDialog(parent),
|
|
ui(new Ui::SpecialMessageBox)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
if(type == TypeSpecMsgBox::warningYesNo)
|
|
{
|
|
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/warning.png")));
|
|
this->setWindowTitle(tr("Attention!"));
|
|
}
|
|
else if(type == TypeSpecMsgBox::warningClose)
|
|
{
|
|
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/warning.png")));
|
|
this->setWindowTitle(tr("Attention!"));
|
|
ui->btnNo->setVisible(false);
|
|
ui->btnYes->setText(tr("Close"));
|
|
}
|
|
else if(type == TypeSpecMsgBox::criticalClose)
|
|
{
|
|
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/critical.png")));
|
|
this->setWindowTitle(tr("Error!"));
|
|
ui->btnNo->setVisible(false);
|
|
ui->btnYes->setText(tr("Close"));
|
|
}
|
|
else if(type == TypeSpecMsgBox::infoOk)
|
|
{
|
|
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/info.png")));
|
|
this->setWindowTitle(tr("Information"));
|
|
ui->btnNo->setVisible(false);
|
|
ui->btnYes->setText(tr("Ok"));
|
|
}
|
|
|
|
ui->lblText->setText(text);
|
|
}
|
|
|
|
SpecMsgBox::~SpecMsgBox()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
int SpecMsgBox::WarningYesNo(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
|
|
{
|
|
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::warningYesNo, text);
|
|
}
|
|
|
|
int SpecMsgBox::WarningClose(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
|
|
{
|
|
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::warningClose, text);
|
|
}
|
|
|
|
int SpecMsgBox::CriticalClose(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
|
|
{
|
|
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::criticalClose, text);
|
|
}
|
|
|
|
int SpecMsgBox::InfoOk(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
|
|
{
|
|
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::infoOk, text);
|
|
}
|
|
|
|
int SpecMsgBox::work(SpecMsgBox *msgBox, QWidget *parent, TypeSpecMsgBox type, const QString& text)
|
|
{
|
|
msgBox = new SpecMsgBox(parent, type, text);
|
|
return msgBox->exec();
|
|
}
|
|
|
|
void SpecMsgBox::on_btnYes_clicked()
|
|
{
|
|
this->accept();
|
|
}
|
|
|
|
void SpecMsgBox::on_btnNo_clicked()
|
|
{
|
|
this->reject();
|
|
}
|