before task parser

This commit is contained in:
krivoshein
2024-11-25 15:25:55 +03:00
parent 2ed1eac956
commit 7637922872
401 changed files with 39759 additions and 1630 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2024-11-13T17:15:54. -->
<!-- Written by QtCreator 4.11.1, 2024-11-25T15:15:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@@ -1,15 +1,17 @@
#include "commonview.h"
CommonView::CommonView(TypeView type, bool adminMode, QWidget *parent):
CommonView::CommonView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent):
QWidget(parent),
dbLMS(dbLMS),
treeWidget(nullptr),
typeView(type),
archiveVisible(false),
notLoggedInVisible(false),
adminMode(adminMode)
adminMode(false),
authComplited(false)
{
treeWidget = new QTreeWidget();
}
void CommonView::setItemColorArchive(QTreeWidgetItem *item)
@@ -24,8 +26,8 @@ void CommonView::setItemColorNoArchive(QTreeWidgetItem *item)
void CommonView::setItemColor(QTreeWidgetItem *item, QColor color)
{
int columnCount = treeWidget->columnCount();
//int columnCount = treeWidget->columnCount();
for (int i = 0; i < columnCount; i++)
for (int i = 0; i < item->columnCount(); i++)
item->setBackground(i, color);
}

View File

@@ -3,7 +3,9 @@
#include <QTreeWidget>
#include <QTranslator>
#include <QMutex>
#include "instructorsAndTrainees_global.h"
#include "interfacedatabaselms.h"
//Родительский класс представления БД Инструкторов/Обучаемых (самого верхнего уровня)
@@ -19,7 +21,17 @@ public:
};
public:
CommonView(TypeView type, bool adminMode, QWidget *parent = nullptr);
CommonView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent = nullptr);
public:
void setAdminMode(bool adminMode)
{
this->adminMode = adminMode;
}
void setAuthComplited(bool authComplited)
{
this->authComplited = authComplited;
}
protected:
void setArchiveVisible(bool archiveVisible)
@@ -37,14 +49,14 @@ protected:
void setItemColor(QTreeWidgetItem* item, QColor color);
protected:
InterfaceDataBaseLMS* dbLMS;
QTreeWidget* treeWidget;
QMutex mtxTreeWidget;
TypeView typeView;
bool archiveVisible;
bool notLoggedInVisible;
bool adminMode;
protected:
QTranslator qtLanguageTranslator;
bool authComplited;
};
#endif // COMMONVIEW_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -13,6 +13,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
@@ -25,6 +26,11 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Login</string>
</property>
@@ -32,6 +38,11 @@
</item>
<item>
<widget class="QLineEdit" name="editLogin">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>admin</string>
</property>
@@ -43,6 +54,11 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Password</string>
</property>
@@ -50,6 +66,11 @@
</item>
<item>
<widget class="QLineEdit" name="editPassword">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>admin</string>
</property>
@@ -59,6 +80,11 @@
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>

View File

@@ -13,6 +13,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
@@ -25,6 +26,11 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Name</string>
</property>
@@ -43,6 +49,11 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Login</string>
</property>
@@ -57,6 +68,11 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Password</string>
</property>
@@ -74,6 +90,11 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Administrator</string>
</property>
@@ -96,6 +117,11 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Archived</string>
</property>
@@ -118,6 +144,11 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Logged</string>
</property>
@@ -137,6 +168,11 @@
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>

View File

