Files
RRJServer/LibServer/serverlmswidget.h
2026-01-26 18:47:57 +03:00

199 lines
4.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef SERVERLMSWIDGET_H
#define SERVERLMSWIDGET_H
#include "ServerLMS_global.h"
#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QXmlStreamWriter>
#include <QMap>
#include <QTranslator>
#include <QMutex>
#include <QSystemTrayIcon>
#include <Systems/Parsers/dataparser.h>
#include <Systems/sendsystem.h>
#include <Systems/processingsystem.h>
#include <Systems/updatecontroller.h>
#include <Systems/assetsmanager.h>
#include <Systems/recognizesystem.h>
#include <Systems/logger.h>
#include <Systems/commonclienthandler.h>
#include <Systems/assetsmanager.h>
#include <Data/typesDataServerClient.h>
#include <Data/Client.h>
#include "multithreadserver.h"
#include "providerdblms.h"
#include "docsupdater.h"
#include "waitanimationwidget.h"
#include "specialmessagebox.h"
#include "cficontroller.h"
namespace Ui {
class ServerLMSWidget;
}
class DataParser;
class SendSystem;
class ProcessingSystem;
class Logger;
class UpdateController;
class RecognizeSystem;
class ClientHandler;
class MultiThreadServer;
class AssetsManager;
class ChatSystem;
class DocsUpdater;
class CfiController;
class SERVERLMS_EXPORT ServerLMSWidget : public QWidget
{
Q_OBJECT
public:
explicit ServerLMSWidget(QWidget *parent = nullptr);
~ServerLMSWidget();
void start();
public:
static const QString languageENG;
static const QString languageRUS;
protected:
// Метод получения событий
// В нём будет производиться проверка события смены перевода приложения
void changeEvent(QEvent * event) override;
void resizeEvent(QResizeEvent *event) override;
signals:
//сигнал смены языка
void signal_LanguageChanged(QString language);
//сигнал вывода сообщения из трея
void signal_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information);
void signal_Menu_ShowWindow();
void signal_Menu_HideWindow();
void sigRecognize();
void sigCalculateFullHash();
void sigUpdateControllerInitialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
void signal_DocsChanged();
void signal_hasError(int code);
void signal_updateStateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
public slots:
void slot_LanguageChanged(QString language);
void slot_UpdateListClients();
void slot_BlockAutorizationIndicate(bool block, QString blocker, QString types);
void slot_AddMessageToLog(QString message);
void slot_ErrorPostgreSQL(QString text);
void slot_UpdateDocs();
void slot_ParsingCfiXML();
void slot_startInitialization_step1();
void slot_setVersion(QString versionStr);
public:
QString getLanguage()
{
return language;
}
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;
emit signal_hasError(code);
}
int hasError() const
{
return errorCode;
}
ProcessingSystem* getProcessingSystem()
{
return processingSystem;
}
QMutex *getMutex() const
{
return mutex;
}
void removeClient(int socketId);
private slots:
void on_btnStartServer_clicked();
void on_btnStopServer_clicked();
void on_btnSettings_clicked();
private:
void setLanguageInterfase();
void updateMyStyleSheet();
QString loadStyleSheet();
void startInitialization_step0();
void tryConnectionToDB();
void updateStateOnlyServer();
void updateStateOnlyDB();
void updateStateOnlyVersion();
private:
Ui::ServerLMSWidget *ui;
private:
WaitAnimationWidget *waitAnimationWidget;
MultiThreadServer *server;
QThread *updateThread;
QThread *loggerThread;
QMutex *mutex;
DataParser *dataParser;
ProcessingSystem *processingSystem;
UpdateController *updateController;
AssetsManager *assetsManager;
CommonClientHandler *commonClientHandler;
ChatSystem *chatSystem;
DocsUpdater* docsUpdater;
CfiController* cfiController;
ProviderDBLMS* providerDBLMS;
bool first = true; // для тестов Unity
QTranslator qtLanguageTranslator;
QString language;
int errorCode;
QString versionStr;
bool flStartInitialization;
};
#endif // SERVERLMSWIDGET_H