Авто подключение работает

This commit is contained in:
2025-11-24 18:19:28 +03:00
parent 4bdfb8163a
commit f2d7557f19
3 changed files with 13 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
#include <QMessageBox>
#include <QThread>
#include <QTimer>
#include "instructorsandtraineeswidget.h"
#include "ui_instructorsandtraineeswidget.h"
#include "dialogauthorization.h"
@@ -46,7 +47,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
setLanguageInterfase();
connectorToServer = new ConnectorToServer(this);
connectorToServer = new ConnectorToServer(/*this*/nullptr);
connect(connectorToServer, &ConnectorToServer::sigLoginResult, this, &InstructorsAndTraineesWidget::slot_checkLoginResult);
connect(connectorToServer, &ConnectorToServer::sigDeLoginResult, this, &InstructorsAndTraineesWidget::slot_checkDeLoginResult);
connect(connectorToServer,&ConnectorToServer::signal_AnswerDocsChanged,this, &InstructorsAndTraineesWidget::slot_AnswerDocsChanged);
@@ -296,9 +297,8 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
{
if(cntTryConnectToServer < 10)
{
QThread::sleep(1);
cntTryConnectToServer++;
connectorToServer->SetConnectToServer();
QTimer::singleShot(1000, this, SLOT(slot_ConnectToServer()));
}
else
{
@@ -366,6 +366,12 @@ void InstructorsAndTraineesWidget::slot_AnswerDocsChanged()
viewerTrainees->getAmmTasksWidgetCommon()->setDocsActualed(false);
}
void InstructorsAndTraineesWidget::slot_ConnectToServer()
{
updateLabelServer();
connectorToServer->SetConnectToServer();
}
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
{
DialogAuthorization dlg(parent);
@@ -429,7 +435,7 @@ void InstructorsAndTraineesWidget::on_btnConnectionToServer_clicked()
updateLabelServer();
connectorToServer->SetConnectToServer();
QTimer::singleShot(1000, this, SLOT(slot_ConnectToServer()));
}
void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()