@@ -4,17 +4,23 @@
#include "ui_editorinstructors.h"
EditorInstructors::EditorInstructors(InterfaceDataBaseLMS* dbLMS, bool adminMode, QWidget *parent) :
InstructorsView(dbLMS, CommonView::TypeView::control, adminMode, parent),
InstructorsView(dbLMS, CommonView::TypeView::control, parent),
ui(new Ui::EditorInstructors)
{
ui->setupUi((QDialog*)this);
preparationTreeWidget(ui->treeWidget);
setNotLoggedInVisible(true);
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &EditorInstructors::on_treeWidget_currentItemChanged);
ui->verticalLayout_1->addWidget(treeWidget);
this->adminMode = adminMode;
preparationTreeWidget(/*ui->treeWidget*/);
//setNotLoggedInVisible(true);
loadInstructorsFromDB();
if(adminMode)
ui->btnArchive->click();
ui->btnArchive->click();
}
EditorInstructors::~EditorInstructors()
@@ -72,7 +78,7 @@ void EditorInstructors::on_btnNewInstructor_clicked()
void EditorInstructors::on_btnDeleteInstructor_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent != nullptr)
{
@@ -88,6 +94,12 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
return;
}
if(dbLMS->isLoggedInInstructor(id))
{//Инструктор залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot delete a logged-in instructor."));
return;
}
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete it anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
{
if(dbLMS->delInstructor(id))
@@ -99,7 +111,7 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
void EditorInstructors::on_btnToOrFromArchive_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent != nullptr)
{
@@ -124,6 +136,12 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
}
else
{//Не Архивный
if(dbLMS->isLoggedInInstructor(id))
{//Инструктор залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in instructor."));
return;
}
instructor.setArchived(true);
if(int id_edit = dbLMS->editInstructor(instructor))
{
@@ -140,7 +158,7 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
void EditorInstructors::on_btnEdit_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent == nullptr)
return;
@@ -151,6 +169,12 @@ void EditorInstructors::on_btnEdit_clicked()
int id = treeItemCurrent->text(ColumnsTreeInsructors::clmn_ID).toInt();
if(dbLMS->isLoggedInInstructor(id))
{//Инструктор залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in instructor."));
return;
}
DialogEditInstructor dlg(this);
Instructor instructor = dbLMS->getInstructor(id);
@@ -225,10 +249,11 @@ void EditorInstructors::on_treeWidget_currentItemChanged(QTreeWidgetItem *curren
ui->btnNewInstructor->setEnabled(true);
if(dbLMS->isAdminInstructor(id))
{//Это Админ! Удалять/Архивировать нельзя!
if(dbLMS->isAdminInstructor(id) || dbLMS->isLoggedInInstructor(id))
{//Это Админ или залогированный! Удалять/Архивировать/Редактировать нельзя!
ui->btnDeleteInstructor->setEnabled(false);
ui->btnToOrFromArchive->setEnabled(false);
ui->btnEdit->setEnabled(false);
}
else
{
@@ -238,9 +263,11 @@ void EditorInstructors::on_treeWidget_currentItemChanged(QTreeWidgetItem *curren
ui->btnDeleteInstructor->setEnabled(true);
else
ui->btnDeleteInstructor->setEnabled(false);
ui->btnEdit->setEnabled(true);
}
ui->btnEdit->setEnabled(true);
//ui->btnEdit->setEnabled(true);
ui->btnArchive->setEnabled(true);
}
}

View File

@@ -10,6 +10,12 @@
<height>800</height>
</rect>
</property>
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>List instructors</string>
</property>
@@ -18,7 +24,8 @@
<widget class="QWidget" name="widget" native="true">
<property name="font">
<font>
<pointsize>12</pointsize>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
@@ -28,32 +35,7 @@
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="columnCount">
<number>1</number>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
<layout class="QVBoxLayout" name="verticalLayout_1"/>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
@@ -72,6 +54,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">

View File

@@ -2,33 +2,72 @@
#include <QTranslator>
#include "instructorsview.h"
InstructorsView::InstructorsView(InterfaceDataBaseLMS* dbLMS, TypeView type, bool adminMode, QWidget *parent):
CommonView(type, adminMode, parent),
dbLMS(dbLMS)
InstructorsView::InstructorsView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent):
CommonView(dbLMS, type, parent)
{
}
void InstructorsView::preparationTreeWidget(QTreeWidget* tree)
void InstructorsView::slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee)
{
treeWidget = tree;
if(typeView == TypeView::onlyView)
{
if(adminMode)
archiveVisible = true;
else
archiveVisible = false;
}
else
{
archiveVisible = true;
}
if(adminMode)
{
treeWidget->setColumnHidden(ColumnsTreeInsructors::clmn_ID, false);
treeWidget->setColumnHidden(ColumnsTreeInsructors::clmn_Archived, false);
}
else
{
treeWidget->setColumnHidden(ColumnsTreeInsructors::clmn_ID, true);
treeWidget->setColumnHidden(ColumnsTreeInsructors::clmn_Archived, true);
}
updateButtons();
if(treeInstructor)
loadInstructorsFromDB();
}
void InstructorsView::preparationTreeWidget(/*QTreeWidget* tree*/)
{
mtxTreeWidget.lock();
//treeWidget = tree;
/*
if(treeWidget == nullptr)
{
mtxTreeWidget.unlock();
return;
}
*/
treeWidget->setColumnCount(7);
reSetHeadTreeWidget();
treeWidget->header()->setStyleSheet(QStringLiteral("font-size: 10pt;"));
//treeWidget->header()->setStyleSheet(QStringLiteral("font-size: 10pt;"));
treeWidget->setStyleSheet(QStringLiteral("font-size: 10pt;"
"font-family: Tahoma;"));
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_ID, 50);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Instructor, 250);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Login, 100);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Password, 100);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Administrator, 100);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Archived, 80);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Logged, 80);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Archived, 100);
treeWidget->setColumnWidth(ColumnsTreeInsructors::clmn_Logged, 100);
if(typeView == TypeView::onlyView)
{//onlyView
@@ -37,13 +76,22 @@ void InstructorsView::preparationTreeWidget(QTreeWidget* tree)
treeWidget->setColumnHidden(ColumnsTreeInsructors::clmn_Password, true);
treeWidget->setColumnHidden(ColumnsTreeInsructors::clmn_Archived, true);
treeWidget->setColumnHidden(ColumnsTreeInsructors::clmn_Administrator, true);
if(adminMode)
archiveVisible = true;
else
archiveVisible = false;
notLoggedInVisible = true;
}
else
{//control
archiveVisible = true;
notLoggedInVisible = true;
if(adminMode)
{
archiveVisible = true;
notLoggedInVisible = true;
}
else
{
@@ -54,16 +102,27 @@ void InstructorsView::preparationTreeWidget(QTreeWidget* tree)
treeWidget->setSortingEnabled(true);
treeWidget->sortItems(ColumnsTreeInsructors::clmn_Instructor, Qt::SortOrder::AscendingOrder);
mtxTreeWidget.unlock();
}
void InstructorsView::loadInstructorsFromDB()
{
/*
if(treeWidget == nullptr)
return;
return;*/
mtxTreeWidget.lock();
//Обновление дерева
treeWidget->clear();
if(!dbLMS->DBisConnected())
{
mtxTreeWidget.unlock();
return;
}
//Инструкторы
QList<Instructor> listInstructors;
listInstructors = dbLMS->getListInstructors();
@@ -77,7 +136,8 @@ void InstructorsView::loadInstructorsFromDB()
ItemInstructor->setText(ColumnsTreeInsructors::clmn_Password, instructor.getPassword());
//Сокрытие пароля
ItemInstructor->setText(ColumnsTreeInsructors::clmn_Password, QStringLiteral("******"));
if(!adminMode)
ItemInstructor->setText(ColumnsTreeInsructors::clmn_Password, QStringLiteral("******"));
if(instructor.getArchived())
{//Архивный
@@ -132,6 +192,8 @@ void InstructorsView::loadInstructorsFromDB()
if(item != nullptr)
treeWidget->setCurrentItem(item);
}
mtxTreeWidget.unlock();
}
void InstructorsView::reSetHeadTreeWidget()

View File

@@ -2,7 +2,6 @@
#define INSTRUCTORSVIEW_H
#include "instructorsAndTrainees_global.h"
#include "interfacedatabaselms.h"
#include "commonview.h"
//Родительский класс представления БД Инструкторов (для просмотра и управления)
@@ -12,7 +11,7 @@ class InstructorsView: public CommonView
Q_OBJECT
public:
InstructorsView(InterfaceDataBaseLMS* dbLMS, TypeView type, bool adminMode, QWidget *parent = nullptr);
InstructorsView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent = nullptr);
protected:
enum ColumnsTreeInsructors{
@@ -25,14 +24,16 @@ protected:
clmn_ID
};
public Q_SLOTS:
//Слот обработки сигнала необходимости обновления интерфейса
void slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee);
protected:
void preparationTreeWidget(QTreeWidget* tree);
virtual void updateButtons(){};
void preparationTreeWidget(/*QTreeWidget* tree*/);
void loadInstructorsFromDB();
void reSetHeadTreeWidget();
protected:
InterfaceDataBaseLMS* dbLMS;
};
#endif // INSTRUCTORSVIEW_H

View File

