mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Корректное переподключение к серверу
This commit is contained in:
@@ -45,7 +45,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
||||
|
||||
updateMyStyleSheet();
|
||||
|
||||
on_btnSettings_clicked();
|
||||
setLanguageInterfase();
|
||||
|
||||
connectorToServer = new ConnectorToServer(this);
|
||||
connect(connectorToServer,&ConnectorToServer::sigLoginResult,this,&InstructorsAndTraineesWidget::checkLoginResult);
|
||||
@@ -93,46 +93,6 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
||||
ui->verticalLayout_Instructors->addWidget(viewerInstructors);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
QWidget* wGB2 = new QWidget(this);
|
||||
QHBoxLayout* lGB2 = new QHBoxLayout(this);
|
||||
wGB2->setLayout(lGB2);
|
||||
lGB2->addWidget(ui->groupBox_Tasks);
|
||||
ui->horizontalLayout_3->addWidget(wGB2);
|
||||
|
||||
ui->verticalLayout_41->addWidget(ammTasksWidget);
|
||||
ui->verticalLayout_42->addWidget(fimTasksWidget);
|
||||
|
||||
ui->verticalLayout_2->addWidget(messangerWidget);
|
||||
|
||||
ui->verticalLayout_2->addWidget(viewerInstructors);
|
||||
*/
|
||||
|
||||
|
||||
//viewerTrainees->setMinimumSize(900, 500);
|
||||
//viewerTrainees->setMaximumWidth(1050);
|
||||
|
||||
|
||||
/*wGB2->setMinimumSize(500, 500);*/
|
||||
//wGB2->setMaximumWidth(1050);
|
||||
|
||||
//ammTasksWidget->setMinimumSize(1000, 500);
|
||||
//ammTasksWidget->setMaximumWidth(2000);
|
||||
//fimTasksWidget->setMinimumSize(1000, 500);
|
||||
//fimTasksWidget->setMaximumWidth(2000);
|
||||
//ui->tabWidget_Tasks->setMaximumWidth(2000);
|
||||
//ui->groupBox_Tasks->setMaximumWidth(2000);
|
||||
|
||||
//viewerInstructors->setMinimumSize(450, 400);
|
||||
//viewerInstructors->setMaximumWidth(500);
|
||||
//viewerInstructors->setMaximumHeight(400);
|
||||
|
||||
//messangerWidget->setMinimumSize(450, 700);
|
||||
//messangerWidget->setMaximumWidth(500);
|
||||
|
||||
ui->groupBox_Messenger->setMaximumWidth(500);
|
||||
ui->groupBox_Instructors->setMaximumWidth(500);
|
||||
|
||||
@@ -176,20 +136,6 @@ void InstructorsAndTraineesWidget::changeEvent(QEvent *event)
|
||||
{// переведём окно заново
|
||||
ui->retranslateUi(this);
|
||||
|
||||
/*
|
||||
if(ui->btnAuthorizationInstructor->isChecked())
|
||||
ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor"));
|
||||
else
|
||||
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
|
||||
*/
|
||||
|
||||
/*
|
||||
if(ui->btnConnectionToDB->isChecked())
|
||||
ui->btnConnectionToDB->setText(tr("Disconnection DB"));
|
||||
else
|
||||
ui->btnConnectionToDB->setText(tr("Connection DB"));
|
||||
*/
|
||||
|
||||
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal);
|
||||
updateLabelServer();
|
||||
}
|
||||
@@ -320,8 +266,11 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
|
||||
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||
|
||||
ServerSettings serverSettings = connectorToServer->getServerSettings();
|
||||
ui->lblServer->setText(serverSettings.Address + ":" +serverSettings.Port);
|
||||
//ServerSettings serverSettings = connectorToServer->getServerSettings();
|
||||
//ui->lblServer->setText(serverSettings.Address + ":" +serverSettings.Port);
|
||||
|
||||
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal);
|
||||
updateLabelServer();
|
||||
}
|
||||
else
|
||||
{//Сервер отключен
|
||||
@@ -331,7 +280,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
|
||||
ui->btnAuthorizationInstructor->setChecked(false);
|
||||
//ui->btnSetVersion->hide();
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
ui->lblServer->setText(tr("none"));
|
||||
//ui->lblServer->setText(tr("none"));
|
||||
|
||||
viewerInstructors->setAuthComplited(false);
|
||||
viewerTrainees->setAuthComplited(false);
|
||||
@@ -347,8 +296,14 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
|
||||
|
||||
messangerWidget->clear();
|
||||
|
||||
loginInstructorLoggedInLocal = "";
|
||||
nameInstructorLoggedInLocal = "";
|
||||
|
||||
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal);
|
||||
updateLabelServer();
|
||||
|
||||
QMessageBox::warning(this, tr("Warning!"), tr("The server is disabled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
|
||||
@@ -470,6 +425,18 @@ void InstructorsAndTraineesWidget::updateLabelServer()
|
||||
ui->lblServer->setText(tr("none"));
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::setLanguageInterfase()
|
||||
{
|
||||
ServerSettings settings;
|
||||
DialogSettings::loadSettings(&settings);
|
||||
|
||||
if(settings.Language == "ENG")
|
||||
qtLanguageTranslator.load(QString("translations/InstructorsAndTraineesWidget_") + "en_EN", ".");
|
||||
else
|
||||
qtLanguageTranslator.load(QString("translations/InstructorsAndTraineesWidget_") + "ru_RU", ".");
|
||||
qApp->installTranslator(&qtLanguageTranslator);
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_btnSetVersion_clicked()
|
||||
{
|
||||
connectorToServer->showVersionSelect();
|
||||
@@ -488,15 +455,24 @@ void InstructorsAndTraineesWidget::on_btnSettings_clicked()
|
||||
case QDialog::Accepted:
|
||||
{
|
||||
language = dlg.getSettings().Language;
|
||||
|
||||
if(dlg.settingsServerIsChanged())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Attention!"), tr("Server settings have been changed. Please reconnect to the server."));
|
||||
|
||||
if(authorizationIsCompleted())
|
||||
deAuthorizationInstructor(loginInstructorLoggedInLocal);
|
||||
|
||||
connectorToServer->StopConnectToServer();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case QDialog::Rejected:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
language = dlg.getSettings().Language;
|
||||
}
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_btnEditorTrainees_clicked()
|
||||
|
||||
Reference in New Issue
Block a user