refract Server 0

This commit is contained in:
2026-02-06 14:47:20 +03:00
parent 8ab4238537
commit 4b98d00faf
17 changed files with 549 additions and 333 deletions

View File

@@ -1,27 +1,26 @@
#ifndef MULTITHREADSERVER_H
#define MULTITHREADSERVER_H
#include "serverlmswidget.h"
#include "Systems/processingsystem.h"
#include <QObject>
class ProcessingSystem;
class DocsUpdater;
class MultiThreadServer : public QTcpServer
{
Q_OBJECT
public:
MultiThreadServer(ServerLMSWidget *widget,UpdateController *updateController,ProcessingSystem *processingSystem,
MultiThreadServer(UpdateController *updateController, DocsUpdater *docsUpdater,ProcessingSystem *processingSystem,
DataParser *dataParser, qint16 hostPort, QObject *parent = nullptr);
~MultiThreadServer();
QMap<int, ClientHandler *> *getClientsMap() const;
QStringList getClientFullNameList();
void updateClientList();
void disableClients();
bool startServer();
bool stopServer();
EStateBlockAutorization getStateBlockAutorization() const
{
return stateBlockAutorization;
@@ -30,38 +29,60 @@ public:
{
return stateServer;
}
QMutex *getMutex() const
{
return mutex;
}
private:
bool startServer();
bool stopServer();
void blockAutorization()
{
stateBlockAutorization = blocked;
emit signal_StateServer(stateServer, stateBlockAutorization);
}
void unBlockAutorization()
{
stateBlockAutorization = unblocked;
emit signal_StateServer(stateServer, stateBlockAutorization);
}
signals:
void sigInitClient(int descriptor, ServerLMSWidget *serverWidget,
UpdateController *updateController, DataParser *dataParser);
//void sigInitClient(int descriptor, ServerLMSWidget *serverWidget,
// UpdateController *updateController, DataParser *dataParser, QMutex *mutex);
void signalStopSendFile();
void signal_BlockAutorizationIndicate(bool block, QString blocker, QString types);
void signal_sendPacketToAllClients(PacketType packetType, bool flOnlyGUI);
void signal_StateServer(EStateServer stateServer, EStateBlockAutorization stateBlockAutorization);
void signal_UpdateListClients(QStringList listFullName);
void signal_updateDocsXML();
public slots:
void slotDisconnectClient(QString peerAddress, QString peerPort);
bool slot_BlockAutorization(bool block, QString whoFullName, QString type);
void slot_StartServer();
void slot_StopServer();
void slot_UpdateDocs();
protected:
void incomingConnection(qintptr handle) override;
private:
ServerLMSWidget *serverLmsWidget;
QMutex *mutex;
QMap<int, ClientHandler*> *clientsMap;
qint16 hostPort;
ProcessingSystem *processingSystem;
UpdateController *updateController;
DocsUpdater *docsUpdater;
DataParser *dataParser;
EStateServer stateServer;