This commit is contained in:
2025-11-28 11:28:39 +03:00
parent c61066cfd1
commit 612fcc8aa7
23 changed files with 351 additions and 193 deletions

View File

@@ -3,7 +3,7 @@
#include <QDialog> #include <QDialog>
#include "instructor.h" #include "instructor.h"
#include "ui_dialogeditinstructor.h" //#include "ui_dialogeditinstructor.h"
namespace Ui { namespace Ui {
class DialogEditInstructor; class DialogEditInstructor;

View File

@@ -1,12 +1,12 @@
#include <QMessageBox> #include <QMessageBox>
#include "editorinstructors.h" #include "editorinstructors.h"
#include "dialogeditinstructor.h"
#include "specialmessagebox.h" #include "specialmessagebox.h"
#include "ui_editorinstructors.h" #include "ui_editorinstructors.h"
EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) : EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) :
InstructorsView(connectorToServer, CommonView::TypeView::control, parent), InstructorsView(connectorToServer, CommonView::TypeView::control, parent),
ui(new Ui::EditorInstructors) ui(new Ui::EditorInstructors),
dlgEditInstructor(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
@@ -34,12 +34,20 @@ EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool
EditorInstructors::~EditorInstructors() EditorInstructors::~EditorInstructors()
{ {
if(dlgEditInstructor)
{
dlgEditInstructor->close();
delete dlgEditInstructor;
dlgEditInstructor = nullptr;
}
delete ui; delete ui;
} }
void EditorInstructors::closeEvent(QCloseEvent *event) void EditorInstructors::closeEvent(QCloseEvent *event)
{ {
if(dlgEditInstructor)
dlgEditInstructor->close();
} }
void EditorInstructors::on_btnNewInstructor_clicked() void EditorInstructors::on_btnNewInstructor_clicked()
@@ -292,22 +300,25 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
bool EditorInstructors::editInstructor(Instructor instructor, Instructor* instructor_edit) bool EditorInstructors::editInstructor(Instructor instructor, Instructor* instructor_edit)
{ {
DialogEditInstructor dlg(adminMode, this); dlgEditInstructor = new DialogEditInstructor(adminMode, this);
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint); dlgEditInstructor->setWindowFlags(dlgEditInstructor->windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setInstructor(instructor); dlgEditInstructor->setInstructor(instructor);
while (true) bool flStop = false;
bool res = false;
while (!flStop)
{ {
switch( dlg.exec() ) switch( dlgEditInstructor->exec() )
{ {
case QDialog::Accepted: case QDialog::Accepted:
{ {
*instructor_edit = dlg.getInstructor(); *instructor_edit = dlgEditInstructor->getInstructor();
if(! verifyInstructor(*instructor_edit)) if(! verifyInstructor(*instructor_edit))
{ {
dlg.setInstructor(*instructor_edit); dlgEditInstructor->setInstructor(*instructor_edit);
continue; continue;
} }
@@ -318,14 +329,28 @@ bool EditorInstructors::editInstructor(Instructor instructor, Instructor* instru
instructor_edit->setNeedSetPassword(false); instructor_edit->setNeedSetPassword(false);
} }
return true; flStop = true;
res = true;
break;
} }
case QDialog::Rejected: case QDialog::Rejected:
return false; flStop = true;
res = false;
break;
default: default:
return false; flStop = true;
res = false;
break;
} }
} }
if(dlgEditInstructor)
{
delete dlgEditInstructor;
dlgEditInstructor = nullptr;
}
return res;
} }

View File

@@ -4,6 +4,9 @@
#include <QDialog> #include <QDialog>
#include <QTreeWidget> #include <QTreeWidget>
#include "instructorsview.h" #include "instructorsview.h"
#include "dialogeditinstructor.h"
class DialogEditInstructor;
namespace Ui { namespace Ui {
class EditorInstructors; class EditorInstructors;
@@ -35,8 +38,10 @@ private:
bool editInstructor(Instructor instructor, Instructor* instructor_edit); bool editInstructor(Instructor instructor, Instructor* instructor_edit);
private: private:
Ui::EditorInstructors *ui; Ui::EditorInstructors *ui;
DialogEditInstructor* dlgEditInstructor;
}; };
#endif // DIALOGINSTRUCTORS_H #endif // DIALOGINSTRUCTORS_H

View File

