Merge branch 'work31' into DEV

This commit is contained in:
2025-12-01 10:12:04 +03:00
55 changed files with 618 additions and 425 deletions

View File

@@ -12,6 +12,9 @@ kanban-plugin: board
## Completed ## Completed
- [ ] При смене УЗ в ГУИ остается история переписки в мессенджере. При этом Имя инструктора в диалоге подменяется. (Путается только в ГУИ!)
[Возможно, поможет переинициализация мессенджера при переавторизации инструктора?]
- [ ] Отображать текущую версию data в статус баре
- [ ] Сделать крутилку на начальную загрузку Сервера - [ ] Сделать крутилку на начальную загрузку Сервера
- [ ] Логин суперпользователя PostgreSQL предлагать по умолчанию postgres - [ ] Логин суперпользователя PostgreSQL предлагать по умолчанию postgres
- [ ] Сделать несколько попыток подключения к серверу - [ ] Сделать несколько попыток подключения к серверу
@@ -64,15 +67,12 @@ kanban-plugin: board
## GUI Messenger ## GUI Messenger
- [ ] При смене УЗ в ГУИ остается история переписки в мессенджере. При этом Имя инструктора в диалоге подменяется. (Путается только в ГУИ!)
[Возможно, поможет переинициализация мессенджера при переавторизации инструктора?]
- [ ] Не влазиют слишком большие сообщения - [ ] Не влазиют слишком большие сообщения
- [ ] Не видно новых пришедших сообщений, если выбран другой Юзер - [ ] Не видно новых пришедших сообщений, если выбран другой Юзер
## GUI общие ## GUI общие
- [ ] Отображать текущую версию data в статус баре
- [ ] Текстовый поиск в задачах - [ ] Текстовый поиск в задачах

View File

@@ -13,11 +13,10 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
instructorsAndTraineesWidget = new InstructorsAndTraineesWidget(this); instructorsAndTraineesWidget = new InstructorsAndTraineesWidget(this);
ui->horizontalLayout->addWidget(instructorsAndTraineesWidget);
connect(instructorsAndTraineesWidget, &InstructorsAndTraineesWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged); connect(instructorsAndTraineesWidget, &InstructorsAndTraineesWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged);
ui->horizontalLayout->addWidget(instructorsAndTraineesWidget);
this->move(0, 0); this->move(0, 0);
//this->showNormal(); //this->showNormal();
this->showMaximized(); this->showMaximized();

View File

@@ -27,8 +27,6 @@ add_library(InstructorsAndTrainees SHARED
specialmessagebox/specialmessagebox.cpp specialmessagebox/specialmessagebox.cpp
specialmessagebox/specialmessagebox.h specialmessagebox/specialmessagebox.h
specialmessagebox/specialmessagebox.ui specialmessagebox/specialmessagebox.ui
specialmessagebox/notifycontroller.cpp
specialmessagebox/notifycontroller.h
authorization/dialogauthorization.cpp authorization/dialogauthorization.cpp
authorization/dialogauthorization.h authorization/dialogauthorization.h
@@ -141,6 +139,8 @@ add_library(InstructorsAndTrainees SHARED
widgets/waitanimationwidget.cpp widgets/waitanimationwidget.cpp
widgets/waitanimationwidget.h widgets/waitanimationwidget.h
widgets/waitanimationwidget.ui widgets/waitanimationwidget.ui
widgets/widgettools.cpp
widgets/widgettools.h
InstructorsAndTrainees.qrc InstructorsAndTrainees.qrc
) )

View File

@@ -413,7 +413,7 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
QFile xmlInFile(xmlFileName); QFile xmlInFile(xmlFileName);
if (!xmlInFile.open(QFile::ReadOnly | QFile::Text)) if (!xmlInFile.open(QFile::ReadOnly | QFile::Text))
{ {
SpecialMessageBox(nullptr, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The file could not be opened ") + xmlFileName).exec(); SpecMsgBox::CriticalClose(nullptr, tr("The file could not be opened ") + xmlFileName);
return; return;
} }
else else
@@ -490,17 +490,17 @@ void RecognizeSystem::xmlParser(QByteArray array)
if (value == "BASEDELETETRY") if (value == "BASEDELETETRY")
{ {
emit sigNotify(tr("You cannot delete the basic version!")); emit sigNotifyVersionControl(tr("You cannot delete the basic version!"));
} }
if (value == "TRYACTIVEDELETE") if (value == "TRYACTIVEDELETE")
{ {
emit sigNotify(tr("You cannot delete the active version")); emit sigNotifyVersionControl(tr("You cannot delete the active version"));
} }
if (value == "DUPLICATEVERNAME") if (value == "DUPLICATEVERNAME")
{ {
emit sigNotify(tr("This name already exists")); emit sigNotifyVersionControl(tr("This name already exists"));
} }
} }
} }

View File

@@ -56,7 +56,7 @@ signals:
void sigAnswerQueryTasksXML_AMM(QByteArray array); void sigAnswerQueryTasksXML_AMM(QByteArray array);
void sigShowServerDataList(QList<StreamingVersionData*> *versions); void sigShowServerDataList(QList<StreamingVersionData*> *versions);
void sigSetVersion(StreamingVersionData* serverVersion); void sigSetVersion(StreamingVersionData* serverVersion);
void sigNotify(QString text, QWidget *parentWidget = nullptr); void sigNotifyVersionControl(QString text);
void sigAnimationActivated(bool flag); void sigAnimationActivated(bool flag);
void sigHashReady(); void sigHashReady();
void sigAnswerQuerySubProc(QList<SubProc> listSubProc, QString parentTask_dmCode); void sigAnswerQuerySubProc(QList<SubProc> listSubProc, QString parentTask_dmCode);

View File

