mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
214 lines
5.5 KiB
C++
214 lines
5.5 KiB
C++
#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:
|
|
static const QString languageENG;
|
|
static const QString languageRUS;
|
|
|
|
public:
|
|
explicit ServerLMSWidget(QWidget *parent = nullptr);
|
|
~ServerLMSWidget();
|
|
|
|
public:
|
|
void start();
|
|
|
|
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);
|
|
|
|
void signal_updateDocsXML();
|
|
|
|
void signal_InitializeFinished();
|
|
|
|
void signal_TryConnectionToDB();
|
|
void signal_TryDisConnectionFromDB();
|
|
|
|
void signal_StartServer();
|
|
void signal_StopServer();
|
|
|
|
public slots:
|
|
void slot_LanguageChanged(QString language);
|
|
void slot_UpdateListClients(QStringList listFullName);
|
|
void slot_BlockAutorizationIndicate(bool block, QString blocker, QString types);
|
|
void slot_AddMessageToLog(QString message);
|
|
|
|
void slot_ErrorPostgreSQL(QString text);
|
|
void slot_StateConnectionToDB(bool dbIsConnected, DataBaseSettings dbSettings);
|
|
void slot_StateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
|
|
|
|
void slot_UpdateDocs();
|
|
|
|
void slot_UpdateControllerInitializeFinished();
|
|
|
|
void slot_StateVersionMaterials(QString stateVersionMaterials);
|
|
|
|
void slot_ResultTryConnectDb(bool result);
|
|
void slot_ResultTryDisConnectDb(bool result);
|
|
|
|
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;
|
|
}
|
|
|
|
void removeClient(int socketId);
|
|
|
|
private slots:
|
|
void on_btnStartServer_clicked();
|
|
void on_btnStopServer_clicked();
|
|
void on_btnSettings_clicked();
|
|
|
|
private:
|
|
void updateMyStyleSheet();
|
|
QString loadStyleSheet();
|
|
void initLanguageInterfase();
|
|
|
|
private:
|
|
void updateStateOnlyServer();
|
|
void updateStateOnlyDB();
|
|
void updateStateOnlyVersionMaterials();
|
|
|
|
private:
|
|
void startInitialization_step0();
|
|
void startInitialization_step1();
|
|
void tryConnectionToDB();
|
|
|
|
private:
|
|
Ui::ServerLMSWidget *ui;
|
|
|
|
private:
|
|
WaitAnimationWidget *waitAnimationWidget;
|
|
|
|
QThread *updateThread;
|
|
QThread *loggerThread;
|
|
QThread *serverThread;
|
|
|
|
MultiThreadServer *server; //serverThread
|
|
DataParser *dataParser; //serverThread
|
|
ProcessingSystem *processingSystem; //serverThread
|
|
CommonClientHandler *commonClientHandler; //serverThread
|
|
ChatSystem *chatSystem; //serverThread
|
|
ProviderDBLMS* providerDBLMS; //serverThread
|
|
|
|
UpdateController *updateController; //updateThread
|
|
AssetsManager *assetsManager; //updateThread
|
|
DocsUpdater* docsUpdater; //updateThread
|
|
CfiController* cfiController; //updateThread
|
|
|
|
bool first; // для тестов Unity
|
|
|
|
QTranslator qtLanguageTranslator;
|
|
QString language;
|
|
|
|
int errorCode;
|
|
|
|
QString stateVersionMaterials;
|
|
bool dbIsConnected;
|
|
DataBaseSettings dbSettings;
|
|
EStateServer stateServer;
|
|
EStateBlockAutorization stateBlockAutorization;
|
|
|
|
bool flStartInitialization;
|
|
bool flTryConnectionToDB;
|
|
bool flNeedReconnectDB;
|
|
};
|
|
|
|
#endif // SERVERLMSWIDGET_H
|