Сделал очищение списков Обучаемых и инструкторов при деавторизации

This commit is contained in:
krivoshein
2025-01-23 12:04:59 +03:00
parent 1ca29b9642
commit 6a86ae9909
2 changed files with 17 additions and 3 deletions

View File

@@ -39,6 +39,10 @@ public:
{ {
this->authComplited = authComplited; this->authComplited = authComplited;
} }
void clearTree()
{
treeWidget->clear();
}
protected: protected:
void setArchiveVisible(bool archiveVisible) void setArchiveVisible(bool archiveVisible)

View File

@@ -38,8 +38,8 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
connect(viewerInstructors, &ViewerInstructors::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization); connect(viewerInstructors, &ViewerInstructors::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
connect(viewerTrainees, &ViewerTrainees::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization); connect(viewerTrainees, &ViewerTrainees::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI); //connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI);
connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI); //connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI);
connect(connectorToServer,&ConnectorToServer::signal_ConnectedToServer,this,&InstructorsAndTraineesWidget::slot_ConnectedToServer); connect(connectorToServer,&ConnectorToServer::signal_ConnectedToServer,this,&InstructorsAndTraineesWidget::slot_ConnectedToServer);
@@ -194,7 +194,7 @@ void InstructorsAndTraineesWidget::checkDeLoginResult(ServerDeAuthorization *ser
viewerInstructors->setAuthComplited(false); viewerInstructors->setAuthComplited(false);
viewerTrainees->setAuthComplited(false); viewerTrainees->setAuthComplited(false);
Q_EMIT signal_NeedUpdateUI(true, false); //Q_EMIT signal_NeedUpdateUI(true, false);
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor")); ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
updateLabelLoggedInInstructor("",""); updateLabelLoggedInInstructor("","");
@@ -225,6 +225,9 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
ui->btnAuthorizationInstructor->setChecked(false); ui->btnAuthorizationInstructor->setChecked(false);
ui->btnSetVersion->hide(); ui->btnSetVersion->hide();
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png"))); ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
viewerTrainees->clearTree();
viewerInstructors->clearTree();
} }
} }
@@ -284,6 +287,8 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
{//Авторизация Инструктора локальная (Администратора) {//Авторизация Инструктора локальная (Администратора)
if(authorizationInstructorDialog(this)) if(authorizationInstructorDialog(this))
{ {
connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI);
connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI);
} }
else else
ui->btnAuthorizationInstructor->setChecked(false); ui->btnAuthorizationInstructor->setChecked(false);
@@ -294,6 +299,11 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
{ {
if(deAuthorizationInstructor(loginInstructorLoggedInLocal)) if(deAuthorizationInstructor(loginInstructorLoggedInLocal))
{ {
disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI);
disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI);
viewerTrainees->clearTree();
viewerInstructors->clearTree();
} }
else else
ui->btnAuthorizationInstructor->setChecked(true); ui->btnAuthorizationInstructor->setChecked(true);