mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
* refactoring call update after update from client * refactoring common client deAuth * add packet for notify hash calculate start * bugfix update static data
138 lines
3.1 KiB
C++
138 lines
3.1 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 <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 <Data/typesDataServerClient.h>
|
||
#include <Data/Client.h>
|
||
#include "multithreadserver.h"
|
||
#include "providerdblms.h"
|
||
|
||
namespace Ui {
|
||
class ServerLMSWidget;
|
||
}
|
||
|
||
class DataParser;
|
||
class SendSystem;
|
||
class ProcessingSystem;
|
||
class Logger;
|
||
class UpdateController;
|
||
class RecognizeSystem;
|
||
class ClientHandler;
|
||
class MultiThreadServer;
|
||
class AssetsManager;
|
||
|
||
class SERVERLMS_EXPORT ServerLMSWidget : public QWidget
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit ServerLMSWidget(QWidget *parent = nullptr);
|
||
~ServerLMSWidget();
|
||
|
||
void setError(int code);
|
||
|
||
protected:
|
||
// Метод получения событий
|
||
// В нём будет производиться проверка события смены перевода приложения
|
||
void changeEvent(QEvent * event) override;
|
||
|
||
signals:
|
||
void sigRecognize();
|
||
void sigLog(QString log);
|
||
void sigCalculateFullHash();
|
||
void sigUpdateController(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager,Logger *logger);
|
||
|
||
QTcpSocket* sigGetSocket();
|
||
|
||
public slots:
|
||
void slot_LanguageChanged(QString language);
|
||
void addClient(qintptr descriptor, ClientHandler *client);
|
||
void slotUpdateListClients();
|
||
void slot_BlockAutorization(bool block);
|
||
void slotAddToLog(QString msg);
|
||
|
||
public:
|
||
void removeClient(int socketId);
|
||
|
||
void blockAutorization()
|
||
{
|
||
stateBlockAutorization = blocked;
|
||
}
|
||
void unBlockAutorization()
|
||
{
|
||
stateBlockAutorization = unblocked;
|
||
}
|
||
int hasError() const
|
||
{
|
||
return errorCode;
|
||
}
|
||
EStateBlockAutorization getStateBlockAutorization() const
|
||
{
|
||
return stateBlockAutorization;
|
||
}
|
||
|
||
ProcessingSystem* getProcessingSystem()
|
||
{
|
||
return processingSystem;
|
||
}
|
||
|
||
QMap<int, ClientHandler *> getClientsMap() const;
|
||
|
||
Logger *getLogger() const;
|
||
|
||
private slots:
|
||
void on_btnStartServer_clicked();
|
||
void on_btnStopServer_clicked();
|
||
|
||
private:
|
||
bool startServer();
|
||
bool stopServer();
|
||
|
||
private:
|
||
Ui::ServerLMSWidget *ui;
|
||
|
||
private:
|
||
MultiThreadServer * tcpServer;
|
||
qint16 hostPort;
|
||
QMap<int, ClientHandler*> clientsMap;
|
||
EStateServer stateServer;
|
||
EStateBlockAutorization stateBlockAutorization;
|
||
|
||
QThread *updateThread;
|
||
QThread *loggerThread;
|
||
|
||
DataParser *dataParser;
|
||
ProcessingSystem *processingSystem;
|
||
UpdateController *updateController;
|
||
AssetsManager *assetsManager;
|
||
Logger *logger;
|
||
CommonClientHandler *commonClientHandler;
|
||
|
||
ProviderDBLMS* providerDBLMS;
|
||
|
||
bool first = true; // для тестов Unity
|
||
|
||
QTranslator qtLanguageTranslator;
|
||
int errorCode;
|
||
};
|
||
|
||
#endif // SERVERLMSWIDGET_H
|