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;