mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
GUI. Закрытие диалогов при расконнекте с Сервером
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user