mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Откл-е запр-в на EditorTrainees EditorInstructors
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidget *parent) :
|
||||
InstructorsView(connectorToServer, CommonView::TypeView::onlyView, parent),
|
||||
dlgRedactor(nullptr),
|
||||
flTryEditorInstructors(false),
|
||||
ui(new Ui::ViewerInstructors)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -20,6 +21,8 @@ ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidg
|
||||
setNotLoggedInVisible(true);
|
||||
|
||||
ui->btnEditorInstructors->setVisible(false);
|
||||
|
||||
connect(connectorToServer, &ConnectorToServer::sigTryBlockResult, this, &ViewerInstructors::slot_checkTryBlockResult);
|
||||
}
|
||||
|
||||
ViewerInstructors::~ViewerInstructors()
|
||||
@@ -48,6 +51,8 @@ void ViewerInstructors::deactivate()
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
flTryEditorInstructors = false;
|
||||
|
||||
CommonView::deactivate();
|
||||
updateButtons();
|
||||
}
|
||||
@@ -75,23 +80,31 @@ void ViewerInstructors::slot_receiveMessage(ClientMessage clientMessage)
|
||||
slot_NeedUpdateUI(true, false);
|
||||
}
|
||||
|
||||
void ViewerInstructors::slot_checkTryBlockResult(bool result, QString type)
|
||||
{
|
||||
if(flTryEditorInstructors)
|
||||
{
|
||||
if(type == "EditorInstructors")
|
||||
{
|
||||
if(result)
|
||||
{//Одобрено
|
||||
dialog_EditorInstructors();
|
||||
}
|
||||
else
|
||||
{//Отказ
|
||||
SpecMsgBox::WarningClose(this, tr("The server rejected your request to access instructors control.\nAnother instructor is managing instructors.\nPlease try again later."));
|
||||
}
|
||||
|
||||
flTryEditorInstructors = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerInstructors::on_btnEditorInstructors_clicked()
|
||||
{
|
||||
flTryEditorInstructors = true;
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(true, "EditorInstructors");
|
||||
|
||||
dlgRedactor = new DialogRedactorInstructors(connectorToServer, adminMode, this);
|
||||
dlgRedactor->exec();
|
||||
|
||||
if(dlgRedactor)
|
||||
{
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
if(authComplited)
|
||||
loadInstructorsFromDB();
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(false, "EditorInstructors");
|
||||
}
|
||||
|
||||
void ViewerInstructors::on_treeWidgetCurrentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
@@ -143,3 +156,20 @@ void ViewerInstructors::updateButtons()
|
||||
ui->btnEditorInstructors->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerInstructors::dialog_EditorInstructors()
|
||||
{
|
||||
dlgRedactor = new DialogRedactorInstructors(connectorToServer, adminMode, this);
|
||||
dlgRedactor->exec();
|
||||
|
||||
if(dlgRedactor)
|
||||
{
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
if(authComplited)
|
||||
loadInstructorsFromDB();
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(false, "EditorInstructors");
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ protected:
|
||||
public slots:
|
||||
void slot_receiveMessage(ClientMessage clientMessage);
|
||||
|
||||
void slot_checkTryBlockResult(bool result, QString type);
|
||||
|
||||
public Q_SLOTS:
|
||||
void on_btnEditorInstructors_clicked();
|
||||
|
||||
@@ -41,9 +43,13 @@ Q_SIGNALS:
|
||||
private:
|
||||
void updateButtons() override;
|
||||
|
||||
void dialog_EditorInstructors();
|
||||
|
||||
private:
|
||||
DialogRedactorInstructors* dlgRedactor;
|
||||
|
||||
bool flTryEditorInstructors;
|
||||
|
||||
private:
|
||||
Ui::ViewerInstructors *ui;
|
||||
};
|
||||
|
||||
@@ -703,8 +703,6 @@ void InstructorsAndTraineesWidget::on_btnSettings_clicked()
|
||||
connect(dlgSettings, &DialogSettings::signal_LanguageChanged, this, &InstructorsAndTraineesWidget::slot_LanguageChanged);
|
||||
connect(dlgSettings, &DialogSettings::signal_UpdateStyleSheet, this, &InstructorsAndTraineesWidget::slot_UpdateStyleSheet);
|
||||
|
||||
connect(connectorToServer, &ConnectorToServer::sigTryBlockResult, dlgSettings, &DialogSettings::slot_checkTryBlockResult);
|
||||
|
||||
switch( dlgSettings->exec() )
|
||||
{
|
||||
case QDialog::Accepted:
|
||||
|
||||
@@ -70,6 +70,8 @@ DialogSettings::DialogSettings(ConnectorToServer* connectorToServer, bool instru
|
||||
|
||||
ui->btnSave->setEnabled(false);
|
||||
flSettingsServerChanged = false;
|
||||
|
||||
connect(connectorToServer, &ConnectorToServer::sigTryBlockResult, this, &DialogSettings::slot_checkTryBlockResult);
|
||||
}
|
||||
|
||||
DialogSettings::~DialogSettings()
|
||||
@@ -219,9 +221,6 @@ void DialogSettings::on_btnSetVersion_clicked()
|
||||
flTryVersionControl = true;
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(true, "VersionControl");
|
||||
|
||||
//TODO пока сразу
|
||||
//slot_VersionControl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +253,7 @@ void DialogSettings::on_DialogSettings_accepted()
|
||||
emit signal_LanguageChanged(language);
|
||||
}
|
||||
|
||||
void DialogSettings::slot_VersionControl()
|
||||
void DialogSettings::dialog_VersionControl()
|
||||
{
|
||||
dlgVersionControl = new DialogVersionControl(connectorToServer, this);
|
||||
dlgVersionControl->initialize(connectorToServer->getLoginName());
|
||||
@@ -277,7 +276,7 @@ void DialogSettings::slot_checkTryBlockResult(bool result, QString type)
|
||||
{
|
||||
if(result)
|
||||
{//Одобрено
|
||||
slot_VersionControl();
|
||||
dialog_VersionControl();
|
||||
}
|
||||
else
|
||||
{//Отказ
|
||||
|
||||
@@ -47,12 +47,11 @@ private slots:
|
||||
void on_DialogSettings_accepted();
|
||||
|
||||
public slots:
|
||||
void slot_VersionControl();
|
||||
|
||||
void slot_checkTryBlockResult(bool result, QString type);
|
||||
|
||||
private:
|
||||
bool saveSettings();
|
||||
void dialog_VersionControl();
|
||||
|
||||
private:
|
||||
Ui::DialogSettings *ui;
|
||||
|
||||
@@ -11,6 +11,7 @@ ViewerTrainees::ViewerTrainees(ConnectorToServer* connectorToServer, MessangerCo
|
||||
messangerController(messangerController),
|
||||
dlgRedactor(nullptr),
|
||||
dlgCardTrainee(nullptr),
|
||||
flTryEditorTrainees(false),
|
||||
ui(new Ui::ViewerTrainees)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -32,6 +33,8 @@ ViewerTrainees::ViewerTrainees(ConnectorToServer* connectorToServer, MessangerCo
|
||||
setNotLoggedInVisible(true);
|
||||
|
||||
ui->btnEditorTrainees->setVisible(false);
|
||||
|
||||
connect(connectorToServer, &ConnectorToServer::sigTryBlockResult, this, &ViewerTrainees::slot_checkTryBlockResult);
|
||||
}
|
||||
|
||||
ViewerTrainees::~ViewerTrainees()
|
||||
@@ -79,6 +82,8 @@ void ViewerTrainees::deactivate()
|
||||
if(dlgCardTrainee)
|
||||
dlgCardTrainee->close();
|
||||
|
||||
flTryEditorTrainees = false;
|
||||
|
||||
CommonView::deactivate();
|
||||
|
||||
ammTasksWidgetCommon->deactivate();
|
||||
@@ -109,23 +114,31 @@ void ViewerTrainees::slot_receiveMessage(ClientMessage clientMessage)
|
||||
slot_NeedUpdateUI(false, true);
|
||||
}
|
||||
|
||||
void ViewerTrainees::slot_checkTryBlockResult(bool result, QString type)
|
||||
{
|
||||
if(flTryEditorTrainees)
|
||||
{
|
||||
if(type == "EditorTrainees")
|
||||
{
|
||||
if(result)
|
||||
{//Одобрено
|
||||
dialog_EditorTrainees();
|
||||
}
|
||||
else
|
||||
{//Отказ
|
||||
SpecMsgBox::WarningClose(this, tr("The server rejected your request to access trainees control.\nAnother instructor is managing trainees.\nPlease try again later."));
|
||||
}
|
||||
|
||||
flTryEditorTrainees = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerTrainees::on_btnEditorTrainees_clicked()
|
||||
{
|
||||
connectorToServer->sendQueryBlockAuth(true, "EditorTrainees");
|
||||
flTryEditorTrainees = true;
|
||||
|
||||
dlgRedactor = new DialogRedactorTrainees(connectorToServer, adminMode, this);
|
||||
dlgRedactor->exec();
|
||||
|
||||
if(dlgRedactor)
|
||||
{
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
if(authComplited)
|
||||
loadTraineesFromDB();
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(false, "EditorTrainees");
|
||||
connectorToServer->sendQueryBlockAuth(true, "EditorTrainees");
|
||||
}
|
||||
|
||||
void ViewerTrainees::on_btnPersonalCard_clicked()
|
||||
@@ -236,3 +249,20 @@ void ViewerTrainees::updateButtons()
|
||||
ui->btnEditorTrainees->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerTrainees::dialog_EditorTrainees()
|
||||
{
|
||||
dlgRedactor = new DialogRedactorTrainees(connectorToServer, adminMode, this);
|
||||
dlgRedactor->exec();
|
||||
|
||||
if(dlgRedactor)
|
||||
{
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
if(authComplited)
|
||||
loadTraineesFromDB();
|
||||
|
||||
connectorToServer->sendQueryBlockAuth(false, "EditorTrainees");
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ protected:
|
||||
public slots:
|
||||
void slot_receiveMessage(ClientMessage clientMessage);
|
||||
|
||||
void slot_checkTryBlockResult(bool result, QString type);
|
||||
|
||||
public Q_SLOTS:
|
||||
void on_btnEditorTrainees_clicked();
|
||||
void on_btnPersonalCard_clicked();
|
||||
@@ -50,6 +52,8 @@ Q_SIGNALS:
|
||||
private:
|
||||
void updateButtons() override;
|
||||
|
||||
void dialog_EditorTrainees();
|
||||
|
||||
private:
|
||||
AMMtasksWidget* ammTasksWidgetCommon;
|
||||
FIMtasksWidget* fimTasksWidgetCommon;
|
||||
@@ -59,6 +63,8 @@ private:
|
||||
DialogRedactorTrainees* dlgRedactor;
|
||||
DialogCardTrainee* dlgCardTrainee;
|
||||
|
||||
bool flTryEditorTrainees;
|
||||
|
||||
private:
|
||||
Ui::ViewerTrainees *ui;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user