@@ -1,15 +1,13 @@
#include "connectortoserver.h" #include "connectortoserver.h"
#include <QThread> #include <QThread>
ConnectorToServer::ConnectorToServer(QWidget* parentWidget, QObject *parent) : ConnectorToServer::ConnectorToServer(QObject *parent) :
QObject(parent), QObject(parent),
parentWidget(parentWidget),
connectionThread(nullptr), connectionThread(nullptr),
client(nullptr), client(nullptr),
dataParser(nullptr), dataParser(nullptr),
sendSystem(nullptr), sendSystem(nullptr),
recognizeSystem(nullptr), recognizeSystem(nullptr),
notifyController(nullptr),
fl_GetedOfflineMessages(false), fl_GetedOfflineMessages(false),
nameInstructorLoggedInLocal("") nameInstructorLoggedInLocal("")
{ {
@@ -19,7 +17,6 @@ ConnectorToServer::ConnectorToServer(QWidget* parentWidget, QObject *parent) :
ConnectorToServer::~ConnectorToServer() ConnectorToServer::~ConnectorToServer()
{ {
delete client; delete client;
delete notifyController;
delete recognizeSystem; delete recognizeSystem;
delete sendSystem; delete sendSystem;
delete dataParser; delete dataParser;
@@ -115,6 +112,11 @@ void ConnectorToServer::slot_getVersion()
emit signal_SendGetVersion(); emit signal_SendGetVersion();
} }
void ConnectorToServer::slot_NotifyVersionControl(QString text)
{
emit signal_NotifyVersionControl(text);
}
void ConnectorToServer::initialize() void ConnectorToServer::initialize()
{ {
createObjects(); createObjects();
@@ -159,7 +161,7 @@ void ConnectorToServer::bindConnection()
connect(client,&TCPClient::signal_ConnectedToServer,this,&ConnectorToServer::signal_ConnectedToServer,Qt::AutoConnection); connect(client,&TCPClient::signal_ConnectedToServer,this,&ConnectorToServer::signal_ConnectedToServer,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection); connect(recognizeSystem,&RecognizeSystem::sigNotifyVersionControl,this,&ConnectorToServer::slot_NotifyVersionControl,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigHashReady,this,&ConnectorToServer::slot_HashReady); connect(recognizeSystem,&RecognizeSystem::sigHashReady,this,&ConnectorToServer::slot_HashReady);
@@ -190,8 +192,6 @@ void ConnectorToServer::createObjects()
recognizeSystem = new RecognizeSystem; recognizeSystem = new RecognizeSystem;
recognizeSystem->moveToThread(connectionThread); recognizeSystem->moveToThread(connectionThread);
notifyController = new NotifyController(parentWidget);
connectionThread->start(); connectionThread->start();
connectionThread->setPriority(QThread::HighestPriority); connectionThread->setPriority(QThread::HighestPriority);
} }

View File

@@ -14,7 +14,6 @@
#include "computer.h" #include "computer.h"
#include "classroom.h" #include "classroom.h"
#include "Datas.h" #include "Datas.h"
#include "notifycontroller.h"
#include "streamingversiondata.h" #include "streamingversiondata.h"
class ConnectorToServer : public QObject class ConnectorToServer : public QObject
@@ -22,7 +21,7 @@ class ConnectorToServer : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit ConnectorToServer(QWidget* parentWidget, QObject *parent = nullptr); explicit ConnectorToServer(QObject *parent = nullptr);
~ConnectorToServer(); ~ConnectorToServer();
public: public:
@@ -116,6 +115,8 @@ public slots:
void slot_getVersion(); void slot_getVersion();
void slot_NotifyVersionControl(QString text);
signals: signals:
void sigSetConnect(ServerSettings* serverSettings,QThread *thread); void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
void sigStopConnect(); void sigStopConnect();
@@ -157,19 +158,19 @@ signals:
void signal_showServerList(QList<StreamingVersionData*> *serverList); void signal_showServerList(QList<StreamingVersionData*> *serverList);
void signal_SendGetVersion(); void signal_SendGetVersion();
void signal_NotifyVersionControl(QString text);
private: private:
void initialize(); void initialize();
void bindConnection(); void bindConnection();
void createObjects(); void createObjects();
private: private:
QWidget* parentWidget;
QThread *connectionThread; QThread *connectionThread;
TCPClient *client; TCPClient *client;
DataParser *dataParser; DataParser *dataParser;
SendSystem *sendSystem; SendSystem *sendSystem;
RecognizeSystem *recognizeSystem; RecognizeSystem *recognizeSystem;
NotifyController *notifyController;
//Списочная модель БД СУО //Списочная модель БД СУО
QMutex mtxAccess; QMutex mtxAccess;

View File

@@ -22,7 +22,7 @@ DialogEditInstructor::DialogEditInstructor(bool adminMode, QWidget *parent) :
ui->btnViewPassword->setObjectName("btnViewPassword"); ui->btnViewPassword->setObjectName("btnViewPassword");
ui->btnChangePassword->setObjectName("btnChangePassword"); ui->btnChangePassword->setObjectName("btnChangePassword");
ui->editName->setValidator(new QRegExpValidator(QRegExp("[A-Za-zА-Яа-я0-9 _\\d]+"), this)); //ui->editName->setValidator(new QRegExpValidator(QRegExp("[A-Za-zА-Яа-я0-9 _\\d]+"), this));
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this)); ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
ui->editPassword->setEnabled(false); ui->editPassword->setEnabled(false);

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()
@@ -74,17 +82,17 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
if(connectorToServer->isAdminInstructor(id)) if(connectorToServer->isAdminInstructor(id))
{//Это Админ! {//Это Админ!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete the Administrator.")).exec(); SpecMsgBox::CriticalClose(this, tr("You cannot delete the Administrator."));
return; return;
} }
if(connectorToServer->isLoggedInInstructor(id)) if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован! {//Инструктор залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete a logged-in instructor.")).exec(); SpecMsgBox::CriticalClose(this, tr("You cannot delete a logged-in instructor."));
return; return;
} }
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("The deletion will be irrevocable.\nDelete it anyway?")) == QDialog::Accepted)
{ {
waitAnimationWidget->showWithPlay(); waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id);
@@ -119,7 +127,7 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
{//Не Архивный {//Не Архивный
if(connectorToServer->isLoggedInInstructor(id)) if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован! {//Инструктор залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot archive a logged-in instructor.")).exec(); SpecMsgBox::CriticalClose(this, tr("You cannot archive a logged-in instructor."));
return; return;
} }
@@ -156,7 +164,7 @@ void EditorInstructors::on_btnEdit_clicked()
if(connectorToServer->isLoggedInInstructor(id)) if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован! {//Инструктор залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot edit a logged-in instructor.")).exec(); SpecMsgBox::CriticalClose(this, tr("You cannot edit a logged-in instructor."));
return; return;
} }
@@ -262,19 +270,19 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
if(instructor.getName() == QStringLiteral("<name>")) if(instructor.getName() == QStringLiteral("<name>"))
{//Имя не корректно! {//Имя не корректно!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("Unacceptable instructor name has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
if(instructor.getLogin() == QStringLiteral("<login>")) if(instructor.getLogin() == QStringLiteral("<login>"))
{//Логин не корректен! {//Логин не корректен!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("Unacceptable instructor login has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
if(instructor.getPassword() == QStringLiteral("<password>")) if(instructor.getPassword() == QStringLiteral("<password>"))
{//Пароль не корректный! {//Пароль не корректный!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("Unacceptable instructor password has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
@@ -283,7 +291,7 @@ bool EditorInstructors::verifyInstructor(Instructor instructor)
int user_T = connectorToServer->getIdTraineeByLogin(instructor.getLogin()); int user_T = connectorToServer->getIdTraineeByLogin(instructor.getLogin());
if((user_I && (user_I != instructor.getID())) || (user_T && (user_T != instructor.getID()))) if((user_I && (user_I != instructor.getID())) || (user_T && (user_T != instructor.getID())))
{//Логин уже существует! {//Логин уже существует!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
return 0; return 0;
} }
@@ -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,10 @@
#include <QDialog> #include <QDialog>
#include <QTreeWidget> #include <QTreeWidget>
#include "instructorsview.h" #include "instructorsview.h"
#include "dialogeditinstructor.h"
#include "specialmessagebox.h"
class DialogEditInstructor;
namespace Ui { namespace Ui {
class EditorInstructors; class EditorInstructors;
@@ -37,6 +41,8 @@ private:
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

@@ -7,6 +7,7 @@
#include "dialogsettings.h" #include "dialogsettings.h"
#include "specialmessagebox.h" #include "specialmessagebox.h"
#include "hashtools.h" #include "hashtools.h"
#include "widgettools.h"
const QString InstructorsAndTraineesWidget::languageENG = "en_EN"; const QString InstructorsAndTraineesWidget::languageENG = "en_EN";
@@ -15,7 +16,6 @@ const QString InstructorsAndTraineesWidget::languageRUS = "ru_RU";
InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) : InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
waitAnimationWidget(nullptr),
connectorToServer(nullptr), connectorToServer(nullptr),
viewerTrainees(nullptr), viewerTrainees(nullptr),
viewerInstructors(nullptr), viewerInstructors(nullptr),
@@ -24,15 +24,12 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
dlgTasksCommon(nullptr), dlgTasksCommon(nullptr),
dlgSettings(nullptr), dlgSettings(nullptr),
dlgAuthorization(nullptr), dlgAuthorization(nullptr),
adminMode(false), waitAnimationWidget(nullptr),
loginInstructorLoggedInLocal(QStringLiteral("")),
nameInstructorLoggedInLocal(QStringLiteral("")),
idInstructorLoggedInLocal("0"),
language(languageENG),
flSettingsServerIsChanged(false), flSettingsServerIsChanged(false),
flTryConnectToServer(false), flTryConnectToServer(false),
cntTryConnectToServer(0), cntTryConnectToServer(0),
flTryLogin(false), flTryLogin(false),
language(languageENG),
ui(new Ui::InstructorsAndTraineesWidget) ui(new Ui::InstructorsAndTraineesWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
@@ -50,7 +47,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
setLanguageInterfase(); setLanguageInterfase();
connectorToServer = new ConnectorToServer(this); connectorToServer = new ConnectorToServer();
connect(connectorToServer, &ConnectorToServer::sigLoginResult, this, &InstructorsAndTraineesWidget::slot_checkLoginResult); connect(connectorToServer, &ConnectorToServer::sigLoginResult, this, &InstructorsAndTraineesWidget::slot_checkLoginResult);
connect(connectorToServer, &ConnectorToServer::sigDeLoginResult, this, &InstructorsAndTraineesWidget::slot_checkDeLoginResult); connect(connectorToServer, &ConnectorToServer::sigDeLoginResult, this, &InstructorsAndTraineesWidget::slot_checkDeLoginResult);
connect(connectorToServer, &ConnectorToServer::sigServerBlocked, this, &InstructorsAndTraineesWidget::slot_ServerBlocked); connect(connectorToServer, &ConnectorToServer::sigServerBlocked, this, &InstructorsAndTraineesWidget::slot_ServerBlocked);
@@ -108,7 +105,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
InstructorsAndTraineesWidget::~InstructorsAndTraineesWidget() InstructorsAndTraineesWidget::~InstructorsAndTraineesWidget()
{ {
if(authorizationIsCompleted()) if(authorizationIsCompleted())
deAuthorizationInstructor(loginInstructorLoggedInLocal); deAuthorizationInstructor(instructorLoggedInLocal.getLogin());
if(dlgTasksCommon) if(dlgTasksCommon)
{ {
@@ -154,7 +151,7 @@ void InstructorsAndTraineesWidget::changeEvent(QEvent *event)
{// переведём окно заново {// переведём окно заново
ui->retranslateUi(this); ui->retranslateUi(this);
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal); updateLabelLoggedInInstructor(instructorLoggedInLocal);
updateLabelServer(); updateLabelServer();
} }
} }
@@ -179,7 +176,7 @@ QString InstructorsAndTraineesWidget::loadStyleSheet()
QFile styleSheetFile(fileName); QFile styleSheetFile(fileName);
if (!styleSheetFile.open(QFile::ReadOnly | QFile::Text)) if (!styleSheetFile.open(QFile::ReadOnly | QFile::Text))
{ {
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The file could not be opened ") + fileName).exec(); SpecMsgBox::CriticalClose(this, tr("The file could not be opened ") + fileName);
return QStringLiteral(""); return QStringLiteral("");
} }
else else
@@ -209,28 +206,28 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se
{ {
if (serverAuth->Result) if (serverAuth->Result)
{ {
loginInstructorLoggedInLocal = serverAuth->Login; instructorLoggedInLocal.setLogin(serverAuth->Login);
nameInstructorLoggedInLocal = serverAuth->ClientName; instructorLoggedInLocal.setName(serverAuth->ClientName);
idInstructorLoggedInLocal = serverAuth->Id; instructorLoggedInLocal.setID(serverAuth->Id.toInt());
if(loginInstructorLoggedInLocal == QStringLiteral("admin")) if(serverAuth->Login == QStringLiteral("admin"))
adminMode = true; instructorLoggedInLocal.setIsAdmin(true);
else else
adminMode = false; instructorLoggedInLocal.setIsAdmin(false);
viewerInstructors->setAdminMode(adminMode); viewerInstructors->setAdminMode(instructorLoggedInLocal.getIsAdmin());
viewerTrainees->setAdminMode(adminMode); viewerTrainees->setAdminMode(instructorLoggedInLocal.getIsAdmin());
viewerInstructors->setAuthComplited(true); viewerInstructors->setAuthComplited(true);
viewerTrainees->setAuthComplited(true); viewerTrainees->setAuthComplited(true);
ui->btnEditorTrainees->setEnabled(true); ui->btnEditorTrainees->setEnabled(true);
if(adminMode) if(instructorLoggedInLocal.getIsAdmin())
ui->btnEditorInstructors->setEnabled(true); ui->btnEditorInstructors->setEnabled(true);
emit signal_NeedUpdateUI(true, true); emit signal_NeedUpdateUI(true, true);
updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName); updateLabelLoggedInInstructor(instructorLoggedInLocal);
connectorToServer->setLoginName(nameInstructorLoggedInLocal); connectorToServer->setLoginName(instructorLoggedInLocal.getName());
messangerController->setUserLocalGUI_ID(serverAuth->Id.toInt()); messangerController->setUserLocalGUI_ID(serverAuth->Id.toInt());
@@ -255,12 +252,13 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization
{ {
if (serverDeAuth->Result) if (serverDeAuth->Result)
{ {
loginInstructorLoggedInLocal = QStringLiteral(""); instructorLoggedInLocal.setLogin(QStringLiteral(""));
nameInstructorLoggedInLocal = QStringLiteral(""); instructorLoggedInLocal.setName(QStringLiteral(""));
adminMode = false; instructorLoggedInLocal.setIsAdmin(false);
instructorLoggedInLocal.setID(0);
viewerInstructors->setAdminMode(adminMode); viewerInstructors->setAdminMode(instructorLoggedInLocal.getIsAdmin());
viewerTrainees->setAdminMode(adminMode); viewerTrainees->setAdminMode(instructorLoggedInLocal.getIsAdmin());
viewerInstructors->setAuthComplited(false); viewerInstructors->setAuthComplited(false);
viewerTrainees->setAuthComplited(false); viewerTrainees->setAuthComplited(false);
@@ -268,12 +266,12 @@ void InstructorsAndTraineesWidget::slot_checkDeLoginResult(ServerDeAuthorization
ui->btnEditorInstructors->setEnabled(false); ui->btnEditorInstructors->setEnabled(false);
ui->btnPersonalCard->setEnabled(false); ui->btnPersonalCard->setEnabled(false);
updateLabelLoggedInInstructor("",""); updateLabelLoggedInInstructor(instructorLoggedInLocal);
} }
else else
{ {
ui->btnAuthorizationInstructor->setChecked(true); ui->btnAuthorizationInstructor->setChecked(true);
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor deauthorization") + "\n" + tr("Error!")).exec(); SpecMsgBox::CriticalClose(this, tr("Instructor deauthorization") + "\n" + tr("Error!"));
} }
} }
@@ -285,7 +283,7 @@ void InstructorsAndTraineesWidget::slot_ServerBlocked()
waitAnimationWidget->hideWithStop(); waitAnimationWidget->hideWithStop();
ui->btnAuthorizationInstructor->setChecked(false); ui->btnAuthorizationInstructor->setChecked(false);
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + tr("Server blocked!")).exec(); SpecMsgBox::WarningClose(this, tr("Instructor authorization.") + "\n" + tr("Server blocked!"));
} }
} }
@@ -317,7 +315,7 @@ void InstructorsAndTraineesWidget::slot_ErrorAuth(QString error)
errorTextMsg = tr("Login or password error!"); errorTextMsg = tr("Login or password error!");
} }
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Instructor authorization.") + "\n" + errorTextMsg).exec(); SpecMsgBox::WarningClose(this, tr("Instructor authorization.") + "\n" + errorTextMsg);
} }
} }
@@ -336,7 +334,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png"))); ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal); updateLabelLoggedInInstructor(instructorLoggedInLocal);
flTryConnectToServer = false; flTryConnectToServer = false;
cntTryConnectToServer = 0; cntTryConnectToServer = 0;
@@ -375,10 +373,12 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
messangerController->deleteAllWidgets(); messangerController->deleteAllWidgets();
loginInstructorLoggedInLocal = ""; instructorLoggedInLocal.setLogin(QStringLiteral(""));
nameInstructorLoggedInLocal = ""; instructorLoggedInLocal.setName(QStringLiteral(""));
instructorLoggedInLocal.setIsAdmin(false);
instructorLoggedInLocal.setID(0);
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal); updateLabelLoggedInInstructor(instructorLoggedInLocal);
if(flTryConnectToServer) if(flTryConnectToServer)
@@ -386,7 +386,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
if(cntTryConnectToServer < 10) if(cntTryConnectToServer < 10)
{ {
cntTryConnectToServer++; cntTryConnectToServer++;
QTimer::singleShot(1000, this, SLOT(slot_ConnectToServer())); QTimer::singleShot(1000, this, SLOT(slot_TryConnectToServer()));
} }
else else
{ {
@@ -406,7 +406,10 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
if(!flSettingsServerIsChanged) if(!flSettingsServerIsChanged)
{ {
if(!flTryConnectToServer) if(!flTryConnectToServer)
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("The server is not available!")).exec(); {
WidgetTools::closeAllChildWidgets(this, "SpecMsgBox");
SpecMsgBox::WarningClose(this, tr("The server is not available!"));
}
} }
else else
flSettingsServerIsChanged = false; flSettingsServerIsChanged = false;
@@ -443,7 +446,7 @@ void InstructorsAndTraineesWidget::slot_instructorSelected(int id_instructor)
/*Messanger*/ /*Messanger*/
messangerController->deleteWidget(messangerWidget); messangerController->deleteWidget(messangerWidget);
if(id_instructor && id_instructor != idInstructorLoggedInLocal.toInt()) if(id_instructor && id_instructor != instructorLoggedInLocal.getID())
{ {
Instructor instructor = connectorToServer->getInstructor(id_instructor); Instructor instructor = connectorToServer->getInstructor(id_instructor);
if(instructor.getID()) if(instructor.getID())
@@ -456,7 +459,7 @@ void InstructorsAndTraineesWidget::slot_AnswerDocsChanged()
viewerTrainees->getAmmTasksWidgetCommon()->setDocsActualed(false); viewerTrainees->getAmmTasksWidgetCommon()->setDocsActualed(false);
} }
void InstructorsAndTraineesWidget::slot_ConnectToServer() void InstructorsAndTraineesWidget::slot_TryConnectToServer()
{ {
updateLabelServer(); updateLabelServer();
connectorToServer->SetConnectToServer(); connectorToServer->SetConnectToServer();
@@ -519,7 +522,7 @@ bool InstructorsAndTraineesWidget::deAuthorizationInstructor(QString login)
bool InstructorsAndTraineesWidget::authorizationIsCompleted() bool InstructorsAndTraineesWidget::authorizationIsCompleted()
{ {
if(loginInstructorLoggedInLocal == QStringLiteral("")) if(instructorLoggedInLocal.getLogin() == QStringLiteral(""))
return false; return false;
else else
return true; return true;
@@ -536,7 +539,7 @@ void InstructorsAndTraineesWidget::on_btnConnectionToServer_clicked()
updateLabelServer(); updateLabelServer();
QTimer::singleShot(1000, this, SLOT(slot_ConnectToServer())); QTimer::singleShot(1000, this, SLOT(slot_TryConnectToServer()));
} }
void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked() void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
@@ -558,7 +561,7 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
{//ДеАвторизация Инструктора локальная (Администратора) {//ДеАвторизация Инструктора локальная (Администратора)
if(authorizationIsCompleted()) if(authorizationIsCompleted())
{ {
if(deAuthorizationInstructor(loginInstructorLoggedInLocal)) if(deAuthorizationInstructor(instructorLoggedInLocal.getLogin()))
{ {
disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI); disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI);
disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI); disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI);
@@ -578,13 +581,13 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
} }
} }
void InstructorsAndTraineesWidget::updateLabelLoggedInInstructor(QString login, QString name) void InstructorsAndTraineesWidget::updateLabelLoggedInInstructor(Instructor& instructor)
{ {
if(authorizationIsCompleted()) if(authorizationIsCompleted())
{ {
QString nameLoggedInInstructor = QString("%1 (%2)").arg(name, login); QString nameLoggedInInstructor = QString("%1 (%2)").arg(instructor.getName(), instructor.getLogin());
ui->lblLoggedInInstructor->setText(nameLoggedInInstructor); ui->lblLoggedInInstructor->setText(nameLoggedInInstructor);
if(loginInstructorLoggedInLocal == QStringLiteral("admin")) if(instructor.getIsAdmin())
ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/admin.png"))); ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/admin.png")));
else else
ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/instructor.png"))); ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/instructor.png")));
@@ -640,7 +643,7 @@ void InstructorsAndTraineesWidget::setLanguageInterfase()
void InstructorsAndTraineesWidget::on_btnSettings_clicked() void InstructorsAndTraineesWidget::on_btnSettings_clicked()
{ {
dlgSettings = new DialogSettings(connectorToServer, (loginInstructorLoggedInLocal != ""), this); dlgSettings = new DialogSettings(connectorToServer, authorizationIsCompleted(), this);
dlgSettings->setWindowFlags(dlgSettings->windowFlags() & ~Qt::WindowContextHelpButtonHint); dlgSettings->setWindowFlags(dlgSettings->windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(dlgSettings, &DialogSettings::signal_LanguageChanged, this, &InstructorsAndTraineesWidget::slot_LanguageChanged); connect(dlgSettings, &DialogSettings::signal_LanguageChanged, this, &InstructorsAndTraineesWidget::slot_LanguageChanged);
@@ -654,12 +657,12 @@ void InstructorsAndTraineesWidget::on_btnSettings_clicked()
if(dlgSettings->settingsServerIsChanged()) if(dlgSettings->settingsServerIsChanged())
{ {
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Server settings have been changed. Please reconnect to the server.")).exec(); SpecMsgBox::WarningClose(this, tr("Server settings have been changed.\nPlease reconnect to the server."));
flSettingsServerIsChanged = true; flSettingsServerIsChanged = true;
if(authorizationIsCompleted()) if(authorizationIsCompleted())
deAuthorizationInstructor(loginInstructorLoggedInLocal); deAuthorizationInstructor(instructorLoggedInLocal.getLogin());
connectorToServer->StopConnectToServer(); connectorToServer->StopConnectToServer();
} }

View File

@@ -13,6 +13,7 @@
#include "dialogtaskscommon.h" #include "dialogtaskscommon.h"
#include "dialogsettings.h" #include "dialogsettings.h"
#include "dialogauthorization.h" #include "dialogauthorization.h"
#include "instructor.h"
namespace Ui { namespace Ui {
@@ -65,7 +66,7 @@ public Q_SLOTS:
void slot_AnswerDocsChanged(); void slot_AnswerDocsChanged();
void slot_ConnectToServer(); void slot_TryConnectToServer();
Q_SIGNALS: Q_SIGNALS:
//сигнал смены языка //сигнал смены языка
@@ -79,24 +80,18 @@ private Q_SLOTS:
void on_btnSettings_clicked(); void on_btnSettings_clicked();
void on_btnEditorTrainees_clicked(); void on_btnEditorTrainees_clicked();
void on_btnEditorInstructors_clicked(); void on_btnEditorInstructors_clicked();
void on_btnPersonalCard_clicked(); void on_btnPersonalCard_clicked();
void on_btnTasksCommon_clicked(); void on_btnTasksCommon_clicked();
private: private:
//Авторизация инструктора локальная (на ГУИ)
bool authorizationInstructorDialog(QWidget* parent = nullptr); bool authorizationInstructorDialog(QWidget* parent = nullptr);
bool deAuthorizationInstructor(QString login); bool deAuthorizationInstructor(QString login);
bool authorizationIsCompleted(); bool authorizationIsCompleted();
void updateLabelLoggedInInstructor(QString login, QString name); void updateLabelLoggedInInstructor(Instructor& instructor);
void updateLabelServer(); void updateLabelServer();
void setLanguageInterfase(); void setLanguageInterfase();
private: private:
WaitAnimationWidget *waitAnimationWidget;
ConnectorToServer* connectorToServer; ConnectorToServer* connectorToServer;
ViewerTrainees* viewerTrainees; ViewerTrainees* viewerTrainees;
@@ -108,13 +103,9 @@ private:
DialogSettings* dlgSettings; DialogSettings* dlgSettings;
DialogAuthorization* dlgAuthorization; DialogAuthorization* dlgAuthorization;
bool adminMode; WaitAnimationWidget *waitAnimationWidget;
QString loginInstructorLoggedInLocal;
QString nameInstructorLoggedInLocal;
QString idInstructorLoggedInLocal;
QTranslator qtLanguageTranslator; Instructor instructorLoggedInLocal;
QString language;
bool flSettingsServerIsChanged; bool flSettingsServerIsChanged;
@@ -123,6 +114,9 @@ private:
bool flTryLogin; bool flTryLogin;
QTranslator qtLanguageTranslator;
QString language;
Ui::InstructorsAndTraineesWidget *ui; Ui::InstructorsAndTraineesWidget *ui;
}; };

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1314</width> <width>1300</width>
<height>901</height> <height>900</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">

View File

@@ -57,6 +57,7 @@ void DialogVersionControl::initialize(QString authorName)
connect(connectorToServer, &ConnectorToServer::signal_AnimationActivated, this, &DialogVersionControl::slot_activateLoadAnimation); connect(connectorToServer, &ConnectorToServer::signal_AnimationActivated, this, &DialogVersionControl::slot_activateLoadAnimation);
connect(connectorToServer, &ConnectorToServer::signal_showServerList, this, &DialogVersionControl::slot_showServerList); connect(connectorToServer, &ConnectorToServer::signal_showServerList, this, &DialogVersionControl::slot_showServerList);
connect(connectorToServer, &ConnectorToServer::signal_NotifyVersionControl, this, &DialogVersionControl::slot_NotifyVersionControl);
connect(this, &DialogVersionControl::sigSendSwitchVersion, connectorToServer, &ConnectorToServer::slot_SendSwitchVersion); connect(this, &DialogVersionControl::sigSendSwitchVersion, connectorToServer, &ConnectorToServer::slot_SendSwitchVersion);
connect(this, &DialogVersionControl::sigSendCopyVersion, connectorToServer, &ConnectorToServer::slot_SendCopyVersion); connect(this, &DialogVersionControl::sigSendCopyVersion, connectorToServer, &ConnectorToServer::slot_SendCopyVersion);
@@ -114,7 +115,7 @@ void DialogVersionControl::sendCopyEmit(QString newName)
if (selectedVersion == nullptr) if (selectedVersion == nullptr)
{ {
QString text = tr("Version not selected"); QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec(); SpecMsgBox::WarningClose(this, text);
return; return;
} }
@@ -127,7 +128,7 @@ void DialogVersionControl::on_createDuplicateButton_clicked()
if (selectedVersion == nullptr) if (selectedVersion == nullptr)
{ {
QString text = tr("Version not selected"); QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec(); SpecMsgBox::WarningClose(this, text);
return; return;
} }
@@ -160,7 +161,7 @@ void DialogVersionControl::on_deleteVersionButton_clicked()
if (selectedVersion == nullptr) if (selectedVersion == nullptr)
{ {
QString text = tr("Version not selected"); QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec(); SpecMsgBox::WarningClose(this, text);
return; return;
} }
@@ -172,7 +173,7 @@ void DialogVersionControl::on_switchServerVersionButton_clicked()
if (selectedVersion == nullptr) if (selectedVersion == nullptr)
{ {
QString text = tr("Version not selected"); QString text = tr("Version not selected");
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec(); SpecMsgBox::WarningClose(this, text);
return; return;
} }
@@ -209,6 +210,11 @@ void DialogVersionControl::slot_SetVersion(StreamingVersionData *serverVersion)
flGetVersion = true; flGetVersion = true;
} }
void DialogVersionControl::slot_NotifyVersionControl(QString text)
{
SpecMsgBox::WarningClose(this, text);
}
void DialogVersionControl::resizeEvent(QResizeEvent *event) void DialogVersionControl::resizeEvent(QResizeEvent *event)
{ {
QSize size = event->size(); QSize size = event->size();

View File

@@ -39,6 +39,7 @@ private slots:
void slot_activateLoadAnimation(bool flag); void slot_activateLoadAnimation(bool flag);
void slot_showServerList(QList<StreamingVersionData*> *serverList); void slot_showServerList(QList<StreamingVersionData*> *serverList);
void slot_SetVersion(StreamingVersionData* serverVersion); void slot_SetVersion(StreamingVersionData* serverVersion);
void slot_NotifyVersionControl(QString text);
signals: signals:
void sigSendDeleteVersion(StreamingVersionData *streaming); void sigSendDeleteVersion(StreamingVersionData *streaming);

View File

@@ -1,19 +0,0 @@
#include <QMessageBox>
#include "notifycontroller.h"
#include "specialmessagebox.h"
NotifyController::NotifyController(QWidget *parentWidget, QObject *parent) :
QObject(parent),
parentWidget(parentWidget)
{
}
void NotifyController::showWarning(QString text, QWidget *parentWidget)
{
if(parentWidget)
SpecialMessageBox(parentWidget, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
else
SpecialMessageBox(this->parentWidget, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec();
}

View File

@@ -1,20 +0,0 @@
#ifndef NOTIFYCONTROLLER_H
#define NOTIFYCONTROLLER_H
#include <QObject>
#include <QWidget>
class NotifyController : public QObject
{
Q_OBJECT
public:
explicit NotifyController(QWidget *parentWidget = nullptr, QObject *parent = nullptr);
void showWarning(QString text, QWidget *parentWidget = nullptr);
private:
QWidget *parentWidget;
};
#endif // NOTIFYCONTROLLER_H

View File

@@ -2,12 +2,14 @@
#include "specialmessagebox.h" #include "specialmessagebox.h"
#include "ui_specialmessagebox.h" #include "ui_specialmessagebox.h"
SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) : SpecMsgBox::SpecMsgBox(QWidget *parent, TypeSpecMsgBox type, const QString& text) :
QDialog(parent), QDialog(parent),
ui(new Ui::SpecialMessageBox) ui(new Ui::SpecialMessageBox)
{ {
ui->setupUi(this); ui->setupUi(this);
this->setObjectName("SpecMsgBox");
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
if(type == TypeSpecMsgBox::warningYesNo) if(type == TypeSpecMsgBox::warningYesNo)
@@ -22,14 +24,14 @@ SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const
ui->btnNo->setVisible(false); ui->btnNo->setVisible(false);
ui->btnYes->setText(tr("Close")); ui->btnYes->setText(tr("Close"));
} }
else if(type == TypeSpecMsgBox::critical) else if(type == TypeSpecMsgBox::criticalClose)
{ {
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/critical.png"))); ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/critical.png")));
this->setWindowTitle(tr("Error!")); this->setWindowTitle(tr("Error!"));
ui->btnNo->setVisible(false); ui->btnNo->setVisible(false);
ui->btnYes->setText(tr("Close")); ui->btnYes->setText(tr("Close"));
} }
else if(type == TypeSpecMsgBox::info) else if(type == TypeSpecMsgBox::infoOk)
{ {
ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/info.png"))); ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/info.png")));
this->setWindowTitle(tr("Information")); this->setWindowTitle(tr("Information"));
@@ -40,17 +42,43 @@ SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const
ui->lblText->setText(text); ui->lblText->setText(text);
} }
SpecialMessageBox::~SpecialMessageBox() SpecMsgBox::~SpecMsgBox()
{ {
delete ui; delete ui;
} }
void SpecialMessageBox::on_btnYes_clicked() int SpecMsgBox::WarningYesNo(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(parent, TypeSpecMsgBox::warningYesNo, text);
}
int SpecMsgBox::WarningClose(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(parent, TypeSpecMsgBox::warningClose, text);
}
int SpecMsgBox::CriticalClose(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(parent, TypeSpecMsgBox::criticalClose, text);
}
int SpecMsgBox::InfoOk(QWidget *parent, const QString &text)
{
return SpecMsgBox::work(parent, TypeSpecMsgBox::infoOk, text);
}
int SpecMsgBox::work(QWidget *parent, TypeSpecMsgBox type, const QString& text)
{
SpecMsgBox *msgBox = new SpecMsgBox(parent, type, text);
return msgBox->exec();
}
void SpecMsgBox::on_btnYes_clicked()
{ {
this->accept(); this->accept();
} }
void SpecialMessageBox::on_btnNo_clicked() void SpecMsgBox::on_btnNo_clicked()
{ {
this->reject(); this->reject();
} }

