mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
refact
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include "instructor.h"
|
||||
#include "ui_dialogeditinstructor.h"
|
||||
//#include "ui_dialogeditinstructor.h"
|
||||
|
||||
namespace Ui {
|
||||
class DialogEditInstructor;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include <QMessageBox>
|
||||
#include "editorinstructors.h"
|
||||
#include "dialogeditinstructor.h"
|
||||
#include "specialmessagebox.h"
|
||||
#include "ui_editorinstructors.h"
|
||||
|
||||
EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) :
|
||||
InstructorsView(connectorToServer, CommonView::TypeView::control, parent),
|
||||
ui(new Ui::EditorInstructors)
|
||||
ui(new Ui::EditorInstructors),
|
||||
dlgEditInstructor(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -34,12 +34,20 @@ EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool
|
||||
|
||||
EditorInstructors::~EditorInstructors()
|
||||
{
|
||||
if(dlgEditInstructor)
|
||||
{
|
||||
dlgEditInstructor->close();
|
||||
delete dlgEditInstructor;
|
||||
dlgEditInstructor = nullptr;
|
||||
}
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EditorInstructors::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
|
||||
if(dlgEditInstructor)
|
||||
dlgEditInstructor->close();
|
||||
}
|
||||
|
||||
void EditorInstructors::on_btnNewInstructor_clicked()
|
||||
@@ -292,22 +300,25 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
|
||||
|
||||
bool EditorInstructors::editInstructor(Instructor instructor, Instructor* instructor_edit)
|
||||
{
|
||||
DialogEditInstructor dlg(adminMode, this);
|
||||
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
dlgEditInstructor = new DialogEditInstructor(adminMode, this);
|
||||
dlgEditInstructor->setWindowFlags(dlgEditInstructor->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
dlg.setInstructor(instructor);
|
||||
dlgEditInstructor->setInstructor(instructor);
|
||||
|
||||
while (true)
|
||||
bool flStop = false;
|
||||
bool res = false;
|
||||
|
||||
while (!flStop)
|
||||
{
|
||||
switch( dlg.exec() )
|
||||
switch( dlgEditInstructor->exec() )
|
||||
{
|
||||
case QDialog::Accepted:
|
||||
{
|
||||
*instructor_edit = dlg.getInstructor();
|
||||
*instructor_edit = dlgEditInstructor->getInstructor();
|
||||
|
||||
if(! verifyInstructor(*instructor_edit))
|
||||
{
|
||||
dlg.setInstructor(*instructor_edit);
|
||||
dlgEditInstructor->setInstructor(*instructor_edit);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -318,14 +329,28 @@ bool EditorInstructors::editInstructor(Instructor instructor, Instructor* instru
|
||||
instructor_edit->setNeedSetPassword(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
flStop = true;
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
case QDialog::Rejected:
|
||||
return false;
|
||||
flStop = true;
|
||||
res = false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
flStop = true;
|
||||
res = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(dlgEditInstructor)
|
||||
{
|
||||
delete dlgEditInstructor;
|
||||
dlgEditInstructor = nullptr;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include <QDialog>
|
||||
#include <QTreeWidget>
|
||||
#include "instructorsview.h"
|
||||
#include "dialogeditinstructor.h"
|
||||
|
||||
class DialogEditInstructor;
|
||||
|
||||
namespace Ui {
|
||||
class EditorInstructors;
|
||||
@@ -35,8 +38,10 @@ private:
|
||||
|
||||
bool editInstructor(Instructor instructor, Instructor* instructor_edit);
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui::EditorInstructors *ui;
|
||||
|
||||
DialogEditInstructor* dlgEditInstructor;
|
||||
};
|
||||
|
||||
#endif // DIALOGINSTRUCTORS_H
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<string>New instructor</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/addInstructor.png</normaloff>:/resources/icons/addInstructor.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -89,7 +89,7 @@
|
||||
<string>Delete instructor</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/deleteInstructor.png</normaloff>:/resources/icons/deleteInstructor.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -127,7 +127,7 @@
|
||||
<string>To archive</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/instructorArchive.png</normaloff>:/resources/icons/instructorArchive.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -165,7 +165,7 @@
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/edit.png</normaloff>:/resources/icons/edit.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -216,7 +216,7 @@
|
||||
<string>Show archive</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/archive.png</normaloff>:/resources/icons/archive.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -240,7 +240,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
<include location="../InstructorsAndTrainees.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -25,7 +25,11 @@ ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidg
|
||||
ViewerInstructors::~ViewerInstructors()
|
||||
{
|
||||
if(dlgRedactor)
|
||||
{
|
||||
dlgRedactor->close();
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -38,7 +42,11 @@ void ViewerInstructors::setAuthComplited(bool authComplited)
|
||||
void ViewerInstructors::deactivate()
|
||||
{
|
||||
if(dlgRedactor)
|
||||
{
|
||||
dlgRedactor->close();
|
||||
delete dlgRedactor;
|
||||
dlgRedactor = nullptr;
|
||||
}
|
||||
|
||||
CommonView::deactivate();
|
||||
updateButtons();
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<string>Editor of Instructors</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/DB-instructors.png</normaloff>:/resources/icons/DB-instructors.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -67,7 +67,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
<include location="../InstructorsAndTrainees.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user