From b0f02e742a8cd0650a6adc6a9b6d95297bd2deb0 Mon Sep 17 00:00:00 2001 From: krivoshein Date: Thu, 27 Nov 2025 13:25:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20BUSSY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connectorToServer/connectortoserver.cpp | 8 ++++++ .../connectorToServer/connectortoserver.h | 2 ++ .../instructorsandtraineeswidget.cpp | 28 ++++++++++++++++++- .../instructorsandtraineeswidget.h | 5 ++++ ServerLMS/Systems/processingsystem.cpp | 3 ++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/InstructorsAndTrainees/connectorToServer/connectortoserver.cpp b/InstructorsAndTrainees/connectorToServer/connectortoserver.cpp index 00c962e..d82e95b 100644 --- a/InstructorsAndTrainees/connectorToServer/connectortoserver.cpp +++ b/InstructorsAndTrainees/connectorToServer/connectortoserver.cpp @@ -85,6 +85,11 @@ void ConnectorToServer::slot_Auth(ServerAuthorization *serverAuth) emit sigLoginResult(serverAuth); } +void ConnectorToServer::slot_ServerBlocked() +{ + emit sigServerBlocked(); +} + void ConnectorToServer::slot_SendDeleteVersion(StreamingVersionData *streaming) { emit signal_SendDeleteVersion(streaming); @@ -126,6 +131,9 @@ void ConnectorToServer::bindConnection() connect(recognizeSystem,&RecognizeSystem::sigAuth,this,&ConnectorToServer::slot_Auth); connect(recognizeSystem,&RecognizeSystem::sigDeAuth,this,&ConnectorToServer::sigDeLoginResult); + + connect(recognizeSystem,&RecognizeSystem::sigServerBlocked,this,&ConnectorToServer::slot_ServerBlocked); + connect(recognizeSystem,&RecognizeSystem::signal_ReceiveMessage,this,&ConnectorToServer::signal_receiveMessage,Qt::AutoConnection); connect(recognizeSystem,&RecognizeSystem::sigShowServerDataList,this,&ConnectorToServer::slot_showServerList); diff --git a/InstructorsAndTrainees/connectorToServer/connectortoserver.h b/InstructorsAndTrainees/connectorToServer/connectortoserver.h index 7b16c0c..d4663bb 100644 --- a/InstructorsAndTrainees/connectorToServer/connectortoserver.h +++ b/InstructorsAndTrainees/connectorToServer/connectortoserver.h @@ -107,6 +107,7 @@ public slots: void slot_showServerList(QList *serverList); void slot_HashReady(); void slot_Auth(ServerAuthorization * serverAuth); + void slot_ServerBlocked(); void slot_SendDeleteVersion(StreamingVersionData *streaming); void slot_SendSwitchVersion(StreamingVersionData *selectVersion); @@ -123,6 +124,7 @@ signals: void sigLoginResult(ServerAuthorization * serverAuth); void sigDeLoginResult(ServerDeAuthorization * serverDeAuth); + void sigServerBlocked(); void signal_UpdateDB(bool treeInstructor, bool treeTrainee); diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp index c47337d..aff4a6e 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -31,6 +31,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) : flSettingsServerIsChanged(false), flTryConnectToServer(false), cntTryConnectToServer(0), + flTryLogin(false), ui(new Ui::InstructorsAndTraineesWidget) { ui->setupUi(this); @@ -51,6 +52,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) : connectorToServer = new ConnectorToServer(this); connect(connectorToServer, &ConnectorToServer::sigLoginResult, this, &InstructorsAndTraineesWidget::slot_checkLoginResult); connect(connectorToServer, &ConnectorToServer::sigDeLoginResult, this, &InstructorsAndTraineesWidget::slot_checkDeLoginResult); + connect(connectorToServer, &ConnectorToServer::sigServerBlocked, this, &InstructorsAndTraineesWidget::slot_ServerBlocked); connect(connectorToServer,&ConnectorToServer::signal_AnswerDocsChanged,this, &InstructorsAndTraineesWidget::slot_AnswerDocsChanged); messangerController = new MessangerController(connectorToServer, this); @@ -219,12 +221,18 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se viewerTrainees->activate(); viewerInstructors->activate(); + + waitAnimationWidget->hideWithStop(); } else { + waitAnimationWidget->hideWithStop(); + ui->btnAuthorizationInstructor->setChecked(false); SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor authorization.") + "\n" + tr("Invalid login or password!")).exec(); } + + flTryLogin = false; } void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization *serverDeAuth) @@ -253,6 +261,18 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization } } +void InstructorsAndTraineesWidget::slot_ServerBlocked() +{ + if(flTryLogin) + { + flTryLogin = false; + waitAnimationWidget->hideWithStop(); + + ui->btnAuthorizationInstructor->setChecked(false); + SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Attention!") + "\n" + tr("Server blocked!")).exec(); + } +} + void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state) { if(state) @@ -332,7 +352,9 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state) updateLabelServer(); - } + + flTryLogin = false; + } } void InstructorsAndTraineesWidget::slot_traineeSelected(int id_trainee) @@ -402,6 +424,10 @@ bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent // Вычисление MD5 хэша password = HashTools::hashingMD5string(password); + waitAnimationWidget->showWithPlay(); + + flTryLogin = true; + connectorToServer->sendAuthorizationInstructorLocal(login, password); return true; diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.h b/InstructorsAndTrainees/instructorsandtraineeswidget.h index 2b9b19d..7f2dc8d 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.h +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.h @@ -51,6 +51,9 @@ public Q_SLOTS: void slot_checkLoginResult(ServerAuthorization * serverAuth); //Слот обработки результата деавторизации void slot_checkDeLoginResult(ServerDeAuthorization * serverDeAuth); + + void slot_ServerBlocked(); + //Слот обработки результата подключения к серверу void slot_ConnectedToServer(bool state); @@ -114,6 +117,8 @@ private: bool flTryConnectToServer; int cntTryConnectToServer; + bool flTryLogin; + Ui::InstructorsAndTraineesWidget *ui; }; diff --git a/ServerLMS/Systems/processingsystem.cpp b/ServerLMS/Systems/processingsystem.cpp index 0f06f91..61d5997 100644 --- a/ServerLMS/Systems/processingsystem.cpp +++ b/ServerLMS/Systems/processingsystem.cpp @@ -93,6 +93,9 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien client->sendXmlAnswer(arrayAnswer); client->sendVersion(); + //client->sendPacketType(PacketType::BUSY); + //client->sendPacketType(PacketType::FREE); + QString str = QString(arrayAnswer); //logger->addTextToLogger("To Client: " + str); //Извещаем об изменениях в авторизации