View File

@@ -2,12 +2,13 @@
#define SPECIALMESSAGEBOX_H #define SPECIALMESSAGEBOX_H
#include <QDialog> #include <QDialog>
#include "instructorsAndTrainees_global.h"
namespace Ui { namespace Ui {
class SpecialMessageBox; class SpecialMessageBox;
} }
class SpecialMessageBox : public QDialog class INSTRUCTORSANDTRAINEES_EXPORT SpecMsgBox : public QDialog
{ {
Q_OBJECT Q_OBJECT
@@ -15,13 +16,23 @@ public:
enum TypeSpecMsgBox { enum TypeSpecMsgBox {
warningYesNo, warningYesNo,
warningClose, warningClose,
critical, criticalClose,
info infoOk
}; };
private:
explicit SpecMsgBox(QWidget *parent, TypeSpecMsgBox type, const QString& text);
public: public:
explicit SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const QString& text); ~SpecMsgBox();
~SpecialMessageBox();
public:
static int WarningYesNo(QWidget *parent, const QString& text);
static int WarningClose(QWidget *parent, const QString& text);
static int CriticalClose(QWidget *parent, const QString& text);
static int InfoOk(QWidget *parent, const QString& text);
private:
static int work(QWidget *parent, TypeSpecMsgBox type, const QString& text);
private slots: private slots:
void on_btnYes_clicked(); void on_btnYes_clicked();

View File

@@ -9,6 +9,7 @@
#include "ui_ammtaskswidget.h" #include "ui_ammtaskswidget.h"
#include "checkertask.h" #include "checkertask.h"
#include "specialmessagebox.h" #include "specialmessagebox.h"
#include "widgettools.h"
AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTreeAMMFIM type, QWidget *parent) : AMMtasksWidget::AMMtasksWidget(ConnectorToServer* connectorToServer, TypeListTreeAMMFIM type, QWidget *parent) :
QWidget(parent), QWidget(parent),
@@ -145,14 +146,15 @@ void AMMtasksWidget::resizeEvent(QResizeEvent *event)
waitAnimationWidget->resize(size); waitAnimationWidget->resize(size);
} }
void AMMtasksWidget::closeDlgCheckTask() void AMMtasksWidget::closeEvent(QCloseEvent *event)
{
closeChildDlg();
}
void AMMtasksWidget::closeChildDlg()
{ {
if(dlgCheckerTask) if(dlgCheckerTask)
dlgCheckerTask->close(); dlgCheckerTask->close();
}
void AMMtasksWidget::closeDlgListSubProc()
{
if(dlgListSubProc) if(dlgListSubProc)
dlgListSubProc->close(); dlgListSubProc->close();
} }
@@ -325,7 +327,7 @@ void AMMtasksWidget::slot_UpdateSubProcForDMCode(QString dmCode)
lastSelectedTask.listSubProc.clear(); lastSelectedTask.listSubProc.clear();
dlgListSubProc->getListCheckedSubProc(&lastSelectedTask.listSubProc); dlgListSubProc->getListCheckedSubProc(&lastSelectedTask.listSubProc);
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("Assign this task?")) == QDialog::Accepted)
{ {
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask);
} }
@@ -347,7 +349,7 @@ void AMMtasksWidget::slot_UpdateSubProcForDMCode(QString dmCode)
{ {
lastSelectedTask.listSubProc.clear(); lastSelectedTask.listSubProc.clear();
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("Assign this task?")) == QDialog::Accepted)
{ {
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE, idTraineeSelected, &lastSelectedTask);
} }
@@ -504,7 +506,7 @@ void AMMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt(); int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt();
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("The deletion will be irrevocable.\nDelete it anyway?")) == QDialog::Accepted)
{ {
waitAnimationWidget->showWithPlay(); waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TASK_AMM_TO_TRAINEE, id); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TASK_AMM_TO_TRAINEE, id);