@@ -3,24 +3,16 @@
#include "viewerinstructors.h"
#include "ui_viewerinstructors.h"
ViewerInstructors::ViewerInstructors(InterfaceDataBaseLMS* db, bool adminMode, QWidget *parent) :
InstructorsView(db, CommonView::TypeView::onlyView, adminMode, parent),
ViewerInstructors::ViewerInstructors(InterfaceDataBaseLMS* db, QWidget *parent) :
InstructorsView(db, CommonView::TypeView::onlyView, parent),
ui(new Ui::ViewerInstructors)
{
ui->setupUi(this);
this->adminMode = adminMode;
ui->horizontalLayout_2->addWidget(treeWidget);
// Сделаем первоначальную инициализацию перевода для окна виджета
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTrainees_")) + QString(QStringLiteral("ru_RU")), QStringLiteral("."));
qApp->installTranslator(&qtLanguageTranslator);
preparationTreeWidget(ui->treeWidget);
preparationTreeWidget(/*ui->treeWidget*/);
setNotLoggedInVisible(true);
loadInstructorsFromDB();
if(! this->adminMode)
ui->btnEditorInstructors->setEnabled(false);
}
ViewerInstructors::~ViewerInstructors()
@@ -28,38 +20,22 @@ ViewerInstructors::~ViewerInstructors()
delete ui;
}
void ViewerInstructors::setFilterInstructorLoggedIn(bool enabled)
{
setNotLoggedInVisible(!enabled);
loadInstructorsFromDB();
}
void ViewerInstructors::changeEvent(QEvent *event)
{
// В случае получения события изменения языка приложения
if (event->type() == QEvent::LanguageChange)
{
ui->retranslateUi(this); // переведём окно заново
{// переведём окно заново
ui->retranslateUi(this);
reSetHeadTreeWidget();
loadInstructorsFromDB();
//loadInstructorsFromDB();
slot_NeedUpdateUI(true, false);
}
}
void ViewerInstructors::slot_LanguageChanged(QString language)
{
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTrainees_")) + language, QStringLiteral("."));
qApp->installTranslator(&qtLanguageTranslator);
}
void ViewerInstructors::on_btnEditorInstructors_clicked()
{
if(! adminMode)
{
QMessageBox::warning(this, tr("Attention!"),
tr("Only the Administrator has the right to edit instructors."));
return;
}
Q_EMIT signal_BlockAutorization(true);
EditorInstructors editorInstructors(dbLMS, adminMode);
QDialog* dialog = new QDialog(this);
@@ -70,4 +46,18 @@ void ViewerInstructors::on_btnEditorInstructors_clicked()
dialog->exec();
loadInstructorsFromDB();
Q_EMIT signal_BlockAutorization(false);
}
void ViewerInstructors::updateButtons()
{
if(adminMode && authComplited)
{
ui->btnEditorInstructors->setEnabled(true);
}
else
{
ui->btnEditorInstructors->setEnabled(false);
}
}

View File

@@ -1,9 +1,6 @@
#ifndef INSTRUCTORSWIDGET_H
#define INSTRUCTORSWIDGET_H
#include <QWidget>
#include "instructorsAndTrainees_global.h"
#include "interfacedatabaselms.h"
#include "instructorsview.h"
namespace Ui {
@@ -17,23 +14,22 @@ class ViewerInstructors : public InstructorsView
Q_OBJECT
public:
explicit ViewerInstructors(InterfaceDataBaseLMS* db, bool adminMode, QWidget *parent = nullptr);
explicit ViewerInstructors(InterfaceDataBaseLMS* db, QWidget *parent = nullptr);
~ViewerInstructors();
protected:
// Метод получения событий
// В нём будет производиться проверка события смены перевода приложения
void changeEvent(QEvent * event) override;
public Q_SLOTS:
void slot_LanguageChanged(QString language);
Q_SIGNALS:
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
public:
void setFilterInstructorLoggedIn(bool enabled);
private slots:
private Q_SLOTS:
void on_btnEditorInstructors_clicked();
private:
void updateButtons() override;
private:
Ui::ViewerInstructors *ui;
};

View File

@@ -13,6 +13,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
@@ -38,6 +39,9 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="btnEditorInstructors">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>130</width>
@@ -77,27 +81,6 @@
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -6,40 +6,91 @@
InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::InstructorsAndTraineesWidget),
dbLMS(nullptr),
viewerTrainees(nullptr),
viewerInstructors(nullptr),
adminMode(false),
loginInstructorLoggedInLocal(QStringLiteral(""))
{
ui->setupUi(this);
dbLMS = new InterfaceDataBaseLMS();
dbLMS = new InterfaceDataBaseLMS(this);
//Авторизация Инструктора локальная (Администратора)
authorizationInstructorLocal(this);
connect(this, &InstructorsAndTraineesWidget::signal_LanguageChanged, dbLMS, &InterfaceDataBaseLMS::slot_LanguageChanged);
m_viewerTrainees = new ViewerTrainees(dbLMS, adminMode);
m_viewerInstructors = new ViewerInstructors(dbLMS, adminMode);
viewerTrainees = new ViewerTrainees(dbLMS);
viewerInstructors = new ViewerInstructors(dbLMS);
ui->verticalLayout->addWidget(m_viewerTrainees);
ui->verticalLayout->addWidget(m_viewerInstructors);
connect(this, &InstructorsAndTraineesWidget::signal_NeedUpdateUI, viewerTrainees, &ViewerTrainees::slot_NeedUpdateUI);
connect(this, &InstructorsAndTraineesWidget::signal_NeedUpdateUI, viewerInstructors, &ViewerInstructors::slot_NeedUpdateUI);
m_viewerTrainees->setMinimumSize(1600, 700);
m_viewerInstructors->setMinimumSize(1600, 400);
connect(viewerInstructors, &ViewerInstructors::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
connect(viewerTrainees, &ViewerTrainees::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
connect(viewerTrainees, &ViewerTrainees::signal_traineeSelected, this, &InstructorsAndTraineesWidget::signal_traineeSelected);
connect(this, &InstructorsAndTraineesWidget::signal_tabMessengerChanged, viewerTrainees, &ViewerTrainees::slot_tabMessengerChanged);
ui->verticalLayout->addWidget(viewerTrainees);
ui->verticalLayout->addWidget(viewerInstructors);
viewerTrainees->setMinimumSize(1600, 500);
viewerInstructors->setMinimumSize(1600, 400);
ui->btnAuthorizationInstructor->setEnabled(false);
}
InstructorsAndTraineesWidget::~InstructorsAndTraineesWidget()
{
deAuthorizationInstructor(loginInstructorLoggedInLocal);
if(authorizationIsCompleted())
deAuthorizationInstructor(loginInstructorLoggedInLocal);
delete m_viewerInstructors;
delete m_viewerTrainees;
if(dbLMS->DBisConnected())
{
dbLMS->deAuthorizationAllInstructors();
dbLMS->deAuthorizationAllTrainees();
dbLMS->DisConnectionFromDB();
}
delete viewerInstructors;
delete viewerTrainees;
delete dbLMS;
delete ui;
}
void InstructorsAndTraineesWidget::changeEvent(QEvent *event)
{
// В случае получения события изменения языка приложения
if (event->type() == QEvent::LanguageChange)
{// переведём окно заново
ui->retranslateUi(this);
if(ui->btnAuthorizationInstructor->isChecked())
ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor"));
else
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
if(ui->btnConnectionToDB->isChecked())
ui->btnConnectionToDB->setText(tr("Disconnection DB"));
else
ui->btnConnectionToDB->setText(tr("Connection DB"));
updateLabelLoggedInInstructor();
}
}
void InstructorsAndTraineesWidget::slot_LanguageChanged(QString language)
{
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTraineesWidget_")) + language, QStringLiteral("."));
qApp->installTranslator(&qtLanguageTranslator);
Q_EMIT signal_LanguageChanged(language);
}
bool InstructorsAndTraineesWidget::authorizationInstructorLocal(QWidget* parent)
{
DialogAuthorizationInstructor dlg(parent);
dlg.setWindowTitle(tr("Instructor authorithation"));
dlg.setWindowTitle(tr("Instructor authorization"));
do
{
@@ -50,12 +101,21 @@ bool InstructorsAndTraineesWidget::authorizationInstructorLocal(QWidget* parent)
QString login = dlg.getLogin();
QString password = dlg.getPassword();
if(dbLMS->AuthorizationInstructor(login, password))
if(authorizationInstructor(login, password))
{
loginInstructorLoggedInLocal = login;
if(login == QStringLiteral("admin"))
adminMode = true;
else
adminMode = false;
viewerInstructors->setAdminMode(adminMode);
viewerTrainees->setAdminMode(adminMode);
viewerInstructors->setAuthComplited(true);
viewerTrainees->setAuthComplited(true);
Q_EMIT signal_NeedUpdateUI(true, true);
QMessageBox::information(parent, tr("Instructor authorization"), tr("Successfully!"));
@@ -87,20 +147,262 @@ bool InstructorsAndTraineesWidget::authorizationIsCompleted()
bool InstructorsAndTraineesWidget::authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name)
{
return dbLMS->AuthorizationTrainee(login, password, classroom_name, computer_name);
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->AuthorizationTrainee(login, password, classroom_name, computer_name);
Q_EMIT signal_BlockAutorization(false);
if(res)
Q_EMIT signal_NeedUpdateUI(false, true);
mtxAccess.unlock();
return res;
}
bool InstructorsAndTraineesWidget::deAuthorizationTrainee(QString login)
{
return dbLMS->deAuthorizationTrainee(login);
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->deAuthorizationTrainee(login);
Q_EMIT signal_BlockAutorization(false);
if(res)
Q_EMIT signal_NeedUpdateUI(false, true);
mtxAccess.unlock();
return res;
}
QString InstructorsAndTraineesWidget::getNameTraineeByLogin(QString login)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return QStringLiteral("");
}
QString res = dbLMS->getNameTraineeByLogin(login);
mtxAccess.unlock();
return res;
}
bool InstructorsAndTraineesWidget::authorizationInstructor(QString login, QString password)
{
return dbLMS->AuthorizationInstructor(login, password);
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->AuthorizationInstructor(login, password);
Q_EMIT signal_BlockAutorization(false);
if(res)
Q_EMIT signal_NeedUpdateUI(true, false);
mtxAccess.unlock();
return res;
}
bool InstructorsAndTraineesWidget::deAuthorizationInstructor(QString login)
{
return dbLMS->deAuthorizationInstructor(login);
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->deAuthorizationInstructor(login);
Q_EMIT signal_BlockAutorization(false);
if(res)
{
if(loginInstructorLoggedInLocal == login)
{
loginInstructorLoggedInLocal = QStringLiteral("");
adminMode = false;
viewerInstructors->setAdminMode(adminMode);
viewerTrainees->setAdminMode(adminMode);
viewerInstructors->setAuthComplited(false);
viewerTrainees->setAuthComplited(false);
Q_EMIT signal_NeedUpdateUI(true, false);
}
else
Q_EMIT signal_NeedUpdateUI(true, false);
}
mtxAccess.unlock();
return res;
}
QString InstructorsAndTraineesWidget::getNameInstructorByLogin(QString login)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return QStringLiteral("");
}
QString res = dbLMS->getNameInstructorByLogin(login);
mtxAccess.unlock();
return res;
}
QString InstructorsAndTraineesWidget::getMainInstructorName()
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return QStringLiteral("");
}
QString res = dbLMS->getNameInstructorByLogin(loginInstructorLoggedInLocal);
mtxAccess.unlock();
return res;
}
QList<Trainee> InstructorsAndTraineesWidget::getListTrainees()
{
return dbLMS->getListTrainees();
}
void InstructorsAndTraineesWidget::on_btnConnectionToDB_clicked()
{
mtxAccess.lock();
bool stateIsChecked = ui->btnConnectionToDB->isChecked();
if(stateIsChecked)
{//Подключение к БД
if(! dbLMS->DBisConnected())
{
if(dbLMS->ConnectionToDB())
{
ui->btnConnectionToDB->setText(tr("Disconnection DB"));
ui->btnAuthorizationInstructor->setEnabled(true);
Q_EMIT signal_NeedUpdateUI(true, true);
Q_EMIT signal_BlockAutorization(false);
Q_EMIT signal_InitMessanger(dbLMS->getListTrainees());
}
}
}
else
{//Отключение от БД
bool stateIsCheckedAuthorization = ui->btnAuthorizationInstructor->isChecked();
if(stateIsCheckedAuthorization)
ui->btnAuthorizationInstructor->click();
if(dbLMS->DBisConnected())
{
Q_EMIT signal_BlockAutorization(true);
dbLMS->DisConnectionFromDB();
ui->btnConnectionToDB->setText(tr("Connection DB"));
ui->btnAuthorizationInstructor->setEnabled(false);
Q_EMIT signal_NeedUpdateUI(true, true);
}
}
mtxAccess.unlock();
}
void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
{
bool stateIsChecked = ui->btnAuthorizationInstructor->isChecked();
if(stateIsChecked)
{//Авторизация Инструктора локальная (Администратора)
if(authorizationInstructorLocal(this))
{
ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor"));
updateLabelLoggedInInstructor();
Q_EMIT signal_NeedUpdateUI(true, true);
}
else
ui->btnAuthorizationInstructor->setChecked(false);
}
else
{//ДеАвторизация Инструктора локальная (Администратора)
if(authorizationIsCompleted())
{
if(deAuthorizationInstructor(loginInstructorLoggedInLocal))
{
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
updateLabelLoggedInInstructor();
Q_EMIT signal_NeedUpdateUI(true, true);
}
}
}
}
void InstructorsAndTraineesWidget::updateLabelLoggedInInstructor()
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return;
}
if(authorizationIsCompleted())
{
QString nameLoggedInInstructor = QString("%1 (%2)").arg(
dbLMS->getNameInstructorByLogin(loginInstructorLoggedInLocal), loginInstructorLoggedInLocal);
ui->lblLoggedInInstructor->setText(nameLoggedInInstructor);
}
else
{
ui->lblLoggedInInstructor->setText(tr("none"));
}
mtxAccess.unlock();
}

