Вывел все окна в свои диалоги

This commit is contained in:
2025-09-18 13:26:22 +03:00
parent a2cd5280bd
commit 8bb54cb56c
17 changed files with 166 additions and 51 deletions

View File

@@ -43,6 +43,8 @@ add_library(InstructorsAndTrainees SHARED
trainees/personalcardtrainee.ui
trainees/dialogcardtrainee.cpp
trainees/dialogcardtrainee.h
trainees/dialogredactortrainees.cpp
trainees/dialogredactortrainees.h
instructors/viewerinstructors.cpp
instructors/viewerinstructors.h
@@ -58,6 +60,8 @@ add_library(InstructorsAndTrainees SHARED
instructors/dialogauthorizationinstructor.ui
instructors/instructorsview.cpp
instructors/instructorsview.h
instructors/dialogredactorinstructors.cpp
instructors/dialogredactorinstructors.h
connectorToServer/connectortoserver.cpp
connectorToServer/connectortoserver.h

View File

@@ -0,0 +1,33 @@
#include <QHBoxLayout>
#include "dialogredactorinstructors.h"
DialogRedactorInstructors::DialogRedactorInstructors(ConnectorToServer* connectorToServer,
bool adminMode, QWidget *parent) :
QDialog(parent,
Qt::WindowSystemMenuHint
| Qt::WindowMaximizeButtonHint
| Qt::WindowMinimizeButtonHint
| Qt::WindowCloseButtonHint),
editorInstructors(nullptr)
{
editorInstructors = new EditorInstructors(connectorToServer, adminMode, this);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorInstructors, &EditorInstructors::slot_NeedUpdateUI);
editorInstructors->activate();
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(editorInstructors);
this->setWindowTitle(tr("Editor of instructors"));
this->setMinimumSize(1400, 700);
this->setWindowState(Qt::WindowMaximized);
this->setModal(true);
}
DialogRedactorInstructors::~DialogRedactorInstructors()
{
delete editorInstructors;
}
void DialogRedactorInstructors::closeEvent(QCloseEvent *event)
{
editorInstructors->close();
}

View File

@@ -0,0 +1,22 @@
#ifndef DIALOGREDACTORINSTRUCTORS_H
#define DIALOGREDACTORINSTRUCTORS_H
#include <QDialog>
#include <QObject>
#include "connectortoserver.h"
#include "editorinstructors.h"
class DialogRedactorInstructors : public QDialog
{
Q_OBJECT
public:
DialogRedactorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent = nullptr);
~DialogRedactorInstructors();
void closeEvent(QCloseEvent *event) override;
private:
EditorInstructors* editorInstructors;
};
#endif // DIALOGREDACTORINSTRUCTORS_H

View File

@@ -37,6 +37,11 @@ EditorInstructors::~EditorInstructors()
delete ui;
}
void EditorInstructors::closeEvent(QCloseEvent *event)
{
}
void EditorInstructors::on_btnNewInstructor_clicked()
{
Instructor instructor;

View File

@@ -19,6 +19,8 @@ public:
explicit EditorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent = nullptr);
~EditorInstructors();
void closeEvent(QCloseEvent *event) override;
private Q_SLOTS:
void on_btnNewInstructor_clicked();
void on_btnDeleteInstructor_clicked();

View File