View File

@@ -10,6 +10,7 @@
#include "dialogchekertask.h" #include "dialogchekertask.h"
#include "dialoglistsubproc.h" #include "dialoglistsubproc.h"
#include "waitanimationwidget.h" #include "waitanimationwidget.h"
#include "specialmessagebox.h"
namespace Ui { namespace Ui {
class AMMtasksWidget; class AMMtasksWidget;
@@ -31,8 +32,10 @@ public:
public: public:
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
void closeDlgCheckTask(); void closeEvent(QCloseEvent *event) override;
void closeDlgListSubProc();
void closeChildDlg();
protected: protected:
void changeEvent(QEvent * event) override; void changeEvent(QEvent * event) override;

View File

@@ -48,6 +48,7 @@ CheckerTask::~CheckerTask()
delete fimTasksWidget; delete fimTasksWidget;
fimTasksWidget = nullptr; fimTasksWidget = nullptr;
} }
delete ui; delete ui;
} }
@@ -175,7 +176,7 @@ void CheckerTask::on_btnWrong_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'new'"); msgString = tr("Change task status?\nThe status will be set:\n'new'");
} }
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, msgString).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, msgString) == QDialog::Accepted)
{ {
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status); connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close(); this->parentWidget()->close();
@@ -202,7 +203,7 @@ void CheckerTask::on_btnRight_clicked()
msgString = tr("Change task status?\nThe status will be set:\n'completed'"); msgString = tr("Change task status?\nThe status will be set:\n'completed'");
} }
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, msgString).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, msgString) == QDialog::Accepted)
{ {
connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status); connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status);
this->parentWidget()->close(); this->parentWidget()->close();

