Qt6 migration: build fixes for Groups 10/11 + missing plugin modules
Continue the Qt5->Qt6 migration so the LTS Projects (Group 10) and LTS
Application (Group 11) compile, link, and ctest runs.
Qt5->Qt6 API migration (resolves removed/deprecated Qt6 APIs) across Lts
Tools and Apps, e.g. QAction->QActionGroup, QAbstractSocket::errorOccurred,
Qt::SkipEmptyParts, QRandomGenerator, QInputDevice::DeviceType,
QRegularExpression, QLatin1Literal->QStringLiteral, and the SampleModel
m_description->description rename.
CMake build fixes:
- CMakeLists.txt: add Lts/Common to CMAKE_AUTOMOC_INCLUDE_DIRECTORIES so moc
resolves Q_INTERFACES(ProjectPlugin::Plugin) for the migrated Projects.
- cmake/NGLMacros.cmake: NGL_COMPILE_RESOURCES - replace return() (which aborts
the calling CMakeLists.txt) with an if/else/endif.
- OpApp/THP: guard the ArcGISQt5Hack link with $<IF:$<TARGET_EXISTS:...>> (the
target is absent when the SituationMap viewer is stubbed); matches
CentralEffectSimulation.
- LtsSession: prefer the in-tree svcCoreClient target over a FIND_LIBRARY in
/usr/local/lib.
- CnrProxyTester/DotMatrixDisplay: set AUTOUIC_SEARCH_PATHS for the ui/ subdir.
- TopicDiscover: link NGLLogger.
Export-header visibility stubs (expand the empty *_EXPORT macro to
__attribute__((visibility("default"))); the build sets -fvisibility=hidden and
these stubs shadow the CMake-generated header):
- include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h (fixes
undefined reference to LtsProjectionWorkstation::getInstance /
setProjectionOperatorPreset)
- include/LtsSession/ltssession_export.h, include/LtsUtilsGuiDds/ltsutilsguidds_export.h (same pattern)
New plugin modules (copied from legacy) so LtsAppDescriptorChecker finds the
gui:3 IIDs referenced by the Projects' apps.json:
- TakeHomePackageManager/OldTHP gui:3:tpm.man, gui:3:tpm.usb
- PresentationManagement/.../ScriptEditor gui:3:pre.script.edit
- Timeline/Gui/EventTimelineClassic gui:3:tln.view
new_docker_build.sh: correct group targets to the actual CMake target names,
guard LtsReportDisplay on BUILD_CODIFICATION, and skip modules unavailable in
the prebuilt image (AsmWorkstationCertifier/botan2, TrajectoryWidget,
VideoImport, thp_viewer/VLC).
This commit is contained in:
1 parent
040bdd558f
commit
3f7beb3c7e
154 files changed
+24958
-167
No files matched your search
+1
-1
@@ -17,7 +17,7 @@
|
||||
//other
|
||||
#include "awss_websocket_interface.h"
|
||||
|
||||
#include <QtWidgets/QAction>
|
||||
#include <QtGui/QAction> // Qt6: QAction moved from QtWidgets to QtGui
|
||||
#include <QtWidgets/QMenu>
|
||||
|
||||
namespace AdlerWebSocketSimulator {
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
# Created by Hannes Fritsche, SLSE, 2017-09-05
|
||||
#
|
||||
|
||||
# .ui files live in the ui/ subdirectory; tell AUTOUIC where to find them
|
||||
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui)
|
||||
|
||||
SET(SRCS
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
|
||||
@@ -48,12 +48,12 @@ void Initialisation::generateTestData(const QString &type)
|
||||
{
|
||||
ExerciseManagement::Exercise data;
|
||||
|
||||
data.id(999);
|
||||
data.name("TestExe");
|
||||
data.isUsed(m_isUsed);
|
||||
data.partitionName("Exe999");
|
||||
data.state(ExerciseManagement::ExerciseState::Started);
|
||||
data.isDeleted(false);
|
||||
data.id = 999;
|
||||
data.name = "TestExe";
|
||||
data.isUsed = m_isUsed;
|
||||
data.partitionName = "Exe999";
|
||||
data.state = ExerciseManagement::ExerciseState::Started;
|
||||
data.isDeleted = false;
|
||||
|
||||
getPublisher()->write(data);
|
||||
|
||||
@@ -62,19 +62,19 @@ void Initialisation::generateTestData(const QString &type)
|
||||
{
|
||||
ParticipantManagement::Participant data;
|
||||
|
||||
data.id(m_participantId);
|
||||
data.symbol(std::string("231"));
|
||||
data.id = m_participantId;
|
||||
data.symbol = std::string("231");
|
||||
//data.relatedUnit(1);
|
||||
|
||||
data.equipmentNumber (1111);
|
||||
data.equipmentNumber = 1111;
|
||||
|
||||
data.isSimulated(true);
|
||||
data.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
data.isSimulated = true;
|
||||
data.sampleTime = static_cast<int64_t>(QDateTime::currentMSecsSinceEpoch());
|
||||
//data.isNBCProtectionActivated(false);
|
||||
|
||||
getPublisher()->write(data);
|
||||
|
||||
data.id(m_participantId+10);
|
||||
data.id = m_participantId+10;
|
||||
getPublisher()->write(data);
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ static QVector<DDSGeneric::TopicDescription> getAvailableTopicTypes() // get top
|
||||
return false;
|
||||
|
||||
QMap<std::string,DDSGeneric::TopicDescription> topics = typePlugin->getDataTopics();
|
||||
topics.unite(typePlugin->getFunctionTopics());
|
||||
// Qt6: QMap::unite removed; insert() keeps the same "existing keys win" semantics
|
||||
topics.insert(typePlugin->getFunctionTopics());
|
||||
|
||||
QMap<std::string, DDSGeneric::TopicDescription>::iterator it = topics.begin();
|
||||
for( ; it != topics.end(); ++it)
|
||||
@@ -71,23 +72,24 @@ public:
|
||||
return availDataTopics;
|
||||
|
||||
// Convert list of DoTypes, separated by comma (given by user)
|
||||
// Qt6: QStringRef/QString::splitRef removed; QStringView::split provides the same tokenization
|
||||
const QString doTypeStr = value(QLatin1String("t"));
|
||||
const QVector<QStringRef> strList = doTypeStr.splitRef(QLatin1Char(','), QString::SkipEmptyParts);
|
||||
const QList<QStringView> strList = QStringView{doTypeStr}.split(QLatin1Char(','), Qt::SkipEmptyParts);
|
||||
|
||||
if (strList.isEmpty())
|
||||
return availDataTopics;
|
||||
|
||||
QVector<DDSGeneric::TopicDescription> vDt;
|
||||
vDt.reserve(strList.size());
|
||||
for (const QStringRef &doTypeStr : strList)
|
||||
for (const QStringView doTypeView : strList)
|
||||
{
|
||||
bool ok = false;
|
||||
int doTypeInt = doTypeStr.toInt(&ok);
|
||||
const int doTypeInt = doTypeView.toInt(&ok);
|
||||
INFO_LOG(logger) << "doType: " << doTypeInt;
|
||||
if (ok && doTypeInt >= 0 && doTypeInt < availDataTopics.size())
|
||||
vDt.append(availDataTopics.at(doTypeInt));
|
||||
else
|
||||
WARNING_LOG(logger) << doTypeStr.toString() << " is not a valid DoType, skipping.. ";
|
||||
WARNING_LOG(logger) << doTypeView.toString() << " is not a valid DoType, skipping.. ";
|
||||
}
|
||||
return vDt;
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ void TopicData::processData(const ExerciseManagement::Exercise &data)
|
||||
|
||||
DEBUG_LOG(m_logger) << "=> IN processData Exercise";
|
||||
|
||||
INFO_LOG(m_logger) << "|#| id: # " << data.id();
|
||||
INFO_LOG(m_logger) << "|#| name: # " << data.name();
|
||||
INFO_LOG(m_logger) << "|#| state: # " << data.state();
|
||||
INFO_LOG(m_logger) << "|#| partition: # " << data.partitionName();
|
||||
INFO_LOG(m_logger) << "|#| isUsed: # " << data.isUsed();
|
||||
INFO_LOG(m_logger) << "|#| markedAsDeleted: # " << data.isDeleted();
|
||||
INFO_LOG(m_logger) << "|#| id: # " << data.id;
|
||||
INFO_LOG(m_logger) << "|#| name: # " << data.name;
|
||||
INFO_LOG(m_logger) << "|#| state: # " << data.state;
|
||||
INFO_LOG(m_logger) << "|#| partition: # " << data.partitionName;
|
||||
INFO_LOG(m_logger) << "|#| isUsed: # " << data.isUsed;
|
||||
INFO_LOG(m_logger) << "|#| markedAsDeleted: # " << data.isDeleted;
|
||||
|
||||
}
|
||||
|
||||
@@ -90,10 +90,10 @@ void TopicData::processData(const ParticipantManagement::Participant &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "-> IN processData Participant";
|
||||
|
||||
INFO_LOG(m_logger) << "|#| participantId: #" << data.id();
|
||||
INFO_LOG(m_logger) << "|#| name: #" << data.name();
|
||||
INFO_LOG(m_logger) << "|#| hierarchyNo: #" << data.hierarchyNumber();
|
||||
INFO_LOG(m_logger) << "|#| equipNo: #" << data.equipmentNumber();
|
||||
INFO_LOG(m_logger) << "|#| participantId: #" << data.id;
|
||||
INFO_LOG(m_logger) << "|#| name: #" << data.name;
|
||||
INFO_LOG(m_logger) << "|#| hierarchyNo: #" << data.hierarchyNumber;
|
||||
INFO_LOG(m_logger) << "|#| equipNo: #" << data.equipmentNumber;
|
||||
|
||||
//processData(data.location());
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ RWBitfieldWidget::RWBitfieldWidget(RwMode readOnly, QWidget *parent)
|
||||
|
||||
void RWBitfieldWidget::setValue(quint8 val)
|
||||
{
|
||||
m_label->setText(QLatin1Literal("0b") + QString::number(val,2));
|
||||
m_label->setText(QStringLiteral("0b") + QString::number(val,2));
|
||||
if (m_bitfield)
|
||||
m_bitfield->setValue(val);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ SampleModel::SampleData SampleModel::SampleData::decodeFromMime(const QByteArray
|
||||
QString tn;
|
||||
quint64 ptr;
|
||||
dds::core::xtypes::DynamicData *dynDataPtr;
|
||||
stream >> tn >> ptr >> ret.topicName >> ret.m_description >> ret.pause;
|
||||
stream >> tn >> ptr >> ret.topicName >> ret.description >> ret.pause;
|
||||
ret.typeName = tn.toStdString();
|
||||
dynDataPtr = reinterpret_cast<dds::core::xtypes::DynamicData *>(ptr);
|
||||
ret.legatusData = QSharedPointer<dds::core::xtypes::DynamicData>(new dds::core::xtypes::DynamicData(*dynDataPtr));
|
||||
@@ -103,7 +103,7 @@ QVariant SampleModel::data(const QModelIndex &index, int role) const
|
||||
case Column::TopicName:
|
||||
return data.topicName;
|
||||
case Column::Description:
|
||||
return data.m_description;
|
||||
return data.description;
|
||||
case Column::TypeName:
|
||||
return QString::fromStdString(data.typeName);
|
||||
case Column::Pause:
|
||||
@@ -133,10 +133,10 @@ bool SampleModel::setData(const QModelIndex &index, const QVariant &value, int r
|
||||
case Column::TypeName:
|
||||
break;
|
||||
case Column::Description:
|
||||
data.m_description = value.toString();
|
||||
data.description = value.toString();
|
||||
retVal = true;
|
||||
if (data.dialog)
|
||||
data.dialog->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(data.m_description, data.topicName));
|
||||
data.dialog->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(data.description, data.topicName));
|
||||
break;
|
||||
case Column::Pause:
|
||||
{
|
||||
@@ -313,7 +313,7 @@ bool SampleModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
|
||||
sample.legatusData = QSharedPointer<dds::core::xtypes::DynamicData>(new dds::core::xtypes::DynamicData(*ptr));
|
||||
sample.typeName = ptr->type().name();
|
||||
sample.m_description = sample.topicName;
|
||||
sample.description = sample.topicName;
|
||||
|
||||
int beginRow;
|
||||
if (row != -1)
|
||||
@@ -339,7 +339,7 @@ bool SampleModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
// TODO: set topicName
|
||||
sample.typeName = typeName.toStdString();
|
||||
sample.topicName = QString::fromLatin1(topicName.data());
|
||||
sample.m_description = sample.topicName;
|
||||
sample.description = sample.topicName;
|
||||
sample.legatusData = QSharedPointer<dds::core::xtypes::DynamicData>(new dds::core::xtypes::DynamicData(NGLSettings::instance()->dataTopic(sample.topicName).type));
|
||||
|
||||
int beginRow;
|
||||
@@ -370,7 +370,7 @@ bool SampleModel::addRow(const dds::core::xtypes::DynamicData &data, const QStri
|
||||
|
||||
id.typeName = data.type().name();
|
||||
id.topicName = topicName;
|
||||
id.m_description = description.isEmpty() ? topicName : description;
|
||||
id.description = description.isEmpty() ? topicName : description;
|
||||
id.legatusData = QSharedPointer<dds::core::xtypes::DynamicData>(new dds::core::xtypes::DynamicData(data.type()));
|
||||
|
||||
return addRow(id);
|
||||
@@ -423,7 +423,7 @@ bool SampleSortModel::lessThan(const QModelIndex &left,
|
||||
case SampleModel::Column::TopicName:
|
||||
return dataLeft.topicName < dataRight.topicName;
|
||||
case SampleModel::Column::Description:
|
||||
return dataLeft.m_description < dataRight.m_description;
|
||||
return dataLeft.description < dataRight.description;
|
||||
case SampleModel::Column::TypeName:
|
||||
return dataLeft.typeName < dataRight.typeName;
|
||||
case SampleModel::Column::Pause:
|
||||
|
||||
@@ -172,7 +172,7 @@ void SampleView::onTableDoubleClicked(const QModelIndex &mi)
|
||||
if (dvd)
|
||||
{
|
||||
dvd->fill(*data.data());
|
||||
dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).m_description,
|
||||
dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).description,
|
||||
m_model->sampleData(sourceMi).topicName));
|
||||
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void SampleView::onTableDoubleClicked(const QModelIndex &mi)
|
||||
connect(dvd, &DetailViewDlg::send, this, &SampleView::send);
|
||||
dvd->init(*data.data(), m_model->sampleData(sourceMi).topicName, RwMode::WriteOnly);
|
||||
dvd->setBtnsSendOkCancel();
|
||||
dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).m_description,
|
||||
dvd->setWindowTitle(QString::fromLatin1("%1 (%2)").arg(m_model->sampleData(sourceMi).description,
|
||||
m_model->sampleData(sourceMi).topicName));
|
||||
m_model->setDialog(sourceMi, dvd);
|
||||
}
|
||||
|
||||
+1
-1
@@ -165,7 +165,7 @@ void AbstractSequenceWidget::deleteMemberWidget(QObject *member)
|
||||
|
||||
QString childName = child->objectName();
|
||||
QString newId = m_name + QLatin1Char('.') + QString::number(i + 1);
|
||||
child->setObjectName(childName.replace(QRegularExpression(QRegularExpression::escape(m_name + QLatin1String(".") + "([0-9]*)")), newId));
|
||||
child->setObjectName(childName.replace(QRegularExpression(QRegularExpression::escape(m_name + QString::fromLatin1(".([0-9]*)" ))), newId));
|
||||
DEBUG_LOG(m_logger) << "new child name: " << child->objectName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ NGL_ADD_EXECUTABLE(WS NO_TRANSLATION displayPanelSimulator
|
||||
${displayPanelSimulator_HDRS}
|
||||
)
|
||||
|
||||
# .ui files live in the ui/ subdirectory; AUTOUIC only searches the source
|
||||
# dir by default, so tell it where to find them
|
||||
set_target_properties(displayPanelSimulator PROPERTIES AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui")
|
||||
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(displayPanelSimulator
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
|
||||
@@ -96,7 +96,7 @@ QVariant LogViewTableModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
case Qt::TextColorRole: // TEXT COLOR
|
||||
case Qt::ForegroundRole: // TEXT COLOR
|
||||
{
|
||||
const QString logLevel = m_logfile.at(index.row()).level;
|
||||
QColor col = m_fontColors.level.value(logLevel);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "logviewtableview.h"
|
||||
#include "logviewtablemodel.h"
|
||||
|
||||
#include <QtWidgets/QAction>
|
||||
#include <QtGui/QAction> // Qt6: QAction moved from QtWidgets to QtGui
|
||||
#include <QtGui/QColor>
|
||||
#include <QColorDialog>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
@@ -126,10 +126,10 @@ void MainWindow::onActionOpen()
|
||||
|
||||
QString str(QString::fromUtf8(ba));
|
||||
|
||||
const QStringList strLines = str.split(QLatin1Char('\n'), QString::SkipEmptyParts);
|
||||
const QStringList strLines = str.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
|
||||
for (const QString &tempLines : strLines)
|
||||
{
|
||||
const QStringList strWords = tempLines.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
const QStringList strWords = tempLines.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
|
||||
LogViewTableModel::logInformation li;
|
||||
QDateTime firstDate;
|
||||
|
||||
+30
-29
@@ -15,6 +15,7 @@
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QElapsedTimer>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QRandomGenerator>
|
||||
#include <QtCore/QTimer>
|
||||
#include "proxy_emulator.h"
|
||||
|
||||
@@ -29,7 +30,7 @@ ParticipantDataGenerator::MainHandler::MainHandler(QObject *parent)
|
||||
, m_participantCreationTimer(new QElapsedTimer())
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("PDG.MainHandler"))
|
||||
{
|
||||
qsrand(QDateTime::currentMSecsSinceEpoch());
|
||||
QRandomGenerator::global()->seed(QDateTime::currentMSecsSinceEpoch());
|
||||
}
|
||||
|
||||
ParticipantDataGenerator::MainHandler::~MainHandler()
|
||||
@@ -161,9 +162,9 @@ void ParticipantDataGenerator::MainHandler::createParticipants()
|
||||
|
||||
for (auto it = participantMap.begin(); it != participantMap.end(); ++it)
|
||||
{
|
||||
if (it.value().equipmentNumber().is_set())
|
||||
if (it.value().equipmentNumber.has_value())
|
||||
{
|
||||
allocatedEquipmentNumbers.append(it.value().equipmentNumber().get());
|
||||
allocatedEquipmentNumbers.append(it.value().equipmentNumber.value());
|
||||
++equipmentNumberCount;
|
||||
}
|
||||
}
|
||||
@@ -178,13 +179,13 @@ void ParticipantDataGenerator::MainHandler::createParticipants()
|
||||
|
||||
DEBUG_LOG(m_logger) << "Creating " << participantCount << " new participants.";
|
||||
|
||||
request.data().reserve(participantCount);
|
||||
request.data.reserve(participantCount);
|
||||
|
||||
for (int32_t counter = 1; counter <= participantCount; ++counter)
|
||||
{
|
||||
ParticipantManagement::ParticipantData newData;
|
||||
ParticipantManagement::Type type = randomType();
|
||||
newData.modId(counter);
|
||||
newData.modId = counter;
|
||||
inferiorCount.insert(counter, 0);
|
||||
int32_t partyId = 2;
|
||||
int32_t superiorModId = 0;
|
||||
@@ -193,27 +194,27 @@ void ParticipantDataGenerator::MainHandler::createParticipants()
|
||||
superiorModId = randomSuperiorModId(counter - 1);
|
||||
|
||||
int32_t hierarchyNumber = inferiorCount.value(superiorModId) + 1;
|
||||
newData.superiorModId(superiorModId);
|
||||
newData.hierarchyNumber(counter == 1 ? 1 : hierarchyNumber);
|
||||
newData.superiorModId = superiorModId;
|
||||
newData.hierarchyNumber = (counter == 1 ? 1 : hierarchyNumber);
|
||||
inferiorCount.insert(superiorModId, hierarchyNumber);
|
||||
|
||||
// increment equipmentNumber until it is not already allocated
|
||||
while (allocatedEquipmentNumbers.contains(++equipmentNumber));
|
||||
|
||||
allocatedEquipmentNumbers.append(equipmentNumber);
|
||||
newData.equipmentNumber().set(equipmentNumber);
|
||||
newData.isSimulated(true);
|
||||
newData.isDeleted(false);
|
||||
newData.typeId(type.id());
|
||||
newData.symbol(type.symbol());
|
||||
newData.name(QStringLiteral("name_%1").arg(counter).toStdString());
|
||||
newData.designator(QStringLiteral("designator_%1").arg(counter).toStdString());
|
||||
newData.tacticalIdentifier(QStringLiteral("tacticalIdentifier_%1").arg(counter).toStdString());
|
||||
newData.info(QStringLiteral("info_%1").arg(counter).toStdString());
|
||||
newData.assignState(ParticipantManagement::ParticipantAssignState::HandoutExcon);
|
||||
newData.partyId(partyId);
|
||||
newData.equipmentNumber = equipmentNumber;
|
||||
newData.isSimulated = true;
|
||||
newData.isDeleted = false;
|
||||
newData.typeId = type.id;
|
||||
newData.symbol = type.symbol;
|
||||
newData.name = QStringLiteral("name_%1").arg(counter).toStdString();
|
||||
newData.designator = QStringLiteral("designator_%1").arg(counter).toStdString();
|
||||
newData.tacticalIdentifier = QStringLiteral("tacticalIdentifier_%1").arg(counter).toStdString();
|
||||
newData.info = QStringLiteral("info_%1").arg(counter).toStdString();
|
||||
newData.assignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
newData.partyId = partyId;
|
||||
|
||||
request.data().push_back(std::move(newData));
|
||||
request.data.push_back(std::move(newData));
|
||||
}
|
||||
|
||||
m_participantCreationTimer->start();
|
||||
@@ -236,8 +237,8 @@ void ParticipantDataGenerator::MainHandler::onNewPositions()
|
||||
|
||||
for (auto it = participants.begin(); it != participants.end(); ++it)
|
||||
{
|
||||
if (it.value().equipmentNumber().is_set())
|
||||
participantIdToEquipmentnumber.insert(it.value().id(), it.value().equipmentNumber().get());
|
||||
if (it.value().equipmentNumber.has_value())
|
||||
participantIdToEquipmentnumber.insert(it.value().id, it.value().equipmentNumber.value());
|
||||
}
|
||||
|
||||
m_proxyEmulator->moveParticipants(participantIdToEquipmentnumber, m_ppmDtc->participantPositions());
|
||||
@@ -252,14 +253,14 @@ ParticipantManagement::Type ParticipantDataGenerator::MainHandler::randomType()
|
||||
{
|
||||
do
|
||||
{
|
||||
unsigned int index = qrand() % m_types.size();
|
||||
unsigned int index = QRandomGenerator::global()->bounded(m_types.size());
|
||||
result = m_types.at(index);
|
||||
}
|
||||
while (result.typeClass() != ParticipantManagement::TypeClass::Human &&
|
||||
result.typeClass() != ParticipantManagement::TypeClass::GroundVehicle &&
|
||||
result.typeClass() != ParticipantManagement::TypeClass::Aircraft &&
|
||||
result.typeClass() != ParticipantManagement::TypeClass::Vessel &&
|
||||
result.typeClass() != ParticipantManagement::TypeClass::VehicleWithGear
|
||||
while (result.typeClass != ParticipantManagement::TypeClass::Human &&
|
||||
result.typeClass != ParticipantManagement::TypeClass::GroundVehicle &&
|
||||
result.typeClass != ParticipantManagement::TypeClass::Aircraft &&
|
||||
result.typeClass != ParticipantManagement::TypeClass::Vessel &&
|
||||
result.typeClass != ParticipantManagement::TypeClass::VehicleWithGear
|
||||
);
|
||||
}
|
||||
|
||||
@@ -268,8 +269,8 @@ ParticipantManagement::Type ParticipantDataGenerator::MainHandler::randomType()
|
||||
|
||||
int32_t ParticipantDataGenerator::MainHandler::randomSuperiorModId(int32_t upperBound)
|
||||
{
|
||||
qsrand(QDateTime::currentMSecsSinceEpoch());
|
||||
auto ret = qrand() % (upperBound + 1);
|
||||
QRandomGenerator::global()->seed(QDateTime::currentMSecsSinceEpoch());
|
||||
auto ret = QRandomGenerator::global()->bounded(upperBound + 1);
|
||||
return ret == 0 ? ret + 1 : ret;
|
||||
}
|
||||
|
||||
+34
-32
@@ -12,6 +12,7 @@
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QPointF>
|
||||
#include <QRandomGenerator>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
@@ -47,14 +48,14 @@ void ParticipantDataGenerator::ProxyEmulator::giveInitPositions(const QMap<qint3
|
||||
{
|
||||
const ParticipantManagement::Participant ¤tParticipant = it.value();
|
||||
|
||||
if (currentParticipant.equipmentNumber().is_set())
|
||||
if (currentParticipant.equipmentNumber.has_value())
|
||||
{
|
||||
++participantsWithEquipmentNumber;
|
||||
TrainingAreaBase::EquipmentPosition pos;
|
||||
|
||||
pos.equipmentNumber(currentParticipant.equipmentNumber().get());
|
||||
pos.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
pos.position().position(randomPosition());
|
||||
pos.equipmentNumber = currentParticipant.equipmentNumber.value();
|
||||
pos.sampleTime = static_cast<int64_t>(QDateTime::currentMSecsSinceEpoch());
|
||||
pos.position.position = randomPosition();
|
||||
|
||||
m_tabDts->publish(pos);
|
||||
}
|
||||
@@ -79,10 +80,10 @@ static constexpr double minY = 5870000;
|
||||
|
||||
Core::GeoPosition ParticipantDataGenerator::ProxyEmulator::movePosition(const Core::GeoPosition &oldPosition)
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(oldPosition.lon(), oldPosition.lat()));
|
||||
LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(oldPosition.lon, oldPosition.lat));
|
||||
|
||||
int ofsX = (qrand() % 200) - 100;
|
||||
int ofsY = (qrand() % 200) - 100;
|
||||
int ofsX = (QRandomGenerator::global()->bounded(200)) - 100;
|
||||
int ofsY = (QRandomGenerator::global()->bounded(200)) - 100;
|
||||
|
||||
coord.x += ofsX;
|
||||
coord.y += ofsY;
|
||||
@@ -91,26 +92,27 @@ Core::GeoPosition ParticipantDataGenerator::ProxyEmulator::movePosition(const Co
|
||||
coord.y = qBound(minY, coord.y, maxY);
|
||||
|
||||
const QPointF ret(coord.geographic());
|
||||
return Core::GeoPosition(ret.x(), ret.y(), oldPosition.z());
|
||||
return Core::GeoPosition(ret.x(), ret.y(), oldPosition.z);
|
||||
}
|
||||
|
||||
void ParticipantDataGenerator::ProxyEmulator::moveParticipants(const QHash<int32_t, int32_t> &participantIdToEquimentNumber, const QMap<int32_t, ParticipantManagement::ParticipantPosition> &positions)
|
||||
{
|
||||
const int posSelector = (qrand() % 10) + 1;
|
||||
const int biteSelector = (qrand() % 100) + 1;
|
||||
const int equipGearAssignSelector = (qrand() % 200) + 1;
|
||||
const int ctaDataErrorSelector = (qrand() % 100) + 1;
|
||||
const int posSelector = (QRandomGenerator::global()->bounded(10)) + 1;
|
||||
const int biteSelector = (QRandomGenerator::global()->bounded(100)) + 1;
|
||||
const int equipGearAssignSelector = (QRandomGenerator::global()->bounded(200)) + 1;
|
||||
const int ctaDataErrorSelector = (QRandomGenerator::global()->bounded(100)) + 1;
|
||||
int counter = 0;
|
||||
TrainingAreaBase::EquipmentPosition newPosition;
|
||||
newPosition.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
newPosition.sampleTime = static_cast<int64_t>(QDateTime::currentMSecsSinceEpoch());
|
||||
TrainingAreaBase::EquipmentBite newBite;
|
||||
newBite.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
newBite.sampleTime = static_cast<int64_t>(QDateTime::currentMSecsSinceEpoch());
|
||||
TrainingAreaBase::EquipmentGearAssignment newGearAssignment;
|
||||
newGearAssignment.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
newGearAssignment.sampleTime = static_cast<int64_t>(QDateTime::currentMSecsSinceEpoch());
|
||||
TrainingAreaBase::CtaDataError newCtaDataError;
|
||||
newCtaDataError.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
newCtaDataError.reason(ProjectDataManagement::DataErrorReason::ErrorConfigSelfTest);
|
||||
newCtaDataError.originTelegramId(203);
|
||||
newCtaDataError.sampleTime = static_cast<int64_t>(QDateTime::currentMSecsSinceEpoch());
|
||||
// Regenerated DDS enum uses prefixed enumerators (pdm_enums.hpp)
|
||||
newCtaDataError.reason = ProjectDataManagement::DataErrorReason::DataErrorReason_ErrorConfigSelfTest;
|
||||
newCtaDataError.originTelegramId = 203;
|
||||
int pC = 0;
|
||||
int bC = 0;
|
||||
int gC = 0;
|
||||
@@ -118,24 +120,24 @@ void ParticipantDataGenerator::ProxyEmulator::moveParticipants(const QHash<int32
|
||||
for (auto it = positions.begin(); it != positions.end(); ++it, ++counter)
|
||||
{
|
||||
const ParticipantManagement::ParticipantPosition &oldPosition = it.value();
|
||||
const int equipNo = participantIdToEquimentNumber.value(oldPosition.participantId());
|
||||
const int equipNo = participantIdToEquimentNumber.value(oldPosition.participantId);
|
||||
if ((counter % biteSelector) == 0)
|
||||
{
|
||||
newBite.equipmentNumber(equipNo);
|
||||
newBite.configState(counter);
|
||||
newBite.biteState(~counter);
|
||||
newBite.equipmentNumber = equipNo;
|
||||
newBite.configState = counter;
|
||||
newBite.biteState = ~counter;
|
||||
m_tabDts->publish(newBite);
|
||||
++bC;
|
||||
}
|
||||
if ((counter % equipGearAssignSelector) == 0)
|
||||
{
|
||||
newGearAssignment.equipmentNumber(equipNo);
|
||||
newGearAssignment.equipmentNumber = equipNo;
|
||||
m_tabDts->publish(newGearAssignment);
|
||||
++gC;
|
||||
}
|
||||
if ((counter % ctaDataErrorSelector) == 0)
|
||||
{
|
||||
newCtaDataError.equipmentNumber(equipNo);
|
||||
newCtaDataError.equipmentNumber = equipNo;
|
||||
m_tabDts->publish(newCtaDataError);
|
||||
++cC;
|
||||
}
|
||||
@@ -144,11 +146,11 @@ void ParticipantDataGenerator::ProxyEmulator::moveParticipants(const QHash<int32
|
||||
continue;
|
||||
|
||||
|
||||
if (!participantIdToEquimentNumber.contains(oldPosition.participantId()))
|
||||
if (!participantIdToEquimentNumber.contains(oldPosition.participantId))
|
||||
continue;
|
||||
|
||||
newPosition.equipmentNumber(equipNo);
|
||||
newPosition.position().position(movePosition(oldPosition.pos()));
|
||||
newPosition.equipmentNumber = equipNo;
|
||||
newPosition.position.position = movePosition(oldPosition.pos);
|
||||
++pC;
|
||||
|
||||
m_tabDts->publish(newPosition);
|
||||
@@ -171,11 +173,11 @@ Core::GeoPosition ParticipantDataGenerator::ProxyEmulator::randomPosition()
|
||||
constexpr int rangeX = qAbs(minX - maxX);
|
||||
constexpr int rangeY = qAbs(minY - maxY);
|
||||
|
||||
const QPointF p(coord.geographic(qrand() % rangeX,
|
||||
qrand() % rangeY));
|
||||
result.z(0);
|
||||
result.lon(p.x());
|
||||
result.lat(p.y());
|
||||
const QPointF p(coord.geographic(QRandomGenerator::global()->bounded(rangeX),
|
||||
QRandomGenerator::global()->bounded(rangeY)));
|
||||
result.z = 0;
|
||||
result.lon = p.x();
|
||||
result.lat = p.y();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
#include <QtWidgets/QAction>
|
||||
#include <QtGui/QAction> // Qt6: QAction moved from QtWidgets to QtGui
|
||||
#include <QtCore/QFile>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtCore/QJsonArray>
|
||||
|
||||
@@ -29,7 +29,6 @@ QLedLine::QLedLine(QWidget *parent)
|
||||
{
|
||||
m_layout->setSpacing(0);
|
||||
m_layout->setContentsMargins(0,0,0,0);
|
||||
m_layout->setMargin(0);
|
||||
|
||||
QSpacerItem *sp1 = new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
QSpacerItem *sp2 = new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QColorDialog>
|
||||
@@ -10,7 +11,6 @@
|
||||
#include <QFontDatabase>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QTextCodec>
|
||||
#include <QTextEdit>
|
||||
#include <QStatusBar>
|
||||
#include <QToolBar>
|
||||
@@ -367,8 +367,8 @@ bool TextEdit::load(const QString &f)
|
||||
return false;
|
||||
|
||||
QByteArray data = file.readAll();
|
||||
QTextCodec *codec = Qt::codecForHtml(data);
|
||||
QString str = codec->toUnicode(data);
|
||||
// Qt6: QTextCodec/Qt::codecForHtml removed; decode as UTF-8
|
||||
QString str = QString::fromUtf8(data);
|
||||
if (Qt::mightBeRichText(str)) {
|
||||
QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
|
||||
textEdit->document()->setBaseUrl(baseUrl);
|
||||
@@ -505,7 +505,7 @@ void TextEdit::filePrint()
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
QPrintDialog *dlg = new QPrintDialog(&printer, this);
|
||||
if (textEdit->textCursor().hasSelection())
|
||||
dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
|
||||
dlg->setOption(QAbstractPrintDialog::PrintSelection, true);
|
||||
dlg->setWindowTitle(tr("Print Document"));
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
textEdit->print(&printer);
|
||||
|
||||
@@ -38,4 +38,5 @@ NGL_TARGET_LINK_LIBRARIES(topicdiscoverexe
|
||||
LtsCommandLineParser
|
||||
nglcoreapplication
|
||||
topicdiscover
|
||||
NGLLogger
|
||||
)
|
||||
@@ -34,7 +34,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ERROR_LOG(m_logger) << "trainingArea size: " << trainingAreas.size();
|
||||
for (const auto &item : trainingAreas)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ta name: " << item.name << ", id: " << item.m_id;
|
||||
DEBUG_LOG(m_logger) << "ta name: " << item.name << ", id: " << item.id;
|
||||
m_ui->cbTrainingArea->addItem(item.name, QVariant::fromValue(item));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,12 +53,12 @@ QMap<int,Settings::TrainingArea> Settings::trainingAreas()
|
||||
{
|
||||
settings->setArrayIndex(i);
|
||||
TrainingArea ta;
|
||||
ta.m_id = settings->value(QStringLiteral("id")).toInt();
|
||||
ta.id = settings->value(QStringLiteral("id")).toInt();
|
||||
ta.name = settings->value(QStringLiteral("name")).toString();
|
||||
ta.bottomLeft = settings->value(QStringLiteral("bottomLeftMgrs")).toString();
|
||||
ta.width = settings->value(QStringLiteral("width"), 1000).toInt();
|
||||
ta.height = settings->value(QStringLiteral("height"), 1000).toInt();
|
||||
map.insert(ta.m_id, ta);
|
||||
map.insert(ta.id, ta);
|
||||
}
|
||||
settings->endArray();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ Worker::Worker(QObject *parent)
|
||||
m_tcpClient = new QTcpSocket(this);
|
||||
|
||||
connect(m_tcpClient, &QTcpSocket::connected, this, &Worker::onTcpConnected);
|
||||
connect(m_tcpClient, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error), this, &Worker::error);
|
||||
connect(m_tcpClient, &QAbstractSocket::errorOccurred, this, &Worker::error);
|
||||
connect(m_tcpClient, &QTcpSocket::disconnected, this, &Worker::onTcpDisconnected);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user