Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
103 lines
2.7 KiB
C++
103 lines
2.7 KiB
C++
/**
|
|
* @RDE_HEADER@
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hannes Fritsche, NLE, 2019-04-30
|
|
*/
|
|
|
|
#include "pdf_download_socket.h"
|
|
|
|
#include <nglsettings/nglsettings_connections.h>
|
|
#include <nglsettings/nglsettings_settings.h>
|
|
|
|
#include <QTimer>
|
|
|
|
namespace OcBaseDownload
|
|
{
|
|
PdfDownloadSocket::PdfDownloadSocket(const QString &hostName, QObject *parent)
|
|
: QObject(parent)
|
|
, m_socket(new QTcpSocket(this))
|
|
, m_readTimeout(new QTimer(this))
|
|
, m_sizeToDownload(0)
|
|
, m_logger(getLogger("PdfDownloadSocket"))
|
|
{
|
|
DEBUG_LOG(m_logger) << "PdfDownloadSocket::PdfDownloadSocket";
|
|
connect(m_socket, &QTcpSocket::connected, this, &PdfDownloadSocket::connected);
|
|
connect(m_socket, &QTcpSocket::readyRead, this, &PdfDownloadSocket::readyRead);
|
|
unsigned short port = NGL::Connections::port(NGL::Connections::eConnection::FLM_PDF_SERVER);
|
|
m_socket->connectToHost(hostName, port);
|
|
m_socket->waitForConnected();
|
|
|
|
DEBUG_LOG(m_logger) << "hostname " << hostName << " port " << port;
|
|
|
|
m_readTimeout->setInterval(10000);
|
|
m_readTimeout->setSingleShot(false);
|
|
connect(m_readTimeout, &QTimer::timeout, this, &PdfDownloadSocket::onReadTimeout);
|
|
}
|
|
|
|
PdfDownloadSocket::~PdfDownloadSocket()
|
|
{
|
|
DEBUG_LOG(m_logger) << "~PdfDownloadSocket";
|
|
m_socket->close();
|
|
}
|
|
|
|
void PdfDownloadSocket::readyRead()
|
|
{
|
|
DEBUG_LOG(m_logger) << "reading...";
|
|
m_readTimeout->stop();
|
|
|
|
m_downloadedData.append(m_socket->readAll());
|
|
|
|
DEBUG_LOG(m_logger) << m_downloadedData.size() << " of " << m_sizeToDownload << " bytes downloaded";
|
|
|
|
if (m_downloadedData.size() >= m_sizeToDownload)
|
|
{
|
|
m_sizeToDownload = 0;
|
|
DEBUG_LOG(m_logger) << "Download finished";
|
|
emit downloadFinished(m_downloadedData);
|
|
}
|
|
else
|
|
m_readTimeout->start();
|
|
}
|
|
|
|
void PdfDownloadSocket::connected()
|
|
{
|
|
DEBUG_LOG(m_logger) << "connected...";
|
|
}
|
|
|
|
void PdfDownloadSocket::onReadTimeout()
|
|
{
|
|
//check for filesize
|
|
m_readTimeout->stop();
|
|
DEBUG_LOG(m_logger) << "TimerEnd" << m_downloadedData.size() << " expected " << m_sizeToDownload;
|
|
|
|
if (m_downloadedData.size() < m_sizeToDownload)
|
|
WARNING_LOG(m_logger) << "not enough data: got " << m_downloadedData.size() << " expected " << m_sizeToDownload;
|
|
|
|
emit downloadFinished(m_downloadedData);
|
|
}
|
|
|
|
void PdfDownloadSocket::downloadFromHost(const int fileId, const qint64 fileSize)
|
|
{
|
|
m_sizeToDownload = fileSize;
|
|
m_downloadedData = QByteArray();
|
|
|
|
QByteArray cmd;
|
|
cmd += QByteArray("PDF_DOWNLOAD ");
|
|
cmd += QByteArray::number(fileId);
|
|
cmd += "\n";
|
|
m_socket->readAll();
|
|
|
|
int writeHeaderSize = m_socket->write(cmd);
|
|
DEBUG_LOG(m_logger) << "writeHeaderSize = " << writeHeaderSize;
|
|
m_readTimeout->start();
|
|
}
|
|
|
|
bool PdfDownloadSocket::isConnected() const
|
|
{
|
|
return m_socket->state() == QAbstractSocket::ConnectedState;
|
|
}
|
|
|
|
}
|