Files
qt5-legatus-legacy/Lts/Services/OcBaseDownload/pdf_download_socket.h
T
2026-08-13 18:33:10 +02:00

45 lines
858 B
C++
Executable File

/**
* @RDE_HEADER@
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Fritsche, NLE, 2019-04-30
*/
#pragma once
#include "logger.h"
#include <QObject>
#include <QTcpSocket>
#include <QString>
class QTimer;
namespace OcBaseDownload
{
class PdfDownloadSocket : public QObject
{
Q_OBJECT
public:
explicit PdfDownloadSocket(const QString &hostName, QObject *parent);
~PdfDownloadSocket();
void downloadFromHost(const int fileId, const qint64 fileSize);
bool isConnected() const;
void close() { m_socket->close(); }
signals:
void downloadFinished(const QByteArray &data);
private slots:
void readyRead();
void connected();
void onReadTimeout();
private:
QTcpSocket *m_socket;
QTimer *m_readTimeout;
int m_sizeToDownload;
QByteArray m_downloadedData;
NGL::INGLLogger &m_logger;
};
}