Merge branch 'work40' into DEV
@@ -81,7 +81,7 @@ QToolButton {
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
QToolButton#btnSend, QToolButton#btnDelete, QToolButton#btnCheck, QToolButton#btnOnlyActive,
|
||||
QToolButton#btnSend, QToolButton#btnDelete, QToolButton#btnCheck, QToolButton#btnOnlyActive, QToolButton#btnStatus,
|
||||
QToolButton#btnSave, QToolButton#btnUpdateStyle, QToolButton#btnSetVersion,
|
||||
QToolButton#btnAssignTask, QToolButton#btnCheckDB, QToolButton#btnRepare, QToolButton#btnDocsUpdating,
|
||||
QToolButton#btnAssign {
|
||||
|
||||
@@ -435,6 +435,54 @@ int DataBaseLMS::updateStatusTaskFIM(int task_id, QString status)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(status == "new")
|
||||
{//Удаляем отчет
|
||||
queryStr = QString("SELECT reports.report_id "
|
||||
"FROM public.reports "
|
||||
"WHERE fk_task_fim_id = %1 "
|
||||
"ORDER BY reports.report_id ASC").arg(
|
||||
QString::number(task_id));
|
||||
|
||||
int report_id = 0;
|
||||
|
||||
QSqlQuery queryReportsSEL = QSqlQuery(*db);
|
||||
if(queryExec(queryStr, &queryReportsSEL))
|
||||
{
|
||||
if (queryReportsSEL.first())
|
||||
{//Отчет
|
||||
report_id = queryReportsSEL.value(0).toInt();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
queryStr = QString("DELETE FROM public.report_items "
|
||||
"WHERE fk_report_id = %1 ").arg(
|
||||
QString::number(report_id));
|
||||
|
||||
QSqlQuery queryItemsDEL = QSqlQuery(*db);
|
||||
if(!queryExec(queryStr, &queryItemsDEL))
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
queryStr = QString("DELETE FROM public.reports "
|
||||
"WHERE report_id = %1 ").arg(
|
||||
QString::number(report_id));
|
||||
|
||||
QSqlQuery queryReportsDEL = QSqlQuery(*db);
|
||||
if(!queryExec(queryStr, &queryReportsDEL))
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
resBool = db->commit();
|
||||
return id_trainee;
|
||||
}
|
||||
|
||||
@@ -56,5 +56,6 @@
|
||||
<file>resources/icons/eye.png</file>
|
||||
<file>resources/icons/exchange.png</file>
|
||||
<file>resources/icons/link.png</file>
|
||||
<file>resources/icons/new.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <QAbstractScrollArea>
|
||||
#include <QMessageBox>
|
||||
#include <QLabel>
|
||||
#include <QScrollBar>
|
||||
#include "instructor.h"
|
||||
#include "messangerwidget.h"
|
||||
#include "ui_messangerwidget.h"
|
||||
@@ -85,6 +86,8 @@ void MessangerWidget::addTabDialogMessenger(User user)
|
||||
|
||||
oneDialogMessenger = new OneDialogMessenger(userLocalGUI, userRemote, this);
|
||||
|
||||
oneDialogMessenger->setVerticalScrollMode(QAbstractItemView::ScrollMode::ScrollPerPixel);
|
||||
|
||||
ui->verticalLayout_ListMsg->addWidget(oneDialogMessenger);
|
||||
|
||||
//Обновляем заголовок
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../ServerLMS/ServerLMS.qrc">:/resources/icons/circleGray.png</pixmap>
|
||||
<pixmap resource="../InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -128,7 +128,7 @@
|
||||
<string>Send</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/sendMsg.png</normaloff>:/resources/icons/sendMsg.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -149,7 +149,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../ServerLMS/ServerLMS.qrc"/>
|
||||
<include location="../InstructorsAndTrainees.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -15,6 +15,10 @@ OneDialogMessenger::OneDialogMessenger(User userLocalGUI, User userRemote, QWidg
|
||||
|
||||
setWordWrap(true);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
|
||||
|
||||
setVerticalScrollMode(ScrollMode::ScrollPerPixel);
|
||||
|
||||
verticalScrollBar()->setSingleStep(10);
|
||||
}
|
||||
|
||||
OneDialogMessenger::~OneDialogMessenger()
|
||||
|
||||
BIN
LibInstructorsAndTrainees/resources/icons/new — копия (2).png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
LibInstructorsAndTrainees/resources/icons/new — копия.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
LibInstructorsAndTrainees/resources/icons/new.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 16 KiB |
BIN
LibInstructorsAndTrainees/resources/icons/sign — копия.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -21,7 +21,7 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
threadPreparation(nullptr),
|
||||
taskTreePreparation(nullptr),
|
||||
waitAnimationWidget(nullptr),
|
||||
dlgCheckerTask(nullptr),
|
||||
dlgStatusTask(nullptr),
|
||||
dlgListSubProc(nullptr),
|
||||
flOnlyActive(false),
|
||||
lastCurrentID(0)
|
||||
@@ -35,6 +35,8 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
treeWidget->setObjectName("treeWidget_AMMforTrainee");
|
||||
ui->horizontalLayout_Tree->addWidget(treeWidget);
|
||||
|
||||
treeWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
|
||||
connect(treeWidget, &QTreeWidget::itemClicked, this, &AMMtasksWidget::on_treeWidgetItemClicked);
|
||||
connect(treeWidget, &QTreeWidget::itemDoubleClicked, this, &AMMtasksWidget::on_treeWidgetDoubleClicked);
|
||||
|
||||
@@ -63,8 +65,8 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
|
||||
ui->btnDelete->setObjectName("btnDelete");
|
||||
ui->btnDelete->setEnabled(false);
|
||||
ui->btnCheck->setObjectName("btnCheck");
|
||||
ui->btnCheck->setEnabled(false);
|
||||
ui->btnStatus->setObjectName("btnStatus");
|
||||
ui->btnStatus->setEnabled(false);
|
||||
ui->btnOnlyActive->setObjectName("btnOnlyActive");
|
||||
ui->btnOnlyActive->setEnabled(false);
|
||||
ui->btnAssignTask->setObjectName("btnAssignTask");
|
||||
@@ -75,7 +77,19 @@ AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
if(type == TypeListTreeAMMFIM::listCommon)
|
||||
{
|
||||
ui->btnDelete->setVisible(false);
|
||||
ui->btnCheck->setVisible(false);
|
||||
ui->btnStatus->setVisible(false);
|
||||
}
|
||||
else if(type == TypeListTreeAMMFIM::listOneTask)
|
||||
{
|
||||
ui->btnDelete->setVisible(false);
|
||||
ui->btnStatus->setVisible(false);
|
||||
ui->btnAssignTask->setVisible(false);
|
||||
ui->btnOnlyActive->setVisible(false);
|
||||
ui->btnDocsUpdating->setVisible(false);
|
||||
ui->label_DocsActualed->setVisible(false);
|
||||
ui->label_Actual->setVisible(false);
|
||||
this->treeWidget->headerItem()->setHidden(true);
|
||||
this->treeWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,6 +131,13 @@ void AMMtasksWidget::deactivate()
|
||||
idTraineeSelected = 0;
|
||||
}
|
||||
|
||||
void AMMtasksWidget::setOneTaskAmm(TaskAmmFim *task)
|
||||
{
|
||||
QList<TaskAmmFim> listTask;
|
||||
listTask.append(*task);
|
||||
emit signal_prepareAMMListItemsForTrainee(listTask);
|
||||
}
|
||||
|
||||
void AMMtasksWidget::waitAnimationWidgetShowWithPlay()
|
||||
{
|
||||
waitAnimationWidget->showWithPlay();
|
||||
@@ -153,8 +174,8 @@ void AMMtasksWidget::closeEvent(QCloseEvent *event)
|
||||
|
||||
void AMMtasksWidget::closeChildDlg()
|
||||
{
|
||||
if(dlgCheckerTask)
|
||||
dlgCheckerTask->close();
|
||||
if(dlgStatusTask)
|
||||
dlgStatusTask->close();
|
||||
if(dlgListSubProc)
|
||||
dlgListSubProc->close();
|
||||
}
|
||||
@@ -183,7 +204,7 @@ void AMMtasksWidget::on_treeWidgetItemClicked(QTreeWidgetItem *item, int column)
|
||||
if(item == nullptr)
|
||||
{
|
||||
ui->btnDelete->setEnabled(false);
|
||||
ui->btnCheck->setEnabled(false);
|
||||
ui->btnStatus->setEnabled(false);
|
||||
ui->btnAssignTask->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
@@ -204,14 +225,14 @@ void AMMtasksWidget::on_treeWidgetItemClicked(QTreeWidgetItem *item, int column)
|
||||
lastCurrentID = id;
|
||||
|
||||
ui->btnDelete->setEnabled(false);
|
||||
ui->btnCheck->setEnabled(false);
|
||||
ui->btnStatus->setEnabled(false);
|
||||
}
|
||||
else if(this->type == TypeListTreeAMMFIM::listForTrainee)
|
||||
{
|
||||
QTreeWidgetItem *treeItemParent = item->parent();
|
||||
if(treeItemParent == nullptr)
|
||||
{//Выбрана задача
|
||||
ui->btnCheck->setEnabled(true);
|
||||
ui->btnStatus->setEnabled(true);
|
||||
ui->btnDelete->setEnabled(true);
|
||||
|
||||
int id = item->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
|
||||
@@ -222,7 +243,7 @@ void AMMtasksWidget::on_treeWidgetItemClicked(QTreeWidgetItem *item, int column)
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->btnCheck->setEnabled(false);
|
||||
ui->btnStatus->setEnabled(false);
|
||||
ui->btnDelete->setEnabled(false);
|
||||
}
|
||||
ui->btnAssignTask->setEnabled(false);
|
||||
@@ -282,7 +303,7 @@ void AMMtasksWidget::loadTasksAMM(bool flRequestFirst)
|
||||
|
||||
void AMMtasksWidget::slot_AMMlistItemsReady(QList<QTreeWidgetItem *> listItems)
|
||||
{
|
||||
if(type != TypeListTreeAMMFIM::listForTrainee)
|
||||
if(type != TypeListTreeAMMFIM::listForTrainee && type != TypeListTreeAMMFIM::listOneTask)
|
||||
{
|
||||
//Обновление дерева
|
||||
treeWidget->clear();
|
||||
@@ -296,6 +317,13 @@ void AMMtasksWidget::slot_AMMlistItemsReady(QList<QTreeWidgetItem *> listItems)
|
||||
if(item != nullptr)
|
||||
treeWidget->setCurrentItem(item);
|
||||
*/
|
||||
QTreeWidgetItem * item = treeWidget->topLevelItem(0);
|
||||
if(item != nullptr)
|
||||
{
|
||||
//treeWidget->setCurrentItem(item);
|
||||
if(type == TypeListTreeAMMFIM::listOneTask)
|
||||
treeWidget->expandAll();
|
||||
}
|
||||
|
||||
if(type == TypeListTreeAMMFIM::listForTrainee)
|
||||
setCurrentTask(lastCurrentID);
|
||||
@@ -363,7 +391,7 @@ void AMMtasksWidget::preparationTreeWidget()
|
||||
|
||||
reSetHeadTreeWidget();
|
||||
|
||||
if(type == TypeListTreeAMMFIM::listCommon)
|
||||
if(type == TypeListTreeAMMFIM::listCommon || type == TypeListTreeAMMFIM::listOneTask)
|
||||
{
|
||||
treeWidget->setColumnHidden(ColumnsTreeAMM::clmnAMM_ID, true);
|
||||
treeWidget->setColumnHidden(ColumnsTreeAMM::clmnAMM_status, true);
|
||||
@@ -515,7 +543,7 @@ void AMMtasksWidget::on_btnDelete_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void AMMtasksWidget::on_btnCheck_clicked()
|
||||
void AMMtasksWidget::on_btnStatus_clicked()
|
||||
{
|
||||
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
|
||||
|
||||
@@ -529,17 +557,17 @@ void AMMtasksWidget::on_btnCheck_clicked()
|
||||
if(!task.getID())
|
||||
return;
|
||||
|
||||
dlgCheckerTask = new DialogChekerTask(connectorToServer, "amm", this);
|
||||
dlgCheckerTask->setTask(&task);
|
||||
dlgCheckerTask->exec();
|
||||
dlgStatusTask = new DialogChekerTask(connectorToServer, CheckerTask::TypeChecker::amm_check, this);
|
||||
dlgStatusTask->setTask(&task);
|
||||
dlgStatusTask->exec();
|
||||
|
||||
if(dlgCheckerTask->getFlChanged())
|
||||
if(dlgStatusTask->getFlChanged())
|
||||
waitAnimationWidget->showWithPlay();
|
||||
|
||||
if(dlgCheckerTask)
|
||||
if(dlgStatusTask)
|
||||
{
|
||||
delete dlgCheckerTask;
|
||||
dlgCheckerTask = nullptr;
|
||||
delete dlgStatusTask;
|
||||
dlgStatusTask = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
|
||||
public:
|
||||
void deactivate();
|
||||
void setOneTaskAmm(TaskAmmFim* task);
|
||||
void waitAnimationWidgetShowWithPlay();
|
||||
|
||||
void setDocsActualed(bool flActualed);
|
||||
@@ -42,7 +43,7 @@ protected:
|
||||
private Q_SLOTS:
|
||||
void on_treeWidgetItemClicked(QTreeWidgetItem *item, int column);
|
||||
void on_btnDelete_clicked();
|
||||
void on_btnCheck_clicked();
|
||||
void on_btnStatus_clicked();
|
||||
void on_btnAssignTask_clicked();
|
||||
void on_btnOnlyActive_clicked(); //AMM
|
||||
|
||||
@@ -99,7 +100,7 @@ private:
|
||||
TaskAMMFIMTreePreparation* taskTreePreparation;
|
||||
WaitAnimationWidget *waitAnimationWidget;
|
||||
|
||||
DialogChekerTask* dlgCheckerTask;
|
||||
DialogChekerTask* dlgStatusTask;
|
||||
|
||||
DialogListSubProc* dlgListSubProc;
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnCheck">
|
||||
<widget class="QToolButton" name="btnStatus">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
|
||||
@@ -2,42 +2,53 @@
|
||||
#include "specialmessagebox.h"
|
||||
#include "ui_checkertask.h"
|
||||
#include "fimtaskswidget.h"
|
||||
#include "ammtaskswidget.h"
|
||||
|
||||
CheckerTask::CheckerTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent) :
|
||||
CheckerTask::CheckerTask(ConnectorToServer* connectorToServer, TypeChecker type, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CheckerTask),
|
||||
connectorToServer(connectorToServer),
|
||||
fimTasksWidget(nullptr),
|
||||
ammTasksWidget(nullptr),
|
||||
flChanged(false),
|
||||
id_task(0),
|
||||
type("fim")
|
||||
type(TypeChecker::fim_check)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->btnNew->setObjectName("btnNew");
|
||||
ui->btnCheckup->setObjectName("btnCheckup");
|
||||
ui->btnWrong->setObjectName("btnWrong");
|
||||
ui->btnCompleted->setObjectName("btnCompleted");
|
||||
|
||||
this->type = type;
|
||||
|
||||
if(type == "fim")
|
||||
if(type == TypeChecker::fim_check)
|
||||
{
|
||||
fimTasksWidget = new FIMtasksWidget(nullptr, TypeListTreeAMMFIM::listOneTask, this);
|
||||
|
||||
ui->verticalLayout_3->addWidget(fimTasksWidget);
|
||||
|
||||
ui->lblName->setVisible(false);
|
||||
ui->lblDMcode->setVisible(false);
|
||||
|
||||
ui->plainText->setReadOnly(true);
|
||||
ui->plainText->setObjectName("plainText");
|
||||
}
|
||||
else
|
||||
else if(type == TypeChecker::amm_check)
|
||||
{
|
||||
ammTasksWidget = new AMMtasksWidget(nullptr, TypeListTreeAMMFIM::listOneTask, this);
|
||||
ui->verticalLayout_3->addWidget(ammTasksWidget);
|
||||
|
||||
ui->lblName->setVisible(false);
|
||||
ui->lblDMcode->setVisible(false);
|
||||
|
||||
ui->plainText->setVisible(false);
|
||||
ui->label->setVisible(false);
|
||||
//ui->label_Task->setVisible(false);
|
||||
ui->btnRight->setText(tr("Completed"));
|
||||
ui->btnWrong->setText(tr("New"));
|
||||
ui->btnWrong->setIcon(QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
|
||||
ui->btnRight->setEnabled(false);
|
||||
ui->btnWrong->setEnabled(false);
|
||||
ui->btnCheckup->setEnabled(false);
|
||||
ui->btnWrong->setVisible(false);
|
||||
ui->btnCheckup->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +60,12 @@ CheckerTask::~CheckerTask()
|
||||
fimTasksWidget = nullptr;
|
||||
}
|
||||
|
||||
if(ammTasksWidget)
|
||||
{
|
||||
delete ammTasksWidget;
|
||||
ammTasksWidget = nullptr;
|
||||
}
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -62,20 +79,68 @@ void CheckerTask::setTask(TaskAmmFim* task)
|
||||
this->task = *task;
|
||||
id_task = task->getID();
|
||||
|
||||
if(type == "fim")
|
||||
if(type == TypeChecker::fim_check)
|
||||
{
|
||||
//Задача
|
||||
fimTasksWidget->setOneTaskFim(&this->task);
|
||||
|
||||
//Репорт
|
||||
outReport(this->task.report);
|
||||
}
|
||||
else if(type == "amm")
|
||||
{
|
||||
|
||||
if(this->task.status == "new")
|
||||
ui->btnRight->setEnabled(true);
|
||||
else
|
||||
{
|
||||
ui->btnNew->setEnabled(false);
|
||||
ui->btnCheckup->setEnabled(false);
|
||||
ui->btnWrong->setEnabled(false);
|
||||
ui->btnCompleted->setEnabled(false);
|
||||
|
||||
ui->plainText->setVisible(false);
|
||||
ui->label->setVisible(false);
|
||||
}
|
||||
else if(this->task.status == "checkup")
|
||||
{
|
||||
ui->btnNew->setEnabled(true);
|
||||
ui->btnCheckup->setEnabled(false);
|
||||
ui->btnWrong->setEnabled(true);
|
||||
ui->btnCompleted->setEnabled(true);
|
||||
}
|
||||
else if(this->task.status == "failed")
|
||||
{
|
||||
ui->btnNew->setEnabled(true);
|
||||
ui->btnCheckup->setEnabled(true);
|
||||
ui->btnWrong->setEnabled(false);
|
||||
ui->btnCompleted->setEnabled(true);
|
||||
}
|
||||
else if(this->task.status == "completed")
|
||||
{
|
||||
ui->btnNew->setEnabled(true);
|
||||
ui->btnCheckup->setEnabled(true);
|
||||
ui->btnWrong->setEnabled(true);
|
||||
ui->btnCompleted->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->btnNew->setEnabled(false);
|
||||
ui->btnCheckup->setEnabled(false);
|
||||
ui->btnWrong->setEnabled(false);
|
||||
ui->btnCompleted->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else if(type == TypeChecker::amm_check)
|
||||
{
|
||||
//Задача
|
||||
ammTasksWidget->setOneTaskAmm(&this->task);
|
||||
|
||||
if(this->task.status == "new")
|
||||
{
|
||||
ui->btnNew->setEnabled(false);
|
||||
ui->btnCompleted->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->btnNew->setEnabled(true);
|
||||
ui->btnCompleted->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->lblName->setText(task->ammProcedure.title);
|
||||
ui->lblDMcode->setText(task->ammProcedure.dmCode);
|
||||
@@ -100,7 +165,7 @@ void CheckerTask::setTask(TaskAmmFim* task)
|
||||
else
|
||||
{
|
||||
ui->lblStatusCurrText->setText(tr("new"));
|
||||
ui->lblStatusCurrIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
ui->lblStatusCurrIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/new.png")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,19 +222,70 @@ void CheckerTask::outReport(FIMReport report)
|
||||
}
|
||||
}
|
||||
|
||||
//НЕВЕРНО
|
||||
void CheckerTask::on_btnWrong_clicked()
|
||||
{
|
||||
TypeQueryToDB typeQuery;
|
||||
QString status;
|
||||
QString msgString;
|
||||
|
||||
if(type == "fim")
|
||||
if(type == TypeChecker::fim_check)
|
||||
{
|
||||
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE;
|
||||
status = "failed";
|
||||
msgString = tr("Change task status?\nThe status will be set:\n'failed'");
|
||||
}
|
||||
else
|
||||
|
||||
if(SpecMsgBox::WarningYesNo(this, msgString) == QDialog::Accepted)
|
||||
{
|
||||
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
|
||||
this->parentWidget()->close();
|
||||
flChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
//ВЫПОЛНЕНО
|
||||
void CheckerTask::on_btnCompleted_clicked()
|
||||
{
|
||||
TypeQueryToDB typeQuery;
|
||||
QString status;
|
||||
QString msgString;
|
||||
|
||||
if(type == TypeChecker::fim_check)
|
||||
{
|
||||
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE;
|
||||
status = "completed";
|
||||
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
|
||||
}
|
||||
else if(type == TypeChecker::amm_check)
|
||||
{
|
||||
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE;
|
||||
status = "completed";
|
||||
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
|
||||
}
|
||||
|
||||
if(SpecMsgBox::WarningYesNo(this, msgString) == QDialog::Accepted)
|
||||
{
|
||||
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
|
||||
this->parentWidget()->close();
|
||||
flChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
//НОВАЯ
|
||||
void CheckerTask::on_btnNew_clicked()
|
||||
{
|
||||
TypeQueryToDB typeQuery;
|
||||
QString status;
|
||||
QString msgString;
|
||||
|
||||
if(type == TypeChecker::fim_check)
|
||||
{
|
||||
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE;
|
||||
status = "new";
|
||||
msgString = tr("Change task status?\nThe status will be set:\n'new'");
|
||||
}
|
||||
else if(type == TypeChecker::amm_check)
|
||||
{
|
||||
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE;
|
||||
status = "new";
|
||||
@@ -184,23 +300,18 @@ void CheckerTask::on_btnWrong_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void CheckerTask::on_btnRight_clicked()
|
||||
//НА ПРОВЕРКЕ
|
||||
void CheckerTask::on_btnCheckup_clicked()
|
||||
{
|
||||
TypeQueryToDB typeQuery;
|
||||
QString status;
|
||||
QString msgString;
|
||||
|
||||
if(type == "fim")
|
||||
if(type == TypeChecker::fim_check)
|
||||
{
|
||||
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE;
|
||||
status = "completed";
|
||||
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
|
||||
}
|
||||
else
|
||||
{
|
||||
typeQuery = TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE;
|
||||
status = "completed";
|
||||
msgString = tr("Change task status?\nThe status will be set:\n'completed'");
|
||||
status = "checkup";
|
||||
msgString = tr("Change task status?\nThe status will be set:\n'checkup'");
|
||||
}
|
||||
|
||||
if(SpecMsgBox::WarningYesNo(this, msgString) == QDialog::Accepted)
|
||||
|
||||
@@ -13,13 +13,21 @@ class CheckerTask;
|
||||
}
|
||||
|
||||
class FIMtasksWidget;
|
||||
class AMMtasksWidget;
|
||||
|
||||
class CheckerTask : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CheckerTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent = nullptr);
|
||||
enum TypeChecker
|
||||
{
|
||||
amm_check,
|
||||
fim_check
|
||||
};
|
||||
|
||||
public:
|
||||
explicit CheckerTask(ConnectorToServer* connectorToServer, TypeChecker type, QWidget *parent = nullptr);
|
||||
~CheckerTask();
|
||||
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
@@ -33,7 +41,9 @@ public:
|
||||
|
||||
private slots:
|
||||
void on_btnWrong_clicked();
|
||||
void on_btnRight_clicked();
|
||||
void on_btnCompleted_clicked();
|
||||
void on_btnNew_clicked();
|
||||
void on_btnCheckup_clicked();
|
||||
|
||||
private:
|
||||
void outReport(FIMReport report);
|
||||
@@ -47,10 +57,11 @@ private:
|
||||
private:
|
||||
ConnectorToServer* connectorToServer;
|
||||
FIMtasksWidget* fimTasksWidget;
|
||||
AMMtasksWidget* ammTasksWidget;
|
||||
|
||||
bool flChanged;
|
||||
int id_task;
|
||||
QString type;
|
||||
TypeChecker type;
|
||||
};
|
||||
|
||||
#endif // DIALOGCHECKTASK_H
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../InstructorsAndTrainees.qrc">:/resources/icons/rectGray.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -159,6 +162,58 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnNew">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/new.png</normaloff>:/resources/icons/new.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnCheckup">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Checkup</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/circleYellow.png</normaloff>:/resources/icons/circleYellow.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnWrong">
|
||||
<property name="minimumSize">
|
||||
@@ -186,7 +241,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnRight">
|
||||
<widget class="QToolButton" name="btnCompleted">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
@@ -194,7 +249,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
<string>Completed</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include "dialogchekertask.h"
|
||||
|
||||
DialogChekerTask::DialogChekerTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent) :
|
||||
DialogChekerTask::DialogChekerTask(ConnectorToServer* connectorToServer, CheckerTask::TypeChecker type, QWidget *parent) :
|
||||
QDialog(parent,
|
||||
Qt::WindowSystemMenuHint
|
||||
| Qt::WindowMaximizeButtonHint
|
||||
@@ -13,17 +13,22 @@ DialogChekerTask::DialogChekerTask(ConnectorToServer* connectorToServer, QString
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->addWidget(checkerTask);
|
||||
this->setWindowTitle(tr("Check Task"));
|
||||
|
||||
if(type == "fim")
|
||||
switch (type)
|
||||
{
|
||||
case CheckerTask::TypeChecker::fim_check:
|
||||
this->setWindowTitle(tr("Check Task"));
|
||||
this->setMinimumSize(1400, 700);
|
||||
this->setWindowState(Qt::WindowMaximized);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setMinimumSize(400, 200);
|
||||
//this->setWindowState(Qt::WindowMaximized);
|
||||
break;
|
||||
case CheckerTask::TypeChecker::amm_check:
|
||||
this->setWindowTitle(tr("Status Task"));
|
||||
this->setMinimumSize(1400, 500);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this->setModal(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class DialogChekerTask : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DialogChekerTask(ConnectorToServer* connectorToServer, QString type, QWidget *parent = nullptr);
|
||||
DialogChekerTask(ConnectorToServer* connectorToServer, CheckerTask::TypeChecker type, QWidget *parent = nullptr);
|
||||
~DialogChekerTask();
|
||||
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
@@ -32,6 +32,8 @@ FIMtasksWidget::FIMtasksWidget(ConnectorToServer* connectorToServer, TypeListTre
|
||||
treeWidget = new QTreeWidget();
|
||||
ui->horizontalLayout_Tree->addWidget(treeWidget);
|
||||
|
||||
treeWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
|
||||
//connect(treeWidget, &QTreeWidget::currentItemChanged, this, &FIMtasksWidget::on_treeWidgetCurrentItemChanged);
|
||||
connect(treeWidget, &QTreeWidget::itemClicked, this, &FIMtasksWidget::on_treeWidgetItemClicked);
|
||||
|
||||
@@ -191,10 +193,11 @@ void FIMtasksWidget::on_treeWidgetItemClicked(QTreeWidgetItem *item, int column)
|
||||
|
||||
ui->btnDelete->setEnabled(true);
|
||||
|
||||
if(task.status != "new")
|
||||
ui->btnCheck->setEnabled(true);
|
||||
/*if(task.status != "new")
|
||||
ui->btnCheck->setEnabled(true);
|
||||
else
|
||||
ui->btnCheck->setEnabled(false);
|
||||
ui->btnCheck->setEnabled(false);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -422,7 +425,7 @@ void FIMtasksWidget::on_btnCheck_clicked()
|
||||
if(!task.getID())
|
||||
return;
|
||||
|
||||
dlgCheckerTask = new DialogChekerTask(connectorToServer, "fim", this);
|
||||
dlgCheckerTask = new DialogChekerTask(connectorToServer, CheckerTask::TypeChecker::fim_check, this);
|
||||
dlgCheckerTask->setTask(&task);
|
||||
dlgCheckerTask->exec();
|
||||
|
||||
@@ -464,6 +467,7 @@ void FIMtasksWidget::setCurrentTask(int id)
|
||||
if(item->text(ColumnsTreeFIM::clmnFIM_ID).toInt() == id)
|
||||
{
|
||||
treeWidget->setCurrentItem(item);
|
||||
treeWidget->itemClicked(item, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
public:
|
||||
void deactivate();
|
||||
void setOneTaskFim(TaskAmmFim* task); //FIM
|
||||
void setOneTaskFim(TaskAmmFim* task);
|
||||
void waitAnimationWidgetShowWithPlay();
|
||||
|
||||
public:
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<string>Assign</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/assignTask.png</normaloff>:/resources/icons/assignTask.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -80,7 +80,7 @@
|
||||
<string>Check</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/check.png</normaloff>:/resources/icons/check.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -106,7 +106,7 @@
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/delete.png</normaloff>:/resources/icons/delete.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -129,7 +129,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
<include location="../InstructorsAndTrainees.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -14,6 +14,8 @@ ListSubProc::ListSubProc(QWidget *parent) :
|
||||
treeWidget = new QTreeWidget();
|
||||
ui->horizontalLayout_Tree->addWidget(treeWidget);
|
||||
|
||||
treeWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||
|
||||
preparationTreeWidget();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<string>Assign</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../ServerLMS/ServerLMS.qrc">
|
||||
<iconset resource="../InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/circleGreen.png</normaloff>:/resources/icons/circleGreen.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -93,7 +93,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../ServerLMS/ServerLMS.qrc"/>
|
||||
<include location="../InstructorsAndTrainees.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -43,6 +43,15 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="autoScroll">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -525,13 +525,13 @@ void TaskAMMFIMTreePreparation::slot_prepareAMMListItemsForTrainee(QList<TaskAmm
|
||||
else
|
||||
{
|
||||
item->setText(ColumnsTreeAMM::clmnAMM_status, tr("new"));
|
||||
item->setIcon(ColumnsTreeAMM::clmnAMM_status, QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
item->setIcon(ColumnsTreeAMM::clmnAMM_status, QIcon(QStringLiteral(":/resources/icons/new.png")));
|
||||
}
|
||||
|
||||
item->setToolTip(0, text);
|
||||
|
||||
|
||||
if(type == TypeListTreeAMMFIM::listForTrainee)
|
||||
if(type == TypeListTreeAMMFIM::listForTrainee || type == TypeListTreeAMMFIM::listOneTask)
|
||||
{
|
||||
//Подпроцедуры
|
||||
if(task.listSubProc.count())
|
||||
@@ -598,7 +598,7 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItems(QByteArray array)
|
||||
else
|
||||
{
|
||||
itemTask->setText(ColumnsTreeFIM::clmnFIM_status, tr("new"));
|
||||
itemTask->setIcon(ColumnsTreeFIM::clmnFIM_status, QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
itemTask->setIcon(ColumnsTreeFIM::clmnFIM_status, QIcon(QStringLiteral(":/resources/icons/new.png")));
|
||||
}
|
||||
|
||||
|
||||
@@ -635,7 +635,7 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItems(QByteArray array)
|
||||
itemSign->setText(ColumnsTreeFIM::clmnFIM_Title, sign.description);
|
||||
//itemSign->setFlags(itemSign->flags() | Qt::ItemIsUserCheckable);
|
||||
//itemSign->setCheckState(ColumnsTreeFIM::clmnFIM_Title, Qt::Checked);
|
||||
itemSign->setIcon(ColumnsTreeFIM::clmnFIM_Title, QIcon(":/resources/icons/sign.png"));
|
||||
itemSign->setIcon(ColumnsTreeFIM::clmnFIM_Title, QIcon(":/resources/icons/sign.png").pixmap(24, 24));
|
||||
itemSign->setToolTip(ColumnsTreeFIM::clmnFIM_Title, sign.description);
|
||||
|
||||
itemMalfunction->addChild(itemSign);
|
||||
@@ -691,7 +691,7 @@ void TaskAMMFIMTreePreparation::slot_prepareFIMListItemsForTrainee(QList<TaskAmm
|
||||
else
|
||||
{
|
||||
itemTask->setText(ColumnsTreeFIM::clmnFIM_status, tr("new"));
|
||||
itemTask->setIcon(ColumnsTreeFIM::clmnFIM_status, QIcon(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
itemTask->setIcon(ColumnsTreeFIM::clmnFIM_status, QIcon(QStringLiteral(":/resources/icons/new.png")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 9.7 KiB |
BIN
LibServer/resources/icons/old/lock.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
LibServer/resources/icons/old/stop.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
@@ -2,7 +2,6 @@
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamAttribute>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
#include <QErrorMessage>
|
||||
#include "serverlmswidget.h"
|
||||
@@ -57,6 +56,8 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
||||
waitAnimationWidget->initialize(movie,this);
|
||||
|
||||
waitAnimationWidget->showWithPlay();
|
||||
|
||||
updateStateOnlyVersion();
|
||||
}
|
||||
|
||||
ServerLMSWidget::~ServerLMSWidget()
|
||||
@@ -100,7 +101,9 @@ void ServerLMSWidget::changeEvent(QEvent *event)
|
||||
{
|
||||
ui->retranslateUi(this); // переведём окно заново
|
||||
|
||||
updateStateServer();
|
||||
updateStateOnlyServer();
|
||||
updateStateOnlyDB();
|
||||
updateStateOnlyVersion();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +140,7 @@ void ServerLMSWidget::slot_AddMessageToLog(QString message)
|
||||
void ServerLMSWidget::slot_ErrorPostgreSQL(QString text)
|
||||
{
|
||||
emit signal_Menu_ShowWindow();
|
||||
SpecMsgBox::CriticalClose(this, tr("Error PostgreSQL!"));
|
||||
SpecMsgBox::CriticalClose(this, tr("Error PostgreSQL!") + "\n" + text);
|
||||
}
|
||||
|
||||
void ServerLMSWidget::slot_UpdateDocs()
|
||||
@@ -161,7 +164,9 @@ void ServerLMSWidget::slot_startInitialization_step1()
|
||||
|
||||
flStartInitialization = true;
|
||||
|
||||
updateStateServer();
|
||||
updateStateOnlyServer();
|
||||
updateStateOnlyDB();
|
||||
updateStateOnlyVersion();
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
@@ -177,13 +182,13 @@ void ServerLMSWidget::slot_startInitialization_step1()
|
||||
void ServerLMSWidget::slot_setVersion(QString versionStr)
|
||||
{
|
||||
this->versionStr = versionStr;
|
||||
ui->lblVersionText->setText(versionStr);
|
||||
Logger::instance().log("Set Version: " + versionStr);
|
||||
updateStateOnlyVersion();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::start()
|
||||
{
|
||||
startInitialization_step0();
|
||||
|
||||
}
|
||||
|
||||
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||
@@ -191,15 +196,14 @@ void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||
if(block)
|
||||
{
|
||||
server->blockAutorization();
|
||||
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
|
||||
//emit signal_Tray_ShowMessage(tr("Authorization blocked!"));
|
||||
Logger::instance().log("Autorization is blocked");
|
||||
}
|
||||
else
|
||||
{
|
||||
server->unBlockAutorization();
|
||||
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png")));
|
||||
//emit signal_Tray_ShowMessage(tr("Authorization unblocked!"));
|
||||
Logger::instance().log("Autorization is unblocked");
|
||||
}
|
||||
updateStateOnlyServer();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::slot_LanguageChanged(QString language)
|
||||
@@ -215,28 +219,35 @@ void ServerLMSWidget::on_btnStartServer_clicked()
|
||||
if(server->startServer())
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
ui->btnStartServer->setEnabled(false);
|
||||
ui->btnStopServer->setEnabled(true);
|
||||
slot_BlockAutorization(false);
|
||||
|
||||
updateStateOnlyServer();
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Server is started!"));
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
updateStateServer();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::on_btnStopServer_clicked()
|
||||
{
|
||||
if(server->stopServer())
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
ui->btnStopServer->setEnabled(false);
|
||||
ui->btnStartServer->setEnabled(true);
|
||||
slot_BlockAutorization(true);
|
||||
|
||||
updateStateOnlyServer();
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Server is stoped!"));
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
updateStateServer();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::on_btnSettings_clicked()
|
||||
@@ -271,7 +282,7 @@ void ServerLMSWidget::on_btnSettings_clicked()
|
||||
|
||||
providerDBLMS->DisConnectionFromDB();
|
||||
|
||||
updateStateServer();
|
||||
updateStateOnlyDB();
|
||||
|
||||
SpecMsgBox::WarningClose(this, tr("Database settings have been changed.\nThe server will be restarted."));
|
||||
|
||||
@@ -292,12 +303,12 @@ void ServerLMSWidget::slot_trySetServerState(PacketType packetType)
|
||||
if (packetType == PacketType::BUSY)
|
||||
{
|
||||
server->blockAutorization();
|
||||
updateStateServer();
|
||||
updateStateOnlyServer();
|
||||
}
|
||||
else if (packetType == PacketType::FREE)
|
||||
{
|
||||
server->unBlockAutorization();
|
||||
updateStateServer();
|
||||
updateStateOnlyServer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,41 +386,43 @@ void ServerLMSWidget::startInitialization_step0()
|
||||
|
||||
processingSystem = new ProcessingSystem(providerDBLMS, updateController, docsUpdater);
|
||||
|
||||
dataParser = new DataParser(assetsManager,processingSystem);
|
||||
dataParser = new DataParser(assetsManager, processingSystem);
|
||||
|
||||
commonClientHandler = new CommonClientHandler;
|
||||
connect(this,&ServerLMSWidget::signal_DocsChanged,commonClientHandler, &CommonClientHandler::slot_DocsChanged);
|
||||
connect(commonClientHandler,&CommonClientHandler::sigSetServerState,this,&ServerLMSWidget::slot_trySetServerState);
|
||||
connect(this, &ServerLMSWidget::signal_DocsChanged, commonClientHandler, &CommonClientHandler::slot_DocsChanged);
|
||||
connect(commonClientHandler, &CommonClientHandler::sigSetServerState, this, &ServerLMSWidget::slot_trySetServerState);
|
||||
|
||||
server = new MultiThreadServer(this,updateController,processingSystem,dataParser,6000);
|
||||
server = new MultiThreadServer(this, updateController, processingSystem, dataParser, 6000);
|
||||
|
||||
loggerThread->start();
|
||||
updateThread->start();
|
||||
|
||||
commonClientHandler->initialize(server->getClientsMap(),processingSystem,dataParser);
|
||||
processingSystem->initialize(server,dataParser,commonClientHandler,updateController,chatSystem);
|
||||
chatSystem->initialize(commonClientHandler,dataParser,server->getClientsMap());
|
||||
commonClientHandler->initialize(server->getClientsMap(), processingSystem, dataParser);
|
||||
processingSystem->initialize(server, dataParser, commonClientHandler, updateController, chatSystem);
|
||||
chatSystem->initialize(commonClientHandler, dataParser, server->getClientsMap());
|
||||
|
||||
Logger::instance().moveToThread(loggerThread);
|
||||
Logger::instance().setLoggingType(LoggingType::WIDGET);
|
||||
Logger::instance().setLogToFile(true);
|
||||
|
||||
connect(this,&ServerLMSWidget::sigUpdateControllerInitialize,updateController,&UpdateController::initialize/*,Qt::DirectConnection*/);
|
||||
connect(updateController,&UpdateController::sigInitializeFinished, this,&ServerLMSWidget::slot_startInitialization_step1/*,Qt::DirectConnection*/);
|
||||
connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection);
|
||||
connect(updateController,&UpdateController::sigErrorRequired,this,&ServerLMSWidget::setError);
|
||||
connect(updateController,&UpdateController::sigUpdateDocs,this,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection);
|
||||
connect(&Logger::instance(),&Logger::sigLogToWidget,this, &ServerLMSWidget::slot_AddMessageToLog,Qt::QueuedConnection);
|
||||
connect(this, &ServerLMSWidget::sigUpdateControllerInitialize, updateController, &UpdateController::initialize);
|
||||
connect(updateController, &UpdateController::sigInitializeFinished, this, &ServerLMSWidget::slot_startInitialization_step1);
|
||||
connect(this, &ServerLMSWidget::sigCalculateFullHash, updateController, &UpdateController::calculateFullHash, Qt::AutoConnection);
|
||||
connect(updateController, &UpdateController::sigErrorRequired, this, &ServerLMSWidget::setError);
|
||||
connect(updateController, &UpdateController::sigUpdateDocs, this, &ServerLMSWidget::slot_UpdateDocs, Qt::AutoConnection);
|
||||
connect(&Logger::instance(), &Logger::sigLogToWidget, this, &ServerLMSWidget::slot_AddMessageToLog, Qt::QueuedConnection);
|
||||
|
||||
connect(assetsManager,&AssetsManager::signal_setVersion, this, &ServerLMSWidget::slot_setVersion);
|
||||
connect(assetsManager, &AssetsManager::signal_setVersion, this, &ServerLMSWidget::slot_setVersion);
|
||||
|
||||
emit sigUpdateControllerInitialize(commonClientHandler,dataParser,assetsManager);
|
||||
emit sigUpdateControllerInitialize(commonClientHandler, dataParser, assetsManager);
|
||||
}
|
||||
|
||||
void ServerLMSWidget::tryConnectionToDB()
|
||||
{
|
||||
if(! providerDBLMS->ConnectionToDB())
|
||||
{
|
||||
Logger::instance().log("Database connection error!");
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Database connection error!"), QSystemTrayIcon::Critical);
|
||||
|
||||
emit signal_Menu_ShowWindow();
|
||||
@@ -436,34 +449,38 @@ void ServerLMSWidget::tryConnectionToDB()
|
||||
on_btnStartServer_clicked();
|
||||
}
|
||||
|
||||
updateStateServer();
|
||||
updateStateOnlyDB();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::updateStateServer()
|
||||
void ServerLMSWidget::updateStateOnlyServer()
|
||||
{
|
||||
if(server)
|
||||
{
|
||||
if(server->getStateServer() == EStateServer::started)
|
||||
{
|
||||
if(server->getStateBlockAutorization() == EStateBlockAutorization::unblocked)
|
||||
{
|
||||
ui->lblOnOffText->setText(tr("started"));
|
||||
ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lblOnOffText->setText(tr("stoped"));
|
||||
ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
ui->lblOnOffText->setText(tr("started") + ", " + tr("locked"));
|
||||
ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
|
||||
}
|
||||
|
||||
if(server->getStateBlockAutorization() == EStateBlockAutorization::unblocked)
|
||||
{
|
||||
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
|
||||
}
|
||||
ui->lblOnOffText->setText(tr("stoped"));
|
||||
ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/stop.png")));
|
||||
}
|
||||
|
||||
emit signal_updateStateServer(server->getStateServer(), server->getStateBlockAutorization());
|
||||
}
|
||||
}
|
||||
|
||||
void ServerLMSWidget::updateStateOnlyDB()
|
||||
{
|
||||
if(providerDBLMS)
|
||||
{
|
||||
if(providerDBLMS->DBisConnected())
|
||||
@@ -486,6 +503,9 @@ void ServerLMSWidget::updateStateServer()
|
||||
ui->btnStartServer->setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ServerLMSWidget::updateStateOnlyVersion()
|
||||
{
|
||||
ui->lblVersionText->setText(versionStr);
|
||||
}
|
||||
|
||||
@@ -82,11 +82,12 @@ signals:
|
||||
void sigRecognize();
|
||||
void sigCalculateFullHash();
|
||||
void sigUpdateControllerInitialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
|
||||
QTcpSocket* sigGetSocket();
|
||||
|
||||
void signal_DocsChanged();
|
||||
void signal_hasError(int code);
|
||||
|
||||
void signal_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
|
||||
|
||||
public slots:
|
||||
void slot_LanguageChanged(QString language);
|
||||
void slot_UpdateListClients();
|
||||
@@ -101,6 +102,8 @@ public slots:
|
||||
|
||||
void slot_setVersion(QString versionStr);
|
||||
|
||||
void slot_trySetServerState(PacketType packetType);
|
||||
|
||||
public:
|
||||
QString getLanguage()
|
||||
{
|
||||
@@ -142,7 +145,6 @@ private slots:
|
||||
void on_btnStartServer_clicked();
|
||||
void on_btnStopServer_clicked();
|
||||
void on_btnSettings_clicked();
|
||||
void slot_trySetServerState(PacketType packetType);
|
||||
|
||||
private:
|
||||
void setLanguageInterfase();
|
||||
@@ -153,7 +155,9 @@ private:
|
||||
|
||||
void tryConnectionToDB();
|
||||
|
||||
void updateStateServer();
|
||||
void updateStateOnlyServer();
|
||||
void updateStateOnlyDB();
|
||||
void updateStateOnlyVersion();
|
||||
|
||||
private:
|
||||
Ui::ServerLMSWidget *ui;
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="ServerLMS.qrc">
|
||||
<iconset resource="Server.qrc">
|
||||
<normaloff>:/resources/icons/rocket.png</normaloff>:/resources/icons/rocket.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -109,7 +109,7 @@
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="ServerLMS.qrc">
|
||||
<iconset resource="Server.qrc">
|
||||
<normaloff>:/resources/icons/stop.png</normaloff>:/resources/icons/stop.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -148,7 +148,7 @@
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">
|
||||
<iconset resource="../LibInstructorsAndTrainees/InstructorsAndTrainees.qrc">
|
||||
<normaloff>:/resources/icons/settings.png</normaloff>:/resources/icons/settings.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -250,7 +250,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
|
||||
<pixmap resource="../LibInstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
@@ -268,7 +268,7 @@
|
||||
<widget class="QLabel" name="lblOnOffText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -305,7 +305,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
|
||||
<pixmap resource="../LibInstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -374,61 +374,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_Block">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Authorization</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBlockAuth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="ServerLMS.qrc">:/resources/icons/lock.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -436,8 +381,8 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../InstructorsAndTrainees/InstructorsAndTrainees.qrc"/>
|
||||
<include location="ServerLMS.qrc"/>
|
||||
<include location="../LibInstructorsAndTrainees/InstructorsAndTrainees.qrc"/>
|
||||
<include location="Server.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>resources/IcoGUIRRJ.ico</file>
|
||||
<file>resources/PngGUIRRJ.png</file>
|
||||
<file>resources/IcoGUIRRJ.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -2,5 +2,8 @@
|
||||
<qresource prefix="/">
|
||||
<file>resources/PngServerRRJ.png</file>
|
||||
<file>resources/IcoServerRRJ.ico</file>
|
||||
<file>resources/PngServerRRJ_lock.png</file>
|
||||
<file>resources/PngServerRRJ_start.png</file>
|
||||
<file>resources/PngServerRRJ_stop.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QMenu>
|
||||
@@ -30,6 +29,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_ShowWindow, this, &MainWindow::slot_TrayMenu_ShowWindow);
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_HideWindow, this, &MainWindow::slot_TrayMenu_HideWindow);
|
||||
|
||||
connect(serverLMSWidget, &ServerLMSWidget::signal_updateStateServer, this, &MainWindow::slot_updateStateServer);
|
||||
|
||||
qtLanguageTranslator.load(QString("translations/RRJServer_") + serverLMSWidget->getLanguage(), ".");
|
||||
qApp->installTranslator(&qtLanguageTranslator);
|
||||
|
||||
@@ -38,7 +39,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
* */
|
||||
trayIcon = new QSystemTrayIcon(this);
|
||||
//trayIcon->setIcon(this->style()->standardIcon(QStyle::SP_ComputerIcon));
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ.png"));
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_stop.png"));
|
||||
|
||||
/* После чего создаем контекстное меню для иконки трея*/
|
||||
trayMenu = new QMenu(this);
|
||||
@@ -66,7 +67,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
slot_Tray_ShowMessage(tr("Starting the server..."));
|
||||
|
||||
QTimer::singleShot(1000,this,&MainWindow::slot_LazyInitialization);
|
||||
QTimer::singleShot(1000, this, &MainWindow::slot_LazyInitialization);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -151,11 +152,6 @@ void MainWindow::slot_TrayMenu_HideWindow()
|
||||
this->hide();
|
||||
action_ShowWindow->setEnabled(true);
|
||||
action_HideWindow->setEnabled(false);
|
||||
|
||||
/*
|
||||
slot_Tray_ShowMessage(tr("The application is minimized to the tray.\n"
|
||||
"To maximize the application window, click the application icon in the tray."));
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::slot_TrayMenu_Exit()
|
||||
@@ -167,9 +163,26 @@ void MainWindow::slot_TrayMenu_Exit()
|
||||
void MainWindow::slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg)
|
||||
{
|
||||
QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon(iconMsg);
|
||||
trayIcon->showMessage(tr("Server MPS"),
|
||||
textMsg,
|
||||
icon, 100);
|
||||
trayIcon->showMessage(tr("Server MPS"), textMsg, icon, 100);
|
||||
}
|
||||
|
||||
void MainWindow::slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization)
|
||||
{
|
||||
if(stateServer == EStateServer::started)
|
||||
{
|
||||
if(stateBlockAutorization == EStateBlockAutorization::unblocked)
|
||||
{
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_start.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_lock.png"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QPixmap(":/resources/PngServerRRJ_stop.png"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slot_LazyInitialization()
|
||||
@@ -209,7 +222,7 @@ void MainWindow::errorCheck()
|
||||
slot_TrayMenu_ShowWindow();
|
||||
|
||||
//выключение с задержкой, так как eventLoop инициализируется позже
|
||||
QTimer::singleShot(1000,this,&MainWindow::slot_TrayMenu_Exit);
|
||||
QTimer::singleShot(1000, this, &MainWindow::slot_TrayMenu_Exit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +52,14 @@ public slots:
|
||||
|
||||
//Слот вывода сообщения из трея
|
||||
void slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information);
|
||||
//Слот изменения иконки трея о статусе Сервера
|
||||
void slot_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
|
||||
|
||||
//Слот отложенной инициализации
|
||||
void slot_LazyInitialization();
|
||||
|
||||
void slot_hasError(int code);
|
||||
|
||||
private:
|
||||
void exit();
|
||||
void errorCheck();
|
||||
|
||||
BIN
ProgramServerMPS/resources/PngServerRRJ_lock.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
ProgramServerMPS/resources/PngServerRRJ_start.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
ProgramServerMPS/resources/PngServerRRJ_stop.png
Normal file
|
After Width: | Height: | Size: 11 KiB |