View File

@@ -2,6 +2,7 @@
#define INSTRUCTORSANDTRAINEESWIDGET_H
#include <QWidget>
#include <QTranslator>
#include "instructorsAndTrainees_global.h"
#include "viewertrainees.h"
#include "viewerinstructors.h"
@@ -19,29 +20,71 @@ public:
explicit InstructorsAndTraineesWidget(QWidget *parent = nullptr);
~InstructorsAndTraineesWidget();
private:
void changeEvent(QEvent * event) override;
public Q_SLOTS:
//Слот обработки смены языка
void slot_LanguageChanged(QString language);
Q_SIGNALS:
//сигнал об изменении языка интерфейса
void signal_LanguageChanged(QString language);
//сигнал о необходимости обновления интерфейса
void signal_NeedUpdateUI(bool treeInstructor, bool treeTrainee);
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
//сигнал о выборе обучаемого (в списке)
void signal_traineeSelected(QString login);
//сигнал об изменении вкладки диалога (в мессенджере)
void signal_tabMessengerChanged(QString login);
//сигнал об инициализации мессенджера
void signal_InitMessanger(QList<Trainee> listTrainees);
public:
//Авторизация инструктора локальная
bool authorizationInstructorLocal(QWidget* parent = nullptr);
bool authorizationIsCompleted();
QString getMainInstructorName();
QList<Trainee> getListTrainees();
//Авторизация обучаемого на клиенте
bool authorizationTrainee(QString login, QString password, QString classroom_name = QStringLiteral(""), QString computer_name = QStringLiteral(""));
bool deAuthorizationTrainee(QString login);
QString getNameTraineeByLogin(QString login);
//Авторизация инструктора на клиенте
bool authorizationInstructor(QString login, QString password);
bool deAuthorizationInstructor(QString login);
QString getNameInstructorByLogin(QString login);
private Q_SLOTS:
void on_btnConnectionToDB_clicked();
void on_btnAuthorizationInstructor_clicked();
private:
void updateLabelLoggedInInstructor();
//Авторизация инструктора локальная
bool authorizationInstructorLocal(QWidget* parent = nullptr);
bool authorizationIsCompleted();
private:
Ui::InstructorsAndTraineesWidget *ui;
InterfaceDataBaseLMS* dbLMS;
ViewerTrainees* m_viewerTrainees;
ViewerInstructors* m_viewerInstructors;
ViewerTrainees* viewerTrainees;
ViewerInstructors* viewerInstructors;
bool adminMode;
QString loginInstructorLoggedInLocal;
QTranslator qtLanguageTranslator;
QMutex mtxAccess;
};
#endif // INSTRUCTORSANDTRAINEESWIDGET_H