@@ -5,7 +5,7 @@
ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidget *parent) :
InstructorsView(connectorToServer, CommonView::TypeView::onlyView, parent),
dlgEditor(nullptr),
dlgRedactor(nullptr),
ui(new Ui::ViewerInstructors)
{
ui->setupUi(this);
@@ -24,8 +24,8 @@ ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidg
ViewerInstructors::~ViewerInstructors()
{
if(dlgEditor)
dlgEditor->close();
if(dlgRedactor)
dlgRedactor->close();
delete ui;
}
@@ -37,8 +37,8 @@ void ViewerInstructors::setAuthComplited(bool authComplited)
void ViewerInstructors::deactivate()
{
if(dlgEditor)
dlgEditor->close();
if(dlgRedactor)
dlgRedactor->close();
CommonView::deactivate();
updateButtons();
@@ -60,25 +60,14 @@ void ViewerInstructors::on_btnEditorInstructors_clicked()
{
Q_EMIT signal_BlockAutorization(true);
EditorInstructors* editorInstructors = new EditorInstructors(connectorToServer, adminMode);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorInstructors, &EditorInstructors::slot_NeedUpdateUI);
editorInstructors->activate();
dlgRedactor = new DialogRedactorInstructors(connectorToServer, adminMode, this);
dlgRedactor->exec();
dlgEditor = new QDialog(this,
Qt::WindowSystemMenuHint
| Qt::WindowMaximizeButtonHint
| Qt::WindowMinimizeButtonHint
| Qt::WindowCloseButtonHint);
QHBoxLayout *layout = new QHBoxLayout(dlgEditor);
layout->addWidget(editorInstructors);
dlgEditor->setWindowTitle(tr("Editor of instructors"));
dlgEditor->setMinimumSize(1400, 700);
dlgEditor->setWindowState(Qt::WindowMaximized);
dlgEditor->setModal(true);
dlgEditor->exec();
delete dlgEditor;
dlgEditor = nullptr;
if(dlgRedactor)
{
delete dlgRedactor;
dlgRedactor = nullptr;
}
if(authComplited)
loadInstructorsFromDB();

View File

@@ -2,6 +2,7 @@
#define INSTRUCTORSWIDGET_H
#include "instructorsview.h"
#include "dialogredactorinstructors.h"
namespace Ui {
class ViewerInstructors;
@@ -43,7 +44,7 @@ private:
void updateButtons() override;
private:
QDialog* dlgEditor;
DialogRedactorInstructors* dlgRedactor;
private:
Ui::ViewerInstructors *ui;

View File

@@ -136,6 +136,12 @@ void AMMtasksWidget::resizeEvent(QResizeEvent *event)
treeWidget->setColumnWidth(ColumnsTreeAMM::clmnAMM_PMorDM, widthPMorDM);
}
void AMMtasksWidget::closeDlgCheckTask()
{
if(dlgCheckerTask)
dlgCheckerTask->close();
}
void AMMtasksWidget::changeEvent(QEvent *event)
{
// В случае получения события изменения языка приложения

View File

@@ -27,6 +27,7 @@ public:
public:
void resizeEvent(QResizeEvent *event) override;
void closeDlgCheckTask();
protected:
void changeEvent(QEvent * event) override;

View File

@@ -15,6 +15,7 @@ DialogChekerTask::DialogChekerTask(ConnectorToServer* connectorToServer, QString
layout->addWidget(checkerTask);
this->setWindowTitle(tr("Check Task"));
this->setMinimumSize(1400, 700);
if(type == "fim")
this->setWindowState(Qt::WindowMaximized);
this->setModal(true);
}

View File

@@ -0,0 +1,33 @@
#include <QHBoxLayout>
#include "dialogredactortrainees.h"
DialogRedactorTrainees::DialogRedactorTrainees(ConnectorToServer* connectorToServer,
bool adminMode, QWidget *parent) :
QDialog(parent,
Qt::WindowSystemMenuHint
| Qt::WindowMaximizeButtonHint
| Qt::WindowMinimizeButtonHint
| Qt::WindowCloseButtonHint),
editorTraineesGroups(nullptr)
{
editorTraineesGroups = new EditorTrainees(connectorToServer, adminMode, this);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorTraineesGroups, &EditorTrainees::slot_NeedUpdateUI);
editorTraineesGroups->activate();
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(editorTraineesGroups);
this->setWindowTitle(tr("Editor of trainees"));
this->setMinimumSize(1400, 700);
this->setWindowState(Qt::WindowMaximized);
this->setModal(true);
}
DialogRedactorTrainees::~DialogRedactorTrainees()
{
delete editorTraineesGroups;
}
void DialogRedactorTrainees::closeEvent(QCloseEvent *event)
{
editorTraineesGroups->close();
}

View File

@@ -0,0 +1,22 @@
#ifndef DIALOGREDACTORTRAINEES_H
#define DIALOGREDACTORTRAINEES_H
#include <QDialog>
#include <QObject>
#include "connectortoserver.h"
#include "editortrainees.h"
class DialogRedactorTrainees : public QDialog
{
Q_OBJECT
public:
DialogRedactorTrainees(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent = nullptr);
~DialogRedactorTrainees();
void closeEvent(QCloseEvent *event) override;
private:
EditorTrainees* editorTraineesGroups;
};
#endif // DIALOGREDACTORTRAINEES_H

View File

@@ -41,6 +41,11 @@ EditorTrainees::~EditorTrainees()
delete ui;
}
void EditorTrainees::closeEvent(QCloseEvent *event)
{
}
void EditorTrainees::on_btnNewGroup_clicked()
{
Group group;

View File

@@ -20,6 +20,8 @@ public:
explicit EditorTrainees(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent = nullptr);
~EditorTrainees();
void closeEvent(QCloseEvent *event) override;
private Q_SLOTS:
void on_btnNewGroup_clicked();
void on_btnDeleteGroup_clicked();

View File

@@ -75,6 +75,7 @@ PersonalCardTrainee::~PersonalCardTrainee()
void PersonalCardTrainee::closeEvent(QCloseEvent *event)
{
fimTasksWidget_personal->closeDlgCheckTask();
ammTasksWidget_personal->closeDlgCheckTask();
}
void PersonalCardTrainee::loadInfo()

View File

@@ -9,7 +9,7 @@ ViewerTrainees::ViewerTrainees(ConnectorToServer* connectorToServer, MessangerCo
ammTasksWidgetCommon(nullptr),
fimTasksWidgetCommon(nullptr),
messangerController(messangerController),
dlgEditor(nullptr),
dlgRedactor(nullptr),
dlgCardTrainee(nullptr),
ui(new Ui::ViewerTrainees)
{
@@ -48,8 +48,8 @@ ViewerTrainees::~ViewerTrainees()
fimTasksWidgetCommon = nullptr;
}
if(dlgEditor)
dlgEditor->close();
if(dlgRedactor)
dlgRedactor->close();
if(dlgCardTrainee)
dlgCardTrainee->close();
@@ -65,13 +65,11 @@ void ViewerTrainees::setAuthComplited(bool authComplited)
void ViewerTrainees::deactivate()
{
if(dlgEditor)
dlgEditor->close();
if(dlgRedactor)
dlgRedactor->close();
if(dlgCardTrainee)
{
dlgCardTrainee->close();
}
CommonView::deactivate();
@@ -96,25 +94,14 @@ void ViewerTrainees::on_btnEditorTrainees_clicked()
{
Q_EMIT signal_BlockAutorization(true);
EditorTrainees* editorTraineesGroups = new EditorTrainees(connectorToServer, adminMode);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorTraineesGroups, &EditorTrainees::slot_NeedUpdateUI);
editorTraineesGroups->activate();
dlgRedactor = new DialogRedactorTrainees(connectorToServer, adminMode, this);
dlgRedactor->exec();
dlgEditor = new QDialog(this,
Qt::WindowSystemMenuHint
| Qt::WindowMaximizeButtonHint
| Qt::WindowMinimizeButtonHint
| Qt::WindowCloseButtonHint);
QHBoxLayout *layout = new QHBoxLayout(dlgEditor);
layout->addWidget(editorTraineesGroups);
dlgEditor->setWindowTitle(tr("Editor of trainees"));
dlgEditor->setMinimumSize(1400, 700);
dlgEditor->setWindowState(Qt::WindowMaximized);
dlgEditor->setModal(true);
dlgEditor->exec();
delete dlgEditor;
dlgEditor = nullptr;
if(dlgRedactor)
{
delete dlgRedactor;
dlgRedactor = nullptr;
}
if(authComplited)
loadTraineesFromDB();

View File

@@ -6,6 +6,7 @@
#include "fimtaskswidget.h"
#include "messangercontroller.h"
#include "dialogcardtrainee.h"
#include "dialogredactortrainees.h"
namespace Ui {
class ViewerTrainees;
@@ -53,7 +54,7 @@ private:
MessangerController* messangerController;
QDialog* dlgEditor;
DialogRedactorTrainees* dlgRedactor;
DialogCardTrainee* dlgCardTrainee;
private: