Wait крутилки на все действия с редакторами

This commit is contained in:
2025-07-01 17:53:35 +03:00
parent d48db016cb
commit 67cc236b70
6 changed files with 59 additions and 8 deletions

View File

@@ -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);
}
}
}

View File

@@ -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()