mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Анимировал ожидание загрузки назначенных FIM задач
This commit is contained in:
@@ -37,9 +37,9 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeList ty
|
|||||||
if(type == TypeList::listForTrainee)
|
if(type == TypeList::listForTrainee)
|
||||||
{
|
{
|
||||||
ui->btnAssignTaskToTrainee->setVisible(false);
|
ui->btnAssignTaskToTrainee->setVisible(false);
|
||||||
ui->label->setVisible(false);
|
|
||||||
ui->editCode->setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
ui->label->setVisible(false);
|
||||||
|
ui->editCode->setVisible(false);
|
||||||
|
|
||||||
threadPreparation = new QThread();
|
threadPreparation = new QThread();
|
||||||
taskTreePreparation = new TaskTreePreparation();
|
taskTreePreparation = new TaskTreePreparation();
|
||||||
@@ -88,7 +88,14 @@ void AMMtasksWidget::resizeEvent(QResizeEvent *event)
|
|||||||
|
|
||||||
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 50);
|
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 50);
|
||||||
treeWidget->setColumnWidth(ColumnsTree::clmn_code, 250);
|
treeWidget->setColumnWidth(ColumnsTree::clmn_code, 250);
|
||||||
treeWidget->setColumnWidth(ColumnsTree::clmn_PMorDM, width - 310);
|
|
||||||
|
int widthPMorDM;
|
||||||
|
if(type == TypeList::listCommon)
|
||||||
|
widthPMorDM = width - (250 + 10);
|
||||||
|
else
|
||||||
|
widthPMorDM = width - (300 + 10);
|
||||||
|
|
||||||
|
treeWidget->setColumnWidth(ColumnsTree::clmn_PMorDM, widthPMorDM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
void AMMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||||
@@ -141,8 +148,8 @@ void AMMtasksWidget::slot_traineeSelected(QString login)
|
|||||||
|
|
||||||
if(type == TypeList::listForTrainee)
|
if(type == TypeList::listForTrainee)
|
||||||
{
|
{
|
||||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_GET_TASKS_AMM_FOR_TRAINEE, idTraineeSelected);
|
|
||||||
waitAnimationWidget->showWithPlay();
|
waitAnimationWidget->showWithPlay();
|
||||||
|
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_GET_TASKS_AMM_FOR_TRAINEE, idTraineeSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,11 +205,12 @@ Module *AMMtasksWidget::searchModuleByID(int id)
|
|||||||
|
|
||||||
void AMMtasksWidget::preparationTreeWidget()
|
void AMMtasksWidget::preparationTreeWidget()
|
||||||
{
|
{
|
||||||
treeWidget->setColumnCount(2);
|
treeWidget->setColumnCount(clmn_count);
|
||||||
|
|
||||||
reSetHeadTreeWidget();
|
reSetHeadTreeWidget();
|
||||||
|
|
||||||
//treeWidget->setColumnHidden(ColumnsTree::clmn_ID, true);
|
if(type == TypeList::listCommon)
|
||||||
|
treeWidget->setColumnHidden(ColumnsTree::clmn_ID, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMMtasksWidget::reSetHeadTreeWidget()
|
void AMMtasksWidget::reSetHeadTreeWidget()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QResizeEvent>
|
||||||
#include "fimtaskswidget.h"
|
#include "fimtaskswidget.h"
|
||||||
#include "ui_fimtaskswidget.h"
|
#include "ui_fimtaskswidget.h"
|
||||||
#include "tasksAmmFim.h"
|
#include "tasksAmmFim.h"
|
||||||
@@ -15,7 +16,9 @@ FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeList ty
|
|||||||
type(type),
|
type(type),
|
||||||
userName(""),
|
userName(""),
|
||||||
loginTraineeSelected(""),
|
loginTraineeSelected(""),
|
||||||
idTraineeSelected(0)
|
idTraineeSelected(0),
|
||||||
|
threadAnimation(nullptr),
|
||||||
|
waitAnimationWidget(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@@ -34,24 +37,52 @@ FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeList ty
|
|||||||
if(type == TypeList::listForTrainee)
|
if(type == TypeList::listForTrainee)
|
||||||
{
|
{
|
||||||
ui->btnAssignTaskToTrainee->setVisible(false);
|
ui->btnAssignTaskToTrainee->setVisible(false);
|
||||||
ui->label->setVisible(false);
|
|
||||||
ui->editCode->setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
ui->label->setVisible(false);
|
||||||
|
ui->editCode->setVisible(false);
|
||||||
|
|
||||||
|
threadAnimation = new QThread();
|
||||||
|
waitAnimationWidget = new WaitAnimationWidget;
|
||||||
|
QMovie *movie = new QMovie(":/resources/icons/762.gif");
|
||||||
|
waitAnimationWidget->setParent(this);
|
||||||
|
waitAnimationWidget->initialize(movie,this);
|
||||||
|
waitAnimationWidget->moveToThread(threadAnimation);
|
||||||
|
threadAnimation->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
FIMtasksWidget::~FIMtasksWidget()
|
FIMtasksWidget::~FIMtasksWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
deleteAllTaskAmmFim();
|
deleteAllTaskAmmFim();
|
||||||
|
|
||||||
|
waitAnimationWidget->hideWithStop();
|
||||||
|
|
||||||
|
threadAnimation->quit();
|
||||||
|
threadAnimation->wait();
|
||||||
|
|
||||||
|
delete threadAnimation;
|
||||||
|
|
||||||
|
delete waitAnimationWidget;
|
||||||
|
delete treeWidget;
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FIMtasksWidget::resizeEvent(QResizeEvent *event)
|
void FIMtasksWidget::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
|
QSize size = event->size();
|
||||||
|
waitAnimationWidget->resize(size);
|
||||||
|
|
||||||
int width = treeWidget->width();
|
int width = treeWidget->width();
|
||||||
|
|
||||||
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 50);
|
treeWidget->setColumnWidth(ColumnsTree::clmn_ID, 50);
|
||||||
treeWidget->setColumnWidth(ColumnsTree::clmn_Title, width - 60);
|
|
||||||
|
int widthTitle;
|
||||||
|
if(type == TypeList::listCommon)
|
||||||
|
widthTitle = width - (0 + 10);
|
||||||
|
else
|
||||||
|
widthTitle = width - (50 + 10);
|
||||||
|
|
||||||
|
treeWidget->setColumnWidth(ColumnsTree::clmn_Title, widthTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FIMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
void FIMtasksWidget::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||||
@@ -222,11 +253,12 @@ void FIMtasksWidget::prepareListTasksForTrainee(QList<TaskAmmFim> listTask)
|
|||||||
|
|
||||||
void FIMtasksWidget::preparationTreeWidget()
|
void FIMtasksWidget::preparationTreeWidget()
|
||||||
{
|
{
|
||||||
treeWidget->setColumnCount(2);
|
treeWidget->setColumnCount(clmn_count);
|
||||||
|
|
||||||
reSetHeadTreeWidget();
|
reSetHeadTreeWidget();
|
||||||
|
|
||||||
//treeWidget->setColumnHidden(ColumnsTree::clmn_ID, true);
|
if(type == TypeList::listCommon)
|
||||||
|
treeWidget->setColumnHidden(ColumnsTree::clmn_ID, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FIMtasksWidget::reSetHeadTreeWidget()
|
void FIMtasksWidget::reSetHeadTreeWidget()
|
||||||
@@ -255,8 +287,8 @@ void FIMtasksWidget::slot_traineeSelected(QString login)
|
|||||||
|
|
||||||
if(type == TypeList::listForTrainee)
|
if(type == TypeList::listForTrainee)
|
||||||
{
|
{
|
||||||
int trainee_id = connectorToServer->getIdTraineeByLogin(loginTraineeSelected);
|
waitAnimationWidget->showWithPlay();
|
||||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_GET_TASKS_FIM_FOR_TRAINEE, trainee_id);
|
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_GET_TASKS_FIM_FOR_TRAINEE, idTraineeSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,6 +301,7 @@ void FIMtasksWidget::slot_UpdateTasksFIMforTrainee(int trainee_id)
|
|||||||
QList<TaskAmmFim> listTask = connectorToServer->getListTasksFIMforTrainee(trainee_id);
|
QList<TaskAmmFim> listTask = connectorToServer->getListTasksFIMforTrainee(trainee_id);
|
||||||
prepareListTasksForTrainee(listTask);
|
prepareListTasksForTrainee(listTask);
|
||||||
fillTree();
|
fillTree();
|
||||||
|
waitAnimationWidget->hideWithStop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,11 +311,15 @@ void FIMtasksWidget::loadTasksFIM()
|
|||||||
//Обновление дерева
|
//Обновление дерева
|
||||||
treeWidget->clear();
|
treeWidget->clear();
|
||||||
|
|
||||||
|
waitAnimationWidget->showWithPlay();
|
||||||
|
|
||||||
QByteArray array = connectorToServer->getListTaskFimArray();
|
QByteArray array = connectorToServer->getListTaskFimArray();
|
||||||
loadFIMtasksFromXML(array);
|
loadFIMtasksFromXML(array);
|
||||||
|
|
||||||
//собственно обновление дерева
|
//собственно обновление дерева
|
||||||
fillTree();
|
fillTree();
|
||||||
|
|
||||||
|
waitAnimationWidget->hideWithStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskAmmFim* FIMtasksWidget::getTaskByID(int id)
|
TaskAmmFim* FIMtasksWidget::getTaskByID(int id)
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
enum ColumnsTree{
|
enum ColumnsTree{
|
||||||
clmn_Title = 0,
|
clmn_Title = 0,
|
||||||
clmn_ID
|
clmn_ID,
|
||||||
|
clmn_count
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -82,6 +83,9 @@ private:
|
|||||||
QList<TaskAmmFim*> listTaskAmmFim;
|
QList<TaskAmmFim*> listTaskAmmFim;
|
||||||
QString loginTraineeSelected;
|
QString loginTraineeSelected;
|
||||||
int idTraineeSelected;
|
int idTraineeSelected;
|
||||||
|
|
||||||
|
QThread* threadAnimation;
|
||||||
|
WaitAnimationWidget *waitAnimationWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FIMTASKSWIDGET_H
|
#endif // FIMTASKSWIDGET_H
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
enum ColumnsTree{
|
enum ColumnsTree{
|
||||||
clmn_PMorDM = 0,
|
clmn_PMorDM = 0,
|
||||||
clmn_code,
|
clmn_code,
|
||||||
clmn_ID
|
clmn_ID,
|
||||||
|
clmn_count
|
||||||
};
|
};
|
||||||
|
|
||||||
class TaskTreePreparation : public QObject
|
class TaskTreePreparation : public QObject
|
||||||
|
|||||||
Reference in New Issue
Block a user