@@ -51,7 +51,7 @@
<string>New instructor</string> <string>New instructor</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources.qrc"> <iconset resource="../InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/addInstructor.png</normaloff>:/resources/icons/addInstructor.png</iconset> <normaloff>:/resources/icons/addInstructor.png</normaloff>:/resources/icons/addInstructor.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@@ -89,7 +89,7 @@
<string>Delete instructor</string> <string>Delete instructor</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources.qrc"> <iconset resource="../InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/deleteInstructor.png</normaloff>:/resources/icons/deleteInstructor.png</iconset> <normaloff>:/resources/icons/deleteInstructor.png</normaloff>:/resources/icons/deleteInstructor.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@@ -127,7 +127,7 @@
<string>To archive</string> <string>To archive</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources.qrc"> <iconset resource="../InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/instructorArchive.png</normaloff>:/resources/icons/instructorArchive.png</iconset> <normaloff>:/resources/icons/instructorArchive.png</normaloff>:/resources/icons/instructorArchive.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@@ -165,7 +165,7 @@
<string>Edit</string> <string>Edit</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources.qrc"> <iconset resource="../InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/edit.png</normaloff>:/resources/icons/edit.png</iconset> <normaloff>:/resources/icons/edit.png</normaloff>:/resources/icons/edit.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@@ -216,7 +216,7 @@
<string>Show archive</string> <string>Show archive</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources.qrc"> <iconset resource="../InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/archive.png</normaloff>:/resources/icons/archive.png</iconset> <normaloff>:/resources/icons/archive.png</normaloff>:/resources/icons/archive.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@@ -240,7 +240,7 @@
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="../resources.qrc"/> <include location="../InstructorsAndTrainees.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@@ -25,7 +25,11 @@ ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidg
ViewerInstructors::~ViewerInstructors() ViewerInstructors::~ViewerInstructors()
{ {
if(dlgRedactor) if(dlgRedactor)
{
dlgRedactor->close(); dlgRedactor->close();
delete dlgRedactor;
dlgRedactor = nullptr;
}
delete ui; delete ui;
} }
@@ -38,7 +42,11 @@ void ViewerInstructors::setAuthComplited(bool authComplited)
void ViewerInstructors::deactivate() void ViewerInstructors::deactivate()
{ {
if(dlgRedactor) if(dlgRedactor)
{
dlgRedactor->close(); dlgRedactor->close();
delete dlgRedactor;
dlgRedactor = nullptr;
}
CommonView::deactivate(); CommonView::deactivate();
updateButtons(); updateButtons();

View File

@@ -44,7 +44,7 @@
<string>Editor of Instructors</string> <string>Editor of Instructors</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources.qrc"> <iconset resource="../InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/DB-instructors.png</normaloff>:/resources/icons/DB-instructors.png</iconset> <normaloff>:/resources/icons/DB-instructors.png</normaloff>:/resources/icons/DB-instructors.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@@ -67,7 +67,7 @@
</layout> </layout>
</widget> </widget>
<resources> <resources>
<include location="../resources.qrc"/> <include location="../InstructorsAndTrainees.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@@ -1,7 +1,8 @@
#include "dialogeditgroup.h"
#include "computersLocations.h"
#include <QPushButton> #include <QPushButton>
#include <QRegExpValidator> #include <QRegExpValidator>
#include "dialogeditgroup.h"
#include "computersLocations.h"
#include "ui_dialogeditgroup.h"
DialogEditGroup::DialogEditGroup(QWidget *parent) : DialogEditGroup::DialogEditGroup(QWidget *parent) :
QDialog(parent), QDialog(parent),

View File

@@ -2,7 +2,7 @@
#define DIALOGEDITGROUP_H #define DIALOGEDITGROUP_H
#include <QDialog> #include <QDialog>
#include "ui_dialogeditgroup.h" //#include "ui_dialogeditgroup.h"
#include "computersLocations.h" #include "computersLocations.h"
#include "group.h" #include "group.h"

View File

@@ -7,7 +7,9 @@
EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) : EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent) :
TraineesView(connectorToServer, CommonView::TypeView::control, parent), TraineesView(connectorToServer, CommonView::TypeView::control, parent),
ui(new Ui::EditorTrainees) ui(new Ui::EditorTrainees),
dlgEditTrainee(nullptr),
dlgEditGroup(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
@@ -38,12 +40,30 @@ EditorTrainees::EditorTrainees(ConnectorToServer* connectorToServer, bool adminM
EditorTrainees::~EditorTrainees() EditorTrainees::~EditorTrainees()
{ {
if(dlgEditTrainee)
{
dlgEditTrainee->close();
delete dlgEditTrainee;
dlgEditTrainee = nullptr;
}
if(dlgEditGroup)
{
dlgEditGroup->close();
delete dlgEditGroup;
dlgEditGroup = nullptr;
}
delete ui; delete ui;
} }
void EditorTrainees::closeEvent(QCloseEvent *event) void EditorTrainees::closeEvent(QCloseEvent *event)
{ {
if(dlgEditTrainee)
dlgEditTrainee->close();
if(dlgEditGroup)
dlgEditGroup->close();
} }
void EditorTrainees::on_btnNewGroup_clicked() void EditorTrainees::on_btnNewGroup_clicked()
@@ -437,53 +457,73 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
bool EditorTrainees::editGroup(Group group, Group *group_edit) bool EditorTrainees::editGroup(Group group, Group *group_edit)
{ {
DialogEditGroup dlg(this); dlgEditGroup = new DialogEditGroup(this);
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint); dlgEditGroup->setWindowFlags(dlgEditGroup->windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setGroup(group); dlgEditGroup->setGroup(group);
while (true) bool flStop = false;
bool res = false;
while (!flStop)
{ {
switch( dlg.exec() ) switch( dlgEditGroup->exec() )
{ {
case QDialog::Accepted: case QDialog::Accepted:
{ {
*group_edit = dlg.getGroup(); *group_edit = dlgEditGroup->getGroup();
if(! verifyGroup(*group_edit)) if(! verifyGroup(*group_edit))
{ {
dlg.setGroup(*group_edit); dlgEditGroup->setGroup(*group_edit);
continue; continue;
} }
return true; flStop = true;
res = true;
break;
} }
case QDialog::Rejected: case QDialog::Rejected:
return false; flStop = true;
res = false;
break;
default: default:
return false; flStop = true;
res = false;
break;
} }
} }
if(dlgEditGroup)
{
delete dlgEditGroup;
dlgEditGroup = nullptr;
}
return res;
} }
bool EditorTrainees::editTrainee(Trainee trainee, Trainee *trainee_edit) bool EditorTrainees::editTrainee(Trainee trainee, Trainee *trainee_edit)
{ {
DialogEditTrainee dlg(adminMode, this); dlgEditTrainee = new DialogEditTrainee(adminMode, this);
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint); dlgEditTrainee->setWindowFlags(dlgEditTrainee->windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setTrainee(trainee); dlgEditTrainee->setTrainee(trainee);
while (true) bool flStop = false;
bool res = false;
while (!flStop)
{ {
switch( dlg.exec() ) switch( dlgEditTrainee->exec() )
{ {
case QDialog::Accepted: case QDialog::Accepted:
{ {
*trainee_edit = dlg.getTrainee(); *trainee_edit = dlgEditTrainee->getTrainee();
if(! verifyTrainee(*trainee_edit)) if(! verifyTrainee(*trainee_edit))
{ {
dlg.setTrainee(*trainee_edit); dlgEditTrainee->setTrainee(*trainee_edit);
continue; continue;
} }
@@ -494,14 +534,28 @@ bool EditorTrainees::editTrainee(Trainee trainee, Trainee *trainee_edit)
trainee_edit->setNeedSetPassword(false); trainee_edit->setNeedSetPassword(false);
} }
return true; flStop = true;
res = true;
break;
} }
case QDialog::Rejected: case QDialog::Rejected:
return false; flStop = true;
res = false;
break;
default: default:
return false; flStop = true;
res = false;
break;
} }
} }
if(dlgEditTrainee)
{
delete dlgEditTrainee;
dlgEditTrainee = nullptr;
}
return res;
} }

