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