mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Wait крутилки на все действия с редакторами
This commit is contained in:
@@ -13,14 +13,22 @@ CommonView::CommonView(ConnectorToServer* connectorToServer, TypeView type, QWid
|
||||
adminMode(false),
|
||||
authComplited(false),
|
||||
lastCurrentID(0),
|
||||
typeObject(TypeObject::objInstructor)
|
||||
typeObject(TypeObject::objInstructor),
|
||||
waitAnimationWidget(nullptr)
|
||||
{
|
||||
treeWidget = new QTreeWidget();
|
||||
|
||||
//treeWidget->setIconSize(QSize(20, 20));
|
||||
treeWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
|
||||
//updateMyStyleSheet();
|
||||
waitAnimationWidget = new WaitAnimationWidget;
|
||||
QMovie *movie = new QMovie(":/resources/icons/762.gif");
|
||||
//waitAnimationWidget->setParent(this);
|
||||
waitAnimationWidget->initialize(movie,this);
|
||||
}
|
||||
|
||||
CommonView::~CommonView()
|
||||
{
|
||||
waitAnimationWidget->hideWithStop();
|
||||
delete waitAnimationWidget;
|
||||
}
|
||||
|
||||
void CommonView::setItemColorArchive(QTreeWidgetItem *item)
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
|
||||
public:
|
||||
CommonView(ConnectorToServer* connectorToServer, TypeView type, QWidget *parent = nullptr);
|
||||
~CommonView();
|
||||
|
||||
public:
|
||||
void setAdminMode(bool adminMode)
|
||||
@@ -67,6 +68,8 @@ protected:
|
||||
bool authComplited;
|
||||
int lastCurrentID;
|
||||
TypeObject typeObject;
|
||||
|
||||
WaitAnimationWidget *waitAnimationWidget;
|
||||
};
|
||||
|
||||
#endif // COMMONVIEW_H
|
||||
|
||||
@@ -21,6 +21,8 @@ EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool
|
||||
|
||||
if(adminMode)
|
||||
ui->btnArchive->click();
|
||||
|
||||
waitAnimationWidget->setParent(this);
|
||||
}
|
||||
|
||||
EditorInstructors::~EditorInstructors()
|
||||
@@ -34,7 +36,10 @@ void EditorInstructors::on_btnNewInstructor_clicked()
|
||||
Instructor instructor_edit;
|
||||
|
||||
if(editInstructor(instructor, &instructor_edit))
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_NEW_INSTRUCTOR, 0, &instructor_edit);
|
||||
}
|
||||
|
||||
return;
|
||||
/*
|
||||
@@ -111,6 +116,7 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
|
||||
|
||||
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete it anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id);
|
||||
}
|
||||
}
|
||||
@@ -136,6 +142,7 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
|
||||
if(connectorToServer->isArchivedInstructor(id))
|
||||
{//Архивный
|
||||
instructor.setArchived(false);
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor);
|
||||
}
|
||||
else
|
||||
@@ -147,6 +154,7 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
|
||||
}
|
||||
|
||||
instructor.setArchived(true);
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor);
|
||||
if(!archiveVisible)
|
||||
ui->btnArchive->click();
|
||||
@@ -189,7 +197,10 @@ void EditorInstructors::on_btnEdit_clicked()
|
||||
Instructor instructor_edit;
|
||||
|
||||
if(editInstructor(instructor, &instructor_edit))
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor_edit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <QHeaderView>
|
||||
#include <QTranslator>
|
||||
#include <QResizeEvent>
|
||||
#include "instructorsview.h"
|
||||
|
||||
InstructorsView::InstructorsView(ConnectorToServer* connectorToServer, TypeView type, QWidget *parent):
|
||||
@@ -36,6 +37,9 @@ void InstructorsView::resizeEvent(QResizeEvent *event)
|
||||
widthInstructor = 250;
|
||||
|
||||
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Instructor, widthInstructor);
|
||||
|
||||
QSize size = event->size();
|
||||
waitAnimationWidget->resize(size);
|
||||
}
|
||||
|
||||
void InstructorsView::slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee)
|
||||
@@ -170,6 +174,8 @@ void InstructorsView::loadInstructorsFromDB()
|
||||
treeWidget->sortItems(ColumnsTreeInsructors::clmn_Instructor, Qt::SortOrder::AscendingOrder);
|
||||
|
||||
mtxTreeWidget.unlock();
|
||||
|
||||
waitAnimationWidget->hideWithStop();
|
||||
}
|
||||
|
||||
void InstructorsView::reSetHeadTreeWidget()
|
||||
|
||||
@@ -8,7 +8,7 @@ EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminM
|
||||
TraineesView(connectorToServer, CommonView::TypeView::control, parent),
|
||||
ui(new Ui::EditorTrainees)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &EditorTrainees::on_treeWidget_currentItemChanged);
|
||||
|
||||
@@ -22,6 +22,8 @@ EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminM
|
||||
|
||||
if(adminMode)
|
||||
ui->btnArchive->click();
|
||||
|
||||
waitAnimationWidget->setParent(this);
|
||||
}
|
||||
|
||||
EditorTrainees::~EditorTrainees()
|
||||
@@ -35,7 +37,10 @@ void EditorTrainees::on_btnNewGroup_clicked()
|
||||
Group group_edit;
|
||||
|
||||
if(editGroup(group, &group_edit))
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_NEW_GROUP, 0, &group_edit);
|
||||
}
|
||||
|
||||
return;
|
||||
/*
|
||||
@@ -106,6 +111,7 @@ void EditorTrainees::on_btnDeleteGroup_clicked()
|
||||
{//Пустая группа
|
||||
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_GROUP, id_group);
|
||||
}
|
||||
}
|
||||
@@ -128,8 +134,10 @@ void EditorTrainees::on_btnNewTrainee_clicked()
|
||||
Trainee trainee_edit;
|
||||
|
||||
if(editTrainee(trainee, &trainee_edit))
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_NEW_TRAINEE, id_group, &trainee_edit);
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -207,6 +215,7 @@ void EditorTrainees::on_btnDeleteTrainee_clicked()
|
||||
|
||||
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE, id_trainee);
|
||||
}
|
||||
}
|
||||
@@ -232,7 +241,8 @@ void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
|
||||
if(connectorToServer->isArchivedTrainee(id_trainee))
|
||||
{//Архивный
|
||||
trainee.setArchived(false);
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE, id_trainee, &trainee);
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE, id_trainee, &trainee);
|
||||
}
|
||||
else
|
||||
{//Не Архивный
|
||||
@@ -243,7 +253,8 @@ void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
|
||||
}
|
||||
|
||||
trainee.setArchived(true);
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE, id_trainee, &trainee);
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE, id_trainee, &trainee);
|
||||
if(!archiveVisible)
|
||||
ui->btnArchive->click();
|
||||
}
|
||||
@@ -271,7 +282,10 @@ void EditorTrainees::on_btnEdit_clicked()
|
||||
Group group_edit;
|
||||
|
||||
if(editGroup(group, &group_edit))
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_GROUP, id_group, &group_edit);
|
||||
}
|
||||
}
|
||||
else
|
||||
{//Выбран обучаемый
|
||||
@@ -291,7 +305,10 @@ void EditorTrainees::on_btnEdit_clicked()
|
||||
Trainee trainee_edit;
|
||||
|
||||
if(editTrainee(trainee, &trainee_edit))
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE, id_trainee, &trainee_edit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <QHeaderView>
|
||||
#include <QResizeEvent>
|
||||
#include "traineesview.h"
|
||||
|
||||
TraineesView::TraineesView(ConnectorToServer* connectorToServer, TypeView type, QWidget *parent):
|
||||
@@ -37,6 +38,9 @@ void TraineesView::resizeEvent(QResizeEvent *event)
|
||||
widthTrainee = 250;
|
||||
|
||||
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Trainee, widthTrainee);
|
||||
|
||||
QSize size = event->size();
|
||||
waitAnimationWidget->resize(size);
|
||||
}
|
||||
|
||||
void TraineesView::slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee)
|
||||
@@ -200,6 +204,8 @@ void TraineesView::loadTraineesFromDB()
|
||||
treeWidget->sortItems(ColumnsTreeTrainees::clmn_Trainee, Qt::SortOrder::AscendingOrder);
|
||||
|
||||
mtxTreeWidget.unlock();
|
||||
|
||||
waitAnimationWidget->hideWithStop();
|
||||
}
|
||||
|
||||
void TraineesView::reSetHeadTreeWidget()
|
||||
|
||||
Reference in New Issue
Block a user