Files
RRJServer/ServerLMS/ServerLMS/Systems/sendsystem.h
2025-01-13 14:22:52 +03:00

70 lines
1.7 KiB
C++

#ifndef SENDSYSTEM_H
#define SENDSYSTEM_H
#include <QObject>
#include <QString>
#include <QtNetwork>
#include <Systems/dataparser.h>
#include <Systems/tools.h>
#include <Data/Client.h>
#include <Data/PacketType.h>
class DataParser;
class FileData;
class SendSystem : public QObject
{
Q_OBJECT
public:
explicit SendSystem(QObject* parent = nullptr);
void initialize(DataParser* dataParser,Logger *logger);
void setClient(Client* client,QTcpSocket *socket);
void sendMessageBlock(QString message);
void sendFileBlock(QString path);
void sendFileBlockWithRename(QString path,QString newName);
void sendFolderBlock(QString path);
void sendDeleteBlock(QString path);
void sendPacketType(PacketType packet);
void sendHello();
void sendNotify(QString notify);
void sendStop();
void sendXmlAnswer(QByteArray array, PacketType packetType = PacketType::TYPE_XMLANSWER);
void sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount);
void updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList);
bool socketFlush();
bool getIsSendStopped() const;
~SendSystem();
public slots:
void socketWrite(QByteArray array);
void socketClose();
void sendVersion();
signals:
void sigLoadHash();
void sigSendToLogger(QString message);
QByteArray sigSendXMLmessage(QString message, QString login = "");
QByteArray sigSendNotify(QString message);
QByteArray sigSendVersion();
private:
Client *client;
QTcpSocket* socket;
DataParser* dataParser;
Logger *logger;
QMutex *mutex;
quint64 fileSize;
int countSend;
bool isSendStopped;
bool isUnity;
};
#endif // SENDSYSTEM_H