This commit is contained in:
2025-09-17 17:42:34 +03:00
parent bd1bcd4e71
commit 8cf98ea2d9
17 changed files with 85 additions and 1307 deletions

View File

@@ -19,8 +19,8 @@ MainWindow::MainWindow(QWidget *parent)
ui->horizontalLayout->addWidget(instructorsAndTraineesWidget);
this->move(0, 0);
this->showNormal();
//this->showMaximized();
//this->showNormal();
this->showMaximized();
qtLanguageTranslator.load(QString("translations/GUIdataBaseLMS_") + instructorsAndTraineesWidget->getLanguage(), ".");
qApp->installTranslator(&qtLanguageTranslator);

View File

@@ -19,6 +19,8 @@ CommonView::CommonView(ConnectorToServer* connectorToServer, TypeView type, QWid
treeWidget = new QTreeWidget();
treeWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
treeWidget->setEnabled(false);
waitAnimationWidget = new WaitAnimationWidget;
QMovie *movie = new QMovie(":/resources/icons/762.gif");
//waitAnimationWidget->setParent(this);

View File

@@ -36,9 +36,14 @@ public:
{
this->adminMode = adminMode;
}
void activate()
{
treeWidget->setEnabled(true);
}
void deactivate()
{
treeWidget->clear();
treeWidget->setEnabled(false);
lastCurrentID = 0;
}
void clearSelection()

View File

@@ -30,7 +30,7 @@ void SendSystem::sendDisable()
stream << data;
socket->waitForBytesWritten();
}
/*
void SendSystem::sendXMLmsgGUItoServer(QByteArray array)
{
qDebug() << "SendSystem" << QThread::currentThreadId();
@@ -41,6 +41,7 @@ void SendSystem::sendXMLmsgGUItoServer(QByteArray array)
stream << array;
socket->waitForBytesWritten(6000);
}
*/
void SendSystem::sendFileBlock(QString path)
{

View File

@@ -14,7 +14,7 @@ class SendSystem :public QObject
public:
explicit SendSystem(QObject* parent = nullptr);
void setSocket(QTcpSocket *socket);
void sendXMLmsgGUItoServer(QByteArray array);
//void sendXMLmsgGUItoServer(QByteArray array);
void sendDisable();
void sendFileBlock(QString path);
void sendFolderBlock(QString path);

View File

@@ -47,7 +47,7 @@ bool ConnectorToServer::authorizationInstructorLocal(QString login, QString pass
isLoggedIn = true;
QByteArray array = dataParser->createAuthMessage(autorization);
emit signal_sendXMLmsgGUItoServer(array);
emit sigSendAnswerToServer(array);
return true;
}
@@ -64,7 +64,7 @@ bool ConnectorToServer::deAuthorizationInstructorLocal(QString login)
isLoggedIn = false;
QByteArray array = dataParser->createDeAuthMessage(deAutorization);
emit signal_sendXMLmsgGUItoServer(array);
emit sigSendAnswerToServer(array);
return true;
}
@@ -80,7 +80,7 @@ bool ConnectorToServer::sendQueryToDB(TypeQueryToDB typeQuery, int id, void* dat
queryToDB->typeQuery = typeQuery;
QByteArray array = dataParser->createQueryToDBMessage(queryToDB, id, data);
emit signal_sendXMLmsgGUItoServer(array);
emit sigSendAnswerToServer(array);
return true;
}
@@ -92,7 +92,7 @@ bool ConnectorToServer::sendMessage(ClientMessage clientMessage)
return false;
}
QByteArray array = dataParser->createMessage(clientMessage);
emit signal_sendXMLmsgGUItoServer(array);
emit sigSendAnswerToServer(array);
return true;
}
@@ -111,7 +111,7 @@ bool ConnectorToServer::sendQueryTasksXML(QString type)
}
QByteArray array = dataParser->createQueryTasksXMLMessage(type);
emit signal_sendXMLmsgGUItoServer(array);
emit sigSendAnswerToServer(array);
return true;
}
@@ -466,7 +466,7 @@ void ConnectorToServer::bindConnection()
connect(this,&ConnectorToServer::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
connect(this,&ConnectorToServer::sigStopConnect,client,&TCPClient::setDisconnect,Qt::AutoConnection);
connect(this,&ConnectorToServer::signal_sendXMLmsgGUItoServer,sendSystem,&SendSystem::sendXMLmsgGUItoServer);
//Sconnect(this,&ConnectorToServer::signal_sendXMLmsgGUItoServer,sendSystem,&SendSystem::sendXMLmsgGUItoServer);
connect(this,&ConnectorToServer::sigSendAnswerToServer,sendSystem,&SendSystem::sendXMLAnswer,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigAuth,this,&ConnectorToServer::slot_Auth); // ::sigLoginResult);

View File

@@ -100,7 +100,7 @@ signals:
SendSystem *sendSystem,
QThread *thread);
void signal_sendXMLmsgGUItoServer(QByteArray array);
//void signal_sendXMLmsgGUItoServer(QByteArray array);
void sigLoginResult(ServerAuthorization * serverAuth);
void sigDeLoginResult(ServerDeAuthorization * serverDeAuth);

