feat: add server blocked behaviour

This commit is contained in:
semenov
2024-09-12 12:16:41 +03:00
parent a831e29ddc
commit 23982ecd6b
26 changed files with 172 additions and 114 deletions

View File

@@ -52,6 +52,7 @@ void MainWindow::initialize()
connect(recognizeSystem,&RecognizeSystem::sigSocketDisabled,this,&MainWindow::lostConnection);
connect(recognizeSystem,&RecognizeSystem::sigSaveLoginData,this,&MainWindow::checkLoginResult);
connect(recognizeSystem,&RecognizeSystem::sigSocketWaitForReadyRead,client,&TCPClient::waitRead,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigServerBlocked,this,&MainWindow::serverBlocked);
connect(client,&TCPClient::sigGetXmlAnswer,dataParser,&DataParser::slotGetXmlAnswer);
@@ -140,6 +141,18 @@ void MainWindow::lostConnection()
slotConnectionState(false);
}
void MainWindow::serverBlocked()
{
ui->notificationLabel->show();
QPalette palette = ui->notificationLabel->palette();
QColor orangeColor(255,165,0);
palette.setColor(ui->notificationLabel->foregroundRole(),orangeColor);
ui->notificationLabel->setText(tr("Сервер заблокирован"));
ui->notificationLabel->setPalette(palette);
timer->start(3000);
}
void MainWindow::checkLoginResult(ServerAuthorization *serverAuth)
{
if (serverAuth->Result){
@@ -287,8 +300,8 @@ void MainWindow::on_updateButton_clicked()
void MainWindow::on_startButton_clicked()
{
client->sendUnityConnect();
externalExecuter->callApp();
client->sendDisable();
}