mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
refact
This commit is contained in:
@@ -284,10 +284,13 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization
|
||||
ui->btnPersonalCard->setEnabled(false);
|
||||
|
||||
updateLabelLoggedInInstructor(instructorLoggedInLocal);
|
||||
|
||||
waitAnimationWidget->hideWithStop();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->btnAuthorizationInstructor->setChecked(true);
|
||||
waitAnimationWidget->hideWithStop();
|
||||
SpecMsgBox::CriticalClose(this, tr("Instructor deauthorization") + "\n" + tr("Error!"));
|
||||
}
|
||||
}
|
||||
@@ -300,7 +303,7 @@ void InstructorsAndTraineesWidget::slot_ServerBlocked()
|
||||
waitAnimationWidget->hideWithStop();
|
||||
|
||||
ui->btnAuthorizationInstructor->setChecked(false);
|
||||
SpecMsgBox::WarningClose(this, tr("Instructor authorization.") + "\n" + tr("Server blocked!"));
|
||||
SpecMsgBox::WarningClose(this, tr("Instructor authorization is temporarily unavailable.") + "\n" + tr("Server blocked!") + "\n" + tr("Try again later."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,6 +599,8 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
|
||||
{//ДеАвторизация Инструктора локальная (Администратора)
|
||||
if(authorizationIsCompleted())
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
|
||||
if(deAuthorizationInstructor(instructorLoggedInLocal.getLogin()))
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#define NOTIFY_ERROR_AUTH_ALREADYLOGIN "ERROR_AUTH_ALREADYLOGIN"
|
||||
#define NOTIFY_SERVER_END "END"
|
||||
#define NOTIFY_SERVER_BLOCKED "BLOCKED"
|
||||
#define SERVER_HELLO "NewConnection. I am server LMS!"
|
||||
|
||||
enum EStateServer{started, stoped};
|
||||
enum EStateBlockAutorization{blocked, unblocked};
|
||||
|
||||
@@ -111,7 +111,7 @@ void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType)
|
||||
{
|
||||
ClientHandler *handler = clientsMap->value(idSocket);
|
||||
|
||||
if(packetType != PacketType::BUSY && packetType != PacketType::FREE)
|
||||
//if(packetType != PacketType::BUSY && packetType != PacketType::FREE)
|
||||
if (!handler->getClient()->getIsLoggedIn()) continue;
|
||||
|
||||
handler->sendPacketType(packetType);
|
||||
|
||||
@@ -96,6 +96,14 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
||||
{
|
||||
client->sendVersion();
|
||||
|
||||
//Отправляем состояние блокировки
|
||||
/**/
|
||||
if(server->getStateBlockAutorization() == EStateBlockAutorization::blocked)
|
||||
client->sendPacketType(PacketType::BUSY);
|
||||
else
|
||||
client->sendPacketType(PacketType::FREE);
|
||||
|
||||
|
||||
//client->sendPacketType(PacketType::BUSY);
|
||||
//client->sendPacketType(PacketType::FREE);
|
||||
|
||||
|
||||
@@ -231,11 +231,6 @@ void SendSystem::sendPacketType(PacketType packetType)
|
||||
|
||||
}
|
||||
|
||||
void SendSystem::sendHello()
|
||||
{
|
||||
socket->write(SERVER_HELLO);
|
||||
}
|
||||
|
||||
void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
|
||||
{
|
||||
qDebug() << "SendSystemThread: " << QThread::currentThreadId();
|
||||
|
||||
@@ -29,7 +29,6 @@ public:
|
||||
void sendFolderBlock(QString path);
|
||||
void sendDeleteBlock(QString path);
|
||||
void sendPacketType(PacketType packet);
|
||||
void sendHello();
|
||||
void sendNotify(QString notify);
|
||||
void sendStop();
|
||||
void sendDocs(QString docPath);
|
||||
|
||||
@@ -39,7 +39,7 @@ void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget,
|
||||
client = new Client(peerName,peerAddress,peerPort,socket);
|
||||
|
||||
connect(this,&ClientHandler::sigSendXmlAnswer,sendSystem,&SendSystem::sendXmlAnswer,Qt::AutoConnection);
|
||||
connect(this,&ClientHandler::sigInitSender,sendSystem,&SendSystem::initialize,Qt::AutoConnection);
|
||||
connect(this,&ClientHandler::sigInitSender,sendSystem,&SendSystem::initialize,Qt::AutoConnection/*Qt::DirectConnection*/);
|
||||
connect(this,&ClientHandler::sigFileBlock,sendSystem,&SendSystem::sendFileBlock,Qt::AutoConnection);
|
||||
connect(this,&ClientHandler::sigFileBlockByteArray,sendSystem,&SendSystem::sendFileBlockByteArray,Qt::AutoConnection);
|
||||
connect(this,&ClientHandler::sigFolderBlock,sendSystem,&SendSystem::sendFolderBlock,Qt::AutoConnection);
|
||||
@@ -61,6 +61,7 @@ void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget,
|
||||
sendSystem->setClient(client,socket);
|
||||
emit sigInitSender(dataParser,serverWidget->getMutex());
|
||||
|
||||
Logger::instance().log("SERVER: Client connected");
|
||||
}
|
||||
|
||||
void ClientHandler::setClient(Client *value)
|
||||
|
||||
@@ -18,20 +18,22 @@ void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
|
||||
{
|
||||
ClientHandler* newClient = new ClientHandler;
|
||||
|
||||
connect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize,Qt::AutoConnection);
|
||||
connect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize, Qt::AutoConnection/*Qt::DirectConnection*/);
|
||||
connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::AutoConnection);
|
||||
emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser);
|
||||
disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize);
|
||||
|
||||
addClient(socketDesriptor,newClient);
|
||||
|
||||
Logger::instance().log("To Client: " + QString(SERVER_HELLO));
|
||||
//Logger::instance().log("To Client: " + QString(SERVER_HELLO));
|
||||
|
||||
//Отправляем состояние блокировки
|
||||
/*
|
||||
if(getStateBlockAutorization() == EStateBlockAutorization::blocked)
|
||||
newClient->sendPacketType(PacketType::BUSY);
|
||||
else
|
||||
newClient->sendPacketType(PacketType::FREE);
|
||||
newClient->sendPacketType(PacketType::FREE);*/
|
||||
|
||||
}
|
||||
|
||||
bool MultiThreadServer::startServer()
|
||||
|
||||
Reference in New Issue
Block a user