View File

@@ -5,6 +5,8 @@
#include <QTreeWidget> #include <QTreeWidget>
#include "traineesview.h" #include "traineesview.h"
//#include "computersLocations.h" //#include "computersLocations.h"
#include "dialogedittrainee.h"
#include "dialogeditgroup.h"
namespace Ui { namespace Ui {
class EditorTrainees; class EditorTrainees;
@@ -43,6 +45,9 @@ private:
private: private:
Ui::EditorTrainees *ui; Ui::EditorTrainees *ui;
DialogEditTrainee* dlgEditTrainee;
DialogEditGroup* dlgEditGroup;
}; };
#endif // DIALOGTRAINEESGROUPS_H #endif // DIALOGTRAINEESGROUPS_H

View File

@@ -49,7 +49,11 @@ ViewerTrainees::~ViewerTrainees()
} }
if(dlgRedactor) if(dlgRedactor)
{
dlgRedactor->close(); dlgRedactor->close();
delete dlgRedactor;
dlgRedactor = nullptr;
}
if(dlgCardTrainee) if(dlgCardTrainee)
dlgCardTrainee->close(); dlgCardTrainee->close();
@@ -66,7 +70,11 @@ void ViewerTrainees::setAuthComplited(bool authComplited)
void ViewerTrainees::deactivate() void ViewerTrainees::deactivate()
{ {
if(dlgRedactor) if(dlgRedactor)
{
dlgRedactor->close(); dlgRedactor->close();
delete dlgRedactor;
dlgRedactor = nullptr;
}
if(dlgCardTrainee) if(dlgCardTrainee)
dlgCardTrainee->close(); dlgCardTrainee->close();

View File

@@ -971,7 +971,17 @@ Delete it anyway?</source>
<translation>Сервер: </translation> <translation>Сервер: </translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.ui" line="424"/> <location filename="../instructorsandtraineeswidget.ui" line="386"/>
<source>Version of materials: </source>
<translation>Версия материалов: </translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="393"/>
<source>...</source>
<translation></translation>
</message>
<message>
<location filename="../instructorsandtraineeswidget.ui" line="448"/>
<source> Instructor: </source> <source> Instructor: </source>
<translation> Инструктор: </translation> <translation> Инструктор: </translation>
</message> </message>
@@ -991,85 +1001,85 @@ Delete it anyway?</source>
<translation>Инструкторы</translation> <translation>Инструкторы</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.ui" line="369"/> <location filename="../instructorsandtraineeswidget.ui" line="375"/>
<location filename="../instructorsandtraineeswidget.ui" line="443"/> <location filename="../instructorsandtraineeswidget.ui" line="467"/>
<location filename="../instructorsandtraineeswidget.cpp" line="587"/> <location filename="../instructorsandtraineeswidget.cpp" line="594"/>
<source>none</source> <source>none</source>
<translation>нет</translation> <translation>нет</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="181"/> <location filename="../instructorsandtraineeswidget.cpp" line="182"/>
<source>The file could not be opened </source> <source>The file could not be opened </source>
<translation>Файл не может быть открыт </translation> <translation>Файл не может быть открыт </translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="287"/> <location filename="../instructorsandtraineeswidget.cpp" line="288"/>
<location filename="../instructorsandtraineeswidget.cpp" line="319"/> <location filename="../instructorsandtraineeswidget.cpp" line="320"/>
<source>Instructor authorization.</source> <source>Instructor authorization.</source>
<translation>Авторизация инструктора.</translation> <translation>Авторизация инструктора.</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="275"/> <location filename="../instructorsandtraineeswidget.cpp" line="276"/>
<source>Instructor deauthorization</source> <source>Instructor deauthorization</source>
<translation>Деавторизация инструктора</translation> <translation>Деавторизация инструктора</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="275"/> <location filename="../instructorsandtraineeswidget.cpp" line="276"/>
<source>Error!</source> <source>Error!</source>
<translation>Ошибка!</translation> <translation>Ошибка!</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="287"/> <location filename="../instructorsandtraineeswidget.cpp" line="288"/>
<source>Server blocked!</source> <source>Server blocked!</source>
<translation>Сервер заблокирован!</translation> <translation>Сервер заблокирован!</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="304"/> <location filename="../instructorsandtraineeswidget.cpp" line="305"/>
<source>Database error!</source> <source>Database error!</source>
<translation>Ошибка базы данных!</translation> <translation>Ошибка базы данных!</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="308"/> <location filename="../instructorsandtraineeswidget.cpp" line="309"/>
<source>The user is archived!</source> <source>The user is archived!</source>
<translation>Пользователь является архивным!</translation> <translation>Пользователь является архивным!</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="312"/> <location filename="../instructorsandtraineeswidget.cpp" line="313"/>
<source>The user is already logged in!</source> <source>The user is already logged in!</source>
<translation>Пользователь уже в сети!</translation> <translation>Пользователь уже в сети!</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="316"/> <location filename="../instructorsandtraineeswidget.cpp" line="317"/>
<source>Login or password error!</source> <source>Login or password error!</source>
<translation>Ошибка логина или пароля!</translation> <translation>Ошибка логина или пароля!</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="402"/> <location filename="../instructorsandtraineeswidget.cpp" line="409"/>
<source>The server is not available!</source> <source>The server is not available!</source>
<translation>Сервер недоступен!</translation> <translation>Сервер недоступен!</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="599"/> <location filename="../instructorsandtraineeswidget.cpp" line="606"/>
<source>Connection attempt</source> <source>Connection attempt</source>
<translation>Попытка соединения</translation> <translation>Попытка соединения</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="606"/> <location filename="../instructorsandtraineeswidget.cpp" line="613"/>
<source>connected</source> <source>connected</source>
<translation>подключен</translation> <translation>подключен</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="609"/> <location filename="../instructorsandtraineeswidget.cpp" line="616"/>
<source>not connected</source> <source>not connected</source>
<translation>не подключен</translation> <translation>не подключен</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="650"/> <location filename="../instructorsandtraineeswidget.cpp" line="657"/>
<source>Server settings have been changed. Please reconnect to the server.</source> <source>Server settings have been changed. Please reconnect to the server.</source>
<translation>Настройки сервера изменены. Выполните переподключение к серверу.</translation> <translation>Настройки сервера изменены. Выполните переподключение к серверу.</translation>
</message> </message>
<message> <message>
<location filename="../instructorsandtraineeswidget.cpp" line="462"/> <location filename="../instructorsandtraineeswidget.cpp" line="469"/>
<source>Instructor authorization</source> <source>Instructor authorization</source>
<translation>Авторизация инструктора</translation> <translation>Авторизация инструктора</translation>
</message> </message>

View File

@@ -17,7 +17,8 @@ public:
this->name = name; this->name = name;
this->address = address; this->address = address;
this->port = port; this->port = port;
this->fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login; //this->fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login;
this->fullName = "IP: " + address + " port : " + port + " login: " + login;
}; };
~Client(){}; ~Client(){};
@@ -31,7 +32,8 @@ public:
{ {
this->login = login; this->login = login;
isLoggedIn = true; isLoggedIn = true;
fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login; //fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login;
fullName = "IP: " + address + " port : " + port + " login: " + login;
} }
QString getLogin() QString getLogin()
{ {

View File

@@ -53,7 +53,22 @@ void Logger::setLogToFile(bool flag)
void Logger::handleLog(QString msg, LogLevel logLevel) void Logger::handleLog(QString msg, LogLevel logLevel)
{ {
/*
color: red; * Красный *
color: green; * Зелёный *
color: blue; * Синий *
color: yellow; * Жёлтый *
color: black; * Чёрный *
color: white; * Белый *
color: purple; * Фиолетовый *
color: orange; * Оранжевый *
color: pink; * Розовый *
color: brown; * Коричневый *
color: gray; * Серый *
*/
QString level; QString level;
QString colorLevel = "pink";
#ifndef PROJECT_TYPE_DEBUG #ifndef PROJECT_TYPE_DEBUG
if(logLevel == DEBUG) if(logLevel == DEBUG)
@@ -62,24 +77,44 @@ void Logger::handleLog(QString msg, LogLevel logLevel)
switch (logLevel) switch (logLevel)
{ {
case INFO: level = "INFO"; break; case INFO:
case WARNING: level = "WARNING"; break; level = "INFO";
case ERROR: level = "ERROR"; break; colorLevel = "green";
case CRITICAL: level = "CRITICAL"; break; break;
case DEBUG: level = "DEBUG"; break;
case WARNING:
level = "WARNING";
colorLevel = "yellow";
break;
case ERROR:
level = "ERROR";
colorLevel = "red";
break;
case CRITICAL:
level = "CRITICAL";
colorLevel = "purple";
break;
case DEBUG:
level = "DEBUG";
colorLevel = "brown";
break;
} }
QString timeStamp = QDateTime::currentDateTime().toString("hh:mm:ss"); QString timeStamp = QDateTime::currentDateTime().toString("hh:mm:ss");
QString message = timeStamp + " " + level + " " + msg; QString message = timeStamp + " " + level + " " + msg;
QString messageHTML = QString("<p><span style=\"color: blue;\">%1</span> <span style=\"color: %2;\">%3</span> <span style=\"color: black;\">%4</span></p>").
arg(timeStamp, colorLevel, level, msg);
if (loggingType == LoggingType::WIDGET) if (loggingType == LoggingType::WIDGET)
{ {
emit sigLogToWidget(message); emit sigLogToWidget(messageHTML);
} }
else if(loggingType == LoggingType::CONSOLE) else if(loggingType == LoggingType::CONSOLE)
{ {
qDebug() << message; qDebug() << messageHTML;
} }
if(isLogToFile) if(isLogToFile)

View File

@@ -32,6 +32,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
first (true), first (true),
language(languageENG), language(languageENG),
errorCode(0), errorCode(0),
versionStr("..."),
flStartInitialization(false) flStartInitialization(false)
{ {
ui->setupUi(this); ui->setupUi(this);
@@ -39,6 +40,9 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
qDebug() << "ServerLMSWidget init thread ID " << QThread::currentThreadId(); qDebug() << "ServerLMSWidget init thread ID " << QThread::currentThreadId();
ui->widget_Control->setObjectName("widgetControl"); ui->widget_Control->setObjectName("widgetControl");
ui->btnStopServer->setObjectName("btnStopServer");
ui->btnStartServer->setObjectName("btnStartServer");
ui->btnSettings->setObjectName("btnSettings");
registerMetaType(); registerMetaType();
@@ -125,7 +129,8 @@ void ServerLMSWidget::slot_UpdateListClients()
void ServerLMSWidget::slot_AddMessageToLog(QString message) void ServerLMSWidget::slot_AddMessageToLog(QString message)
{ {
ui->loggerTextField->appendPlainText(message); //ui->loggerTextField->appendPlainText(message);
ui->loggerTextField->appendHtml(message);
} }
void ServerLMSWidget::slot_ErrorPostgreSQL(QString text) void ServerLMSWidget::slot_ErrorPostgreSQL(QString text)
@@ -170,6 +175,7 @@ void ServerLMSWidget::slot_startInitialization_step1()
void ServerLMSWidget::slot_setVersion(QString versionStr) void ServerLMSWidget::slot_setVersion(QString versionStr)
{ {
this->versionStr = versionStr;
ui->lblVersionText->setText(versionStr); ui->lblVersionText->setText(versionStr);
} }
@@ -479,4 +485,6 @@ void ServerLMSWidget::updateStateServer()
ui->btnStartServer->setEnabled(false); ui->btnStartServer->setEnabled(false);
} }
} }
ui->lblVersionText->setText(versionStr);
} }

