This commit is contained in:
2026-02-10 16:28:28 +03:00
parent 2cce331a67
commit ed7de8af4e
35 changed files with 418 additions and 358 deletions

View File

@@ -7,12 +7,13 @@ SendSystem::SendSystem(QObject *parent) : QObject(parent)
void SendSystem::initialize(DataParser *dataParser,QMutex *globalMutex)
{
this->dataParser = dataParser;
connect(this,&SendSystem::sigSendXMLmessage,dataParser->ClientAnswer(),&ClientAnswerParser::message,Qt::AutoConnection);
connect(this,&SendSystem::sigSendNotify,dataParser->ClientAnswer(),&ClientAnswerParser::notify,Qt::DirectConnection); //потому что возвращает значение
connect(this,&SendSystem::sigSendVersion,dataParser->ClientAnswer(),&ClientAnswerParser::currentVersion,Qt::AutoConnection);
qDebug() << "SendSystem::initialize thread ID " << QThread::currentThreadId();
this->dataParser = dataParser;
//connect(this,&SendSystem::sigSendXMLmessage,dataParser->ClientAnswer(),&ClientAnswerParser::message,Qt::AutoConnection); //сигнал не используется
connect(this,&SendSystem::sigSendNotify,dataParser->ClientAnswer(),&ClientAnswerParser::notify,Qt::DirectConnection); //потому что возвращает значение
//connect(this,&SendSystem::sigSendVersion,dataParser->ClientAnswer(),&ClientAnswerParser::currentVersion,Qt::AutoConnection); //сигнал не используется
qDebug() << "SendSystem thread: " << QThread::currentThreadId();
mutex = globalMutex;
}
@@ -26,7 +27,8 @@ void SendSystem::setClient(Client *client,QTcpSocket *socket)
void SendSystem::sendNotify(QString notify)
{
qDebug() << "SendNotify thread: " << QThread::currentThreadId();
qDebug() << "SendSystem::sendNotify thread ID " << QThread::currentThreadId();
auto answer = emit sigSendNotify(notify);
sendXmlAnswer(answer);
}
@@ -140,7 +142,7 @@ void SendSystem::sendVersion()
void SendSystem::sendFileBlockWithRename(QString path, QString newName)
{
qDebug() << "sendFileBlockWithRename thread: " << QThread::currentThreadId();
qDebug() << "SendSystem::sendFileBlockWithRename thread ID " << QThread::currentThreadId();
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
@@ -232,7 +234,8 @@ void SendSystem::sendPacketType(PacketType packetType)
void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
{
qDebug() << "SendSystemThread: " << QThread::currentThreadId();
qDebug() << "SendSystem::sendXmlAnswer thread ID " << QThread::currentThreadId();
Logger::instance().log("SEND TO: "+ client->getLogin() + " " + enumToString(packetType) + "\n Text: " +
QString(array),LogLevel::DEBUG);
@@ -315,11 +318,6 @@ void SendSystem::socketClose()
socket->close();
}
bool SendSystem::socketFlush() //TODO: проверить использование
{
return socket->flush();
}
void SendSystem::sendStop()
{
isSendStopped = true;