View File

@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>1000</width>
<height>800</height>
</rect>
</property>
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
@@ -20,6 +26,7 @@
<widget class="QGroupBox" name="groupBox">
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
@@ -27,9 +34,102 @@
<string>Database LMS</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="btnConnectionToDB">
<property name="minimumSize">
<size>
<width>130</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Connection to DB</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/connectDB.png</normaloff>:/icons/connectDB.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnAuthorizationInstructor">
<property name="minimumSize">
<size>
<width>140</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Authorization Instructor</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/login-user.png</normaloff>:/icons/login-user.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<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>
<widget class="QLabel" name="label">
<property name="text">
<string>Logged in instructor:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblLoggedInInstructor">
<property name="text">
<string>none</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
@@ -37,6 +137,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -23,5 +23,7 @@
<file>icons/admin.png</file>
<file>icons/DB-instructors.png</file>
<file>icons/DB-trainees.png</file>
<file>icons/connectDB.png</file>
<file>icons/login-user.png</file>
</qresource>
</RCC>

View File

@@ -13,6 +13,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
@@ -29,13 +30,24 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editName"/>
<widget class="QLineEdit" name="editName">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
@@ -43,6 +55,11 @@
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>

View File

@@ -13,6 +13,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
@@ -25,6 +26,11 @@
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
@@ -42,13 +48,24 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editName"/>
<widget class="QLineEdit" name="editName">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
@@ -56,13 +73,24 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Login</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editLogin"/>
<widget class="QLineEdit" name="editLogin">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
@@ -70,13 +98,24 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editPassword"/>
<widget class="QLineEdit" name="editPassword">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
@@ -87,6 +126,11 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Archived</string>
</property>
@@ -109,6 +153,11 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Logged</string>
</property>

View File