View File

@@ -6,6 +6,7 @@
//#include "fimtaskswidget.h" //#include "fimtaskswidget.h"
#include "module.h" #include "module.h"
#include "connectortoserver.h" #include "connectortoserver.h"
#include "specialmessagebox.h"
namespace Ui { namespace Ui {
class CheckerTask; class CheckerTask;

View File

@@ -101,9 +101,7 @@ FIMtasksWidget::~FIMtasksWidget()
delete treeWidget; delete treeWidget;
if(dlgCheckerTask) if(dlgCheckerTask)
{
dlgCheckerTask->close(); dlgCheckerTask->close();
}
delete ui; delete ui;
} }
@@ -130,7 +128,12 @@ void FIMtasksWidget::resizeEvent(QResizeEvent *event)
waitAnimationWidget->resize(size); waitAnimationWidget->resize(size);
} }
void FIMtasksWidget::closeDlgCheckTask() void FIMtasksWidget::closeEvent(QCloseEvent *event)
{
closeChildDlg();
}
void FIMtasksWidget::closeChildDlg()
{ {
if(dlgCheckerTask) if(dlgCheckerTask)
dlgCheckerTask->close(); dlgCheckerTask->close();
@@ -393,7 +396,7 @@ void FIMtasksWidget::on_btnDelete_clicked()
int id = treeItemCurrent->text(ColumnsTreeFIM::clmnFIM_ID).toInt(); int id = treeItemCurrent->text(ColumnsTreeFIM::clmnFIM_ID).toInt();
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("The deletion will be irrevocable.\nDelete it anyway?")) == QDialog::Accepted)
{ {
waitAnimationWidget->showWithPlay(); waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TASK_FIM_TO_TRAINEE, id); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TASK_FIM_TO_TRAINEE, id);
@@ -437,7 +440,7 @@ void FIMtasksWidget::on_btnCheck_clicked()
void FIMtasksWidget::on_btnAssignTask_clicked() void FIMtasksWidget::on_btnAssignTask_clicked()
{ {
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("Assign this task?")) == QDialog::Accepted)
assignTaskFIMtoTrainee(); assignTaskFIMtoTrainee();
} }

