mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Вывел все окна в свои диалоги
This commit is contained in:
@@ -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();
|
||||
}
|
||||
@@ -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
|
||||
@@ -37,6 +37,11 @@ EditorInstructors::~EditorInstructors()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EditorInstructors::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EditorInstructors::on_btnNewInstructor_clicked()
|
||||
{
|
||||
Instructor instructor;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user