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

@@ -413,7 +413,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
QFile xmlInFile(xmlFileName);
if (!xmlInFile.open(QFile::ReadOnly | QFile::Text))
{
SpecMsgBox(nullptr, SpecMsgBox::TypeSpecMsgBox::criticalClose, tr("The file could not be opened ") + xmlFileName).exec();
SpecMsgBox::CriticalClose(nullptr, tr("The file could not be opened ") + xmlFileName);
return;
}
else
@@ -490,17 +490,17 @@ void RecognizeSystem::xmlParser(QByteArray array)
if (value == "BASEDELETETRY")
{
emit sigNotify(tr("You cannot delete the basic version!"));
emit sigNotifyVersionControl(tr("You cannot delete the basic version!"));
}
if (value == "TRYACTIVEDELETE")
{
emit sigNotify(tr("You cannot delete the active version"));
emit sigNotifyVersionControl(tr("You cannot delete the active version"));
}
if (value == "DUPLICATEVERNAME")
{
emit sigNotify(tr("This name already exists"));
emit sigNotifyVersionControl(tr("This name already exists"));
}
}
}

View File

@@ -56,7 +56,7 @@ signals:
void sigAnswerQueryTasksXML_AMM(QByteArray array);
void sigShowServerDataList(QList<StreamingVersionData*> *versions);
void sigSetVersion(StreamingVersionData* serverVersion);
void sigNotify(QString text, QWidget *parentWidget = nullptr);
void sigNotifyVersionControl(QString text);
void sigAnimationActivated(bool flag);
void sigHashReady();
void sigAnswerQuerySubProc(QList<SubProc> listSubProc, QString parentTask_dmCode);

View File