View File

@@ -8,6 +8,7 @@
#include "tasktreepreparation.h" #include "tasktreepreparation.h"
#include "dialogchekertask.h" #include "dialogchekertask.h"
#include "waitanimationwidget.h" #include "waitanimationwidget.h"
#include "specialmessagebox.h"
namespace Ui { namespace Ui {
class FIMtasksWidget; class FIMtasksWidget;
@@ -31,7 +32,10 @@ public:
public: public:
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
void closeDlgCheckTask(); void closeEvent(QCloseEvent *event) override;
void closeChildDlg();
protected: protected:
void changeEvent(QEvent * event) override; void changeEvent(QEvent * event) override;

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),
@@ -11,7 +12,7 @@ DialogEditGroup::DialogEditGroup(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
verify(); verify();
ui->editName->setValidator(new QRegExpValidator(QRegExp("[A-Za-zА-Яа-я0-9 _\\d]+"), this)); //ui->editName->setValidator(new QRegExpValidator(QRegExp("[A-Za-zА-Яа-я0-9 _\\d]+"), this));
ui->editName->setProperty("mandatoryField", true); ui->editName->setProperty("mandatoryField", true);
} }

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

@@ -22,7 +22,7 @@ DialogEditTrainee::DialogEditTrainee(bool adminMode, QWidget *parent) :
ui->btnViewPassword->setObjectName("btnViewPassword"); ui->btnViewPassword->setObjectName("btnViewPassword");
ui->btnChangePassword->setObjectName("btnChangePassword"); ui->btnChangePassword->setObjectName("btnChangePassword");
ui->editName->setValidator(new QRegExpValidator(QRegExp("[A-Za-zА-Яа-я0-9 _\\d]+"), this)); //ui->editName->setValidator(new QRegExpValidator(QRegExp("[A-Za-zА-Яа-я0-9 _\\d]+"), this));
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this)); ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
ui->editPassword->setEnabled(false); ui->editPassword->setEnabled(false);

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()
@@ -73,12 +93,12 @@ void EditorTrainees::on_btnDeleteGroup_clicked()
if(connectorToServer->getListTraineesInGroup(id_group).count() > 0) if(connectorToServer->getListTraineesInGroup(id_group).count() > 0)
{ {
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The group is not empty.\nIt is not possible to delete a non-empty group.")).exec(); SpecMsgBox::CriticalClose(this, tr("The group is not empty.\nIt is not possible to delete a non-empty group."));
return; return;
} }
else else
{//Пустая группа {//Пустая группа
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("The deletion will be irrevocable.\nDelete it anyway?")) == QDialog::Accepted)
{ {
waitAnimationWidget->showWithPlay(); waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_GROUP, id_group); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_GROUP, id_group);
@@ -129,11 +149,11 @@ void EditorTrainees::on_btnDeleteTrainee_clicked()
if(connectorToServer->isLoggedInTrainee(id_trainee)) if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован! {//Обучаемый залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot delete a logged-in trainee.")).exec(); SpecMsgBox::CriticalClose(this, tr("You cannot delete a logged-in trainee."));
return; return;
} }
if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) if(SpecMsgBox::WarningYesNo(this, tr("The deletion will be irrevocable.\nDelete it anyway?")) == QDialog::Accepted)
{ {
waitAnimationWidget->showWithPlay(); waitAnimationWidget->showWithPlay();
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE, id_trainee); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE, id_trainee);
@@ -168,7 +188,7 @@ void EditorTrainees::on_btnToOrFromArchiveTrainee_clicked()
{//Не Архивный {//Не Архивный
if(connectorToServer->isLoggedInTrainee(id_trainee)) if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован! {//Обучаемый залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot archive a logged-in trainee.")).exec(); SpecMsgBox::CriticalClose(this, tr("You cannot archive a logged-in trainee."));
return; return;
} }
@@ -214,7 +234,7 @@ void EditorTrainees::on_btnEdit_clicked()
if(connectorToServer->isLoggedInTrainee(id_trainee)) if(connectorToServer->isLoggedInTrainee(id_trainee))
{//Обучаемый залогирован! {//Обучаемый залогирован!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("You cannot edit a logged-in trainee.")).exec(); SpecMsgBox::CriticalClose(this, tr("You cannot edit a logged-in trainee."));
return; return;
} }
@@ -383,7 +403,7 @@ bool EditorTrainees::verifyGroup(Group group)
if(group.getName() == QStringLiteral("<group>")) if(group.getName() == QStringLiteral("<group>"))
{//Имя не корректно! {//Имя не корректно!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable group name has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("Unacceptable group name has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
@@ -393,7 +413,7 @@ bool EditorTrainees::verifyGroup(Group group)
{ {
if(group.getName() == exist_group.getName() && group.getID() != exist_group.getID()) if(group.getName() == exist_group.getName() && group.getID() != exist_group.getID())
{//Имя уже существует {//Имя уже существует
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing group name has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("An existing group name has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
} }
@@ -407,19 +427,19 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
if(trainee.getName() == QStringLiteral("<name>")) if(trainee.getName() == QStringLiteral("<name>"))
{//Имя не корректно! {//Имя не корректно!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("Unacceptable trainee name has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
if(trainee.getLogin() == QStringLiteral("<login>")) if(trainee.getLogin() == QStringLiteral("<login>"))
{//Логин не корректен! {//Логин не корректен!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee login has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("Unacceptable trainee login has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
if(trainee.getPassword() == QStringLiteral("<password>")) if(trainee.getPassword() == QStringLiteral("<password>"))
{//Пароль не корректный! {//Пароль не корректный!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Unacceptable trainee password has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("Unacceptable trainee password has been entered.\nThe changes will not be accepted."));
return false; return false;
} }
@@ -428,7 +448,7 @@ bool EditorTrainees::verifyTrainee(Trainee trainee)
int user_T = connectorToServer->getIdTraineeByLogin(trainee.getLogin()); int user_T = connectorToServer->getIdTraineeByLogin(trainee.getLogin());
if((user_I && (user_I != trainee.getID())) || (user_T && (user_T != trainee.getID()))) if((user_I && (user_I != trainee.getID())) || (user_T && (user_T != trainee.getID())))
{//Логин уже существует! {//Логин уже существует!
SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted.")).exec(); SpecMsgBox::CriticalClose(this, tr("An existing instructor or trainee login has been entered.\nThe changes will not be accepted."));
return 0; return 0;
} }
@@ -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,9 @@
#include <QTreeWidget> #include <QTreeWidget>
#include "traineesview.h" #include "traineesview.h"
//#include "computersLocations.h" //#include "computersLocations.h"
#include "dialogedittrainee.h"
#include "dialogeditgroup.h"
#include "specialmessagebox.h"
namespace Ui { namespace Ui {
class EditorTrainees; class EditorTrainees;
@@ -43,6 +46,9 @@ private:
private: private:
Ui::EditorTrainees *ui; Ui::EditorTrainees *ui;
DialogEditTrainee* dlgEditTrainee;
DialogEditGroup* dlgEditGroup;
}; };
#endif // DIALOGTRAINEESGROUPS_H #endif // DIALOGTRAINEESGROUPS_H

View File

@@ -78,10 +78,11 @@ PersonalCardTrainee::~PersonalCardTrainee()
void PersonalCardTrainee::closeEvent(QCloseEvent *event) void PersonalCardTrainee::closeEvent(QCloseEvent *event)
{ {
fimTasksWidget_personal->closeDlgCheckTask(); fimTasksWidget_personal->closeChildDlg();
ammTasksWidget_personal->closeDlgCheckTask(); fimTasksWidget_common->closeChildDlg();
ammTasksWidget_common->closeDlgListSubProc(); ammTasksWidget_personal->closeChildDlg();
ammTasksWidget_common->closeChildDlg();
} }
void PersonalCardTrainee::loadInfo() void PersonalCardTrainee::loadInfo()

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

@@ -0,0 +1,24 @@
#include "widgettools.h"
WidgetTools::WidgetTools()
{
}
// Рекурсивная функция для закрытия всех дочерних виджетов
void WidgetTools::closeAllChildWidgets(QWidget *parent, QString objName)
{
// Ищем всех дочерних виджетов типа QWidget
QObjectList children = parent->children();
foreach(auto obj, children)
{
if (auto wgt = qobject_cast<QWidget*>(obj))
{ // Проверяем имя объекта
if(wgt->objectName() == objName)
{
wgt->close(); // Закрываем виджет
}
closeAllChildWidgets(wgt, objName); // Рекурсия для возможных внучатых виджетов
}
}
}

View File

@@ -0,0 +1,16 @@
#ifndef WIDGETTOOLS_H
#define WIDGETTOOLS_H
#include <QWidget>
class WidgetTools
{
public:
WidgetTools();
public:
static void closeAllChildWidgets(QWidget* parent, QString objName);
};
#endif // WIDGETTOOLS_H

View File

@@ -87,6 +87,7 @@ target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../Instr
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/authorization) target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/authorization)
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/tasks) target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/tasks)
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/widgets) target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/widgets)
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/specialmessagebox)
if(PROJECT_TYPE_DEBUG) if(PROJECT_TYPE_DEBUG)
target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees) target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees)
else() else()

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);
} }
@@ -387,7 +393,7 @@ void ServerLMSWidget::startInitialization_step0()
Logger::instance().setLoggingType(LoggingType::WIDGET); Logger::instance().setLoggingType(LoggingType::WIDGET);
Logger::instance().setLogToFile(true); Logger::instance().setLogToFile(true);
connect(this,&ServerLMSWidget::sigUpdateControllerInitialize,updateController,&UpdateController::initialize/*,Qt::DirectConnection*/); connect(this,&ServerLMSWidget::sigUpdateControllerInitialize,updateController,&UpdateController::initialize,Qt::DirectConnection);
connect(updateController,&UpdateController::sigInitializeFinished, this,&ServerLMSWidget::slot_startInitialization_step1/*,Qt::DirectConnection*/); connect(updateController,&UpdateController::sigInitializeFinished, this,&ServerLMSWidget::slot_startInitialization_step1/*,Qt::DirectConnection*/);
connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection); connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection);
connect(updateController,&UpdateController::sigErrorRequired,this,&ServerLMSWidget::setError); connect(updateController,&UpdateController::sigErrorRequired,this,&ServerLMSWidget::setError);
@@ -479,4 +485,6 @@ void ServerLMSWidget::updateStateServer()
ui->btnStartServer->setEnabled(false); ui->btnStartServer->setEnabled(false);
} }
} }
ui->lblVersionText->setText(versionStr);
} }