@@ -5,13 +5,19 @@
#include "dialogedittrainee.h"
EditorTrainees::EditorTrainees(InterfaceDataBaseLMS* dbLMS, bool adminMode, QWidget *parent) :
TraineesView(dbLMS, CommonView::TypeView::control, adminMode, parent),
TraineesView(dbLMS, CommonView::TypeView::control, parent),
ui(new Ui::EditorTrainees)
{
ui->setupUi((QDialog*)this);
preparationTreeWidget(ui->treeWidget);
setNotLoggedInVisible(true);
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &EditorTrainees::on_treeWidget_currentItemChanged);
ui->verticalLayout_1->addWidget(treeWidget);
this->adminMode = adminMode;
preparationTreeWidget(/*ui->treeWidget*/);
//setNotLoggedInVisible(true);
loadTraineesFromDB();
if(adminMode)
@@ -74,7 +80,7 @@ void EditorTrainees::on_btnNewGroup_clicked()
void EditorTrainees::on_btnDeleteGroup_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent != nullptr)
{
@@ -90,13 +96,16 @@ void EditorTrainees::on_btnDeleteGroup_clicked()
}
else
{//Пустая группа
if(int id = dbLMS->delGroup(id_group))
{//Удалено
loadTraineesFromDB();
}
else
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
{
//Ошибка удаления
if(int id = dbLMS->delGroup(id_group))
{//Удалено
loadTraineesFromDB();
}
else
{
//Ошибка удаления
}
}
}
}
@@ -105,7 +114,7 @@ void EditorTrainees::on_btnDeleteGroup_clicked()
void EditorTrainees::on_btnNewTrainee_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent != nullptr)
{
@@ -168,7 +177,7 @@ void EditorTrainees::on_btnNewTrainee_clicked()
void EditorTrainees::on_btnDeleteTrainee_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent != nullptr)
{
@@ -179,6 +188,12 @@ void EditorTrainees::on_btnDeleteTrainee_clicked()
int id_trainee = treeItemCurrent->text(ColumnsTreeTrainees::clmn_ID).toInt();
int id_group = treeItemParent->text(ColumnsTreeTrainees::clmn_ID).toInt();
if(dbLMS->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot delete a logged-in trainee."));
return;
}
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
{
if(int id = dbLMS->delTrainee(id_trainee))
@@ -197,7 +212,7 @@ void EditorTrainees::on_btnDeleteTrainee_clicked()
void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent != nullptr)
{
@@ -225,7 +240,13 @@ void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
}
}
else
{//Не Архивный
{//Не Архивный
if(dbLMS->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in trainee."));
return;
}
trainee.setArchived(true);
if(int id = dbLMS->editTrainee(trainee))
{//Отредактировано
@@ -246,7 +267,7 @@ void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
void EditorTrainees::on_btnEdit_clicked()
{
QTreeWidgetItem *treeItemCurrent = ui->treeWidget->currentItem();
QTreeWidgetItem *treeItemCurrent = treeWidget->currentItem();
if(treeItemCurrent == nullptr)
return;
@@ -301,6 +322,12 @@ void EditorTrainees::on_btnEdit_clicked()
int id_trainee = treeItemCurrent->text(ColumnsTreeTrainees::clmn_ID).toInt();
if(dbLMS->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in trainee."));
return;
}
DialogEditTrainee dlg(this);
Trainee trainee = dbLMS->getTrainee(id_trainee);
@@ -399,22 +426,40 @@ void EditorTrainees::on_treeWidget_currentItemChanged(QTreeWidgetItem *current,
if(dbLMS->isArchivedTrainee(id_trainee))
{//Архивный
ui->btnDeleteTrainee->setEnabled(true);
//ui->btnDeleteTrainee->setEnabled(true);
ui->btnToOrFromArchiveTrainee->setText(tr("From archive"));
ui->btnToOrFromArchiveTrainee->setIcon(QIcon(QStringLiteral(":/icons/traineeFromArchive.png")));
}
else
{//Не Архивный
ui->btnDeleteTrainee->setEnabled(false);
//ui->btnDeleteTrainee->setEnabled(false);
ui->btnToOrFromArchiveTrainee->setText(tr("To archive"));
ui->btnToOrFromArchiveTrainee->setIcon(QIcon(QStringLiteral(":/icons/traineeArchive.png")));
}
ui->btnToOrFromArchiveTrainee->setEnabled(true);
if(dbLMS->isLoggedInTrainee(id_trainee))
{//Это залогированный! Удалять/Архивировать/Редактировать нельзя!
ui->btnDeleteTrainee->setEnabled(false);
ui->btnToOrFromArchiveTrainee->setEnabled(false);
ui->btnEdit->setEnabled(false);
}
else
{
ui->btnToOrFromArchiveTrainee->setEnabled(true);
ui->btnEdit->setEnabled(true);
if(dbLMS->isArchivedTrainee(id_trainee))
ui->btnDeleteTrainee->setEnabled(true);
else
ui->btnDeleteTrainee->setEnabled(false);
ui->btnEdit->setEnabled(true);
}
//ui->btnToOrFromArchiveTrainee->setEnabled(true);
//ui->btnEdit->setEnabled(true);
ui->btnArchive->setEnabled(true);
}
}

View File

@@ -3,9 +3,8 @@
#include <QDialog>
#include <QTreeWidget>
//#include "computersLocations.h"
#include "interfacedatabaselms.h"
#include "traineesview.h"
//#include "computersLocations.h"
namespace Ui {
class EditorTrainees;
@@ -13,7 +12,7 @@ class EditorTrainees;
//Виджет для редактирования БД Обучаемых
class EditorTrainees : /*public QDialog,*/ public TraineesView
class EditorTrainees : public TraineesView
{
Q_OBJECT

View File

@@ -24,7 +24,8 @@
<widget class="QWidget" name="widget" native="true">
<property name="font">
<font>
<pointsize>12</pointsize>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">
@@ -34,32 +35,7 @@
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="columnCount">
<number>1</number>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
<layout class="QVBoxLayout" name="verticalLayout_1"/>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
@@ -78,6 +54,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="styleSheet">

View File

@@ -1,25 +1,59 @@
#include <QHeaderView>
#include "traineesview.h"
TraineesView::TraineesView(InterfaceDataBaseLMS* dbLMS, TypeView type, bool adminMode, QWidget *parent):
CommonView(type, adminMode, parent),
dbLMS(dbLMS)
TraineesView::TraineesView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent):
CommonView(dbLMS, type, parent)
{
}
void TraineesView::preparationTreeWidget(QTreeWidget *tree)
void TraineesView::slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee)
{
treeWidget = tree;
if(typeView == TypeView::onlyView)
{
if(adminMode)
archiveVisible = true;
else
archiveVisible = false;
}
else
{
archiveVisible = true;
}
if(adminMode)
{
treeWidget->setColumnHidden(ColumnsTreeTrainees::clmn_ID, false);
treeWidget->setColumnHidden(ColumnsTreeTrainees::clmn_Archived, false);
}
else
{
treeWidget->setColumnHidden(ColumnsTreeTrainees::clmn_ID, true);
treeWidget->setColumnHidden(ColumnsTreeTrainees::clmn_Archived, true);
}
updateButtons();
if(treeTrainee)
loadTraineesFromDB();
}
void TraineesView::preparationTreeWidget(/*QTreeWidget *tree*/)
{
//treeWidget = tree;
/*
if(treeWidget == nullptr)
return;
*/
treeWidget->setColumnCount(10);
reSetHeadTreeWidget();
treeWidget->header()->setStyleSheet(QStringLiteral("font-size: 10pt;"));
//treeWidget->header()->setStyleSheet(QStringLiteral("font-size: 10pt;"));
treeWidget->setStyleSheet(QStringLiteral("font-size: 10pt;"
"font-family: Tahoma;"));
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_ID, 80);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Trainee, 250);
@@ -28,8 +62,8 @@ void TraineesView::preparationTreeWidget(QTreeWidget *tree)
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Class, 130);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Computer, 130);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_IP_address, 130);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Archived, 80);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Logged, 80);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Archived, 100);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Logged, 100);
treeWidget->setColumnWidth(ColumnsTreeTrainees::clmn_Tasks, 200);
@@ -40,15 +74,21 @@ void TraineesView::preparationTreeWidget(QTreeWidget *tree)
treeWidget->setColumnHidden(ColumnsTreeTrainees::clmn_Password, true);
treeWidget->setColumnHidden(ColumnsTreeTrainees::clmn_Archived, true);
archiveVisible = false;
if(adminMode)
archiveVisible = true;
else
archiveVisible = false;
notLoggedInVisible = true;
}
else
{//control
archiveVisible = true;
notLoggedInVisible = true;
if(adminMode)
{
archiveVisible = true;
notLoggedInVisible = true;
}
else
{
@@ -63,19 +103,23 @@ void TraineesView::preparationTreeWidget(QTreeWidget *tree)
void TraineesView::loadTraineesFromDB()
{
QList <Group> listGroups;
QList <Trainee> listTrainees;
//dbTrainees->transactionBegin();
listGroups = dbLMS->getListGroups();
listTrainees = dbLMS->getListTrainees();
//dbTrainees->transactionEnd();
/*
if(treeWidget == nullptr)
return;
return;*/
//Обновление дерева
treeWidget->clear();
if(!dbLMS->DBisConnected())
return;
QList <Group> listGroups;
QList <Trainee> listTrainees;
//dbLMS->transactionBegin();
listGroups = dbLMS->getListGroups();
listTrainees = dbLMS->getListTrainees();
//dbLMS->transactionEnd();
for(Group group : listGroups)
{
//Группа
@@ -102,7 +146,8 @@ void TraineesView::loadTraineesFromDB()
ItemTrainee->setText(ColumnsTreeTrainees::clmn_IP_address, trainee.getComputer().getIpAddress());
//Сокрытие пароля
ItemTrainee->setText(ColumnsTreeTrainees::clmn_Password, QStringLiteral("******"));
if(!adminMode)
ItemTrainee->setText(ColumnsTreeTrainees::clmn_Password, QStringLiteral("******"));
if(trainee.getArchived())
{//Архивный

View File

@@ -2,7 +2,6 @@
#define TRAINEESVIEW_H
#include "instructorsAndTrainees_global.h"
#include "interfacedatabaselms.h"
#include "commonview.h"
//Родительский класс представления БД Обучаемых (для просмотра и управления)
@@ -12,7 +11,7 @@ class TraineesView: public CommonView
Q_OBJECT
public:
TraineesView(InterfaceDataBaseLMS* dbLMS, TypeView type, bool adminMode, QWidget *parent = nullptr);
TraineesView(InterfaceDataBaseLMS* dbLMS, TypeView type, QWidget *parent = nullptr);
protected:
enum ColumnsTreeTrainees{
@@ -28,14 +27,16 @@ protected:
clmn_ID
};
public Q_SLOTS:
//Слот обработки сигнала необходимости обновления интерфейса
void slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee);
protected:
void preparationTreeWidget(QTreeWidget* tree);
virtual void updateButtons(){};
void preparationTreeWidget(/*QTreeWidget* tree*/);
void loadTraineesFromDB();
void reSetHeadTreeWidget();
protected:
InterfaceDataBaseLMS* dbLMS;
};
#endif // TRAINEESVIEW_H

View File

@@ -2,21 +2,18 @@
#include "viewertrainees.h"
#include "ui_viewertrainees.h"
ViewerTrainees::ViewerTrainees(InterfaceDataBaseLMS* db, bool adminMode, QWidget *parent) :
TraineesView(db, CommonView::TypeView::onlyView, adminMode, parent),
ViewerTrainees::ViewerTrainees(InterfaceDataBaseLMS* db, QWidget *parent) :
TraineesView(db, CommonView::TypeView::onlyView, parent),
ui(new Ui::ViewerTrainees)
{
ui->setupUi(this);
this->adminMode = adminMode;
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &ViewerTrainees::on_treeWidget_currentItemChanged);
// Сделаем первоначальную инициализацию перевода для окна виджета
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTrainees_")) + QString(QStringLiteral("ru_RU")), QStringLiteral("."));
qApp->installTranslator(&qtLanguageTranslator);
ui->horizontalLayout_2->addWidget(treeWidget);
preparationTreeWidget(ui->treeWidget);
preparationTreeWidget(/*ui->treeWidget*/);
setNotLoggedInVisible(true);
loadTraineesFromDB();
}
ViewerTrainees::~ViewerTrainees()
@@ -24,12 +21,7 @@ ViewerTrainees::~ViewerTrainees()
delete ui;
}
void ViewerTrainees::setFilterTraineeLoggedIn(bool enabled)
{
setNotLoggedInVisible(!enabled);
loadTraineesFromDB();
}
/*
void ViewerTrainees::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column)
{
if(item->childCount() == 0)
@@ -37,20 +29,20 @@ void ViewerTrainees::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column
QString login = item->text(ColumnsTreeTrainees::clmn_Login);
Q_EMIT signal_traineeSelected(login);
}
}
}*/
void ViewerTrainees::slot_tabMessengerChanged(QString login)
{
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
for (int i = 0; i < treeWidget->topLevelItemCount(); i++)
{//Проход по группам
int countChild = ui->treeWidget->topLevelItem(i)->childCount();
int countChild = treeWidget->topLevelItem(i)->childCount();
for (int j = 0; j < countChild; j++)
{//Проход по обучаемым
QString loginChild = ui->treeWidget->topLevelItem(i)->child(j)->text(ColumnsTreeTrainees::clmn_Login);
QString loginChild = treeWidget->topLevelItem(i)->child(j)->text(ColumnsTreeTrainees::clmn_Login);
if(loginChild == login)
{
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(i)->child(j));
treeWidget->setCurrentItem(treeWidget->topLevelItem(i)->child(j));
Q_EMIT signal_traineeSelected(login);
return;
}
@@ -62,22 +54,19 @@ void ViewerTrainees::changeEvent(QEvent *event)
{
// В случае получения события изменения языка приложения
if (event->type() == QEvent::LanguageChange)
{
ui->retranslateUi(this); // переведём окно заново
{// переведём окно заново
ui->retranslateUi(this);
reSetHeadTreeWidget();
loadTraineesFromDB();
//loadTraineesFromDB();
slot_NeedUpdateUI(false, true);
}
}
void ViewerTrainees::slot_LanguageChanged(QString language)
{
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTrainees_")) + language, QStringLiteral("."));
qApp->installTranslator(&qtLanguageTranslator);
}
void ViewerTrainees::on_btnEditorTrainees_clicked()
{
Q_EMIT signal_BlockAutorization(true);
EditorTrainees editorTraineesGroups(dbLMS, adminMode);
QDialog* dialog = new QDialog(this);
QHBoxLayout *layout = new QHBoxLayout(dialog);
@@ -87,4 +76,30 @@ void ViewerTrainees::on_btnEditorTrainees_clicked()
dialog->exec();
loadTraineesFromDB();
Q_EMIT signal_BlockAutorization(false);
}
void ViewerTrainees::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
if(current == nullptr)
return;
if(current->childCount() == 0)
{//Выбран обучаемый
QString login = current->text(ColumnsTreeTrainees::clmn_Login);
Q_EMIT signal_traineeSelected(login);
}
}
void ViewerTrainees::updateButtons()
{
if(authComplited)
{
ui->btnEditorTrainees->setEnabled(true);
}
else
{
ui->btnEditorTrainees->setEnabled(false);
}
}

View File

@@ -1,11 +1,6 @@
#ifndef TRAINEESWIDGET_H
#define TRAINEESWIDGET_H
#include <QWidget>
#include <QObject>
#include <QEvent>
#include "instructorsAndTrainees_global.h"
#include "interfacedatabaselms.h"
#include "traineesview.h"
namespace Ui {
@@ -19,24 +14,20 @@ class ViewerTrainees : public TraineesView
Q_OBJECT
public:
explicit ViewerTrainees(InterfaceDataBaseLMS* db, bool adminMode, QWidget *parent = nullptr);
explicit ViewerTrainees(InterfaceDataBaseLMS* db, QWidget *parent = nullptr);
~ViewerTrainees();
protected:
// Метод получения событий
// В нём будет производиться проверка события смены перевода приложения
void changeEvent(QEvent * event) override;
public Q_SLOTS:
void slot_LanguageChanged(QString language);
public:
void setFilterTraineeLoggedIn( bool enabled );
Q_SIGNALS:
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
private Q_SLOTS:
void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column);
//void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column);
void on_btnEditorTrainees_clicked();
void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
public Q_SLOTS:
//слот обработки сигнала об изменении вкладки диалога в мессенджере
@@ -46,6 +37,9 @@ Q_SIGNALS:
//сигнал о выборе обучаемого
void signal_traineeSelected(QString login);
private:
void updateButtons() override;
private:
Ui::ViewerTrainees *ui;
};

View File

@@ -13,6 +13,7 @@
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
@@ -38,6 +39,9 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="btnEditorTrainees">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>130</width>
@@ -77,30 +81,6 @@
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="columnCount">
<number>1</number>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -0,0 +1,492 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
<name>DialogAuthorizationInstructor</name>
<message>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="19"/>
<source>Instructor authorization</source>
<translation>Авторизация инструктора</translation>
</message>
<message>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="29"/>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="36"/>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="54"/>
<source>admin</source>
<translation></translation>
</message>
<message>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="47"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
</context>
<context>
<name>DialogEditGroup</name>
<message>
<location filename="../trainees/dialogeditgroup.ui" line="19"/>
<source>Group</source>
<translation>Группа</translation>
</message>
<message>
<location filename="../trainees/dialogeditgroup.ui" line="33"/>
<source>Name</source>
<translation>Имя</translation>
</message>
</context>
<context>
<name>DialogEditInstructor</name>
<message>
<location filename="../instructors/dialogeditinstructor.ui" line="19"/>
<source>Instructor</source>
<translation>Инструктор</translation>
</message>
<message>
<location filename="../instructors/dialogeditinstructor.ui" line="29"/>
<source>Name</source>
<translation>Имя</translation>
</message>
<message>
<location filename="../instructors/dialogeditinstructor.ui" line="47"/>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../instructors/dialogeditinstructor.ui" line="61"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<location filename="../instructors/dialogeditinstructor.ui" line="78"/>
<source>Administrator</source>
<translation>Администратор</translation>
</message>
<message>
<location filename="../instructors/dialogeditinstructor.ui" line="100"/>
<source>Archived</source>
<translation>Архивный</translation>
</message>
<message>
<location filename="../instructors/dialogeditinstructor.ui" line="122"/>
<source>Logged</source>
<translation>Залогирован</translation>
</message>
</context>
<context>
<name>DialogEditTrainee</name>
<message>
<location filename="../trainees/dialogedittrainee.ui" line="19"/>
<source>Trainee</source>
<translation>Обучаемый</translation>
</message>
<message>
<location filename="../trainees/dialogedittrainee.ui" line="46"/>
<source>Name</source>
<translation>Имя</translation>
</message>
<message>
<location filename="../trainees/dialogedittrainee.ui" line="60"/>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../trainees/dialogedittrainee.ui" line="74"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<location filename="../trainees/dialogedittrainee.ui" line="91"/>
<source>Archived</source>
<translation>Архивный</translation>
</message>
<message>
<location filename="../trainees/dialogedittrainee.ui" line="113"/>
<source>Logged</source>
<translation>Залогирован</translation>
</message>
</context>
<context>
<name>EditorInstructors</name>
<message>
<location filename="../instructors/editorinstructors.ui" line="14"/>
<source>List instructors</source>
<translation>Список инструкторов</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.ui" line="104"/>
<source>New instructor</source>
<translation>Новый инструктор</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.ui" line="142"/>
<source>Delete instructor</source>
<translation>Удалить инструктора</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.ui" line="174"/>
<location filename="../instructors/editorinstructors.cpp" line="224"/>
<source>To archive</source>
<translation>Архивировать</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.ui" line="212"/>
<source>Edit</source>
<translation>Редактировать</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.ui" line="263"/>
<source>Show archive</source>
<translation>Показать архив</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="89"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="89"/>
<source>You cannot delete the Administrator.</source>
<translation>Нельзя удалить администратора.</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="93"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="93"/>
<source>The deletion will be irrevocable.
Delete it anyway?</source>
<translation>Удаление будет безвозвратным.
Всё равно удалить?</translation>
</message>
<message>
<location filename="../instructors/editorinstructors.cpp" line="219"/>
<source>From archive</source>
<translation>Разархивировать</translation>
</message>
</context>
<context>
<name>EditorTrainees</name>
<message>
<location filename="../trainees/editortrainees.ui" line="20"/>
<source>List trainees</source>
<translation>Список обучаемых</translation>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="113"/>
<source>New group</source>
<translation>Новая группа</translation>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="151"/>
<source>Delete group</source>
<translation>Удалить группу</translation>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="189"/>
<source>New trainee</source>
<translation>Новый обучаемый</translation>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="227"/>
<source>Delete trainee</source>
<translation>Удалить обучаемого</translation>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="265"/>
<location filename="../trainees/editortrainees.cpp" line="394"/>
<location filename="../trainees/editortrainees.cpp" line="416"/>
<source>To archive</source>
<translation>Архивировать</translation>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="303"/>
<source>Edit</source>
<translation>Редактировать</translation>
</message>
<message>
<location filename="../trainees/editortrainees.ui" line="354"/>
<source>Show archive</source>
<translation>Показать архив</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="90"/>
<source>Editing error!</source>
<translation>Ошибка редактирования!</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="90"/>
<source>The group is not empty.
It is not possible to delete a non-empty group.</source>
<translation>Группа не пуста. Невозможно удалить непустую группу.</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="95"/>
<location filename="../trainees/editortrainees.cpp" line="187"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="95"/>
<location filename="../trainees/editortrainees.cpp" line="187"/>
<source>The deletion will be irrevocable.
Delete anyway?</source>
<translation>Удаление будет безвозвратным. Всё равно удалить?</translation>
</message>
<message>
<location filename="../trainees/editortrainees.cpp" line="409"/>
<source>From archive</source>
<translation>Разархивировать</translation>
</message>
</context>
<context>
<name>InstructorsAndTraineesWidget</name>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="14"/>
<source>Form</source>
<translation>Форма</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="27"/>
<source>Database LMS</source>
<translation>База данных СУО</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="46"/>
<source>Connection to DB</source>
<translation>Соединиться с БД</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="75"/>
<location filename="../instructorsandtraineeswidget.cpp" line="55"/>
<location filename="../instructorsandtraineeswidget.cpp" line="215"/>
<source>Authorization Instructor</source>
<translation>Авторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="111"/>
<source>Logged in instructor:</source>
<translation>Авторизованный инструктор:</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="118"/>
<location filename="../instructorsandtraineeswidget.cpp" line="236"/>
<source>none</source>
<translation>нет</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="53"/>
<location filename="../instructorsandtraineeswidget.cpp" line="199"/>
<source>Deauthorization Instructor</source>
<translation>Деавторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="59"/>
<location filename="../instructorsandtraineeswidget.cpp" line="164"/>
<source>Disconnection DB</source>
<translation>Отключение БД</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="61"/>
<location filename="../instructorsandtraineeswidget.cpp" line="181"/>
<source>Connection DB</source>
<translation>Подключение БД</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="78"/>
<location filename="../instructorsandtraineeswidget.cpp" line="98"/>
<location filename="../instructorsandtraineeswidget.cpp" line="103"/>
<source>Instructor authorization</source>
<translation>Авторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="98"/>
<source>Successfully!</source>
<translation>Успешно!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="103"/>
<source>Invalid login or password!</source>
<translation>Неправильный логин или пароль!</translation>
</message>
</context>
<context>
<name>InstructorsView</name>
<message>
<location filename="../instructors/instructorsview.cpp" line="92"/>
<location filename="../instructors/instructorsview.cpp" line="105"/>
<location filename="../instructors/instructorsview.cpp" line="115"/>
<source>yes</source>
<translation>да</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="98"/>
<location filename="../instructors/instructorsview.cpp" line="110"/>
<location filename="../instructors/instructorsview.cpp" line="120"/>
<source>no</source>
<translation>нет</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="147"/>
<source>Instructor</source>
<translation>Инструктор</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="147"/>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="147"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="147"/>
<source>Administrator</source>
<translation>Администратор</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="147"/>
<source>Archived</source>
<translation>Архивный</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="147"/>
<source>Logged</source>
<translation>Залогирован</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="147"/>
<source>ID</source>
<translation>ID</translation>
</message>
</context>
<context>
<name>TasksWidget</name>
<message>
<location filename="../tasks/taskswidget.ui" line="14"/>
<location filename="../tasks/taskswidget.ui" line="22"/>
<source>Task manager</source>
<translation>Менеджер задач</translation>
</message>
</context>
<context>
<name>TraineesView</name>
<message>
<location filename="../trainees/traineesview.cpp" line="114"/>
<location filename="../trainees/traineesview.cpp" line="127"/>
<source>yes</source>
<translation>да</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="120"/>
<location filename="../trainees/traineesview.cpp" line="132"/>
<source>no</source>
<translation>нет</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Trainee</source>
<translation>Обучаемый</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Class</source>
<translation>Класс</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Computer</source>
<translation>Компьютер</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>IP address</source>
<translation>IP адрес</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Archived</source>
<translation>Архивный</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Logged</source>
<translation>Залогирован</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>Tasks</source>
<translation>Задачи</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="169"/>
<source>ID</source>
<translation>ID</translation>
</message>
</context>
<context>
<name>ViewerInstructors</name>
<message>
<location filename="../instructors/viewerinstructors.ui" line="19"/>
<location filename="../instructors/viewerinstructors.ui" line="32"/>
<source>Instructors</source>
<translation>Инструкторы</translation>
</message>
<message>
<location filename="../instructors/viewerinstructors.ui" line="51"/>
<source>Editor of Instructors</source>
<translation>Редактор инструкторов</translation>
</message>
<message>
<location filename="../instructors/viewerinstructors.cpp" line="63"/>
<source>Attention!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../instructors/viewerinstructors.cpp" line="64"/>
<source>Only the Administrator has the right to edit instructors.</source>
<translation>Только Администратор имеет право редактировать инструкторов.</translation>
</message>
<message>
<location filename="../instructors/viewerinstructors.cpp" line="72"/>
<source>Editor of instructors</source>
<translation>Редактор инструкторов</translation>
</message>
</context>
<context>
<name>ViewerTrainees</name>
<message>
<location filename="../trainees/viewertrainees.ui" line="19"/>
<location filename="../trainees/viewertrainees.ui" line="32"/>
<source>Trainees</source>
<translation>Обучаемые</translation>
</message>
<message>
<location filename="../trainees/viewertrainees.ui" line="51"/>
<source>Editor of Trainees</source>
<translation>Редактор обучаемых</translation>
</message>
<message>
<location filename="../trainees/viewertrainees.cpp" line="92"/>
<source>Editor of trainees</source>
<translation>Редактор обучаемых</translation>
</message>
</context>
</TS>