SpecMsgBox в процессе исправления

This commit is contained in:
2025-11-28 21:01:33 +03:00
parent 8ad6d06f18
commit fb493aca9f
17 changed files with 169 additions and 60 deletions

View File

@@ -413,7 +413,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
QFile xmlInFile(xmlFileName);
if (!xmlInFile.open(QFile::ReadOnly | QFile::Text))
{
SpecialMessageBox(nullptr, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The file could not be opened ") + xmlFileName).exec();
SpecMsgBox(nullptr, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("The file could not be opened ") + xmlFileName).exec();
return;
}
else

View File

@@ -6,7 +6,8 @@
EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) :
InstructorsView(connectorToServer, CommonView::TypeView::control, parent),
ui(new Ui::EditorInstructors),
dlgEditInstructor(nullptr)
dlgEditInstructor(nullptr),
specialMessageBox(nullptr)
{
ui->setupUi(this);
@@ -41,6 +42,13 @@ EditorInstructors::~EditorInstructors()
dlgEditInstructor = nullptr;
}
if(specialMessageBox)
{
specialMessageBox->close();
delete specialMessageBox;
specialMessageBox = nullptr;
}
delete ui;
}
@@ -48,6 +56,9 @@ void EditorInstructors::closeEvent(QCloseEvent *event)
{
if(dlgEditInstructor)
dlgEditInstructor->close();
if(specialMessageBox)
specialMessageBox->close();
}
void EditorInstructors::on_btnNewInstructor_clicked()
@@ -82,21 +93,39 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
if(connectorToServer->isAdminInstructor(id))
{//Это Админ!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete the Administrator.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot delete the Administrator."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return;
}
if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete a logged-in instructor.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot delete a logged-in instructor."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return;
}
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted)
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?"));
if(specialMessageBox->exec() == QDialog::Accepted)
{
waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id);
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
}
}
}
@@ -127,7 +156,13 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
{//Не Архивный
if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot archive a logged-in instructor.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot archive a logged-in instructor."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return;
}
@@ -164,7 +199,13 @@ void EditorInstructors::on_btnEdit_clicked()
if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot edit a logged-in instructor.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("You cannot edit a logged-in instructor."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return;
}
@@ -270,19 +311,37 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
if(instructor.getName() == QStringLiteral("<name>"))
{//Имя не корректно!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return false;
}
if(instructor.getLogin() == QStringLiteral("<login>"))
{//Логин не корректен!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return false;
}
if(instructor.getPassword() == QStringLiteral("<password>"))
{//Пароль не корректный!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return false;
}
@@ -291,7 +350,13 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
int user_T = connectorToServer->getIdTraineeByLogin(instructor.getLogin());
if((user_I && (user_I != instructor.getID())) || (user_T && (user_T != instructor.getID())))
{//Логин уже существует!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted.")).exec();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
specialMessageBox->exec();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
return 0;
}

View File

@@ -5,6 +5,7 @@
#include <QTreeWidget>
#include "instructorsview.h"
#include "dialogeditinstructor.h"
#include "specialmessagebox.h"
class DialogEditInstructor;
@@ -42,6 +43,7 @@ private:
Ui::EditorInstructors *ui;
DialogEditInstructor* dlgEditInstructor;
SpecMsgBox* specialMessageBox;
};
#endif // DIALOGINSTRUCTORS_H

View File