View File

@@ -173,6 +173,8 @@ private:
QString language; QString language;
int errorCode; int errorCode;
QString versionStr;
bool flStartInitialization; bool flStartInitialization;
}; };

View File

@@ -6,10 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1000</width> <width>1200</width>
<height>600</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>1200</width>
<height>600</height>
</size>
</property>
<property name="font"> <property name="font">
<font> <font>
<family>Tahoma</family> <family>Tahoma</family>
@@ -45,14 +51,14 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>16777215</width>
<height>55</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
<size> <size>
<width>80</width> <width>0</width>
<height>40</height> <height>0</height>
</size> </size>
</property> </property>
<property name="layoutDirection"> <property name="layoutDirection">
@@ -86,14 +92,14 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>16777215</width>
<height>55</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="baseSize"> <property name="baseSize">
<size> <size>
<width>80</width> <width>0</width>
<height>40</height> <height>0</height>
</size> </size>
</property> </property>
<property name="layoutDirection"> <property name="layoutDirection">
@@ -262,13 +268,13 @@
<widget class="QLabel" name="lblOnOffText"> <widget class="QLabel" name="lblOnOffText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>100</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>150</width> <width>100</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>

View File

@@ -18,6 +18,7 @@ DialogSettingsTray::DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *pa
ui->btnSave->setObjectName("btnSave"); ui->btnSave->setObjectName("btnSave");
ui->btnCheckDB->setObjectName("btnCheckDB"); ui->btnCheckDB->setObjectName("btnCheckDB");
ui->btnUpdateDocs->setObjectName("btnUpdateDocs"); ui->btnUpdateDocs->setObjectName("btnUpdateDocs");
ui->checkLocalhost->setObjectName("checkLocalhost");
/* Создаем строку для регулярного выражения */ /* Создаем строку для регулярного выражения */
QString ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"; QString ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])";