View File

@@ -11,6 +11,11 @@ DialogAuthorizationInstructor::DialogAuthorizationInstructor(QWidget *parent) :
ui->editPassword->setProperty("mandatoryField", true);
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
#ifdef PROJECT_TYPE_DEBUG
ui->editLogin->setText("admin");
ui->editPassword->setText("admin");
#endif
}
DialogAuthorizationInstructor::~DialogAuthorizationInstructor()
@@ -18,7 +23,7 @@ DialogAuthorizationInstructor::~DialogAuthorizationInstructor()
delete ui;
}
void DialogAuthorizationInstructor::on_btnOK_clicked()
void DialogAuthorizationInstructor::on_btnLogIn_clicked()
{
this->accept();
}

View File

@@ -28,7 +28,7 @@ public:
}
private slots:
void on_btnOK_clicked();
void on_btnLogIn_clicked();
private:
Ui::DialogAuthorizationInstructor *ui;

View File

@@ -66,7 +66,7 @@
</font>
</property>
<property name="text">
<string>admin</string>
<string/>
</property>
</widget>
</item>
@@ -78,7 +78,7 @@
</font>
</property>
<property name="text">
<string>admin</string>
<string/>
</property>
</widget>
</item>
@@ -102,7 +102,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btnOK">
<widget class="QPushButton" name="btnLogIn">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -110,7 +110,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Login in</string>
<string>Log in</string>
</property>
</widget>
</item>

View File