@@ -179,7 +179,7 @@ QString InstructorsAndTraineesWidget::loadStyleSheet()
QFile styleSheetFile(fileName);
if (!styleSheetFile.open(QFile::ReadOnly | QFile::Text))
{
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The file could not be opened ") + fileName).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("The file could not be opened ") + fileName).exec();
return QStringLiteral("");
}
else
@@ -273,7 +273,7 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization
else
{
ui->btnAuthorizationInstructor->setChecked(true);
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor deauthorization") + "\n" + tr("Error!")).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("Instructor deauthorization") + "\n" + tr("Error!")).exec();
}
}
@@ -285,7 +285,7 @@ void InstructorsAndTraineesWidget::slot_ServerBlocked()
waitAnimationWidget->hideWithStop();
ui->btnAuthorizationInstructor->setChecked(false);
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + tr("Server blocked!")).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + tr("Server blocked!")).exec();
}
}
@@ -317,7 +317,7 @@ void InstructorsAndTraineesWidget::slot_ErrorAuth(QString error)
errorTextMsg = tr("Login or password error!");
}
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + errorTextMsg).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + errorTextMsg).exec();
}
}
@@ -406,7 +406,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
if(!flSettingsServerIsChanged)
{
if(!flTryConnectToServer)
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("The server is not available!")).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, tr("The server is not available!")).exec();
}
else
flSettingsServerIsChanged = false;
@@ -654,7 +654,7 @@ void InstructorsAndTraineesWidget::on_btnSettings_clicked()
if(dlgSettings->settingsServerIsChanged())
{
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Server settings have been changed. Please reconnect to the server.")).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, tr("Server settings have been changed. Please reconnect to the server.")).exec();
flSettingsServerIsChanged = true;

View File

@@ -114,7 +114,7 @@ void DialogVersionControl::sendCopyEmit(QString newName)
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
return;
}
@@ -127,7 +127,7 @@ void DialogVersionControl::on_createDuplicateButton_clicked()
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
return;
}
@@ -160,7 +160,7 @@ void DialogVersionControl::on_deleteVersionButton_clicked()
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
return;
}
@@ -172,7 +172,7 @@ void DialogVersionControl::on_switchServerVersionButton_clicked()
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
return;
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();

View File

@@ -329,7 +329,7 @@ void AMMtasksWidget::slot_UpdateSubProcForDMCode(QString dmCode)
lastSelectedTask.listSubProc.clear();
dlgListSubProc->getListCheckedSubProc(&lastSelectedTask.listSubProc);
specialMessageBox = new SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
if(specialMessageBox->exec() == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask);
@@ -357,7 +357,7 @@ void AMMtasksWidget::slot_UpdateSubProcForDMCode(QString dmCode)
{
lastSelectedTask.listSubProc.clear();
specialMessageBox = new SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
if(specialMessageBox->exec() == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask);
@@ -520,7 +520,7 @@ void AMMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
specialMessageBox = new SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?"));
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?"));
if(specialMessageBox->exec() == QDialog::Accepted)
{

View File

@@ -103,7 +103,7 @@ private:
DialogListSubProc* dlgListSubProc;
SpecialMessageBox* specialMessageBox;
SpecMsgBox* specialMessageBox;
bool flOnlyActive; //AMM

View File

@@ -183,7 +183,7 @@ void CheckerTask::on_btnWrong_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'new'");
}
specialMessageBox = new SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, msgString);
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, msgString);
if(specialMessageBox->exec() == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
@@ -216,7 +216,7 @@ void CheckerTask::on_btnRight_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
}
specialMessageBox = new SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, msgString);
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, msgString);
if(specialMessageBox->exec() == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);

View File

@@ -48,7 +48,7 @@ private:
ConnectorToServer* connectorToServer;
FIMtasksWidget* fimTasksWidget;
SpecialMessageBox* specialMessageBox;
SpecMsgBox* specialMessageBox;
bool flChanged;
int id_task;

View File

