diff --git a/InstructorsAndTrainees/commonview.cpp b/InstructorsAndTrainees/commonview.cpp index 8e6bb54..d4cfaa8 100644 --- a/InstructorsAndTrainees/commonview.cpp +++ b/InstructorsAndTrainees/commonview.cpp @@ -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) diff --git a/InstructorsAndTrainees/commonview.h b/InstructorsAndTrainees/commonview.h index dd1305d..85f37ac 100644 --- a/InstructorsAndTrainees/commonview.h +++ b/InstructorsAndTrainees/commonview.h @@ -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 diff --git a/InstructorsAndTrainees/instructors/editorinstructors.cpp b/InstructorsAndTrainees/instructors/editorinstructors.cpp index 2305d06..5aceb87 100644 --- a/InstructorsAndTrainees/instructors/editorinstructors.cpp +++ b/InstructorsAndTrainees/instructors/editorinstructors.cpp @@ -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); + } } } diff --git a/InstructorsAndTrainees/instructors/instructorsview.cpp b/InstructorsAndTrainees/instructors/instructorsview.cpp index 673e4bc..20ed7c6 100644 --- a/InstructorsAndTrainees/instructors/instructorsview.cpp +++ b/InstructorsAndTrainees/instructors/instructorsview.cpp @@ -1,5 +1,6 @@ #include #include +#include #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() diff --git a/InstructorsAndTrainees/trainees/editortrainees.cpp b/InstructorsAndTrainees/trainees/editortrainees.cpp index 67c9a3a..0f59340 100644 --- a/InstructorsAndTrainees/trainees/editortrainees.cpp +++ b/InstructorsAndTrainees/trainees/editortrainees.cpp @@ -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); + } } } diff --git a/InstructorsAndTrainees/trainees/traineesview.cpp b/InstructorsAndTrainees/trainees/traineesview.cpp index 96f8867..2b71268 100644 --- a/InstructorsAndTrainees/trainees/traineesview.cpp +++ b/InstructorsAndTrainees/trainees/traineesview.cpp @@ -1,4 +1,5 @@ #include +#include #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()