mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
SpecialMessageBox
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <QMessageBox>
|
||||
#include "editorinstructors.h"
|
||||
#include "dialogeditinstructor.h"
|
||||
#include "specialmessagebox.h"
|
||||
#include "ui_editorinstructors.h"
|
||||
|
||||
EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) :
|
||||
@@ -108,17 +109,17 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
|
||||
|
||||
if(connectorToServer->isAdminInstructor(id))
|
||||
{//Это Админ!
|
||||
QMessageBox::critical(this, tr("Error!"), tr("You cannot delete the Administrator."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete the Administrator.")).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
if(connectorToServer->isLoggedInInstructor(id))
|
||||
{//Инструктор залогирован!
|
||||
QMessageBox::critical(this, tr("Error!"), tr("You cannot delete a logged-in instructor."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete a logged-in instructor.")).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete it anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
||||
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted)
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id);
|
||||
@@ -153,7 +154,7 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
|
||||
{//Не Архивный
|
||||
if(connectorToServer->isLoggedInInstructor(id))
|
||||
{//Инструктор залогирован!
|
||||
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in instructor."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot archive a logged-in instructor.")).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +191,7 @@ void EditorInstructors::on_btnEdit_clicked()
|
||||
|
||||
if(connectorToServer->isLoggedInInstructor(id))
|
||||
{//Инструктор залогирован!
|
||||
QMessageBox::critical(this, tr("Error!"), tr("You cannot edit a logged-in instructor."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot edit a logged-in instructor.")).exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -276,22 +277,19 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
|
||||
|
||||
if(instructor.getName() == QStringLiteral("<name>"))
|
||||
{//Имя не корректно!
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted.")).exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(instructor.getLogin() == QStringLiteral("<login>"))
|
||||
{//Логин не корректен!
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted.")).exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(instructor.getPassword() == QStringLiteral("<password>"))
|
||||
{//Пароль не корректный!
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted.")).exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -300,8 +298,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())))
|
||||
{//Логин уже существует!
|
||||
QMessageBox::critical(this, tr("Editing error!"),
|
||||
tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
|
||||
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted.")).exec();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user