@@ -401,7 +401,7 @@ void FIMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeFIM::clmnFIM_ID).toInt();
specialMessageBox = new SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?"));
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?"));
if(specialMessageBox->exec() == QDialog::Accepted)
{
waitAnimationWidget->showWithPlay();
@@ -451,7 +451,7 @@ void FIMtasksWidget::on_btnCheck_clicked()
void FIMtasksWidget::on_btnAssignTask_clicked()
{
specialMessageBox = new SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
if(specialMessageBox->exec() == QDialog::Accepted)
assignTaskFIMtoTrainee();
if(specialMessageBox)

View File

@@ -92,7 +92,7 @@ private:
DialogChekerTask* dlgCheckerTask;
SpecialMessageBox* specialMessageBox;
SpecMsgBox* specialMessageBox;
QString userName; //FIM

View File

@@ -9,7 +9,8 @@ EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminM
TraineesView(connectorToServer, CommonView::TypeView::control, parent),
ui(new Ui::EditorTrainees),
dlgEditTrainee(nullptr),
dlgEditGroup(nullptr)
dlgEditGroup(nullptr),
specialMessageBox(nullptr)
{
ui->setupUi(this);
@@ -54,6 +55,8 @@ EditorTrainees::~EditorTrainees()
dlgEditGroup = nullptr;
}
//SpecMsgBox::CloseAndDelete(specialMessageBox);
delete ui;
}
@@ -64,6 +67,8 @@ void EditorTrainees::closeEvent(QCloseEvent *event)
if(dlgEditGroup)
dlgEditGroup->close();
//SpecMsgBox::CloseAndDelete(specialMessageBox);
}
void EditorTrainees::on_btnNewGroup_clicked()
@@ -93,12 +98,12 @@ void EditorTrainees::on_btnDeleteGroup_clicked()
if(connectorToServer->getListTraineesInGroup(id_group).count() > 0)
{
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The group is not empty.\nIt is not possible to delete a non-empty group.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("The group is not empty.\nIt is not possible to delete a non-empty group."));
return;
}
else
{//Пустая группа
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted)
if(SpecMsgBox::WarningYesNo(specialMessageBox, this, tr("The deletion will be irrevocable.\nDelete it anyway?")) == QDialog::Accepted)
{
waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_GROUP, id_group);
@@ -149,11 +154,11 @@ void EditorTrainees::on_btnDeleteTrainee_clicked()
if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete a logged-in trainee.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("You cannot delete a logged-in trainee."));
return;
}
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted)
if(SpecMsgBox::WarningYesNo(specialMessageBox, this, tr("The deletion will be irrevocable.\nDelete it anyway?")) == QDialog::Accepted)
{
waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE, id_trainee);
@@ -188,7 +193,7 @@ void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
{//Не Архивный
if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot archive a logged-in trainee.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("You cannot archive a logged-in trainee."));
return;
}
@@ -234,7 +239,7 @@ void EditorTrainees::on_btnEdit_clicked()
if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot edit a logged-in trainee.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("You cannot edit a logged-in trainee."));
return;
}
@@ -403,7 +408,7 @@ bool EditorTrainees::verifyGroup(Group group)
if(group.getName() == QStringLiteral("<group>"))
{//Имя не корректно!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable group name has been entered.\nThe changes will not be accepted.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("Unacceptable group name has been entered.\nThe changes will not be accepted."));
return false;
}
@@ -413,7 +418,7 @@ bool EditorTrainees::verifyGroup(Group group)
{
if(group.getName() == exist_group.getName() && group.getID() != exist_group.getID())
{//Имя уже существует
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing group name has been entered.\nThe changes will not be accepted.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("An existing group name has been entered.\nThe changes will not be accepted."));
return false;
}
}
@@ -427,19 +432,19 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
if(trainee.getName() == QStringLiteral("<name>"))
{//Имя не корректно!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted."));
return false;
}
if(trainee.getLogin() == QStringLiteral("<login>"))
{//Логин не корректен!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee login has been entered.\nThe changes will not be accepted.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("Unacceptable trainee login has been entered.\nThe changes will not be accepted."));
return false;
}
if(trainee.getPassword() == QStringLiteral("<password>"))
{//Пароль не корректный!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee password has been entered.\nThe changes will not be accepted.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("Unacceptable trainee password has been entered.\nThe changes will not be accepted."));
return false;
}
@@ -448,7 +453,7 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
int user_T = connectorToServer->getIdTraineeByLogin(trainee.getLogin());
if((user_I && (user_I != trainee.getID())) || (user_T && (user_T != trainee.getID())))
{//Логин уже существует!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted.")).exec();
SpecMsgBox::CriticalClose(specialMessageBox, this, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
return 0;
}

View File

@@ -7,6 +7,7 @@
//#include "computersLocations.h"
#include "dialogedittrainee.h"
#include "dialogeditgroup.h"
#include "specialmessagebox.h"
namespace Ui {
class EditorTrainees;
@@ -48,6 +49,7 @@ private:
DialogEditTrainee* dlgEditTrainee;
DialogEditGroup* dlgEditGroup;
SpecMsgBox* specialMessageBox;
};
#endif // DIALOGTRAINEESGROUPS_H