View File

@@ -29,8 +29,7 @@
#include "docsupdater.h" #include "docsupdater.h"
#include "waitanimationwidget.h" #include "waitanimationwidget.h"
#include "specialmessagebox.h"
namespace Ui { namespace Ui {
@@ -109,6 +108,14 @@ public:
void setError(int code) void setError(int code)
{ {
if(code == 100)
{
QString textError = tr("No Client files found!") + "\n\n" +
tr("* check Application for the presence of a folder with a build \n"
"* check SharedData for a folder with the base version and the name base");
SpecMsgBox::CriticalClose(this, textError);
}
errorCode = code; errorCode = code;
} }
@@ -173,6 +180,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

@@ -38,3 +38,4 @@ target_link_libraries(TrayServerLMS PRIVATE libServerLMS.dll)
target_include_directories(TrayServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees) target_include_directories(TrayServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees)
target_include_directories(TrayServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/tasks) target_include_directories(TrayServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/tasks)
target_include_directories(TrayServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/widgets) target_include_directories(TrayServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/widgets)
target_include_directories(TrayServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/specialmessagebox)

View File

@@ -6,6 +6,6 @@ int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; MainWindow w;
w.show(); //По-умолчанию свернуто в трее w.show(); //Закоментировать, если нужно, чтобы по-умолчанию было свернуто в трее!
return a.exec(); return a.exec();
} }