@@ -62,12 +62,13 @@ void ViewerInstructors::on_btnEditorInstructors_clicked()
EditorInstructors* editorInstructors = new EditorInstructors(connectorToServer, adminMode);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorInstructors, &EditorInstructors::slot_NeedUpdateUI);
editorInstructors->activate();
dlgEditor = new QDialog(this);
QHBoxLayout *layout = new QHBoxLayout(dlgEditor);
layout->addWidget(editorInstructors);
dlgEditor->setWindowTitle(tr("Editor of instructors"));
dlgEditor->setMinimumSize(1600, 800);
dlgEditor->setMinimumSize(1400, 700);
dlgEditor->setWindowFlags(dlgEditor->windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlgEditor->exec();

View File

@@ -23,6 +23,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
nameInstructorLoggedInLocal(QStringLiteral("")),
idInstructorLoggedInLocal("0"),
language(languageENG),
flSettingsServerIsChanged(false),
ui(new Ui::InstructorsAndTraineesWidget)
{
ui->setupUi(this);
@@ -62,15 +63,15 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
ui->verticalLayout_Trainees->addWidget(viewerTrainees);
ui->verticalLayout_Instructors->addWidget(viewerInstructors);
ui->groupBox_Messenger->setMinimumHeight(900);
ui->groupBox_Messenger->setMinimumHeight(600);
ui->groupBox_Messenger->setMaximumWidth(500);
ui->groupBox_Messenger->setMinimumWidth(500);
ui->groupBox_Instructors->setMinimumHeight(300);
ui->groupBox_Instructors->setMinimumHeight(200);
ui->groupBox_Instructors->setMaximumHeight(300);
ui->groupBox_Trainees->setMinimumHeight(600);
ui->groupBox_Trainees->setMinimumHeight(400);
ui->groupBox_Trainees->setMinimumWidth(600);
ui->groupBox_Instructors->setMinimumWidth(600);
@@ -182,6 +183,9 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se
connectorToServer->sendQueryTasksXML("fim");
connectorToServer->sendQueryTasksXML("amm");
viewerTrainees->activate();
viewerInstructors->activate();
}
else
{
@@ -251,7 +255,10 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal);
updateLabelServer();
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("The server is not available!")).exec();
if(!flSettingsServerIsChanged)
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("The server is not available!")).exec();
else
flSettingsServerIsChanged = false;
}
}
@@ -441,6 +448,8 @@ void InstructorsAndTraineesWidget::on_btnSettings_clicked()
{
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Server settings have been changed. Please reconnect to the server.")).exec();
flSettingsServerIsChanged = true;
if(authorizationIsCompleted())
deAuthorizationInstructor(loginInstructorLoggedInLocal);

View File

@@ -95,6 +95,8 @@ private:
QTranslator qtLanguageTranslator;
QString language;
bool flSettingsServerIsChanged;
Ui::InstructorsAndTraineesWidget *ui;
};

View File

