mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
SpecMsgBox в процессе исправления
This commit is contained in:
@@ -13,7 +13,7 @@ NotifyController::NotifyController(QWidget *parentWidget, QObject *parent) :
|
||||
void NotifyController::showWarning(QString text, QWidget *parentWidget)
|
||||
{
|
||||
if(parentWidget)
|
||||
SpecialMessageBox(parentWidget, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
|
||||
SpecMsgBox(parentWidget, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
|
||||
else
|
||||
SpecialMessageBox(this->parentWidget, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
|
||||
SpecMsgBox(this->parentWidget, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "specialmessagebox.h"
|
||||
#include "ui_specialmessagebox.h"
|
||||
|
||||
SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) :
|
||||
SpecMsgBox::SpecMsgBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SpecialMessageBox)
|
||||
{
|
||||
@@ -22,14 +22,14 @@ SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const
|
||||
ui->btnNo->setVisible(false);
|
||||
ui->btnYes->setText(tr("Close"));
|
||||
}
|
||||
else if(type == TypeSpecMsgBox::critical)
|
||||
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::info)
|
||||
else if(type == TypeSpecMsgBox::infoOk)
|
||||
{
|
||||
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/info.png")));
|
||||
this->setWindowTitle(tr("Information"));
|
||||
@@ -40,17 +40,43 @@ SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const
|
||||
ui->lblText->setText(text);
|
||||
}
|
||||
|
||||
SpecialMessageBox::~SpecialMessageBox()
|
||||
SpecMsgBox::~SpecMsgBox()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SpecialMessageBox::on_btnYes_clicked()
|
||||
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 SpecialMessageBox::on_btnNo_clicked()
|
||||
void SpecMsgBox::on_btnNo_clicked()
|
||||
{
|
||||
this->reject();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ui {
|
||||
class SpecialMessageBox;
|
||||
}
|
||||
|
||||
class SpecialMessageBox : public QDialog
|
||||
class SpecMsgBox : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -15,13 +15,22 @@ public:
|
||||
enum TypeSpecMsgBox {
|
||||
warningYesNo,
|
||||
warningClose,
|
||||
critical,
|
||||
info
|
||||
criticalClose,
|
||||
infoOk
|
||||
};
|
||||
|
||||
public:
|
||||
explicit SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const QString& text);
|
||||
~SpecialMessageBox();
|
||||
explicit SpecMsgBox(QWidget *parent, TypeSpecMsgBox type, const QString& text);
|
||||
~SpecMsgBox();
|
||||
|
||||
public:
|
||||
static int WarningYesNo(SpecMsgBox* msgBox, QWidget *parent, const QString& text);
|
||||
static int WarningClose(SpecMsgBox* msgBox, QWidget *parent, const QString& text);
|
||||
static int CriticalClose(SpecMsgBox* msgBox, QWidget *parent, const QString& text);
|
||||
static int InfoOk(SpecMsgBox* msgBox, QWidget *parent, const QString& text);
|
||||
|
||||
private:
|
||||
static int work(SpecMsgBox* msgBox, QWidget *parent, TypeSpecMsgBox type, const QString& text);
|
||||
|
||||
private slots:
|
||||
void on_btnYes_clicked();
|
||||
|
||||
Reference in New Issue
Block a user