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

@@ -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