From 4def07ff689cb835870eb8df72b04a261e6d42f6 Mon Sep 17 00:00:00 2001 From: krivoshein Date: Thu, 27 Nov 2025 14:46:18 +0300 Subject: [PATCH] =?UTF-8?q?GUI.=20=D0=97=D0=B0=D0=BA=D1=80=D1=8B=D1=82?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D1=80=D0=B0=D1=81=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D0=BD=D0=B5=D0=BA=D1=82=D0=B5=20=D1=81=20=D0=A1=D0=B5=D1=80?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GUIdataBaseLMS/CMakeLists.txt | 1 + .../instructorsandtraineeswidget.cpp | 48 +++++++++++++++---- .../instructorsandtraineeswidget.h | 2 + 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/GUIdataBaseLMS/CMakeLists.txt b/GUIdataBaseLMS/CMakeLists.txt index 76da07e..b37ea64 100644 --- a/GUIdataBaseLMS/CMakeLists.txt +++ b/GUIdataBaseLMS/CMakeLists.txt @@ -26,6 +26,7 @@ target_include_directories(GUIdataBaseLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ target_include_directories(GUIdataBaseLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/widgets) target_include_directories(GUIdataBaseLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/specialmessagebox) target_include_directories(GUIdataBaseLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/settings) +target_include_directories(GUIdataBaseLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/authorization) if(PROJECT_TYPE_DEBUG) target_link_directories(GUIdataBaseLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees) else() diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp index aff4a6e..0465a35 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -23,6 +23,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) : messangerController(nullptr), dlgTasksCommon(nullptr), dlgSettings(nullptr), + dlgAuthorization(nullptr), adminMode(false), loginInstructorLoggedInLocal(QStringLiteral("")), nameInstructorLoggedInLocal(QStringLiteral("")), @@ -108,10 +109,25 @@ InstructorsAndTraineesWidget::~InstructorsAndTraineesWidget() deAuthorizationInstructor(loginInstructorLoggedInLocal); if(dlgTasksCommon) + { dlgTasksCommon->close(); + delete dlgTasksCommon; + dlgTasksCommon = nullptr; + } if(dlgSettings) + { dlgSettings->close(); + delete dlgSettings; + dlgSettings = nullptr; + } + + if(dlgAuthorization) + { + dlgAuthorization->close(); + delete dlgAuthorization; + dlgAuthorization = nullptr; + } delete messangerController; delete viewerInstructors; @@ -312,6 +328,13 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state) if(dlgSettings) dlgSettings->deactivate(); + if(dlgAuthorization) + { + dlgAuthorization->close(); + delete dlgAuthorization; + dlgAuthorization = nullptr; + } + messangerController->deleteAllWidgets(); loginInstructorLoggedInLocal = ""; @@ -403,23 +426,24 @@ void InstructorsAndTraineesWidget::slot_ConnectToServer() bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent) { - DialogAuthorization dlg(parent); - dlg.setWindowTitle(tr("Instructor authorization")); - dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint); - dlg.setStyleSheet(this->styleSheet()); + dlgAuthorization = new DialogAuthorization(parent); + + dlgAuthorization->setWindowTitle(tr("Instructor authorization")); + dlgAuthorization->setWindowFlags(dlgAuthorization->windowFlags() & ~Qt::WindowContextHelpButtonHint); + dlgAuthorization->setStyleSheet(this->styleSheet()); #ifdef PROJECT_TYPE_DEBUG - dlg.setLogin("admin"); - dlg.setPassword("admin"); + dlgAuthorization->setLogin("admin"); + dlgAuthorization->setPassword("admin"); #endif do { - switch( dlg.exec() ) + switch( dlgAuthorization->exec() ) { case QDialog::Accepted: { - QString login = dlg.getLogin(); - QString password = dlg.getPassword(); + QString login = dlgAuthorization->getLogin(); + QString password = dlgAuthorization->getPassword(); // Вычисление MD5 хэша password = HashTools::hashingMD5string(password); @@ -440,6 +464,12 @@ bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent } while(true); + if(dlgAuthorization) + { + delete dlgAuthorization; + dlgAuthorization = nullptr; + } + return false; } diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.h b/InstructorsAndTrainees/instructorsandtraineeswidget.h index 7f2dc8d..307754b 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.h +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.h @@ -12,6 +12,7 @@ #include "metatypes.h" #include "dialogtaskscommon.h" #include "dialogsettings.h" +#include "dialogauthorization.h" namespace Ui { @@ -103,6 +104,7 @@ private: DialogTasksCommon* dlgTasksCommon; DialogSettings* dlgSettings; + DialogAuthorization* dlgAuthorization; bool adminMode; QString loginInstructorLoggedInLocal;