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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user