notifyController убрал

This commit is contained in:
2025-11-30 19:28:08 +03:00
parent fb493aca9f
commit d129fbded0
20 changed files with 82 additions and 206 deletions

View File

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