View File

@@ -1,6 +1,8 @@
#include <QMessageBox> #include <QMessageBox>
#include <QTimer> #include <QTimer>
#include <QThread> #include <QThread>
#include <QMenu>
#include "specialmessagebox.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
@@ -16,18 +18,13 @@ 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->statusbar->setVisible(false);
serverLMSWidget = new ServerLMSWidget(this); serverLMSWidget = new ServerLMSWidget(this);
ui->verticalLayout_Main->addWidget(serverLMSWidget); ui->verticalLayout_Main->addWidget(serverLMSWidget);
connect(serverLMSWidget, &ServerLMSWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged); connect(serverLMSWidget, &ServerLMSWidget::signal_LanguageChanged, this, &MainWindow::slot_LanguageChanged);
connect(serverLMSWidget, &ServerLMSWidget::signal_Tray_ShowMessage, this, &MainWindow::slot_Tray_ShowMessage); connect(serverLMSWidget, &ServerLMSWidget::signal_Tray_ShowMessage, this, &MainWindow::slot_Tray_ShowMessage);
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_ShowWindow, this, &MainWindow::slot_TrayMenu_ShowWindow); connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_ShowWindow, this, &MainWindow::slot_TrayMenu_ShowWindow);
connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_HideWindow, this, &MainWindow::slot_TrayMenu_HideWindow); connect(serverLMSWidget, &ServerLMSWidget::signal_Menu_HideWindow, this, &MainWindow::slot_TrayMenu_HideWindow);
@@ -206,23 +203,9 @@ void MainWindow::errorCheck()
{ {
slot_TrayMenu_ShowWindow(); slot_TrayMenu_ShowWindow();
QMessageBox msgBox(this);
msgBox.setWindowTitle(tr("Error!"));
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(tr("No Client files found!"));
msgBox.setInformativeText(tr("* check Application for the presence of a folder with a build \n"
"* check SharedData for a folder with the base version and the name base"));
msgBox.setStandardButtons(QMessageBox::Close);
msgBox.show();
int ret = msgBox.exec();
if (ret == QMessageBox::Close)
{
//выключение с задержкой, так как eventLoop инициализируется позже //выключение с задержкой, так как eventLoop инициализируется позже
QTimer::singleShot(1000,this,&MainWindow::slot_TrayMenu_Exit); QTimer::singleShot(1000,this,&MainWindow::slot_TrayMenu_Exit);
} }
}
} }
void MainWindow::updateTrayTitles() void MainWindow::updateTrayTitles()

View File

@@ -53,6 +53,7 @@ public slots:
//Слот вывода сообщения из трея //Слот вывода сообщения из трея
void slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information); void slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information);
//Слот отложенной инициализации
void slot_LazyInitialization(); void slot_LazyInitialization();
private: private:
void exit(); void exit();

View File

@@ -34,24 +34,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1200</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</widget> </widget>
<resources> <resources>
<include location="TrayServerLMS.qrc"/> <include location="TrayServerLMS.qrc"/>