SpecialMessageBox

This commit is contained in:
2025-09-15 18:20:39 +03:00
parent bffbd0fe81
commit 0e81d14566
19 changed files with 366 additions and 215 deletions

View File

@@ -103,6 +103,10 @@ add_library(InstructorsAndTrainees SHARED
widgets/waitanimationwidget.h
widgets/waitanimationwidget.ui
specialmessagebox.cpp
specialmessagebox.h
specialmessagebox.ui
resources.qrc
)

View File

@@ -1,4 +1,5 @@
#include "notifycontroller.h"
#include "specialmessagebox.h"
NotifyController::NotifyController(QObject *parent) : QObject(parent)
{
@@ -7,10 +8,5 @@ NotifyController::NotifyController(QObject *parent) : QObject(parent)
void NotifyController::showWarning(QString text)
{
QMessageBox warning;
warning.setText(text);
warning.setIcon(QMessageBox::Warning);
warning.setWindowTitle(tr("Error"));
warning.exec();
SpecialMessageBox(nullptr, SpecialMessageBox::TypeSpecMsgBox::warningWithoutButtons, text).exec();
}

View File

@@ -6,6 +6,7 @@
#include "instructor.h"
#include "tasksAmmFim.h"
#include "timingoftrainee.h"
#include "specialmessagebox.h"
RecognizeSystem::RecognizeSystem(QObject *parent):
@@ -392,7 +393,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
QFile xmlInFile(xmlFileName);
if (!xmlInFile.open(QFile::ReadOnly | QFile::Text))
{
QMessageBox::critical(nullptr, tr("Attention!"), tr("The file could not be opened ") + xmlFileName);
SpecialMessageBox(nullptr, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The file could not be opened ") + xmlFileName).exec();
return;
}
else

View File

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

View File

@@ -4,6 +4,7 @@
#include "ui_instructorsandtraineeswidget.h"
#include "dialogauthorizationinstructor.h"
#include "dialogsettings.h"
#include "specialmessagebox.h"
const QString InstructorsAndTraineesWidget::languageENG = "en_EN";
@@ -124,7 +125,7 @@ QString InstructorsAndTraineesWidget::loadStyleSheet()
QFile styleSheetFile(fileName);
if (!styleSheetFile.open(QFile::ReadOnly | QFile::Text))
{
QMessageBox::critical(this, tr("Attention!"), tr("The file could not be opened ") + fileName);
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The file could not be opened ") + fileName).exec();
return QStringLiteral("");
}
else
@@ -181,12 +182,11 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se
connectorToServer->sendQueryTasksXML("fim");
connectorToServer->sendQueryTasksXML("amm");
//QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!"));
}
else
{
ui->btnAuthorizationInstructor->setChecked(false);
QMessageBox::warning(this, tr("Instructor authorization"), tr("Invalid login or password!"));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor authorization") + "\n" + tr("Invalid login or password!")).exec();
}
}
@@ -207,12 +207,11 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization
ui->btnEditorInstructors->setEnabled(false);
updateLabelLoggedInInstructor("","");
//QMessageBox::information(this, tr("Instructor deauthorization"), tr("Successfully!"));
}
else
{
ui->btnAuthorizationInstructor->setChecked(true);
QMessageBox::warning(this, tr("Instructor deauthorization"), tr("Error!"));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor deauthorization") + "\n" + tr("Error!")).exec();
}
}
@@ -252,7 +251,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal);
updateLabelServer();
QMessageBox::warning(this, tr("Warning!"), tr("The server is not available"));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The server is not available!")).exec();
}
}
@@ -440,7 +439,7 @@ void InstructorsAndTraineesWidget::on_btnSettings_clicked()
if(dlg.settingsServerIsChanged())
{
QMessageBox::warning(this, tr("Attention!"), tr("Server settings have been changed. Please reconnect to the server."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningWithoutButtons, tr("Server settings have been changed. Please reconnect to the server.")).exec();
if(authorizationIsCompleted())
deAuthorizationInstructor(loginInstructorLoggedInLocal);

View File

@@ -49,5 +49,8 @@
<file>resources/icons/updateVersion.png</file>
<file>resources/icons/editorDB.png</file>
<file>resources/icons/lms.png</file>
<file>resources/icons/critical.png</file>
<file>resources/icons/warning.png</file>
<file>resources/icons/info.png</file>
</qresource>
</RCC>

View File

@@ -71,9 +71,10 @@ QPushButton, QToolButton {
qproperty-iconSize: 32px;
}
QPushButton {
height: 25px;
width: 75px;
width: 100px;
}
QToolButton {
width: 180px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,56 @@
#include <QTranslator>
#include "specialmessagebox.h"
#include "ui_specialmessagebox.h"
SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) :
QDialog(parent),
ui(new Ui::SpecialMessageBox)
{
ui->setupUi(this);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
if(type == TypeSpecMsgBox::warning)
{
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/warning.png")));
this->setWindowTitle(tr("Attention!"));
}
else if(type == TypeSpecMsgBox::warningWithoutButtons)
{
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/warning.png")));
this->setWindowTitle(tr("Attention!"));
ui->btnYes->setVisible(false);
ui->btnNo->setVisible(false);
}
else if(type == TypeSpecMsgBox::critical)
{
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/critical.png")));
this->setWindowTitle(tr("Error!"));
ui->btnYes->setVisible(false);
ui->btnNo->setVisible(false);
}
else if(type == TypeSpecMsgBox::info)
{
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/info.png")));
this->setWindowTitle(tr("Information"));
ui->btnYes->setVisible(false);
ui->btnNo->setVisible(false);
}
ui->lblText->setText(text);
}
SpecialMessageBox::~SpecialMessageBox()
{
delete ui;
}
void SpecialMessageBox::on_btnYes_clicked()
{
this->accept();
}
void SpecialMessageBox::on_btnNo_clicked()
{
this->reject();
}

View File

@@ -0,0 +1,35 @@
#ifndef SPECIALMESSAGEBOX_H
#define SPECIALMESSAGEBOX_H
#include <QDialog>
namespace Ui {
class SpecialMessageBox;
}
class SpecialMessageBox : public QDialog
{
Q_OBJECT
public:
enum TypeSpecMsgBox {
warning,
warningWithoutButtons,
critical,
info
};
public:
explicit SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const QString& text);
~SpecialMessageBox();
private slots:
void on_btnYes_clicked();
void on_btnNo_clicked();
private:
Ui::SpecialMessageBox *ui;
};
#endif // SPECIALMESSAGEBOX_H

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SpecialMessageBox</class>
<widget class="QDialog" name="SpecialMessageBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>100</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lbl_icon">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/resources/icons/circleGray.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblText">
<property name="text">
<string>text</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnYes">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Yes</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnNo">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>No</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -7,6 +7,7 @@
#include "ammtaskswidget.h"
#include "ui_ammtaskswidget.h"
#include "dialogchecktask.h"
#include "specialmessagebox.h"
AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTreeAMMFIM type, QWidget *parent) :
QWidget(parent),
@@ -291,7 +292,7 @@ void AMMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
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_TASK_AMM_TO_TRAINEE, id);
@@ -334,7 +335,7 @@ void AMMtasksWidget::on_btnCheck_clicked()
void AMMtasksWidget::on_btnAssignTask_clicked()
{
if(QMessageBox::question(this, tr("New task"), tr("Assign this task?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("Assign this task?")).exec() == QDialog::Accepted)
assignTaskAMMtoTrainee();
}

View File

@@ -1,4 +1,5 @@
#include "dialogchecktask.h"
#include "specialmessagebox.h"
#include "ui_dialogchecktask.h"
DialogCheckTask::DialogCheckTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent) :
@@ -138,7 +139,7 @@ void DialogCheckTask::on_btnWrong_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'new'");
}
if(QMessageBox::warning(this, tr("Attention!"), msgString, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, msgString).exec() == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close();
@@ -165,7 +166,7 @@ void DialogCheckTask::on_btnRight_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
}
if(QMessageBox::warning(this, tr("Attention!"), msgString, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, msgString).exec() == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close();

View File

@@ -8,6 +8,7 @@
#include "ui_fimtaskswidget.h"
#include "tasksAmmFim.h"
#include "dialogchecktask.h"
#include "specialmessagebox.h"
FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeListTreeAMMFIM type, QWidget *parent) :
QWidget(parent),
@@ -338,7 +339,7 @@ void FIMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeFIM::clmnFIM_ID).toInt();
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_TASK_FIM_TO_TRAINEE, id);
@@ -385,7 +386,7 @@ void FIMtasksWidget::on_btnCheck_clicked()
void FIMtasksWidget::on_btnAssignTask_clicked()
{
if(QMessageBox::question(this, tr("New task"), tr("Assign this task?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("Assign this task?")).exec() == QDialog::Accepted)
assignTaskFIMtoTrainee();
}

View File

@@ -3,6 +3,7 @@
#include "ui_editortrainees.h"
#include "dialogeditgroup.h"
#include "dialogedittrainee.h"
#include "specialmessagebox.h"
EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) :
TraineesView(connectorToServer, CommonView::TypeView::control, parent),
@@ -111,12 +112,12 @@ void EditorTrainees::on_btnDeleteGroup_clicked()
if(connectorToServer->getListTraineesInGroup(id_group).count() > 0)
{
QMessageBox::critical(this, tr("Editing error!"), tr("The group is not empty.\nIt is not possible to delete a non-empty group."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The group is not empty.\nIt is not possible to delete a non-empty group.")).exec();
return;
}
else
{//Пустая группа
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete 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_GROUP, id_group);
@@ -216,11 +217,11 @@ void EditorTrainees::on_btnDeleteTrainee_clicked()
if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot delete a logged-in trainee."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete a logged-in trainee.")).exec();
return;
}
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete 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_TRAINEE, id_trainee);
@@ -255,7 +256,7 @@ void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
{//Не Архивный
if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in trainee."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot archive a logged-in trainee.")).exec();
return;
}
@@ -301,7 +302,7 @@ void EditorTrainees::on_btnEdit_clicked()
if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot edit a logged-in trainee."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot edit a logged-in trainee.")).exec();
return;
}
@@ -431,8 +432,7 @@ bool EditorTrainees::verifyGroup(Group group)
if(group.getName() == QStringLiteral("<group>"))
{//Имя не корректно!
QMessageBox::critical(this, tr("Editing error!"),
tr("Unacceptable group name has been entered.\nThe changes will not be accepted."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable group name has been entered.\nThe changes will not be accepted.")).exec();
return false;
}
@@ -442,8 +442,7 @@ bool EditorTrainees::verifyGroup(Group group)
{
if(group.getName() == exist_group.getName() && group.getID() != exist_group.getID())
{//Имя уже существует
QMessageBox::critical(this, tr("Editing error!"),
tr("An existing group name has been entered.\nThe changes will not be accepted."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing group name has been entered.\nThe changes will not be accepted.")).exec();
return false;
}
}
@@ -457,22 +456,19 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
if(trainee.getName() == QStringLiteral("<name>"))
{//Имя не корректно!
QMessageBox::critical(this, tr("Editing error!"),
tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted.")).exec();
return false;
}
if(trainee.getLogin() == QStringLiteral("<login>"))
{//Логин не корректен!
QMessageBox::critical(this, tr("Editing error!"),
tr("Unacceptable trainee login has been entered.\nThe changes will not be accepted."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee login has been entered.\nThe changes will not be accepted.")).exec();
return false;
}
if(trainee.getPassword() == QStringLiteral("<password>"))
{//Пароль не корректный!
QMessageBox::critical(this, tr("Editing error!"),
tr("Unacceptable trainee password has been entered.\nThe changes will not be accepted."));
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee password has been entered.\nThe changes will not be accepted.")).exec();
return false;
}
@@ -481,8 +477,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())))
{//Логин уже существует!
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;
}

View File

@@ -24,54 +24,44 @@
<translation>Удалить</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="256"/>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<location filename="../tasks/ammtaskswidget.cpp" line="257"/>
<location filename="../tasks/ammtaskswidget.cpp" line="259"/>
<source>Task AMM</source>
<translation>Задача AMM</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="256"/>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<location filename="../tasks/ammtaskswidget.cpp" line="257"/>
<location filename="../tasks/ammtaskswidget.cpp" line="259"/>
<source>DM code</source>
<translation>DM код</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="256"/>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<location filename="../tasks/ammtaskswidget.cpp" line="257"/>
<location filename="../tasks/ammtaskswidget.cpp" line="259"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.ui" line="60"/>
<location filename="../tasks/ammtaskswidget.cpp" line="256"/>
<location filename="../tasks/ammtaskswidget.cpp" line="258"/>
<location filename="../tasks/ammtaskswidget.cpp" line="257"/>
<location filename="../tasks/ammtaskswidget.cpp" line="259"/>
<source>Status</source>
<translation>Статус</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="294"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="294"/>
<location filename="../tasks/ammtaskswidget.cpp" line="295"/>
<source>The deletion will be irrevocable.
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="324"/>
<location filename="../tasks/ammtaskswidget.cpp" line="325"/>
<source>Status Task</source>
<translation>Статус задачи</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="337"/>
<source>New task</source>
<translation>Новая задача</translation>
</message>
<message>
<location filename="../tasks/ammtaskswidget.cpp" line="337"/>
<location filename="../tasks/ammtaskswidget.cpp" line="338"/>
<source>Assign this task?</source>
<translation>Назначить эту задачу?</translation>
</message>
@@ -133,27 +123,27 @@ Delete it anyway?</source>
<translation>Верно</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="31"/>
<location filename="../tasks/dialogchecktask.cpp" line="32"/>
<source>Completed</source>
<translation>Выполнена</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="32"/>
<location filename="../tasks/dialogchecktask.cpp" line="33"/>
<source>New</source>
<translation>Новая</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="108"/>
<location filename="../tasks/dialogchecktask.cpp" line="109"/>
<source>viewed</source>
<translation>Просмотрено</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="110"/>
<location filename="../tasks/dialogchecktask.cpp" line="111"/>
<source>completed</source>
<translation>Выполнена</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="132"/>
<location filename="../tasks/dialogchecktask.cpp" line="133"/>
<source>Change task status?
The status will be set:
&apos;failed&apos;</source>
@@ -162,7 +152,7 @@ The status will be set:
&apos;неверно&apos;</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="138"/>
<location filename="../tasks/dialogchecktask.cpp" line="139"/>
<source>Change task status?
The status will be set:
&apos;new&apos;</source>
@@ -171,14 +161,8 @@ The status will be set:
&apos;новая&apos;</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="141"/>
<location filename="../tasks/dialogchecktask.cpp" line="168"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/dialogchecktask.cpp" line="159"/>
<location filename="../tasks/dialogchecktask.cpp" line="165"/>
<location filename="../tasks/dialogchecktask.cpp" line="160"/>
<location filename="../tasks/dialogchecktask.cpp" line="166"/>
<source>Change task status?
The status will be set:
&apos;completed&apos;</source>
@@ -363,7 +347,7 @@ The status will be set:
</message>
<message>
<location filename="../instructors/editorinstructors.ui" line="121"/>
<location filename="../instructors/editorinstructors.cpp" line="244"/>
<location filename="../instructors/editorinstructors.cpp" line="245"/>
<source>To archive</source>
<translation>Архивировать</translation>
</message>
@@ -378,58 +362,37 @@ The status will be set:
<translation>Показать архив</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="111"/>
<location filename="../instructors/editorinstructors.cpp" line="117"/>
<location filename="../instructors/editorinstructors.cpp" line="156"/>
<location filename="../instructors/editorinstructors.cpp" line="193"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="111"/>
<location filename="../instructors/editorinstructors.cpp" line="112"/>
<source>You cannot delete the Administrator.</source>
<translation>Нельзя удалить администратора.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="117"/>
<location filename="../instructors/editorinstructors.cpp" line="118"/>
<source>You cannot delete a logged-in instructor.</source>
<translation>Вы не можете удалить инструктора, вошедшего в систему.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="121"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="121"/>
<location filename="../instructors/editorinstructors.cpp" line="122"/>
<source>The deletion will be irrevocable.
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="156"/>
<location filename="../instructors/editorinstructors.cpp" line="157"/>
<source>You cannot archive a logged-in instructor.</source>
<translation>Вы не можете заархивировать инструктора, вошедшего в систему.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="193"/>
<location filename="../instructors/editorinstructors.cpp" line="194"/>
<source>You cannot edit a logged-in instructor.</source>
<translation>Вы не можете редактировать инструктора, вошедшего в систему.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="239"/>
<location filename="../instructors/editorinstructors.cpp" line="240"/>
<source>From archive</source>
<translation>Разархивировать</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="279"/>
<location filename="../instructors/editorinstructors.cpp" line="286"/>
<location filename="../instructors/editorinstructors.cpp" line="293"/>
<location filename="../instructors/editorinstructors.cpp" line="303"/>
<source>Editing error!</source>
<translation>Ошибка редактирования!</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="280"/>
<source>Unacceptable instructor name has been entered.
@@ -438,21 +401,21 @@ The changes will not be accepted.</source>
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="287"/>
<location filename="../instructors/editorinstructors.cpp" line="286"/>
<source>Unacceptable instructor login has been entered.
The changes will not be accepted.</source>
<translation>Введен неприемлемый логин инструктора.
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="294"/>
<location filename="../instructors/editorinstructors.cpp" line="292"/>
<source>Unacceptable instructor password has been entered.
The changes will not be accepted.</source>
<translation>Введен неприемлемый пароль инструктора.
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="304"/>
<location filename="../instructors/editorinstructors.cpp" line="301"/>
<source>An existing instructor or trainee login has been entered.
The changes will not be accepted.</source>
<translation>Введен существующий логин инструктора или обучаемого.
@@ -488,8 +451,8 @@ The changes will not be accepted.</source>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="206"/>
<location filename="../trainees/editortrainees.cpp" line="374"/>
<location filename="../trainees/editortrainees.cpp" line="399"/>
<location filename="../trainees/editortrainees.cpp" line="375"/>
<location filename="../trainees/editortrainees.cpp" line="400"/>
<source>To archive</source>
<translation>Архивировать</translation>
</message>
@@ -504,59 +467,36 @@ The changes will not be accepted.</source>
<translation>Показать архив</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="114"/>
<location filename="../trainees/editortrainees.cpp" line="434"/>
<location filename="../trainees/editortrainees.cpp" line="445"/>
<location filename="../trainees/editortrainees.cpp" line="460"/>
<location filename="../trainees/editortrainees.cpp" line="467"/>
<location filename="../trainees/editortrainees.cpp" line="474"/>
<location filename="../trainees/editortrainees.cpp" line="484"/>
<source>Editing error!</source>
<translation>Ошибка редактирования!</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="114"/>
<location filename="../trainees/editortrainees.cpp" line="115"/>
<source>The group is not empty.
It is not possible to delete a non-empty group.</source>
<translation>Группа не пуста. Невозможно удалить непустую группу.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="119"/>
<location filename="../trainees/editortrainees.cpp" line="223"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="119"/>
<location filename="../trainees/editortrainees.cpp" line="223"/>
<location filename="../trainees/editortrainees.cpp" line="120"/>
<location filename="../trainees/editortrainees.cpp" line="224"/>
<source>The deletion will be irrevocable.
Delete anyway?</source>
<translation>Удаление будет безвозвратным. Всё равно удалить?</translation>
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="219"/>
<location filename="../trainees/editortrainees.cpp" line="258"/>
<location filename="../trainees/editortrainees.cpp" line="304"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="219"/>
<location filename="../trainees/editortrainees.cpp" line="220"/>
<source>You cannot delete a logged-in trainee.</source>
<translation>Вы не можете удалить обучаемого, вошедшего в систему.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="258"/>
<location filename="../trainees/editortrainees.cpp" line="259"/>
<source>You cannot archive a logged-in trainee.</source>
<translation>Вы не можете заархивировать обучаемого, вошедшего в систему.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="304"/>
<location filename="../trainees/editortrainees.cpp" line="305"/>
<source>You cannot edit a logged-in trainee.</source>
<translation>Вы не можете редактировать обучаемого, вошедшего в систему.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="392"/>
<location filename="../trainees/editortrainees.cpp" line="393"/>
<source>From archive</source>
<translation>Разархивировать</translation>
</message>
@@ -568,35 +508,35 @@ The changes will not be accepted.</source>
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="446"/>
<location filename="../trainees/editortrainees.cpp" line="445"/>
<source>An existing group name has been entered.
The changes will not be accepted.</source>
<translation>Введено существующее название группы.
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="461"/>
<location filename="../trainees/editortrainees.cpp" line="459"/>
<source>Unacceptable trainee name has been entered.
The changes will not be accepted.</source>
<translation>Введено неприемлемое имя обучаемого.
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="468"/>
<location filename="../trainees/editortrainees.cpp" line="465"/>
<source>Unacceptable trainee login has been entered.
The changes will not be accepted.</source>
<translation>Введен неприемлемый логин обучаемого.
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="475"/>
<location filename="../trainees/editortrainees.cpp" line="471"/>
<source>Unacceptable trainee password has been entered.
The changes will not be accepted.</source>
<translation>Был введен неприемлемый пароль обучаемого.
Изменения приняты не будут.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="485"/>
<location filename="../trainees/editortrainees.cpp" line="480"/>
<source>An existing instructor or trainee login has been entered.
The changes will not be accepted.</source>
<translation>Введен существующий логин инструктора или обучаемого.
@@ -626,47 +566,37 @@ The changes will not be accepted.</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="287"/>
<location filename="../tasks/fimtaskswidget.cpp" line="289"/>
<location filename="../tasks/fimtaskswidget.cpp" line="288"/>
<location filename="../tasks/fimtaskswidget.cpp" line="290"/>
<source>Task FIM</source>
<translation>Задача FIM</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="287"/>
<location filename="../tasks/fimtaskswidget.cpp" line="289"/>
<location filename="../tasks/fimtaskswidget.cpp" line="288"/>
<location filename="../tasks/fimtaskswidget.cpp" line="290"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="287"/>
<location filename="../tasks/fimtaskswidget.cpp" line="289"/>
<location filename="../tasks/fimtaskswidget.cpp" line="288"/>
<location filename="../tasks/fimtaskswidget.cpp" line="290"/>
<source>Status</source>
<translation>Статус</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="341"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="341"/>
<location filename="../tasks/fimtaskswidget.cpp" line="342"/>
<source>The deletion will be irrevocable.
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="374"/>
<location filename="../tasks/fimtaskswidget.cpp" line="375"/>
<source>Check Task</source>
<translation>Проверка задачи</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="388"/>
<source>New task</source>
<translation>Новая задача</translation>
</message>
<message>
<location filename="../tasks/fimtaskswidget.cpp" line="388"/>
<location filename="../tasks/fimtaskswidget.cpp" line="389"/>
<source>Assign this task?</source>
<translation>Назначить эту задачу?</translation>
</message>
@@ -731,50 +661,39 @@ Delete it anyway?</source>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="317"/>
<location filename="../instructorsandtraineeswidget.ui" line="391"/>
<location filename="../instructorsandtraineeswidget.cpp" line="386"/>
<location filename="../instructorsandtraineeswidget.cpp" line="402"/>
<location filename="../instructorsandtraineeswidget.cpp" line="385"/>
<location filename="../instructorsandtraineeswidget.cpp" line="401"/>
<source>none</source>
<translation>нет</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="127"/>
<location filename="../instructorsandtraineeswidget.cpp" line="443"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="127"/>
<location filename="../instructorsandtraineeswidget.cpp" line="128"/>
<source>The file could not be opened </source>
<translation>Файл не может быть открыт </translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="215"/>
<location filename="../instructorsandtraineeswidget.cpp" line="214"/>
<source>Instructor deauthorization</source>
<translation>Деавторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="215"/>
<location filename="../instructorsandtraineeswidget.cpp" line="214"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="255"/>
<source>Warning!</source>
<translation>Внимание!</translation>
<location filename="../instructorsandtraineeswidget.cpp" line="254"/>
<source>The server is not available!</source>
<translation>Сервер не доступен!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="255"/>
<source>The server is not available</source>
<translation>Сервер не доступен</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="443"/>
<location filename="../instructorsandtraineeswidget.cpp" line="442"/>
<source>Server settings have been changed. Please reconnect to the server.</source>
<translation>Настройки сервера изменены. Выполните переподключение к серверу.</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="189"/>
<location filename="../instructorsandtraineeswidget.cpp" line="290"/>
<location filename="../instructorsandtraineeswidget.cpp" line="289"/>
<source>Instructor authorization</source>
<translation>Авторизация инструктора</translation>
</message>
@@ -924,14 +843,6 @@ Delete it anyway?</source>
<translation>Только латинские буквы и цифры</translation>
</message>
</context>
<context>
<name>NotifyController</name>
<message>
<location filename="../connectorToServer/Core/notifycontroller.cpp" line="14"/>
<source>Error</source>
<translation>Ошибка</translation>
</message>
</context>
<context>
<name>PersonalCardTrainee</name>
<message>
@@ -1019,31 +930,65 @@ Delete it anyway?</source>
<context>
<name>RecognizeSystem</name>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="395"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="395"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="396"/>
<source>The file could not be opened </source>
<translation>Файл не может быть открыт </translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="455"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="456"/>
<source>You cannot delete the basic version!</source>
<translation>Вы не можете удалить базовую версию!</translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="460"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="461"/>
<source>You cannot delete the active version</source>
<translation>Вы не можете удалить активную версию</translation>
</message>
<message>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="465"/>
<location filename="../connectorToServer/Core/recognizesystem.cpp" line="466"/>
<source>This name already exists</source>
<translation>Это имя уже существует</translation>
</message>
</context>
<context>
<name>SpecialMessageBox</name>
<message>
<location filename="../specialmessagebox.ui" line="14"/>
<source>Dialog</source>
<translation></translation>
</message>
<message>
<location filename="../specialmessagebox.ui" line="46"/>
<source>text</source>
<translation></translation>
</message>
<message>
<location filename="../specialmessagebox.ui" line="89"/>
<source>Yes</source>
<translation>Да</translation>
</message>
<message>
<location filename="../specialmessagebox.ui" line="102"/>
<source>No</source>
<translation>Нет</translation>
</message>
<message>
<location filename="../specialmessagebox.cpp" line="16"/>
<location filename="../specialmessagebox.cpp" line="21"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../specialmessagebox.cpp" line="28"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../specialmessagebox.cpp" line="35"/>
<source>Information</source>
<translation>Информация</translation>
</message>
</context>
<context>
<name>TaskAMMFIMTreePreparation</name>
<message>