@@ -86,12 +86,13 @@ void ViewerTrainees::on_btnEditorTrainees_clicked()
EditorTrainees* editorTraineesGroups = new EditorTrainees(connectorToServer, adminMode);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorTraineesGroups, &EditorTrainees::slot_NeedUpdateUI);
editorTraineesGroups->activate();
dlgEditor = new QDialog(this);
QHBoxLayout *layout = new QHBoxLayout(dlgEditor);
layout->addWidget(editorTraineesGroups);
dlgEditor->setWindowTitle(tr("Editor of trainees"));
dlgEditor->setMinimumSize(1600, 800);
dlgEditor->setMinimumSize(1400, 700);
dlgEditor->setWindowFlags(dlgEditor->windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlgEditor->exec();

View File

@@ -78,15 +78,9 @@ Delete it anyway?</source>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="69"/>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="81"/>
<source>admin</source>
<translation></translation>
</message>
<message>
<location filename="../instructors/dialogauthorizationinstructor.ui" line="113"/>
<source>Login in</source>
<source>Log in</source>
<translation>Войти</translation>
</message>
<message>
@@ -661,48 +655,48 @@ Delete it anyway?</source>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="317"/>
<location filename="../instructorsandtraineeswidget.ui" line="391"/>
<location filename="../instructorsandtraineeswidget.cpp" line="385"/>
<location filename="../instructorsandtraineeswidget.cpp" line="401"/>
<location filename="../instructorsandtraineeswidget.cpp" line="402"/>
<location filename="../instructorsandtraineeswidget.cpp" line="418"/>
<source>none</source>
<translation>нет</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="128"/>
<location filename="../instructorsandtraineeswidget.cpp" line="130"/>
<source>The file could not be opened </source>
<translation>Файл не может быть открыт </translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="189"/>
<location filename="../instructorsandtraineeswidget.cpp" line="194"/>
<source>Instructor authorization.</source>
<translation>Авторизация инструктора.</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="214"/>
<location filename="../instructorsandtraineeswidget.cpp" line="228"/>
<source>Instructor deauthorization</source>
<translation>Деавторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="214"/>
<location filename="../instructorsandtraineeswidget.cpp" line="228"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="254"/>
<location filename="../instructorsandtraineeswidget.cpp" line="269"/>
<source>The server is not available!</source>
<translation>Сервер недоступен!</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="442"/>
<location filename="../instructorsandtraineeswidget.cpp" line="459"/>
<source>Server settings have been changed. Please reconnect to the server.</source>
<translation>Настройки сервера изменены. Выполните переподключение к серверу.</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="289"/>
<location filename="../instructorsandtraineeswidget.cpp" line="306"/>
<source>Instructor authorization</source>
<translation>Авторизация инструктора</translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.cpp" line="189"/>
<location filename="../instructorsandtraineeswidget.cpp" line="194"/>
<source>Invalid login or password!</source>
<translation>Неправильный логин или пароль!</translation>
</message>
@@ -710,49 +704,49 @@ Delete it anyway?</source>
<context>
<name>InstructorsView</name>
<message>
<location filename="../instructors/instructorsview.cpp" line="122"/>
<location filename="../instructors/instructorsview.cpp" line="135"/>
<location filename="../instructors/instructorsview.cpp" line="119"/>
<location filename="../instructors/instructorsview.cpp" line="132"/>
<source>yes</source>
<translation>да</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="128"/>
<location filename="../instructors/instructorsview.cpp" line="140"/>
<location filename="../instructors/instructorsview.cpp" line="125"/>
<location filename="../instructors/instructorsview.cpp" line="137"/>
<source>no</source>
<translation>нет</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="186"/>
<location filename="../instructors/instructorsview.cpp" line="183"/>
<source>Instructor</source>
<translation>Инструктор</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="186"/>
<location filename="../instructors/instructorsview.cpp" line="183"/>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="186"/>
<location filename="../instructors/instructorsview.cpp" line="183"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="186"/>
<location filename="../instructors/instructorsview.cpp" line="183"/>
<source>Administrator</source>
<translation>Администратор</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="186"/>
<location filename="../instructors/instructorsview.cpp" line="183"/>
<source>Archived</source>
<translation>Архивный</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="186"/>
<location filename="../instructors/instructorsview.cpp" line="183"/>
<source>Logged</source>
<translation>Залогирован</translation>
</message>
<message>
<location filename="../instructors/instructorsview.cpp" line="186"/>
<location filename="../instructors/instructorsview.cpp" line="183"/>
<source>ID</source>
<translation>ID</translation>
</message>
@@ -1038,57 +1032,57 @@ Delete it anyway?</source>
<context>
<name>TraineesView</name>
<message>
<location filename="../trainees/traineesview.cpp" line="152"/>
<location filename="../trainees/traineesview.cpp" line="149"/>
<source>yes</source>
<translation>да</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="158"/>
<location filename="../trainees/traineesview.cpp" line="155"/>
<source>no</source>
<translation>нет</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>Trainee</source>
<translation>Обучаемый</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>Login</source>
<translation>Логин</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>Class</source>
<translation>Класс</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>Computer</source>
<translation>Компьютер</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>IP address</source>
<translation>IP адрес</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>Archived</source>
<translation>Архивный</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>Logged</source>
<translation>Залогирован</translation>
</message>
<message>
<location filename="../trainees/traineesview.cpp" line="220"/>
<location filename="../trainees/traineesview.cpp" line="217"/>
<source>ID</source>
<translation>ID</translation>
</message>
@@ -1197,7 +1191,7 @@ Delete it anyway?</source>
<translation>Редактор инструкторов</translation>
</message>
<message>
<location filename="../instructors/viewerinstructors.cpp" line="69"/>
<location filename="../instructors/viewerinstructors.cpp" line="70"/>
<source>Editor of instructors</source>
<translation>Редактор инструкторов</translation>
</message>
@@ -1215,12 +1209,12 @@ Delete it anyway?</source>
<translation>Редактор обучаемых</translation>
</message>
<message>
<location filename="../trainees/viewertrainees.cpp" line="93"/>
<location filename="../trainees/viewertrainees.cpp" line="94"/>
<source>Editor of trainees</source>
<translation>Редактор обучаемых</translation>
</message>
<message>
<location filename="../trainees/viewertrainees.cpp" line="130"/>
<location filename="../trainees/viewertrainees.cpp" line="131"/>
<source>Personal card trainee</source>
<translation>Персональная карта обучаемого</translation>
</message>