Files
RRJServer/LibServer/Systems/sendsystem.h
2026-02-19 12:26:46 +03:00

82 lines
1.9 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 SENDSYSTEM_H
#define SENDSYSTEM_H
#include <QObject>
#include <QString>
#include <QtNetwork>
#include <QMutex>
#include <Systems/Parsers/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);
~SendSystem();
void initialize(DataParser* dataParser,QMutex *globalMutex);
void setClient(Client* client,QTcpSocket *socket);
void updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList);
private:
bool waitWrittenData(QString marker, int msec = 500);
public slots:
void slot_BytesWrittenToSocket(qint64 bytes);
bool slot_getIsSendingStopped() const;
void slot_stopSending();
void slot_socketClose();
void slot_sendVersion();
void slot_sendNotify(QString notify);
void slot_sendPacketType(PacketType packet);
void slot_sendXmlAnswer(QByteArray array, PacketType packetType = PacketType::TYPE_XMLANSWER);
void slot_sendDocs(QString docPath);
void slot_sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount);
void slot_sendFolderBlock(QString path);
void slot_sendDeleteBlock(QString path);
void slot_sendFileBlock(QString path);
void slot_sendFileBlock_V3(QString path);
void slot_sendFileBlockByteArray(QByteArray array, PacketType packetType);
void slot_sendFileBlockWithRename(QString path,QString newName);
signals:
QByteArray sigSendNotify(QString message);
private:
Client *client;
QTcpSocket* socket;
DataParser* dataParser;
QMutex *globalMutex; //Не используется (но пока оставлен)
char* buffer;
TypeClientAutorization type;
bool flSendingStopped;
bool flWaitWritenToSocket;
qint64 bytesWritedToSocket;
qint64 fileSize;
int countSend;
};
#endif // SENDSYSTEM_H