@@ -9,7 +9,6 @@ ConnectorToServer::ConnectorToServer(QWidget* parentWidget, QObject *parent) :
dataParser(nullptr),
sendSystem(nullptr),
recognizeSystem(nullptr),
notifyController(nullptr),
fl_GetedOfflineMessages(false),
nameInstructorLoggedInLocal("")
{
@@ -19,7 +18,6 @@ ConnectorToServer::ConnectorToServer(QWidget* parentWidget, QObject *parent) :
ConnectorToServer::~ConnectorToServer()
{
delete client;
delete notifyController;
delete recognizeSystem;
delete sendSystem;
delete dataParser;
@@ -115,6 +113,11 @@ void ConnectorToServer::slot_getVersion()
emit signal_SendGetVersion();
}
void ConnectorToServer::slot_NotifyVersionControl(QString text)
{
emit signal_NotifyVersionControl(text);
}
void ConnectorToServer::initialize()
{
createObjects();
@@ -159,7 +162,7 @@ void ConnectorToServer::bindConnection()
connect(client,&TCPClient::signal_ConnectedToServer,this,&ConnectorToServer::signal_ConnectedToServer,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigNotifyVersionControl,this,&ConnectorToServer::slot_NotifyVersionControl,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigHashReady,this,&ConnectorToServer::slot_HashReady);
@@ -190,8 +193,6 @@ void ConnectorToServer::createObjects()
recognizeSystem = new RecognizeSystem;
recognizeSystem->moveToThread(connectionThread);
notifyController = new NotifyController(parentWidget);
connectionThread->start();
connectionThread->setPriority(QThread::HighestPriority);
}

View File

@@ -116,6 +116,8 @@ public slots:
void slot_getVersion();
void slot_NotifyVersionControl(QString text);
signals:
void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
void sigStopConnect();
@@ -157,6 +159,8 @@ signals:
void signal_showServerList(QList<StreamingVersionData*> *serverList);
void signal_SendGetVersion();
void signal_NotifyVersionControl(QString text);
private:
void initialize();
void bindConnection();
@@ -169,7 +173,6 @@ private:
DataParser *dataParser;
SendSystem *sendSystem;
RecognizeSystem *recognizeSystem;
NotifyController *notifyController;
//Списочная модель БД СУО
QMutex mtxAccess;

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

View File

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

View File

@@ -57,6 +57,7 @@ void DialogVersionControl::initialize(QString authorName)
connect(connectorToServer, &ConnectorToServer::signal_AnimationActivated, this, &DialogVersionControl::slot_activateLoadAnimation);
connect(connectorToServer, &ConnectorToServer::signal_showServerList, this, &DialogVersionControl::slot_showServerList);
connect(connectorToServer, &ConnectorToServer::signal_NotifyVersionControl, this, &DialogVersionControl::slot_NotifyVersionControl);
connect(this, &DialogVersionControl::sigSendSwitchVersion, connectorToServer, &ConnectorToServer::slot_SendSwitchVersion);
connect(this, &DialogVersionControl::sigSendCopyVersion, connectorToServer, &ConnectorToServer::slot_SendCopyVersion);
@@ -114,7 +115,7 @@ void DialogVersionControl::sendCopyEmit(QString newName)
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox::WarningClose(this, text);
return;
}
@@ -127,7 +128,7 @@ void DialogVersionControl::on_createDuplicateButton_clicked()
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox::WarningClose(this, text);
return;
}
@@ -160,7 +161,7 @@ void DialogVersionControl::on_deleteVersionButton_clicked()
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox::WarningClose(this, text);
return;
}
@@ -172,7 +173,7 @@ void DialogVersionControl::on_switchServerVersionButton_clicked()
if (selectedVersion == nullptr)
{
QString text = tr("Version not selected");
SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox::WarningClose(this, text);
return;
}
@@ -209,6 +210,11 @@ void DialogVersionControl::slot_SetVersion(StreamingVersionData *serverVersion)
flGetVersion = true;
}
void DialogVersionControl::slot_NotifyVersionControl(QString text)
{
SpecMsgBox::WarningClose(this, text);
}
void DialogVersionControl::resizeEvent(QResizeEvent *event)
{
QSize size = event->size();

View File

@@ -39,6 +39,7 @@ private slots:
void slot_activateLoadAnimation(bool flag);
void slot_showServerList(QList<StreamingVersionData*> *serverList);
void slot_SetVersion(StreamingVersionData* serverVersion);
void slot_NotifyVersionControl(QString text);
signals:
void sigSendDeleteVersion(StreamingVersionData *streaming);

View File

@@ -13,7 +13,7 @@ NotifyController::NotifyController(QWidget *parentWidget, QObject *parent) :
void NotifyController::showWarning(QString text, QWidget *parentWidget)
{
if(parentWidget)
SpecMsgBox(parentWidget, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox::WarningClose(parentWidget, text);
else
SpecMsgBox(this->parentWidget, SpecMsgBox::TypeSpecMsgBox::warningClose, text).exec();
SpecMsgBox::WarningClose(this->parentWidget, text);
}

View File

@@ -45,29 +45,29 @@ SpecMsgBox::~SpecMsgBox()
delete ui;
}
int SpecMsgBox::WarningYesNo(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
int SpecMsgBox::WarningYesNo(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::warningYesNo, text);
return SpecMsgBox::work(parent, TypeSpecMsgBox::warningYesNo, text);
}
int SpecMsgBox::WarningClose(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
int SpecMsgBox::WarningClose(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::warningClose, text);
return SpecMsgBox::work(parent, TypeSpecMsgBox::warningClose, text);
}
int SpecMsgBox::CriticalClose(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
int SpecMsgBox::CriticalClose(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::criticalClose, text);
return SpecMsgBox::work(parent, TypeSpecMsgBox::criticalClose, text);
}
int SpecMsgBox::InfoOk(SpecMsgBox *msgBox, QWidget *parent, const QString &text)
int SpecMsgBox::InfoOk(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(msgBox, parent, TypeSpecMsgBox::infoOk, text);
return SpecMsgBox::work(parent, TypeSpecMsgBox::infoOk, text);
}
int SpecMsgBox::work(SpecMsgBox *msgBox, QWidget *parent, TypeSpecMsgBox type, const QString& text)
int SpecMsgBox::work(QWidget *parent, TypeSpecMsgBox type, const QString& text)
{
msgBox = new SpecMsgBox(parent, type, text);
SpecMsgBox *msgBox = new SpecMsgBox(parent, type, text);
return msgBox->exec();
}

View File

@@ -19,18 +19,19 @@ public:
infoOk
};
public:
private:
explicit SpecMsgBox(QWidget *parent, TypeSpecMsgBox type, const QString& text);
public:
~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);
static int WarningYesNo(QWidget *parent, const QString& text);
static int WarningClose(QWidget *parent, const QString& text);
static int CriticalClose(QWidget *parent, const QString& text);
static int InfoOk(QWidget *parent, const QString& text);
private:
static int work(SpecMsgBox* msgBox, QWidget *parent, TypeSpecMsgBox type, const QString& text);
static int work(QWidget *parent, TypeSpecMsgBox type, const QString& text);
private slots:
void on_btnYes_clicked();

View File

@@ -22,7 +22,6 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
waitAnimationWidget(nullptr),
dlgCheckerTask(nullptr),
dlgListSubProc(nullptr),
specialMessageBox(nullptr),
flOnlyActive(false),
lastCurrentID(0)
{
@@ -157,8 +156,6 @@ void AMMtasksWidget::closeChildDlg()
dlgCheckerTask->close();
if(dlgListSubProc)
dlgListSubProc->close();
if(specialMessageBox)
specialMessageBox->close();
}
void AMMtasksWidget::changeEvent(QEvent *event)
@@ -329,16 +326,10 @@ void AMMtasksWidget::slot_UpdateSubProcForDMCode(QString dmCode)
lastSelectedTask.listSubProc.clear();
dlgListSubProc->getListCheckedSubProc(&lastSelectedTask.listSubProc);
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
if(specialMessageBox->exec() == QDialog::Accepted)
if(SpecMsgBox::WarningYesNo(this, tr("Assign this task?")) == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask);
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
break;
}
case QDialog::Rejected:
@@ -357,16 +348,10 @@ void AMMtasksWidget::slot_UpdateSubProcForDMCode(QString dmCode)
{
lastSelectedTask.listSubProc.clear();
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
if(specialMessageBox->exec() == QDialog::Accepted)
if(SpecMsgBox::WarningYesNo(this, tr("Assign this task?")) == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask);
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
}
}
}
@@ -520,18 +505,11 @@ void AMMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
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_TASK_AMM_TO_TRAINEE, id);
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
}
}
}

View File

@@ -103,8 +103,6 @@ private:
DialogListSubProc* dlgListSubProc;
SpecMsgBox* specialMessageBox;
bool flOnlyActive; //AMM
int lastCurrentID;

View File

@@ -8,7 +8,6 @@ CheckerTask::CheckerTask(ConnectorToServer* connectorToServer, QString type, QWi
ui(new Ui::CheckerTask),
connectorToServer(connectorToServer),
fimTasksWidget(nullptr),
specialMessageBox(nullptr),
flChanged(false),
id_task(0),
type("fim")
@@ -49,19 +48,13 @@ CheckerTask::~CheckerTask()
delete fimTasksWidget;
fimTasksWidget = nullptr;
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
delete ui;
}
void CheckerTask::closeEvent(QCloseEvent *event)
{
if(specialMessageBox)
specialMessageBox->close();
}
void CheckerTask::setTask(TaskAmmFim* task)
@@ -183,18 +176,12 @@ void CheckerTask::on_btnWrong_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'new'");
}
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, msgString);
if(specialMessageBox->exec() == QDialog::Accepted)
if(SpecMsgBox::WarningYesNo(this, msgString) == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close();
flChanged = true;
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
}
void CheckerTask::on_btnRight_clicked()
@@ -216,16 +203,10 @@ void CheckerTask::on_btnRight_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
}
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, msgString);
if(specialMessageBox->exec() == QDialog::Accepted)
if(SpecMsgBox::WarningYesNo(this, msgString) == QDialog::Accepted)
{
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close();
flChanged = true;
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
}

View File

@@ -48,8 +48,6 @@ private:
ConnectorToServer* connectorToServer;
FIMtasksWidget* fimTasksWidget;
SpecMsgBox* specialMessageBox;
bool flChanged;
int id_task;
QString type;

View File

@@ -22,7 +22,6 @@ FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
taskTreePreparation(nullptr),
waitAnimationWidget(nullptr),
dlgCheckerTask(nullptr),
specialMessageBox(nullptr),
userName(""),
lastCurrentID(0)
{
@@ -103,8 +102,6 @@ FIMtasksWidget::~FIMtasksWidget()
if(dlgCheckerTask)
dlgCheckerTask->close();
if(specialMessageBox)
specialMessageBox->close();
delete ui;
}
@@ -140,8 +137,6 @@ void FIMtasksWidget::closeChildDlg()
{
if(dlgCheckerTask)
dlgCheckerTask->close();
if(specialMessageBox)
specialMessageBox->close();
}
void FIMtasksWidget::changeEvent(QEvent *event)
@@ -401,17 +396,11 @@ void FIMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeFIM::clmnFIM_ID).toInt();
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_TASK_FIM_TO_TRAINEE, id);
}
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
}
}
}
@@ -451,14 +440,8 @@ void FIMtasksWidget::on_btnCheck_clicked()
void FIMtasksWidget::on_btnAssignTask_clicked()
{
specialMessageBox = new SpecMsgBox(this, SpecMsgBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?"));
if(specialMessageBox->exec() == QDialog::Accepted)
if(SpecMsgBox::WarningYesNo(this, tr("Assign this task?")) == QDialog::Accepted)
assignTaskFIMtoTrainee();
if(specialMessageBox)
{
delete specialMessageBox;
specialMessageBox = nullptr;
}
}
void FIMtasksWidget::updateTaskItem(QTreeWidgetItem *itemTask)

View File

@@ -92,8 +92,6 @@ private:
DialogChekerTask* dlgCheckerTask;
SpecMsgBox* specialMessageBox;
QString userName; //FIM
int lastCurrentID;

View File

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

View File

@@ -49,7 +49,6 @@ private:
DialogEditTrainee* dlgEditTrainee;
DialogEditGroup* dlgEditGroup;
SpecMsgBox* specialMessageBox;
};
#endif // DIALOGTRAINEESGROUPS_H