Files
qt-migration-legatus/qt5-before/dlbo/TetraIF/PrtCnv/PrtCnvMain.cpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
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>
2026-09-15 18:20:26 +00:00

131 lines
3.2 KiB
C++

// **************************************************************************
//
// (C) Copyright 2009 Swiss SIMTEC AG
//
// **************************************************************************
//
// $HeadURL$
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
//
// **************************************************************************
/*!
*
* \page Tetra-Interface Tetra-Interface
*
* This component is needed to communicate between the Server software and the players in
* the field via Tetra. It's an extra component due to historical reasons only.
*
*/
#include "PrtCnvApplication.hpp"
#include <NGLLogger/INGLLogger.h>
#include <nglapplication/nglcoreapplication.h>
#include <LtsCommandLineParser/LtsCommandLineParser.h>
#include <QNetworkProxy>
#ifndef WIN32
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#endif
// ---------------------------------------------------------------
// Become a daemon
// ---------------------------------------------------------------
static void daemonize()
{
#ifndef WIN32
pid_t pid, sid;
/* already a daemon */
if ( getppid() == 1 )
return;
/* Fork off the parent process */
pid = fork();
if (pid < 0) {
exit(EXIT_FAILURE);
}
/* If we got a good PID, then we can exit the parent process. */
if (pid > 0) {
exit(EXIT_SUCCESS);
}
/* At this point we are executing as the child process */
/* Change the file mode mask */
umask(0);
/* Create a new SID for the child process */
sid = setsid();
if (sid < 0) {
exit(EXIT_FAILURE);
}
/* Change the current working directory. This prevents the current
directory from being locked; hence not being able to remove it. */
if ((chdir("/")) < 0) {
exit(EXIT_FAILURE);
}
/* Redirect standard files to /dev/null */
freopen( "/dev/null", "r", stdin);
freopen( "/dev/null", "w", stdout);
freopen( "/dev/null", "w", stderr);
#endif
}
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
{
public:
CmdLineParser()
: LtsCommandLineParser(ProvideCommandLineParameterOptions(ExerciseId|CustomConfigFile))
{
addOption( { QStringList() << QStringLiteral("d") << QStringLiteral("daemonize"),
QStringLiteral("Start in background") } );
addOption( { QStringList() << QStringLiteral("c") << QStringLiteral("cleandb"),
QStringLiteral("Start over with clean database") } );
}
bool daemonize() const
{
return isSet(QStringLiteral("d"));
}
bool cleanDb() const
{
return isSet(QStringLiteral("c"));
}
};
int main(int argc, char** argv)
{
QNetworkProxy::setApplicationProxy(QNetworkProxy());
NGLCoreApplication app(argc, argv);
CmdLineParser options;
if (!options.init())
return -1;
app.createLogger("PrtCnv", options.exerciseId());
if (options.daemonize())
daemonize();
PrtCnv::PrtCnvApplication prtCnvApp;
prtCnvApp.setCleanDb(options.cleanDb());
prtCnvApp.setExerciseId(options.exerciseId());
if (options.iniFileSet())
prtCnvApp.setConfigFile(options.iniFile());
STARTUP_LOG(app.baseLogger());
prtCnvApp.startApp();
int ret = app.exec();
prtCnvApp.shutdownApp();
SHUTDOWN_LOG(app.baseLogger());
return ret;
}