Formats minimally release source files based on former clang-format

This commit is contained in:
torsten committed 2026-10-14 13:28:01 +00:00
1 parent b662e4daf9
commit 5644914fe3
387 files changed
+37323 -38074

No files matched your search

@@ -21,211 +21,199 @@ namespace TetraRadio
{
std::shared_ptr<TrainingAreaBase::Plugin::Interface> TetraJsonPlugin::createInterface(TrainingAreaBase::Plugin::DataProvider *pdp,
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
const std::shared_ptr<TrainingAreaBase::TxMixin> &,
const std::shared_ptr<TrainingAreaBase::DdsHandler> &,
NGL::Settings *settings)
{
return std::make_shared<TetraJsonInterfaceImpl>(pdp, recvFromTabCb, settings);
}
TetraJsonInterfaceImpl::TetraJsonInterfaceImpl(TrainingAreaBase::Plugin::DataProvider *pdp,
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
NGL::Settings *settings)
: m_logger(N_LogView::getLogger("TAB.Plugin.TetraJsonInterfaceImpl"))
, m_socketDispatcher(new SocketDispatcher(pdp, recvFromTabCb))
, m_pdp(pdp)
, m_prtCnvApp(nullptr)
, m_exerciseId(0)
, m_radioGrpId(0)
{
Q_UNUSED(settings);
N_CoPrtCnv::CoPrtCnvTelegramConverter::setUse2BytesForSingleFireDiameter(
settings->settings()->value(QLatin1String("AES/use2BytesForSingleFireDiameter"), true).toBool());
N_CoPrtCnv::CoPrtCnvTelegramConverter::setUsePvSan(
settings->settings()->value(QLatin1String("TrainingAreaBase/UsePvSan"), false).toBool());
ERROR_LOG(m_logger) << "hello i got this!";
}
TetraJsonInterfaceImpl::~TetraJsonInterfaceImpl()
{
cleanupProcess();
}
bool TetraJsonInterfaceImpl::init()
{
m_exerciseId = m_pdp->exerciseId();
NOTICE_LOG(m_logger) << "Our exercise id is " << m_exerciseId;
if (m_exerciseId == 0)
if (!checkConfigTemplates())
return false;
return updatePrtCnv();
}
void TetraJsonInterfaceImpl::exerciseChanged()
{
NOTICE_LOG(m_logger) << "TetraJsonInterfaceImpl::exerciseChanged";
if (m_pdp->exerciseRadioGroup().id() != m_radioGrpId)
if (!updatePrtCnv())
ERROR_LOG(m_logger) << "Error changing PrtCnv state from radio grp id: "
<< m_radioGrpId
<< " to " << m_pdp->exerciseRadioGroup().id();
}
bool TetraJsonInterfaceImpl::updatePrtCnv()
{
int newRadioGrpId = m_pdp->exerciseRadioGroup().id();
if (newRadioGrpId == m_radioGrpId)
std::shared_ptr<TrainingAreaBase::Plugin::Interface> TetraJsonPlugin::createInterface(TrainingAreaBase::Plugin::DataProvider *pdp,
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
const std::shared_ptr<TrainingAreaBase::TxMixin> &,
const std::shared_ptr<TrainingAreaBase::DdsHandler> &,
NGL::Settings *settings)
{
NOTICE_LOG(m_logger) << "No need to update PrtCnv configuration - radio group did not change: " << m_radioGrpId;
return std::make_shared<TetraJsonInterfaceImpl>(pdp, recvFromTabCb, settings);
}
TetraJsonInterfaceImpl::TetraJsonInterfaceImpl(TrainingAreaBase::Plugin::DataProvider *pdp,
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &recvFromTabCb,
NGL::Settings *settings)
: m_logger(N_LogView::getLogger("TAB.Plugin.TetraJsonInterfaceImpl"))
, m_socketDispatcher(new SocketDispatcher(pdp, recvFromTabCb))
, m_pdp(pdp)
, m_prtCnvApp(nullptr)
, m_exerciseId(0)
, m_radioGrpId(0)
{
Q_UNUSED(settings);
N_CoPrtCnv::CoPrtCnvTelegramConverter::setUse2BytesForSingleFireDiameter(
settings->settings()->value(QLatin1String("AES/use2BytesForSingleFireDiameter"), true).toBool());
N_CoPrtCnv::CoPrtCnvTelegramConverter::setUsePvSan(settings->settings()->value(QLatin1String("TrainingAreaBase/UsePvSan"), false).toBool());
ERROR_LOG(m_logger) << "hello i got this!";
}
TetraJsonInterfaceImpl::~TetraJsonInterfaceImpl()
{
cleanupProcess();
}
bool TetraJsonInterfaceImpl::init()
{
m_exerciseId = m_pdp->exerciseId();
NOTICE_LOG(m_logger) << "Our exercise id is " << m_exerciseId;
if (m_exerciseId == 0)
if (!checkConfigTemplates())
return false;
return updatePrtCnv();
}
void TetraJsonInterfaceImpl::exerciseChanged()
{
NOTICE_LOG(m_logger) << "TetraJsonInterfaceImpl::exerciseChanged";
if (m_pdp->exerciseRadioGroup().id() != m_radioGrpId)
if (!updatePrtCnv())
ERROR_LOG(m_logger) << "Error changing PrtCnv state from radio grp id: " << m_radioGrpId << " to " << m_pdp->exerciseRadioGroup().id();
}
bool TetraJsonInterfaceImpl::updatePrtCnv()
{
int newRadioGrpId = m_pdp->exerciseRadioGroup().id();
if (newRadioGrpId == m_radioGrpId)
{
NOTICE_LOG(m_logger) << "No need to update PrtCnv configuration - radio group did not change: " << m_radioGrpId;
return true;
}
NOTICE_LOG(m_logger) << "Our radio group id is " << newRadioGrpId;
if (newRadioGrpId > 0)
{
QFile::remove(iniFileOut());
if (!QFile::copy(iniFileIn(), iniFileOut()))
{
ERROR_LOG(m_logger) << "Error creating ini file for PrtCnv: " << iniFileOut();
return false;
}
ProjectDataManagement::RadioGroup radioGrp = m_pdp->exerciseRadioGroup();
Q_UNUSED(radioGrp);
{
QSettings s(iniFileOut(), QSettings::IniFormat);
s.setValue(QStringLiteral("Common/LogTelegramPath"), QStringLiteral("logdata/ex_%1").arg(m_exerciseId));
s.setValue(QStringLiteral("Common/LogTelegramPrefix"), QStringLiteral("PrtCnv_ex_%1").arg(m_exerciseId));
s.setValue(QStringLiteral("Central/HostName"), QStringLiteral("directConnection"));
// RadioGroup API simplified - radio configuration members removed
s.setValue(QStringLiteral("Radio/UseScrambling"), m_pdp->useTetraScrambling() ? 1 : 0);
s.setValue(QStringLiteral("Injection/Port"), m_socketDispatcher->randomListenPort());
NOTICE_LOG(m_logger) << "TetraJson Injection/Port = " << s.value(QStringLiteral("Injection/Port")).toInt();
s.sync();
}
if (!startPrtCnv())
return false;
}
else
cleanupProcess();
m_radioGrpId = newRadioGrpId;
return true;
}
NOTICE_LOG(m_logger) << "Our radio group id is " << newRadioGrpId;
if (newRadioGrpId > 0)
bool TetraJsonInterfaceImpl::checkConfigTemplates()
{
QFile::remove(iniFileOut());
if (!QFile::copy(iniFileIn(), iniFileOut()))
if (!QFile::exists(iniFileIn()))
{
ERROR_LOG(m_logger) << "Error creating ini file for PrtCnv: " << iniFileOut();
return false;
INFO_LOG(m_logger) << "Creating " << iniFileIn();
if (!QFile::copy(QStringLiteral(":/PrtCnv.dat"), iniFileIn()))
{
ERROR_LOG(m_logger) << "Error creating " << iniFileIn();
return false;
}
else
QFile(iniFileIn()).setPermissions(QFile::ReadOwner | QFile::ReadGroup | QFile::ReadOther | QFile::WriteOwner);
}
ProjectDataManagement::RadioGroup radioGrp = m_pdp->exerciseRadioGroup();
Q_UNUSED(radioGrp);
if (!QFile::exists(playerIdsFile()))
{
QSettings s(iniFileOut(), QSettings::IniFormat);
s.setValue(QStringLiteral("Common/LogTelegramPath"), QStringLiteral("logdata/ex_%1").arg(m_exerciseId));
s.setValue(QStringLiteral("Common/LogTelegramPrefix"), QStringLiteral("PrtCnv_ex_%1").arg(m_exerciseId));
s.setValue(QStringLiteral("Central/HostName"), QStringLiteral("directConnection"));
// RadioGroup API simplified - radio configuration members removed
s.setValue(QStringLiteral("Radio/UseScrambling"), m_pdp->useTetraScrambling() ? 1 : 0);
s.setValue(QStringLiteral("Injection/Port"), m_socketDispatcher->randomListenPort());
NOTICE_LOG(m_logger) << "TetraJson Injection/Port = " << s.value(QStringLiteral("Injection/Port")).toInt();
s.sync();
INFO_LOG(m_logger) << "Creating " << playerIdsFile();
if (!QFile::copy(QStringLiteral(":/playerIds.dat"), playerIdsFile()))
{
ERROR_LOG(m_logger) << "Error creating " << playerIdsFile();
return false;
}
else
QFile(playerIdsFile()).setPermissions(QFile::ReadOwner | QFile::ReadGroup | QFile::ReadOther | QFile::WriteOwner);
}
if (!startPrtCnv())
return false;
}
else
cleanupProcess();
m_radioGrpId = newRadioGrpId;
return true;
}
bool TetraJsonInterfaceImpl::checkConfigTemplates()
{
if (!QFile::exists(iniFileIn()))
{
INFO_LOG(m_logger) << "Creating " << iniFileIn();
if (!QFile::copy(QStringLiteral(":/PrtCnv.dat"), iniFileIn()))
{
ERROR_LOG(m_logger) << "Error creating " << iniFileIn();
return false;
}
else
QFile(iniFileIn()).setPermissions(QFile::ReadOwner | QFile::ReadGroup | QFile::ReadOther | QFile::WriteOwner);
return true;
}
if (!QFile::exists(playerIdsFile()))
bool TetraJsonInterfaceImpl::startPrtCnv()
{
INFO_LOG(m_logger) << "Creating " << playerIdsFile();
if (!QFile::copy(QStringLiteral(":/playerIds.dat"), playerIdsFile()))
{
ERROR_LOG(m_logger) << "Error creating " << playerIdsFile();
return false;
}
else
QFile(playerIdsFile()).setPermissions(QFile::ReadOwner | QFile::ReadGroup | QFile::ReadOther | QFile::WriteOwner);
NOTICE_LOG(m_logger) << "Starting PrtCnv (intern)";
cleanupProcess();
m_prtCnvApp = new PrtCnv::PrtCnvApplication;
const QSqlDatabase db = m_pdp->databaseConnection();
m_prtCnvApp->setDatabaseConnectionParams(db.driverName(), db.hostName(), db.databaseName(), m_pdp->databaseSchemaName(), db.userName(), db.password());
m_prtCnvApp->setExerciseId(m_pdp->exerciseId());
m_prtCnvApp->setConfigFile(iniFileOut());
m_prtCnvApp->startApp();
m_socketDispatcher->init(m_prtCnvApp);
onTetraConnectionChanged(false);
connect(m_socketDispatcher.get(), &SocketDispatcher::tetraConnectionChanged, this, &TetraJsonInterfaceImpl::onTetraConnectionChanged);
connect(m_socketDispatcher.get(), &SocketDispatcher::warehouseMessage, this, &TetraJsonInterfaceImpl::directMessage);
return true;
}
return true;
}
std::shared_ptr<TrainingAreaBase::SendToTab> TetraJsonInterfaceImpl::sendToTab()
{
return m_socketDispatcher->sendToTab();
}
bool TetraJsonInterfaceImpl::startPrtCnv()
{
NOTICE_LOG(m_logger) << "Starting PrtCnv (intern)";
cleanupProcess();
m_prtCnvApp = new PrtCnv::PrtCnvApplication;
const QSqlDatabase db = m_pdp->databaseConnection();
m_prtCnvApp->setDatabaseConnectionParams(db.driverName(),
db.hostName(),
db.databaseName(),
m_pdp->databaseSchemaName(),
db.userName(),
db.password());
m_prtCnvApp->setExerciseId(m_pdp->exerciseId());
m_prtCnvApp->setConfigFile(iniFileOut());
m_prtCnvApp->startApp();
m_socketDispatcher->init(m_prtCnvApp);
bool TetraJsonInterfaceImpl::canSendData() const
{
return m_socketDispatcher->canSendData() && m_prtCnvApp != nullptr;
}
onTetraConnectionChanged(false);
connect(m_socketDispatcher.get(), &SocketDispatcher::tetraConnectionChanged,
this, &TetraJsonInterfaceImpl::onTetraConnectionChanged);
connect(m_socketDispatcher.get(), &SocketDispatcher::warehouseMessage,
this, &TetraJsonInterfaceImpl::directMessage);
return true;
}
std::shared_ptr<TrainingAreaBase::SendToTab> TetraJsonInterfaceImpl::sendToTab()
{
return m_socketDispatcher->sendToTab();
}
bool TetraJsonInterfaceImpl::canSendData() const
{
return m_socketDispatcher->canSendData() && m_prtCnvApp != nullptr;
}
void TetraJsonInterfaceImpl::onTetraConnectionChanged(bool bConnected)
{
void TetraJsonInterfaceImpl::onTetraConnectionChanged(bool bConnected)
{
emit connectionState(QString::fromUtf8(name()), bConnected);
}
}
void TetraJsonInterfaceImpl::cleanupProcess()
{
m_socketDispatcher->init(nullptr);
if (!m_prtCnvApp)
return;
m_prtCnvApp->shutdownApp();
delete m_prtCnvApp;
m_prtCnvApp = nullptr;
onTetraConnectionChanged(false);
}
void TetraJsonInterfaceImpl::cleanupProcess()
{
m_socketDispatcher->init(nullptr);
if (!m_prtCnvApp)
return;
m_prtCnvApp->shutdownApp();
delete m_prtCnvApp;
m_prtCnvApp = nullptr;
onTetraConnectionChanged(false);
}
QString TetraJsonInterfaceImpl::iniFileIn()
{
return iniPath() + QStringLiteral("/PrtCnv.dat");
}
QString TetraJsonInterfaceImpl::iniFileIn()
{
return iniPath() + QStringLiteral("/PrtCnv.dat");
}
QString TetraJsonInterfaceImpl::iniFileOut() const
{
return iniPath() + QStringLiteral("/PrtCnv_ex_%1.dat").arg(m_exerciseId);
}
QString TetraJsonInterfaceImpl::iniFileOut() const
{
return iniPath() + QStringLiteral("/PrtCnv_ex_%1.dat").arg(m_exerciseId);
}
QString TetraJsonInterfaceImpl::iniPath()
{
return QCoreApplication::applicationDirPath() + QLatin1Char('/');
}
QString TetraJsonInterfaceImpl::iniPath()
{
return QCoreApplication::applicationDirPath() + QLatin1Char('/');
}
QString TetraJsonInterfaceImpl::playerIdsFile()
{
return iniPath() + QStringLiteral("/playerIds.dat");
}
QString TetraJsonInterfaceImpl::playerIdsFile()
{
return iniPath() + QStringLiteral("/playerIds.dat");
}
}
}