View File

@@ -70,11 +70,11 @@
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_DB"> <layout class="QVBoxLayout" name="verticalLayout_DB">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_HostName"> <layout class="QHBoxLayout" name="horizontalLayout_Local">
<item> <item>
<widget class="QLabel" name="label_HostName"> <widget class="QLabel" name="label_Local">
<property name="text"> <property name="text">
<string>Host name</string> <string>Local</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -94,7 +94,18 @@
<item> <item>
<widget class="QCheckBox" name="checkLocalhost"> <widget class="QCheckBox" name="checkLocalhost">
<property name="text"> <property name="text">
<string>Localhost</string> <string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_HostName">
<item>
<widget class="QLabel" name="label_IP">
<property name="text">
<string>IP address</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -218,67 +229,11 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Check">
<item>
<spacer name="horizontalSpacer_2">
<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="QToolButton" name="btnCheckDB">
<property name="minimumSize">
<size>
<width>58</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Check</string>
</property>
<property name="icon">
<iconset resource="../ServerLMS.qrc">
<normaloff>:/resources/icons/checkDB.png</normaloff>:/resources/icons/checkDB.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>
</layout>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_Save"> <layout class="QHBoxLayout" name="horizontalLayout_Save">
<item> <item>
@@ -329,19 +284,19 @@
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Additional"> <layout class="QVBoxLayout" name="verticalLayout_Additional">
<item> <item>
<widget class="QToolButton" name="btnUpdateDocs"> <widget class="QToolButton" name="btnCheckDB">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>58</width>
<height>58</height> <height>58</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Update Docs</string> <string>Check DB</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../InstructorsAndTrainees/InstructorsAndTrainees.qrc"> <iconset resource="../ServerLMS.qrc">
<normaloff>:/resources/icons/exchange.png</normaloff>:/resources/icons/exchange.png</iconset> <normaloff>:/resources/icons/checkDB.png</normaloff>:/resources/icons/checkDB.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@@ -367,6 +322,32 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QToolButton" name="btnUpdateDocs">
<property name="minimumSize">
<size>
<width>80</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Update Docs</string>
</property>
<property name="icon">
<iconset resource="../../InstructorsAndTrainees/InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/exchange.png</normaloff>:/resources/icons/exchange.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>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@@ -4,7 +4,7 @@
<context> <context>
<name>AssetsManager</name> <name>AssetsManager</name>
<message> <message>
<location filename="../Systems/assetsmanager.cpp" line="290"/> <location filename="../Systems/assetsmanager.cpp" line="292"/>
<source>LLC Constanta-Design</source> <source>LLC Constanta-Design</source>
<translation>ООО Константа-Дизайн</translation> <translation>ООО Константа-Дизайн</translation>
</message> </message>
@@ -168,8 +168,8 @@
</message> </message>
<message> <message>
<location filename="../settings/dialogsettingstray.cpp" line="288"/> <location filename="../settings/dialogsettingstray.cpp" line="288"/>
<location filename="../settings/dialogsettingstray.cpp" line="340"/> <location filename="../settings/dialogsettingstray.cpp" line="338"/>
<location filename="../settings/dialogsettingstray.cpp" line="345"/> <location filename="../settings/dialogsettingstray.cpp" line="343"/>
<source>Error!</source> <source>Error!</source>
<translation>Ошибка!</translation> <translation>Ошибка!</translation>
</message> </message>
@@ -184,35 +184,35 @@
<translation>Авторизация суперпользователя PostgreSQL</translation> <translation>Авторизация суперпользователя PostgreSQL</translation>
</message> </message>
<message> <message>
<location filename="../settings/dialogsettingstray.cpp" line="340"/> <location filename="../settings/dialogsettingstray.cpp" line="338"/>
<location filename="../settings/dialogsettingstray.cpp" line="345"/> <location filename="../settings/dialogsettingstray.cpp" line="343"/>
<source>Error connecting to PostgreSQL!</source> <source>Error connecting to PostgreSQL!</source>
<translation>Ошибка соединения с PostgreSQL!</translation> <translation>Ошибка соединения с PostgreSQL!</translation>
</message> </message>
<message> <message>
<location filename="../settings/dialogsettingstray.cpp" line="341"/> <location filename="../settings/dialogsettingstray.cpp" line="339"/>
<location filename="../settings/dialogsettingstray.cpp" line="346"/> <location filename="../settings/dialogsettingstray.cpp" line="344"/>
<source>Possible reasons:</source> <source>Possible reasons:</source>
<translation>Возможные причины:</translation> <translation>Возможные причины:</translation>
</message> </message>
<message> <message>
<location filename="../settings/dialogsettingstray.cpp" line="342"/> <location filename="../settings/dialogsettingstray.cpp" line="340"/>
<location filename="../settings/dialogsettingstray.cpp" line="347"/> <location filename="../settings/dialogsettingstray.cpp" line="345"/>
<source>*superuser PostgreSQL login or password is incorrect;</source> <source>*superuser PostgreSQL login or password is incorrect;</source>
<translation>*логин или пароль суперпользователя PostgreSQL некорректен;</translation> <translation>*логин или пароль суперпользователя PostgreSQL некорректен;</translation>
</message> </message>
<message> <message>
<location filename="../settings/dialogsettingstray.cpp" line="343"/> <location filename="../settings/dialogsettingstray.cpp" line="341"/>
<source>*Port is incorrect.</source> <source>*Port is incorrect.</source>
<translation>*Порт некорректен.</translation> <translation>*Порт некорректен.</translation>
</message> </message>
<message> <message>
<location filename="../settings/dialogsettingstray.cpp" line="348"/> <location filename="../settings/dialogsettingstray.cpp" line="346"/>
<source>*Port is incorrect;</source> <source>*Port is incorrect;</source>
<translation>*Порт некорректен;</translation> <translation>*Порт некорректен;</translation>
</message> </message>
<message> <message>
<location filename="../settings/dialogsettingstray.cpp" line="349"/> <location filename="../settings/dialogsettingstray.cpp" line="347"/>
<source>*file &apos;pg_hba.conf&apos; does not contain an entry for the IP address:</source> <source>*file &apos;pg_hba.conf&apos; does not contain an entry for the IP address:</source>
<translation>*файл &apos;pg_hba.conf не содержит записи доступа для IP адреса:</translation> <translation>*файл &apos;pg_hba.conf не содержит записи доступа для IP адреса:</translation>
</message> </message>
@@ -225,123 +225,129 @@
<translation>Форма</translation> <translation>Форма</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="188"/> <location filename="../serverlmswidget.ui" line="204"/>
<source>Logger</source> <source>Logger</source>
<translation>Логгер</translation> <translation>Логгер</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="153"/> <location filename="../serverlmswidget.ui" line="169"/>
<source>Clients</source> <source>Clients</source>
<translation>Клиенты</translation> <translation>Клиенты</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="131"/> <location filename="../serverlmswidget.ui" line="142"/>
<source>Settings</source> <source>Settings</source>
<translation>Настройки</translation> <translation>Настройки</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="237"/> <location filename="../serverlmswidget.ui" line="257"/>
<source>Server: </source> <source>Server: </source>
<translation>Сервер: </translation> <translation>Сервер: </translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="295"/> <location filename="../serverlmswidget.ui" line="315"/>
<source>Data base: </source> <source>Data base: </source>
<translation>База данных: </translation> <translation>База данных: </translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="256"/> <location filename="../serverlmswidget.ui" line="276"/>
<location filename="../serverlmswidget.ui" line="302"/> <location filename="../serverlmswidget.ui" line="328"/>
<location filename="../serverlmswidget.ui" line="365"/>
<source>...</source> <source>...</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="324"/> <location filename="../serverlmswidget.ui" line="352"/>
<source>Version of materials: </source>
<translation>Версия материалов: </translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="389"/>
<source>Authorization</source> <source>Authorization</source>
<translation>Авторизация</translation> <translation>Авторизация</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="51"/> <location filename="../serverlmswidget.ui" line="62"/>
<source>Start</source> <source>Start</source>
<translation>Запустить</translation> <translation>Запустить</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.ui" line="92"/> <location filename="../serverlmswidget.ui" line="103"/>
<source>Stop</source> <source>Stop</source>
<translation>Остановить</translation> <translation>Остановить</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="171"/> <location filename="../serverlmswidget.cpp" line="217"/>
<source>Server is started!</source> <source>Server is started!</source>
<translation>Сервер запущен!</translation> <translation>Сервер запущен!</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="184"/> <location filename="../serverlmswidget.cpp" line="230"/>
<source>Server is stoped!</source> <source>Server is stoped!</source>
<translation>Сервер остановлен!</translation> <translation>Сервер остановлен!</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="223"/> <location filename="../serverlmswidget.cpp" line="269"/>
<location filename="../serverlmswidget.cpp" line="272"/> <location filename="../serverlmswidget.cpp" line="332"/>
<source>Warning!</source> <source>Warning!</source>
<translation>Внимание!</translation> <translation>Внимание!</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="223"/> <location filename="../serverlmswidget.cpp" line="269"/>
<source>Database settings have been changed. <source>Database settings have been changed.
The server will be restarted.</source> The server will be restarted.</source>
<translation>Настройки Базы Данных были изменены. <translation>Настройки Базы Данных были изменены.
Сервер будет перезапущен.</translation> Сервер будет перезапущен.</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="272"/> <location filename="../serverlmswidget.cpp" line="332"/>
<source>The file could not be opened </source> <source>The file could not be opened </source>
<translation>Файл не может быть открыт </translation> <translation>Файл не может быть открыт </translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="351"/> <location filename="../serverlmswidget.cpp" line="406"/>
<location filename="../serverlmswidget.cpp" line="355"/> <location filename="../serverlmswidget.cpp" line="410"/>
<source>Database connection error!</source> <source>Database connection error!</source>
<translation>Ошибка подключения Базы данных!</translation> <translation>Ошибка подключения Базы данных!</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="194"/> <location filename="../serverlmswidget.cpp" line="240"/>
<location filename="../serverlmswidget.cpp" line="355"/> <location filename="../serverlmswidget.cpp" line="410"/>
<source>Error!</source> <source>Error!</source>
<translation>Ошибка!</translation> <translation>Ошибка!</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="115"/> <location filename="../serverlmswidget.cpp" line="134"/>
<source>Error PostgreSQL!</source> <source>Error PostgreSQL!</source>
<translation>Ошибка PostgreSQL!</translation> <translation>Ошибка PostgreSQL!</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="194"/> <location filename="../serverlmswidget.cpp" line="240"/>
<source>Settings file could not be opened:</source> <source>Settings file could not be opened:</source>
<translation>Файл настроек не открыт:</translation> <translation>Файл настроек не открыт:</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="370"/> <location filename="../serverlmswidget.cpp" line="427"/>
<source>Database connection OK!</source> <source>Database connection OK!</source>
<translation>База данных подключена!</translation> <translation>База данных подключена!</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="384"/> <location filename="../serverlmswidget.cpp" line="441"/>
<source>started</source> <source>started</source>
<translation>запущен</translation> <translation>запущен</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="389"/> <location filename="../serverlmswidget.cpp" line="446"/>
<source>stoped</source> <source>stoped</source>
<translation>остановлен</translation> <translation>остановлен</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="409"/> <location filename="../serverlmswidget.cpp" line="466"/>
<source>connected</source> <source>connected</source>
<translation>подключена</translation> <translation>подключена</translation>
</message> </message>
<message> <message>
<location filename="../serverlmswidget.cpp" line="418"/> <location filename="../serverlmswidget.cpp" line="475"/>
<source>not connected</source> <source>not connected</source>
<translation>не подключена</translation> <translation>не подключена</translation>
</message> </message>

View File

@@ -16,6 +16,7 @@ MainWindow::MainWindow(QWidget *parent) :
action_Exit(nullptr) action_Exit(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowMinimizeButtonHint);
//Скрываем ненужные элементы окна //Скрываем ненужные элементы окна
ui->menubar->setVisible(false); ui->menubar->setVisible(false);