mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +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/widgets)
|
||||||
target_include_directories(GUIdataBaseLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/specialmessagebox)
|
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/settings)
|
||||||
|
target_include_directories(GUIdataBaseLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/authorization)
|
||||||
if(PROJECT_TYPE_DEBUG)
|
if(PROJECT_TYPE_DEBUG)
|
||||||
target_link_directories(GUIdataBaseLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees)
|
target_link_directories(GUIdataBaseLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
|||||||
messangerController(nullptr),
|
messangerController(nullptr),
|
||||||
dlgTasksCommon(nullptr),
|
dlgTasksCommon(nullptr),
|
||||||
dlgSettings(nullptr),
|
dlgSettings(nullptr),
|
||||||
|
dlgAuthorization(nullptr),
|
||||||
adminMode(false),
|
adminMode(false),
|
||||||
loginInstructorLoggedInLocal(QStringLiteral("")),
|
loginInstructorLoggedInLocal(QStringLiteral("")),
|
||||||
nameInstructorLoggedInLocal(QStringLiteral("")),
|
nameInstructorLoggedInLocal(QStringLiteral("")),
|
||||||
@@ -108,10 +109,25 @@ InstructorsAndTraineesWidget::~InstructorsAndTraineesWidget()
|
|||||||
deAuthorizationInstructor(loginInstructorLoggedInLocal);
|
deAuthorizationInstructor(loginInstructorLoggedInLocal);
|
||||||
|
|
||||||
if(dlgTasksCommon)
|
if(dlgTasksCommon)
|
||||||
|
{
|
||||||
dlgTasksCommon->close();
|
dlgTasksCommon->close();
|
||||||
|
delete dlgTasksCommon;
|
||||||
|
dlgTasksCommon = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if(dlgSettings)
|
if(dlgSettings)
|
||||||
|
{
|
||||||
dlgSettings->close();
|
dlgSettings->close();
|
||||||
|
delete dlgSettings;
|
||||||
|
dlgSettings = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dlgAuthorization)
|
||||||
|
{
|
||||||
|
dlgAuthorization->close();
|
||||||
|
delete dlgAuthorization;
|
||||||
|
dlgAuthorization = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
delete messangerController;
|
delete messangerController;
|
||||||
delete viewerInstructors;
|
delete viewerInstructors;
|
||||||
@@ -312,6 +328,13 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
|
|||||||
if(dlgSettings)
|
if(dlgSettings)
|
||||||
dlgSettings->deactivate();
|
dlgSettings->deactivate();
|
||||||
|
|
||||||
|
if(dlgAuthorization)
|
||||||
|
{
|
||||||
|
dlgAuthorization->close();
|
||||||
|
delete dlgAuthorization;
|
||||||
|
dlgAuthorization = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
messangerController->deleteAllWidgets();
|
messangerController->deleteAllWidgets();
|
||||||
|
|
||||||
loginInstructorLoggedInLocal = "";
|
loginInstructorLoggedInLocal = "";
|
||||||
@@ -403,23 +426,24 @@ void InstructorsAndTraineesWidget::slot_ConnectToServer()
|
|||||||
|
|
||||||
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
|
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
|
||||||
{
|
{
|
||||||
DialogAuthorization dlg(parent);
|
dlgAuthorization = new DialogAuthorization(parent);
|
||||||
dlg.setWindowTitle(tr("Instructor authorization"));
|
|
||||||
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
dlgAuthorization->setWindowTitle(tr("Instructor authorization"));
|
||||||
dlg.setStyleSheet(this->styleSheet());
|
dlgAuthorization->setWindowFlags(dlgAuthorization->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
dlgAuthorization->setStyleSheet(this->styleSheet());
|
||||||
#ifdef PROJECT_TYPE_DEBUG
|
#ifdef PROJECT_TYPE_DEBUG
|
||||||
dlg.setLogin("admin");
|
dlgAuthorization->setLogin("admin");
|
||||||
dlg.setPassword("admin");
|
dlgAuthorization->setPassword("admin");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
switch( dlg.exec() )
|
switch( dlgAuthorization->exec() )
|
||||||
{
|
{
|
||||||
case QDialog::Accepted:
|
case QDialog::Accepted:
|
||||||
{
|
{
|
||||||
QString login = dlg.getLogin();
|
QString login = dlgAuthorization->getLogin();
|
||||||
QString password = dlg.getPassword();
|
QString password = dlgAuthorization->getPassword();
|
||||||
|
|
||||||
// Вычисление MD5 хэша
|
// Вычисление MD5 хэша
|
||||||
password = HashTools::hashingMD5string(password);
|
password = HashTools::hashingMD5string(password);
|
||||||
@@ -440,6 +464,12 @@ bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent
|
|||||||
}
|
}
|
||||||
while(true);
|
while(true);
|
||||||
|
|
||||||
|
if(dlgAuthorization)
|
||||||
|
{
|
||||||
|
delete dlgAuthorization;
|
||||||
|
dlgAuthorization = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "metatypes.h"
|
#include "metatypes.h"
|
||||||
#include "dialogtaskscommon.h"
|
#include "dialogtaskscommon.h"
|
||||||
#include "dialogsettings.h"
|
#include "dialogsettings.h"
|
||||||
|
#include "dialogauthorization.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@@ -103,6 +104,7 @@ private:
|
|||||||
|
|
||||||
DialogTasksCommon* dlgTasksCommon;
|
DialogTasksCommon* dlgTasksCommon;
|
||||||
DialogSettings* dlgSettings;
|
DialogSettings* dlgSettings;
|
||||||
|
DialogAuthorization* dlgAuthorization;
|
||||||
|
|
||||||
bool adminMode;
|
bool adminMode;
|
||||||
QString loginInstructorLoggedInLocal;
|
QString loginInstructorLoggedInLocal;
|
||||||
|
|||||||
Reference in New Issue
Block a user