Отработка BUSSY

This commit is contained in:
2025-11-27 13:25:30 +03:00
parent f0e04954ed
commit b0f02e742a
5 changed files with 45 additions and 1 deletions

View File

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

View File

@@ -107,6 +107,7 @@ public slots:
void slot_showServerList(QList<StreamingVersionData*> *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);

View File

@@ -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,6 +352,8 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
updateLabelServer();
flTryLogin = false;
}
}
@@ -402,6 +424,10 @@ bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent
// Вычисление MD5 хэша
password = HashTools::hashingMD5string(password);
waitAnimationWidget->showWithPlay();
flTryLogin = true;
connectorToServer->sendAuthorizationInstructorLocal(login, password);
return true;

View File

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

View File

@@ -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);
//Извещаем об изменениях в авторизации