Complete Qt6 migration: full clean build green across groups G1-G12 incl. runtime plugin set
new_docker_build.sh gains Group 12 (212 GUI/Data plugins); fixes LtsUtilsGuiDds visibility (LTO-stripped exports), LtsProjectionWorkstation unity name shadow, 6 unity-off dirs (dup file-scope statics, ddsftc INTERFACE sources) and reconfigures BUILD_FILTERMANAGEMENT/BUILD_PLUGINS_SERVICEMONITOR=ON
This commit is contained in:
1718 files changed
+126739
-18495
No files matched your search
+60
-70
@@ -4,7 +4,7 @@
|
||||
#include "ism_foreign_data_plugin.h"
|
||||
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/ism_dtc.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
@@ -32,16 +32,6 @@
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
|
||||
// Helper function to convert InfrastructureManagement::Interface::MainSchedule to ParticipantManagement::MainSchedule
|
||||
static ParticipantManagement::MainSchedule convertMainSchedule(const Interface::MainSchedule& ismSchedule)
|
||||
{
|
||||
ParticipantManagement::MainSchedule ppmSchedule;
|
||||
ppmSchedule.id = ismSchedule.id();
|
||||
// Note: Other fields (name, description, startTime, endTime, isActive) have no direct mapping
|
||||
// from InfrastructureManagement::MainSchedule, so they remain at default values
|
||||
return ppmSchedule;
|
||||
}
|
||||
|
||||
ForeignInterfaceImpl::ForeignInterfaceImpl(const std::shared_ptr<Interface::Dtc> &dtc, int exerciseId)
|
||||
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_dtc(dtc)
|
||||
@@ -121,10 +111,10 @@ MountingPoint ForeignInterfaceImpl::mountingPoint(int32_t mountingPointId) const
|
||||
return m_mountingPoints.value(mountingPointId);
|
||||
}
|
||||
|
||||
ParticipantManagement::MainSchedule ForeignInterfaceImpl::mainSchedule(int32_t scheduleId)
|
||||
MainSchedule ForeignInterfaceImpl::mainSchedule(int32_t scheduleId)
|
||||
{
|
||||
enableIsmForeignInterface();
|
||||
return convertMainSchedule(m_dtc->mainSchedule(scheduleId));
|
||||
return m_dtc->mainSchedule(scheduleId);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::setScheduleId(int32_t scheduleId)
|
||||
@@ -135,7 +125,7 @@ void ForeignInterfaceImpl::setScheduleId(int32_t scheduleId)
|
||||
enableIsmForeignInterface();
|
||||
|
||||
m_scheduleId = scheduleId;
|
||||
onMainScheduleChanged(m_dtc->mainSchedule(scheduleId), InfrastructureManagement::Interface::DataModification::eModified);
|
||||
onMainScheduleChanged(m_dtc->mainSchedule(scheduleId), DataModification::eModified);
|
||||
emit scheduleIdChanged(m_scheduleId);
|
||||
}
|
||||
|
||||
@@ -163,27 +153,27 @@ bool ForeignInterfaceImpl::isBuildingsInCurrentExercise(int buildingId) const
|
||||
return m_bldgsInExcersise.contains(buildingId);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, InfrastructureManagement::Interface::DataModification modType)
|
||||
void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType)
|
||||
{
|
||||
const int mseId = data.id();
|
||||
const int mseId = data.id;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case InfrastructureManagement::Interface::DataModification::eRemoved:
|
||||
case DataModification::eRemoved:
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
|
||||
const auto &structureElements = data.elements();
|
||||
const auto &structureElements = data.elements;
|
||||
for (const StructureElement ¤tStructEle : structureElements)
|
||||
{
|
||||
if (currentStructEle.mountingPointTypeId() == MountingPointType::Undefined)
|
||||
if (currentStructEle.mountingPointTypeId == MountingPointType::Unknown)
|
||||
continue;
|
||||
m_mountingPoints.remove(currentStructEle.id());
|
||||
m_mountingPoints.remove(currentStructEle.id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case InfrastructureManagement::Interface::DataModification::eAdded:
|
||||
case InfrastructureManagement::Interface::DataModification::eModified:
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
QVector<int> exeIds;
|
||||
|
||||
@@ -192,14 +182,14 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureMan
|
||||
{
|
||||
QJsonParseError parserError;
|
||||
|
||||
const auto &structureElements = data.elements();
|
||||
const auto &structureElements = data.elements;
|
||||
if (!structureElements.empty())
|
||||
{
|
||||
const QByteArray &content = QByteArray::fromStdString(structureElements[0].properties());
|
||||
const QByteArray &content = QByteArray::fromStdString(structureElements[0].properties);
|
||||
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
WARNING_LOG(m_logger) << "Invalid properties for MSE " << data.id() << ", " << data.name();
|
||||
WARNING_LOG(m_logger) << "Invalid properties for MSE " << data.id << ", " << data.name;
|
||||
else
|
||||
{
|
||||
const QJsonArray exercises(QJsonObject(doc.object()).value(QStringLiteral("available_in_exercise")).toArray());
|
||||
@@ -239,7 +229,7 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureMan
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " m_bldgsInExcersise updated."
|
||||
<< " (mseId=" << mseId << " name=" << data.name();
|
||||
<< " (mseId=" << mseId << " name=" << data.name;
|
||||
emit buildingsInCurrentExerciseChanged();
|
||||
}
|
||||
}
|
||||
@@ -251,52 +241,52 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureMan
|
||||
|
||||
if (m_exerciseId == 0 || (m_exerciseId > 0 && exeIds.contains(m_exerciseId)))
|
||||
{
|
||||
const auto &structureElements = data.elements();
|
||||
const auto &structureElements = data.elements;
|
||||
for (const StructureElement ¤tStructEle : structureElements)
|
||||
{
|
||||
if (currentStructEle.mountingPointTypeId() == MountingPointType::Undefined)
|
||||
if (currentStructEle.mountingPointTypeId == MountingPointType::Unknown)
|
||||
continue;
|
||||
|
||||
StructureElement seFloor;
|
||||
const std::vector<int32_t> &curPath = currentStructEle.path();
|
||||
const std::vector<int32_t> &curPath = currentStructEle.path;
|
||||
if (curPath.size() == 4)
|
||||
{
|
||||
|
||||
|
||||
if (!m_dtc->getStructureElementById(curPath[1], seFloor))
|
||||
|
||||
|
||||
if (!m_dtc->getStructureElementById(curPath[1], seFloor))
|
||||
WARNING_LOG(m_logger) << " getStructureElementById failed for " << curPath[1];
|
||||
|
||||
}
|
||||
|
||||
const int floorId = QString::fromStdString(seFloor.name()).split(QStringLiteral("_")).value(1, QStringLiteral("-10")).toInt();
|
||||
const int floorId = QString::fromStdString(seFloor.name).split(QStringLiteral("_")).value(1, QStringLiteral("-10")).toInt();
|
||||
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
|
||||
|
||||
const auto it = m_mountingPoints.find(currentStructEle.id());
|
||||
const auto it = m_mountingPoints.find(currentStructEle.id);
|
||||
if (it != m_mountingPoints.end())
|
||||
{
|
||||
MountingPoint &mountingPointRef = *it;
|
||||
|
||||
if (mountingPointRef.data().id() == currentStructEle.id())
|
||||
if (mountingPointRef.data().id == currentStructEle.id)
|
||||
continue;
|
||||
|
||||
mountingPointRef.updateData(currentStructEle, floorId);
|
||||
emit mountingPointChanged(mountingPointRef, ParticipantManagement::DataModification::eModified);
|
||||
emit mountingPointChanged(mountingPointRef, DataModification::eModified);
|
||||
} else {
|
||||
DEBUG_LOG(m_logger) << "New Mounting point with id " << currentStructEle.id()
|
||||
<< " and type " << static_cast<int>(currentStructEle.mountingPointTypeId())
|
||||
<< " subid: " << currentStructEle.mountingPointId() << this;
|
||||
DEBUG_LOG(m_logger) << "New Mounting point with id " << currentStructEle.id
|
||||
<< " and type " << static_cast<int>(currentStructEle.mountingPointTypeId)
|
||||
<< " subid: " << currentStructEle.mountingPointId << this;
|
||||
|
||||
MountingPoint newMountingPoint(currentStructEle, floorId);
|
||||
const int assetId = m_mountingPointAssetMap.value(newMountingPoint.data().id(), -1);
|
||||
const int assetId = m_mountingPointAssetMap.value(newMountingPoint.data().id, -1);
|
||||
newMountingPoint.setAssociatedAssetId(assetId);
|
||||
|
||||
|
||||
m_mountingPoints.insert(newMountingPoint.data().id(), newMountingPoint);
|
||||
emit mountingPointChanged(newMountingPoint, ParticipantManagement::DataModification::eAdded);
|
||||
}
|
||||
|
||||
m_mountingPoints.insert(newMountingPoint.data().id, newMountingPoint);
|
||||
emit mountingPointChanged(newMountingPoint, DataModification::eAdded);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -306,11 +296,11 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureMan
|
||||
}
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, InfrastructureManagement::Interface::DataModification modType)
|
||||
void ForeignInterfaceImpl::onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, DataModification modType)
|
||||
{
|
||||
const int32_t structureElementId = data.structureElementId();
|
||||
const int32_t structureElementId = data.structureElementId;
|
||||
|
||||
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged se id: " << structureElementId << ", assetId: " << data.assetId();
|
||||
DEBUG_LOG(m_logger) << "onMountingPointAssetChanged se id: " << structureElementId << ", assetId: " << data.assetId;
|
||||
|
||||
|
||||
|
||||
@@ -321,10 +311,10 @@ void ForeignInterfaceImpl::onMountingPointAssetChanged(const InfrastructureManag
|
||||
|
||||
MountingPoint &mpRef = m_mountingPoints[structureElementId];
|
||||
|
||||
if (modType == InfrastructureManagement::Interface::DataModification::eRemoved)
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
m_mountingPointAssetMap.remove(structureElementId);
|
||||
if (mpRef.data().id() > 0)
|
||||
if (mpRef.data().id > 0)
|
||||
{
|
||||
mpRef.setAssociatedAssetId(-1);
|
||||
mpRef.setHasAssociatedAssetDefect(false);
|
||||
@@ -332,43 +322,43 @@ void ForeignInterfaceImpl::onMountingPointAssetChanged(const InfrastructureManag
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mountingPointAssetMap.insert(structureElementId, data.assetId());
|
||||
if (mpRef.data().id() > 0)
|
||||
m_mountingPointAssetMap.insert(structureElementId, data.assetId);
|
||||
if (mpRef.data().id > 0)
|
||||
{
|
||||
mpRef.setAssociatedAssetId(data.assetId());
|
||||
mpRef.setHasAssociatedAssetDefect(m_dtc->instrumentationAsset(data.assetId()).assetStateId() == Interface::InstrumentationAssetState::Defect);
|
||||
mpRef.setAssociatedAssetId(data.assetId);
|
||||
mpRef.setHasAssociatedAssetDefect(m_dtc->instrumentationAsset(data.assetId).assetStateId == InstrumentationAssetState::Defect);
|
||||
}
|
||||
}
|
||||
|
||||
if (mpRef.data().id() > 0)
|
||||
emit mountingPointChanged(mpRef, ParticipantManagement::DataModification::eModified);
|
||||
if (mpRef.data().id > 0)
|
||||
emit mountingPointChanged(mpRef, DataModification::eModified);
|
||||
}
|
||||
|
||||
void ForeignInterfaceImpl::onMainScheduleChanged(const InfrastructureManagement::Interface::MainSchedule &data, InfrastructureManagement::Interface::DataModification modType)
|
||||
void ForeignInterfaceImpl::onMainScheduleChanged(const InfrastructureManagement::MainSchedule &data, DataModification modType)
|
||||
{
|
||||
if (m_scheduleId != data.id())
|
||||
if (m_scheduleId != data.id)
|
||||
return;
|
||||
|
||||
Q_UNUSED(modType);
|
||||
|
||||
QHash<int, Interface::MountingPointPlan> mppMap;
|
||||
for (const auto &elem : data.elements())
|
||||
mppMap[elem.structureElementId()] = elem;
|
||||
QHash<int, MountingPointPlan> mppMap;
|
||||
for (const auto &elem : data.elements)
|
||||
mppMap[elem.structureElementId] = elem;
|
||||
|
||||
|
||||
for (MountingPoint &mp : m_mountingPoints)
|
||||
{
|
||||
const Interface::MountingPointPlan &mpp = mppMap[mp.data().id()];
|
||||
const MountingPointState &mps = mpp.mountingPointState();
|
||||
const MountingPointPlan &mpp = mppMap[mp.data().id];
|
||||
const MountingPointState &mps = mpp.mountingPointState;
|
||||
|
||||
|
||||
if(mpp.structureElementId() != mp.data().id())
|
||||
|
||||
if(mpp.structureElementId != mp.data().id)
|
||||
{
|
||||
|
||||
if (mp.aimState() == MountingPointState::Idle)
|
||||
continue;
|
||||
mp.setAimState(MountingPointState::Idle);
|
||||
emit mountingPointChanged(mp, ParticipantManagement::DataModification::eModified);
|
||||
emit mountingPointChanged(mp, DataModification::eModified);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -376,7 +366,7 @@ void ForeignInterfaceImpl::onMainScheduleChanged(const InfrastructureManagement:
|
||||
continue;
|
||||
|
||||
mp.setAimState(mps);
|
||||
emit mountingPointChanged(mp, ParticipantManagement::DataModification::eModified);
|
||||
emit mountingPointChanged(mp, DataModification::eModified);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +393,7 @@ void ForeignInterfaceImpl::init()
|
||||
#ifdef PROCESS_MSE_SEQUENTIELL
|
||||
m_dtc->mainStructureElements([this](const InfrastructureManagement::MainStructureElement &data)
|
||||
{
|
||||
onMainStructureElementChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
|
||||
onMainStructureElementChanged(data, DataModification::eAdded);
|
||||
});
|
||||
#else
|
||||
|
||||
@@ -424,20 +414,20 @@ void ForeignInterfaceImpl::init()
|
||||
|
||||
|
||||
QtConcurrent::blockingMap(mseMap, [this](const InfrastructureManagement::MainStructureElement &data) {
|
||||
onMainStructureElementChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
|
||||
onMainStructureElementChanged(data, DataModification::eAdded);
|
||||
});
|
||||
#endif
|
||||
|
||||
m_dtc->mountingPointAssets([this](const InfrastructureManagement::MountingPointAsset &data)
|
||||
{
|
||||
onMountingPointAssetChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
|
||||
onMountingPointAssetChanged(data, DataModification::eAdded);
|
||||
});
|
||||
|
||||
// mainSchedules() returns QMap, iterate and notify for each schedule
|
||||
const auto& schedulesMap = m_dtc->mainSchedules();
|
||||
for (auto it = schedulesMap.begin(); it != schedulesMap.end(); ++it)
|
||||
{
|
||||
onMainScheduleChanged(it.value(), InfrastructureManagement::Interface::DataModification::eAdded);
|
||||
onMainScheduleChanged(it.value(), DataModification::eAdded);
|
||||
}
|
||||
|
||||
int firstBldg = -1;
|
||||
|
||||
+4
-4
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
|
||||
|
||||
ParticipantManagement::MainSchedule mainSchedule(int32_t scheduleId) override final;
|
||||
MainSchedule mainSchedule(int32_t scheduleId) override final;
|
||||
void setScheduleId(int32_t scheduleId) override final;
|
||||
int32_t scheduleId() const override final;
|
||||
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, InfrastructureManagement::Interface::DataModification modType);
|
||||
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, InfrastructureManagement::Interface::DataModification modType);
|
||||
void onMainScheduleChanged(const InfrastructureManagement::Interface::MainSchedule &data, InfrastructureManagement::Interface::DataModification modType);
|
||||
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
|
||||
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, DataModification modType);
|
||||
void onMainScheduleChanged(const InfrastructureManagement::MainSchedule &data, DataModification modType);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
+7
-5
@@ -9,6 +9,7 @@
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
#include <LtsWidgets/lts_overlay_loading.h>
|
||||
#include "ism_set_recording_dialog_requester.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
@@ -23,10 +24,10 @@ namespace
|
||||
static inline InfrastructureManagement::StructureElement findMountingPoint(const InfrastructureManagement::MainStructureElement &building,
|
||||
const InfrastructureManagement::SimpleRecordingData &guiMountingPoint)
|
||||
{
|
||||
Q_ASSERT(guiMountingPoint.mainStructureElementId == building.id());
|
||||
for (const auto ¤tStructureElement : building.elements())
|
||||
Q_ASSERT(guiMountingPoint.mainStructureElementId == building.id);
|
||||
for (const auto ¤tStructureElement : building.elements)
|
||||
{
|
||||
if (currentStructureElement.id() == guiMountingPoint.id)
|
||||
if (currentStructureElement.id == guiMountingPoint.id)
|
||||
return currentStructureElement;
|
||||
}
|
||||
|
||||
@@ -41,6 +42,7 @@ namespace InfrastructureManagement
|
||||
|
||||
SetRecordingDialog::SetRecordingDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_ui(new Ui::SetRecordingDialog)
|
||||
, m_ismDtc(nullptr)
|
||||
, m_ismFtc(nullptr)
|
||||
@@ -162,14 +164,14 @@ bool SetRecordingDialog::apply()
|
||||
const MainStructureElement &building = mse;
|
||||
StructureElement modifiedMountingPoint = findMountingPoint(building, affectedMountingPoint);
|
||||
|
||||
QJsonDocument propsDoc = QJsonDocument::fromJson(QByteArray::fromStdString(modifiedMountingPoint.properties()));
|
||||
QJsonDocument propsDoc = QJsonDocument::fromJson(QByteArray::fromStdString(modifiedMountingPoint.properties));
|
||||
QJsonObject propsObj;
|
||||
if (propsDoc.isObject())
|
||||
propsObj = propsDoc.object();
|
||||
|
||||
propsObj.insert(QLatin1String("record"), affectedMountingPoint.shallHaveRecordingOn);
|
||||
|
||||
modifiedMountingPoint.properties(QJsonDocument(propsObj).toJson(QJsonDocument::Compact).toStdString());
|
||||
modifiedMountingPoint.properties = QJsonDocument(propsObj).toJson(QJsonDocument::Compact).toStdString();
|
||||
modifiedElements[buildingId].push_back(modifiedMountingPoint);
|
||||
}
|
||||
|
||||
|
||||
+22
-20
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_set_recording_dialog_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
@@ -13,9 +14,10 @@
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
|
||||
SetRecordingDialogModel::SetRecordingDialogModel(QObject *parent) : NGLTreeModel(parent, new NGLTreeItem(QVariant()),,
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) { tr("Name") })
|
||||
SetRecordingDialogModel::SetRecordingDialogModel(QObject *parent)
|
||||
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), { tr("Name") })
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,10 +80,10 @@ void SetRecordingDialogModel::initData()
|
||||
QMap<qint32, qint32> mapMse2groupId;
|
||||
for (auto it = mainStructEles.constBegin(); it != mainStructEles.constEnd(); ++it)
|
||||
{
|
||||
mapMse2groupId.insert(it.value().id(), it.value().groupId());
|
||||
for (const StructureElement ¤tElement : it.value().elements())
|
||||
mapMse2groupId.insert(it.value().id, it.value().groupId);
|
||||
for (const StructureElement ¤tElement : it.value().elements)
|
||||
{
|
||||
allStructureElements.insert(currentElement.id(), currentElement);
|
||||
allStructureElements.insert(currentElement.id, currentElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,16 +94,16 @@ void SetRecordingDialogModel::initData()
|
||||
{
|
||||
NGLTreeItem *item = nullptr;
|
||||
|
||||
if (it.value().structureElementTypeId() == StructureElementType::MountingPoint)
|
||||
if (it.value().structureElementTypeId == StructureElementType::MountingPoint)
|
||||
{
|
||||
if (it.value().mountingPointTypeId() != MountingPointType::IndoorCamera &&
|
||||
it.value().mountingPointTypeId() != MountingPointType::OutdoorCamera)
|
||||
if (it.value().mountingPointTypeId != MountingPointType::IndoorCamera &&
|
||||
it.value().mountingPointTypeId != MountingPointType::OutdoorCamera)
|
||||
continue;
|
||||
|
||||
item = new NGLTreeItem(QVariant::fromValue(toSimpleRecordingData(it.value())));
|
||||
}
|
||||
else
|
||||
item = new NGLTreeItem(QString::fromStdString(it.value().displayName()));
|
||||
item = new NGLTreeItem(QString::fromStdString(it.value().displayName));
|
||||
|
||||
|
||||
structEleIdToItem.insert(it.key(), item);
|
||||
@@ -130,16 +132,16 @@ void SetRecordingDialogModel::initData()
|
||||
for (auto it = structEleIdToItem.begin(); it != structEleIdToItem.end(); ++it)
|
||||
{
|
||||
StructureElement structureElement = allStructureElements.value(it.key());
|
||||
int32_t pathSize = structureElement.path().size();
|
||||
int32_t pathSize = structureElement.path.size();
|
||||
|
||||
NGLTreeItem *parent = mapGroup.value(defaultSectionId);
|
||||
if (pathSize > 1)
|
||||
{
|
||||
parent = structEleIdToItem.value(structureElement.path().at(pathSize - 2));
|
||||
parent = structEleIdToItem.value(structureElement.path.at(pathSize - 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
const int sectionId = mapMse2groupId.value(structureElement.mainStructureElementId(), -1);
|
||||
const int sectionId = mapMse2groupId.value(structureElement.mainStructureElementId, -1);
|
||||
if(sectionId != -1)
|
||||
{
|
||||
parent = mapGroup.value(sectionId);
|
||||
@@ -248,22 +250,22 @@ SimpleRecordingData SetRecordingDialogModel::toSimpleRecordingData(const Structu
|
||||
SimpleRecordingData result;
|
||||
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(mountingPoint.properties()), &parseError);
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(mountingPoint.properties), &parseError);
|
||||
if (parseError.error != QJsonParseError::NoError)
|
||||
result.hasRecordingOn = false;
|
||||
else
|
||||
result.hasRecordingOn = doc.object().value(QLatin1String("record")).toBool();
|
||||
|
||||
result.mainStructureElementId = mountingPoint.mainStructureElementId();
|
||||
result.mainStructureElementId = mountingPoint.mainStructureElementId;
|
||||
|
||||
if (mountingPoint.displayName().size())
|
||||
result.name = QString::fromStdString(mountingPoint.displayName());
|
||||
else if (mountingPoint.name().size())
|
||||
result.name = QString::fromStdString(mountingPoint.name());
|
||||
if (mountingPoint.displayName.size())
|
||||
result.name = QString::fromStdString(mountingPoint.displayName);
|
||||
else if (mountingPoint.name.size())
|
||||
result.name = QString::fromStdString(mountingPoint.name);
|
||||
else
|
||||
result.name = QStringLiteral("MP_%1").arg(mountingPoint.id());
|
||||
result.name = QStringLiteral("MP_%1").arg(mountingPoint.id);
|
||||
|
||||
result.id = mountingPoint.id();
|
||||
result.id = mountingPoint.id;
|
||||
result.shallHaveRecordingOn = result.hasRecordingOn;
|
||||
|
||||
return result;
|
||||
|
||||
+5
-3
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <QtWidgets/QTreeView>
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
@@ -21,6 +22,7 @@ namespace InfrastructureManagement
|
||||
|
||||
ExerciseAssignmentDialog::ExerciseAssignmentDialog(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::ExerciseAssignmentDialog)
|
||||
, m_ismDtc(nullptr)
|
||||
@@ -76,7 +78,7 @@ bool ExerciseAssignmentDialog::init(const std::shared_ptr<Interface::Dtc> &ismDt
|
||||
const QMap<qint32, ExerciseManagement::Exercise> exercises = m_exmDtc->exercises();
|
||||
m_ui->cbExercises->addItem(QStringLiteral("-"), 0);
|
||||
for (const auto &exercise : exercises)
|
||||
m_ui->cbExercises->addItem(QString::fromStdString(exercise.name()), exercise.id());
|
||||
m_ui->cbExercises->addItem(QString::fromStdString(exercise.name), exercise.id);
|
||||
|
||||
m_ui->pbAssigned->setEnabled(false);
|
||||
|
||||
@@ -118,14 +120,14 @@ void ExerciseAssignmentDialog::onAssignedClicked()
|
||||
MainStructureElement &req = request;
|
||||
req = m_model->getRowData(index.row());
|
||||
|
||||
QJsonObject obj = QJsonDocument::fromJson(QByteArray::fromStdString(request.properties())).object();
|
||||
QJsonObject obj = QJsonDocument::fromJson(QByteArray::fromStdString(request.properties)).object();
|
||||
|
||||
|
||||
QJsonArray array;
|
||||
if (m_ui->cbExercises->currentIndex() != 0)
|
||||
array.push_back(m_ui->cbExercises->currentData().toInt());
|
||||
obj.insert(QStringLiteral("available_in_exercise"), array);
|
||||
request.properties(QJsonDocument(obj).toJson(QJsonDocument::Compact).toStdString());
|
||||
request.properties = QJsonDocument(obj).toJson(QJsonDocument::Compact).toStdString();
|
||||
|
||||
return m_ismFtc->mainStructureElementModifyRequest(request, this);
|
||||
|
||||
|
||||
+9
-7
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_exercise_assignment_dialog_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
@@ -16,6 +17,7 @@ ExerciseAssignmentDialogModel::ExerciseAssignmentDialogModel(QObject *parent)
|
||||
tr("Assigned Exercise")
|
||||
},
|
||||
parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_dtc(nullptr)
|
||||
, m_exmDtc(nullptr)
|
||||
{
|
||||
@@ -35,19 +37,19 @@ QVariant ExerciseAssignmentDialogModel::data(const QModelIndex &index, int role)
|
||||
switch (index.column())
|
||||
{
|
||||
case NAME:
|
||||
return m_dtc->getBuildingDisplayName(currentMainStructureElement.id());
|
||||
return m_dtc->getBuildingDisplayName(currentMainStructureElement.id);
|
||||
case ASSIGNED_EXERCISES:
|
||||
{
|
||||
if (!currentMainStructureElement.properties().size())
|
||||
if (!currentMainStructureElement.properties.size())
|
||||
return QChar(QLatin1Char('-'));
|
||||
|
||||
QJsonParseError parseError;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(currentMainStructureElement.properties()), &parseError);
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(currentMainStructureElement.properties), &parseError);
|
||||
|
||||
if (parseError.error != QJsonParseError::NoError)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Could not parse JSON props of building with ID "
|
||||
<< currentMainStructureElement.id()
|
||||
<< currentMainStructureElement.id
|
||||
<< ". Reason: "
|
||||
<< parseError.errorString()
|
||||
<< "; JSON: "
|
||||
@@ -68,7 +70,7 @@ QVariant ExerciseAssignmentDialogModel::data(const QModelIndex &index, int role)
|
||||
if (exercise.size())
|
||||
{
|
||||
int exId = exercise.toInt();
|
||||
return QString::fromStdString(m_exmDtc->exercise(exId).name());
|
||||
return QString::fromStdString(m_exmDtc->exercise(exId).name);
|
||||
}
|
||||
return QChar(QLatin1Char('-'));
|
||||
}
|
||||
@@ -110,7 +112,7 @@ bool ExerciseAssignmentDialogModel::initModel(const std::shared_ptr<Interface::D
|
||||
bool ExerciseAssignmentDialogModel::isFiltered(const InfrastructureManagement::MainStructureElement &data, DataModification modType) const
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
return (data.structureElementTypeId() != InfrastructureManagement::StructureElementType::Building &&
|
||||
data.structureElementTypeId() != InfrastructureManagement::StructureElementType::Announcement);
|
||||
return (data.structureElementTypeId != InfrastructureManagement::StructureElementType::Building &&
|
||||
data.structureElementTypeId != InfrastructureManagement::StructureElementType::Announcement);
|
||||
}
|
||||
|
||||
+13
-13
@@ -19,14 +19,14 @@ bool IsmComboBox::fill(LtsWidgets::LtsComboBox *cbx, IsmComboBoxType type, LtsSe
|
||||
{
|
||||
auto cb = [cbx,filter](const InfrastructureManagement::MainStructureElement &mse)
|
||||
{
|
||||
if (mse.structureElementTypeId() == InfrastructureManagement::StructureElementType::RadioStation && !mse.isDeleted() && mse.id() > 0 )
|
||||
if (mse.structureElementTypeId == InfrastructureManagement::StructureElementType::RadioStation && !mse.isDeleted && mse.id > 0 )
|
||||
{
|
||||
const RadioStation &rs = RadioStation::fromMSE(mse);
|
||||
if (((filter >= 0) && rs.radios.contains(static_cast<FrequencyBand>(filter))) ||
|
||||
(filter < 0))
|
||||
{
|
||||
cbx->addItem(QString::fromStdString(mse.name()), mse.id());
|
||||
cbx->setItemData(cbx->findData(mse.id()), rs.radioStationId, Qt::UserRole + 1);
|
||||
cbx->addItem(QString::fromStdString(mse.name), mse.id);
|
||||
cbx->setItemData(cbx->findData(mse.id), rs.radioStationId, Qt::UserRole + 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -37,10 +37,10 @@ bool IsmComboBox::fill(LtsWidgets::LtsComboBox *cbx, IsmComboBoxType type, LtsSe
|
||||
{
|
||||
auto cb = [cbx](const InfrastructureManagement::MainStructureElement &mse)
|
||||
{
|
||||
if ((mse.structureElementTypeId() == InfrastructureManagement::StructureElementType::ApproachingPoint) && !mse.isDeleted() && (mse.id() > 0))
|
||||
if ((mse.structureElementTypeId == InfrastructureManagement::StructureElementType::ApproachingPoint) && !mse.isDeleted && (mse.id > 0))
|
||||
{
|
||||
cbx->addItem(QString::fromStdString(mse.name()), mse.id());
|
||||
cbx->setItemData(cbx->findData(mse.id()), mse.angle(), Qt::UserRole + 1);
|
||||
cbx->addItem(QString::fromStdString(mse.name), mse.id);
|
||||
cbx->setItemData(cbx->findData(mse.id), mse.angle, Qt::UserRole + 1);
|
||||
}
|
||||
};
|
||||
dtc->mainStructureElements(cb);
|
||||
@@ -48,14 +48,14 @@ bool IsmComboBox::fill(LtsWidgets::LtsComboBox *cbx, IsmComboBoxType type, LtsSe
|
||||
}
|
||||
case IsmComboBoxType::CbScheduleStatus:
|
||||
{
|
||||
cbx->addItem(toString(ScheduleStatus::Active), ScheduleStatus::Active);
|
||||
cbx->addItem(toString(ScheduleStatus::Inactive), ScheduleStatus::Inactive);
|
||||
cbx->addItem(toString(ScheduleStatus::Active), static_cast<int>(ScheduleStatus::Active));
|
||||
cbx->addItem(toString(ScheduleStatus::Inactive), static_cast<int>(ScheduleStatus::Inactive));
|
||||
break;
|
||||
}
|
||||
case IsmComboBoxType::CbBridgeStatus:
|
||||
{
|
||||
cbx->addItem(toString(BridgeStatus::Intact), BridgeStatus::Intact);
|
||||
cbx->addItem(toString(BridgeStatus::Broken), BridgeStatus::Broken);
|
||||
cbx->addItem(toString(BridgeStatus::Intact), static_cast<int>(BridgeStatus::Intact));
|
||||
cbx->addItem(toString(BridgeStatus::Broken), static_cast<int>(BridgeStatus::Broken));
|
||||
}
|
||||
case IsmComboBoxType::CbUnknown:
|
||||
default:
|
||||
@@ -68,10 +68,10 @@ bool IsmComboBox::fill(LtsWidgets::LtsComboBox *cbx, IsmComboBoxType type, LtsSe
|
||||
RadioStation RadioStation::fromMSE(const MainStructureElement &mse)
|
||||
{
|
||||
RadioStation rs;
|
||||
rs.mse_id = mse.id();
|
||||
rs.name = QString::fromStdString(mse.name());
|
||||
rs.mse_id = mse.id;
|
||||
rs.name = QString::fromStdString(mse.name);
|
||||
|
||||
LtsUtils::JsonObject jo = LtsUtils::JsonObject::fromJson(mse.properties());
|
||||
LtsUtils::JsonObject jo = LtsUtils::JsonObject::fromJson(mse.properties);
|
||||
LtsUtils::JsonArray radios = jo.valueOr<LtsUtils::JsonArray>("radios", {});
|
||||
|
||||
|
||||
|
||||
+4
-2
@@ -9,12 +9,14 @@
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QtWidgets/QTreeView>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
|
||||
ApproachingPointsDialog::ApproachingPointsDialog(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::ApproachingPointsDialog)
|
||||
, m_model(nullptr)
|
||||
@@ -91,7 +93,7 @@ void ApproachingPointsDialog::onItemDoubleClicked()
|
||||
return;
|
||||
}
|
||||
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("EditApproachingPoint%1").arg(approachingPoint.id()), LtsWidgets::LayoutArea::eDialogTab);
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("EditApproachingPoint%1").arg(approachingPoint.id), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void ApproachingPointsDialog::onPrint()
|
||||
@@ -106,7 +108,7 @@ void ApproachingPointsDialog::onAddApproachingPoint()
|
||||
EditApproachingPointDialog *dialog = new EditApproachingPointDialog(this);
|
||||
|
||||
MainStructureElement approachingPoint = m_model->getRowData(currentIndex.row());
|
||||
approachingPoint.id(0);
|
||||
approachingPoint.id = 0;
|
||||
if (!dialog->init(m_ftc, m_sitMapIfc, approachingPoint))
|
||||
{
|
||||
delete dialog;
|
||||
|
||||
+8
-6
@@ -9,6 +9,7 @@
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
@@ -22,6 +23,7 @@ ApproachingPointsDialogModel::ApproachingPointsDialogModel(QObject *parent)
|
||||
tr("Special Type"),
|
||||
tr("Properties")},
|
||||
parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,21 +37,21 @@ QVariant ApproachingPointsDialogModel::data(const QModelIndex &index, int role)
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return currentPoint.id();
|
||||
return currentPoint.id;
|
||||
case Name:
|
||||
return QString::fromStdString(currentPoint.name());
|
||||
return QString::fromStdString(currentPoint.name);
|
||||
case Description:
|
||||
{
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(currentPoint.description()));
|
||||
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromStdString(currentPoint.description));
|
||||
const QString jsonKey = QLatin1String("description");
|
||||
if (!doc.isObject())
|
||||
return QVariant();
|
||||
return doc.object().value(jsonKey).toString();
|
||||
}
|
||||
case Position:
|
||||
return LtsCoordTrans::mgrsFromGeographic(currentPoint.geoPosition().lon(), currentPoint.geoPosition().lat());
|
||||
return LtsCoordTrans::mgrsFromGeographic(currentPoint.geoPosition.lon, currentPoint.geoPosition.lat);
|
||||
case Orientation:
|
||||
return calculateCardinalDirection(currentPoint.angle());
|
||||
return calculateCardinalDirection(currentPoint.angle);
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
@@ -101,7 +103,7 @@ QString ApproachingPointsDialogModel::calculateCardinalDirection(double degree,
|
||||
bool ApproachingPointsDialogModel::isFiltered(const InfrastructureManagement::MainStructureElement &data, DataModification modType) const
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
return (data.structureElementTypeId() != InfrastructureManagement::StructureElementType::ApproachingPoint);
|
||||
return (data.structureElementTypeId != InfrastructureManagement::StructureElementType::ApproachingPoint);
|
||||
}
|
||||
|
||||
}
|
||||
+22
-20
@@ -10,6 +10,7 @@
|
||||
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <QtCore/QJsonDocument>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
@@ -17,6 +18,7 @@ namespace InfrastructureManagement
|
||||
|
||||
EditApproachingPointDialog::EditApproachingPointDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_ui(new Ui::EditApproachingPointDialog)
|
||||
, m_ftc(nullptr)
|
||||
, m_sitMapGuiIfc(nullptr)
|
||||
@@ -65,33 +67,33 @@ bool EditApproachingPointDialog::apply()
|
||||
{
|
||||
MainStructureElementModifyRequest request;
|
||||
|
||||
request.id(m_approachingPoint.id());
|
||||
request.name(m_ui->leName->text().toStdString());
|
||||
request.angle(m_ui->cbDepartureDirection->currentData().toDouble());
|
||||
request.id = m_approachingPoint.id;
|
||||
request.name = m_ui->leName->text().toStdString();
|
||||
request.angle = m_ui->cbDepartureDirection->currentData().toDouble();
|
||||
|
||||
request.properties("{}");
|
||||
request.structureElementId(m_approachingPoint.structureElementId());
|
||||
request.structureElementTypeId(InfrastructureManagement::StructureElementType::ApproachingPoint);
|
||||
request.properties = "{}";
|
||||
request.structureElementId = m_approachingPoint.structureElementId;
|
||||
request.structureElementTypeId = InfrastructureManagement::StructureElementType::ApproachingPoint;
|
||||
|
||||
QJsonObject objDescription;
|
||||
objDescription.insert(QLatin1String("description"), m_ui->leDescription->text());
|
||||
request.description(QJsonDocument(objDescription).toJson(QJsonDocument::Compact).toStdString());
|
||||
request.description = QJsonDocument(objDescription).toJson(QJsonDocument::Compact).toStdString();
|
||||
|
||||
const Core::GeoPosition pos(m_ui->positionEdit->coordinate().x(),m_ui->positionEdit->coordinate().y(), 0);
|
||||
request.geoPosition(pos);
|
||||
request.geoPosition = pos;
|
||||
|
||||
|
||||
if (m_approachingPoint.id() == 0)
|
||||
if (m_approachingPoint.id == 0)
|
||||
{
|
||||
StructureElement seData;
|
||||
seData.name(request.name());
|
||||
seData.displayName(request.name());
|
||||
seData.structureElementTypeId(InfrastructureManagement::StructureElementType::ApproachingPoint);
|
||||
seData.mountingPointTypeId(InfrastructureManagement::MountingPointType::Unknown);
|
||||
seData.properties("{}");
|
||||
seData.name = request.name;
|
||||
seData.displayName = request.name;
|
||||
seData.structureElementTypeId = InfrastructureManagement::StructureElementType::ApproachingPoint;
|
||||
seData.mountingPointTypeId = InfrastructureManagement::MountingPointType::Unknown;
|
||||
seData.properties = "{}";
|
||||
|
||||
request.elements().resize(1, seData);
|
||||
request.childParentRelations().resize(1, -1);
|
||||
request.elements.resize(1, seData);
|
||||
request.childParentRelations.resize(1, -1);
|
||||
}
|
||||
|
||||
return m_ftc->mainStructureElementModifyRequest(request, this);
|
||||
@@ -114,15 +116,15 @@ void EditApproachingPointDialog::setData(const MainStructureElement &approaching
|
||||
{
|
||||
m_approachingPoint = approachingPoint;
|
||||
|
||||
m_ui->leName->setText(QString::fromStdString(m_approachingPoint.name()));
|
||||
QJsonObject objDescription = QJsonDocument::fromJson(QByteArray::fromStdString(m_approachingPoint.description())).object();
|
||||
m_ui->leName->setText(QString::fromStdString(m_approachingPoint.name));
|
||||
QJsonObject objDescription = QJsonDocument::fromJson(QByteArray::fromStdString(m_approachingPoint.description)).object();
|
||||
QString strDescription = objDescription.value(QLatin1String("description")).toString();
|
||||
m_ui->leDescription->setText(strDescription);
|
||||
QPointF pos(m_approachingPoint.geoPosition().lon(), m_approachingPoint.geoPosition().lat());
|
||||
QPointF pos(m_approachingPoint.geoPosition.lon, m_approachingPoint.geoPosition.lat);
|
||||
if (!pos.isNull())
|
||||
m_ui->positionEdit->setCoordinate(pos);
|
||||
|
||||
m_ui->cbDepartureDirection->setCurrentIndex( (int) ((approachingPoint.angle() / 45) + 0.5) % 8);
|
||||
m_ui->cbDepartureDirection->setCurrentIndex( (int) ((approachingPoint.angle / 45) + 0.5) % 8);
|
||||
}
|
||||
|
||||
void EditApproachingPointDialog::getPosition()
|
||||
|
||||
+77
-78
@@ -20,23 +20,26 @@
|
||||
#include <QtGui/QAction>
|
||||
#include <QtCore/QTimer>
|
||||
#include <vector>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
|
||||
static QHash<int, QString> &INSTRUMENTATION_ASSET_STATES()
|
||||
{
|
||||
static QHash<int, QString> s_ret
|
||||
static QHash<int, QString> s_ret;
|
||||
if (s_ret.isEmpty())
|
||||
{
|
||||
{InstrumentationAssetState::Unmounted, QLatin1String("Unmounted")},
|
||||
{InstrumentationAssetState::Mounted, QLatin1String("Mounted")},
|
||||
{InstrumentationAssetState::Defect, QLatin1String("Defect")}
|
||||
};
|
||||
s_ret.insert(static_cast<int>(InstrumentationAssetState::Unmounted), QLatin1String("Unmounted"));
|
||||
s_ret.insert(static_cast<int>(InstrumentationAssetState::Mounted), QLatin1String("Mounted"));
|
||||
s_ret.insert(static_cast<int>(InstrumentationAssetState::Defect), QLatin1String("Defect"));
|
||||
}
|
||||
return s_ret;
|
||||
}
|
||||
|
||||
AssetListDialog::AssetListDialog(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_session(session)
|
||||
, m_model(nullptr)
|
||||
, m_menuGroup(menuGroup)
|
||||
@@ -82,15 +85,15 @@ bool AssetListDialog::apply()
|
||||
if (!rowContainsAlteredData(m_model->alteredRows().at(i)))
|
||||
continue;
|
||||
asset = m_model->getRowData(i);
|
||||
InstrumentationAssetModifyRequest request(asset.id(),
|
||||
asset.name(),
|
||||
asset.mountingPointTypeId(),
|
||||
asset.barcode(),
|
||||
asset.hostname(),
|
||||
asset.properties(),
|
||||
asset.assetStateId(),
|
||||
asset.lastUpdated(),
|
||||
asset.availableInExercise());
|
||||
InstrumentationAssetModifyRequest request(asset.id,
|
||||
asset.name,
|
||||
asset.mountingPointTypeId,
|
||||
asset.barcode,
|
||||
asset.hostname,
|
||||
asset.properties,
|
||||
asset.assetStateId,
|
||||
asset.lastUpdated,
|
||||
asset.availableInExercise);
|
||||
m_requestHelper->addRequest([request, this]()
|
||||
{
|
||||
return m_ftc->instrumentationAssetModifyRequest(request, this);
|
||||
@@ -144,7 +147,7 @@ QVector<QString> AssetListDialog::getExportString(const AssetFilterDialog::Expor
|
||||
for (int i = 0; i < m_model->rowCount(); ++i)
|
||||
{
|
||||
const InstrumentationAsset &ia = m_model->getRowData(i);
|
||||
if (toString(ia.mountingPointTypeId()) == type)
|
||||
if (toString(ia.mountingPointTypeId) == type)
|
||||
vecOut << exportData(ia);
|
||||
}
|
||||
break;
|
||||
@@ -159,18 +162,18 @@ QVector<QString> AssetListDialog::getExportString(const AssetFilterDialog::Expor
|
||||
|
||||
QString AssetListDialog::exportData(const InstrumentationAsset &ia, const QString &separator)
|
||||
{
|
||||
const QByteArray &properties = QByteArray::fromRawData(ia.properties().c_str(), ia.properties().size());
|
||||
const QByteArray &properties = QByteArray::fromRawData(ia.properties.c_str(), ia.properties.size());
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(properties));
|
||||
const QJsonObject obj(doc.object());
|
||||
|
||||
const QString &name = QString::fromStdString(ia.name());
|
||||
const QString &name = QString::fromStdString(ia.name);
|
||||
const int nameSep = name.lastIndexOf(QLatin1Char('_'));
|
||||
const QString &dmc = QString::fromStdString(ia.barcode());
|
||||
const QString &dmc = QString::fromStdString(ia.barcode);
|
||||
const QString &tkz = name.mid(0, nameSep);
|
||||
const QString &snr = nameSep >= 0 ? name.mid(nameSep + 1) : QString();
|
||||
const QString &mac = obj.value(QStringLiteral("mac")).toString();
|
||||
const QString &status = INSTRUMENTATION_ASSET_STATES().value(ia.assetStateId().underlying());
|
||||
const QString &bz = ia.isUsed() ? QStringLiteral("Mounted") : QStringLiteral("Unmounted");
|
||||
const QString &status = INSTRUMENTATION_ASSET_STATES().value(static_cast<int>(ia.assetStateId));
|
||||
const QString &bz = ia.isUsed ? QStringLiteral("Mounted") : QStringLiteral("Unmounted");
|
||||
const QString &oc = QString::number(obj.value(QStringLiteral("opticalCode")).toInt());
|
||||
const QString &ls = obj.value(QStringLiteral("hasSpeaker")).toBool() ? QStringLiteral("1") : QStringLiteral("0");
|
||||
const QString &mf = obj.value(QStringLiteral("hasMicrophone")).toBool() ? QStringLiteral("1") : QStringLiteral("0");
|
||||
@@ -178,16 +181,16 @@ QString AssetListDialog::exportData(const InstrumentationAsset &ia, const QStrin
|
||||
const QString &user = obj.value(QStringLiteral("username")).toString();
|
||||
const QString &pass = obj.value(QStringLiteral("password")).toString();
|
||||
const QString &props = QString::fromUtf8(properties);
|
||||
const QString &lastMod = QDateTime::fromMSecsSinceEpoch(ia.lastUpdated()).toString();
|
||||
const QString &lastMod = QDateTime::fromMSecsSinceEpoch(ia.lastUpdated).toString();
|
||||
|
||||
return QStringList({dmc, tkz, snr, mac, status, bz, oc, ls, mf, vapix, user, pass, props, lastMod}).join(separator);
|
||||
}
|
||||
|
||||
static std::string unquote(const QStringRef &in)
|
||||
static std::string unquote(const QString &in)
|
||||
{
|
||||
if (!in.startsWith(QLatin1Char('"')) && !in.endsWith(QLatin1Char('"')))
|
||||
return in.toString().toStdString();
|
||||
QString out = in.mid(1, in.length() - 2).toString();
|
||||
return in.toStdString();
|
||||
QString out = in.mid(1, in.length() - 2);
|
||||
out.replace(QStringLiteral("\"\""), QStringLiteral("\""));
|
||||
return out.toStdString();
|
||||
}
|
||||
@@ -200,37 +203,33 @@ static inline void setJson(QJsonObject &obj, const QString &key, bool bVal)
|
||||
else
|
||||
obj[key] = bVal;
|
||||
}
|
||||
static inline void setJson(QJsonObject &obj, const QString &key, const QStringRef &val)
|
||||
static inline void setJson(QJsonObject &obj, const QString &key, const QString &val)
|
||||
{
|
||||
if (val.isEmpty())
|
||||
obj.remove(key);
|
||||
else
|
||||
obj[key] = val.toString();
|
||||
}
|
||||
static inline void setJson(QJsonObject &obj, const QString &key, const QString &val)
|
||||
{
|
||||
setJson(obj, key, QStringRef(&val));
|
||||
obj[key] = val;
|
||||
}
|
||||
|
||||
InstrumentationAsset AssetListDialog::importData(const QVector<QStringRef> &segments, bool *bOk) const
|
||||
InstrumentationAsset AssetListDialog::importData(const QVector<QString> &segments, bool *bOk) const
|
||||
{
|
||||
if (bOk)
|
||||
*bOk = true;
|
||||
const int len = segments.size();
|
||||
|
||||
const QStringRef &dmc = segments.at(0);
|
||||
const QStringRef &tkz = segments.at(1);
|
||||
const QStringRef &snr = segments.at(2);
|
||||
const QStringRef &mac = segments.at(3);
|
||||
const QStringRef &status = segments.at(4);
|
||||
|
||||
const QStringRef &oc = segments.at(6);
|
||||
const QStringRef &ls = segments.at(7);
|
||||
const QStringRef &mf = segments.at(8);
|
||||
const QStringRef &vapix = segments.at(9);
|
||||
const QStringRef &user = len > 10 ? segments.at(10) : QStringRef();
|
||||
const QStringRef &pass = len > 11 ? segments.at(11) : QStringRef();
|
||||
const QStringRef &props = len > 12 ? segments.at(12) : QStringRef();
|
||||
const QString &dmc = segments.at(0);
|
||||
const QString &tkz = segments.at(1);
|
||||
const QString &snr = segments.at(2);
|
||||
const QString &mac = segments.at(3);
|
||||
const QString &status = segments.at(4);
|
||||
|
||||
const QString &oc = segments.at(6);
|
||||
const QString &ls = segments.at(7);
|
||||
const QString &mf = segments.at(8);
|
||||
const QString &vapix = segments.at(9);
|
||||
const QString &user = len > 10 ? segments.at(10) : QString();
|
||||
const QString &pass = len > 11 ? segments.at(11) : QString();
|
||||
const QString &props = len > 12 ? segments.at(12) : QString();
|
||||
|
||||
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(props.toUtf8()));
|
||||
@@ -246,26 +245,26 @@ InstrumentationAsset AssetListDialog::importData(const QVector<QStringRef> &segm
|
||||
const std::string snrStd = unquote(snr);
|
||||
const std::string tkzStd = unquote(tkz);
|
||||
InstrumentationAsset asset;
|
||||
asset.barcode() = unquote(dmc);
|
||||
asset.name() = snrStd.empty() ? tkzStd : std::string(tkzStd + '_' + snrStd);
|
||||
asset.assetStateId(static_cast<InstrumentationAssetState>(INSTRUMENTATION_ASSET_STATES().key(status.toString())));
|
||||
asset.properties() = QJsonDocument(obj).toJson(QJsonDocument::Compact).constData();
|
||||
|
||||
asset.barcode = unquote(dmc);
|
||||
asset.name = snrStd.empty() ? tkzStd : std::string(tkzStd + '_' + snrStd);
|
||||
asset.assetStateId = static_cast<InstrumentationAssetState>(INSTRUMENTATION_ASSET_STATES().key(status));
|
||||
asset.properties = QJsonDocument(obj).toJson(QJsonDocument::Compact).constData();
|
||||
|
||||
if (dmc.startsWith(QLatin1String("GSM")))
|
||||
asset.mountingPointTypeId(MountingPointType::BuildingSensorModule);
|
||||
asset.mountingPointTypeId = MountingPointType::BuildingSensorModule;
|
||||
else if (dmc.startsWith(QLatin1String("KAA")))
|
||||
asset.mountingPointTypeId(MountingPointType::OutdoorCamera);
|
||||
asset.mountingPointTypeId = MountingPointType::OutdoorCamera;
|
||||
else if (dmc.startsWith(QLatin1String("KAI")))
|
||||
asset.mountingPointTypeId(MountingPointType::IndoorCamera);
|
||||
asset.mountingPointTypeId = MountingPointType::IndoorCamera;
|
||||
else if (dmc.startsWith(QLatin1String("OPS")))
|
||||
asset.mountingPointTypeId(MountingPointType::IndoorIPS);
|
||||
asset.mountingPointTypeId = MountingPointType::IndoorIPS;
|
||||
else if (dmc.startsWith(QLatin1String("WD_")))
|
||||
asset.mountingPointTypeId(MountingPointType::EffectGenerationControlUnit);
|
||||
asset.mountingPointTypeId = MountingPointType::EffectGenerationControlUnit;
|
||||
else
|
||||
{
|
||||
if (bOk)
|
||||
*bOk = false;
|
||||
WARNING_LOG(m_logger) << "Could not determine mounting point type from barcode: " << dmc.toString();
|
||||
WARNING_LOG(m_logger) << "Could not determine mounting point type from barcode: " << dmc;
|
||||
}
|
||||
|
||||
return asset;
|
||||
@@ -280,15 +279,15 @@ bool AssetListDialog::updateInstrumentationAsset(const InstrumentationAsset &ass
|
||||
for (int i = 0; i < rowCount; ++i)
|
||||
{
|
||||
InstrumentationAsset iaModelSide = m_model->getRowData(i);
|
||||
if ((iaModelSide.name() == ia.name()) &&
|
||||
(iaModelSide.mountingPointTypeId() == ia.mountingPointTypeId()))
|
||||
if ((iaModelSide.name == ia.name) &&
|
||||
(iaModelSide.mountingPointTypeId == ia.mountingPointTypeId))
|
||||
{
|
||||
ia.id(iaModelSide.id());
|
||||
ia.id = iaModelSide.id;
|
||||
QHash<int, bool> alteredCells;
|
||||
QHash<int, QString> alteredValues;
|
||||
|
||||
|
||||
if (ia.name() != iaModelSide.name())
|
||||
if (ia.name != iaModelSide.name)
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::NAME, true);
|
||||
alteredValues.insert(AssetListDialogModel::NAME, m_model->data(m_model->index(i, AssetListDialogModel::NAME), Qt::DisplayRole).toString());
|
||||
@@ -296,11 +295,11 @@ bool AssetListDialog::updateInstrumentationAsset(const InstrumentationAsset &ass
|
||||
else
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::NAME, false);
|
||||
alteredValues.insert(AssetListDialogModel::NAME, QString::fromStdString(ia.name()));
|
||||
alteredValues.insert(AssetListDialogModel::NAME, QString::fromStdString(ia.name));
|
||||
}
|
||||
|
||||
|
||||
if (ia.mountingPointTypeId() != iaModelSide.mountingPointTypeId())
|
||||
if (ia.mountingPointTypeId != iaModelSide.mountingPointTypeId)
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::TYPE, true);
|
||||
alteredValues.insert(AssetListDialogModel::TYPE, m_model->data(m_model->index(i, AssetListDialogModel::TYPE), Qt::DisplayRole).toString());
|
||||
@@ -308,11 +307,11 @@ bool AssetListDialog::updateInstrumentationAsset(const InstrumentationAsset &ass
|
||||
else
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::TYPE, false);
|
||||
alteredValues.insert(AssetListDialogModel::TYPE, QString::fromStdString(ia.name()));
|
||||
alteredValues.insert(AssetListDialogModel::TYPE, QString::fromStdString(ia.name));
|
||||
}
|
||||
|
||||
|
||||
if (ia.barcode() != iaModelSide.barcode())
|
||||
if (ia.barcode != iaModelSide.barcode)
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::BARCODE, true);
|
||||
alteredValues.insert(AssetListDialogModel::BARCODE, m_model->data(m_model->index(i, AssetListDialogModel::BARCODE), Qt::DisplayRole).toString());
|
||||
@@ -320,11 +319,11 @@ bool AssetListDialog::updateInstrumentationAsset(const InstrumentationAsset &ass
|
||||
else
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::BARCODE, false);
|
||||
alteredValues.insert(AssetListDialogModel::BARCODE, QString::fromStdString(ia.name()));
|
||||
alteredValues.insert(AssetListDialogModel::BARCODE, QString::fromStdString(ia.name));
|
||||
}
|
||||
|
||||
|
||||
if (ia.hostname() != iaModelSide.hostname())
|
||||
if (ia.hostname != iaModelSide.hostname)
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::HOSTNAME, true);
|
||||
alteredValues.insert(AssetListDialogModel::HOSTNAME, m_model->data(m_model->index(i, AssetListDialogModel::HOSTNAME), Qt::DisplayRole).toString());
|
||||
@@ -332,11 +331,11 @@ bool AssetListDialog::updateInstrumentationAsset(const InstrumentationAsset &ass
|
||||
else
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::HOSTNAME, false);
|
||||
alteredValues.insert(AssetListDialogModel::HOSTNAME, QString::fromStdString(ia.name()));
|
||||
alteredValues.insert(AssetListDialogModel::HOSTNAME, QString::fromStdString(ia.name));
|
||||
}
|
||||
|
||||
|
||||
if (ia.properties() != iaModelSide.properties())
|
||||
if (ia.properties != iaModelSide.properties)
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::PROPERTIES, true);
|
||||
alteredValues.insert(AssetListDialogModel::PROPERTIES, m_model->data(m_model->index(i, AssetListDialogModel::PROPERTIES), Qt::DisplayRole).toString());
|
||||
@@ -344,15 +343,15 @@ bool AssetListDialog::updateInstrumentationAsset(const InstrumentationAsset &ass
|
||||
else
|
||||
{
|
||||
alteredCells.insert(AssetListDialogModel::PROPERTIES, false);
|
||||
alteredValues.insert(AssetListDialogModel::PROPERTIES, QString::fromStdString(ia.name()));
|
||||
alteredValues.insert(AssetListDialogModel::PROPERTIES, QString::fromStdString(ia.name));
|
||||
}
|
||||
|
||||
m_model->setAlteredCells(i, alteredCells);
|
||||
|
||||
|
||||
m_model->setPreviousValues(i, alteredValues);
|
||||
ia.assetStateId(iaModelSide.assetStateId());
|
||||
ia.lastUpdated(iaModelSide == ia ? iaModelSide.lastUpdated() : QDateTime::currentMSecsSinceEpoch());
|
||||
ia.assetStateId = iaModelSide.assetStateId;
|
||||
ia.lastUpdated = iaModelSide == ia ? iaModelSide.lastUpdated : QDateTime::currentMSecsSinceEpoch();
|
||||
m_model->setRowData(i, ia);
|
||||
return true;
|
||||
}
|
||||
@@ -379,7 +378,7 @@ void AssetListDialog::onSelectionChanged(const QItemSelection &selected, const Q
|
||||
{
|
||||
InstrumentationAsset asset = m_model->assetByIndex(m_ui->assetListView->currentIndex());
|
||||
StructureElement se;
|
||||
if(m_dtc->getStructureElementInMntPointAssetByAssetId(asset.id(), se) && enabled)
|
||||
if(m_dtc->getStructureElementInMntPointAssetByAssetId(asset.id, se) && enabled)
|
||||
{
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Load)->setEnabled(true);
|
||||
}
|
||||
@@ -607,7 +606,7 @@ void AssetListDialog::onImportClicked()
|
||||
while (!in.atEnd())
|
||||
{
|
||||
const QString line = in.readLine();
|
||||
QVector<QStringRef> segments = line.splitRef(QLatin1Char(';'));
|
||||
QVector<QString> segments = line.split(QLatin1Char(';'));
|
||||
if (segments.size() < 10)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Skipping line '" << line << "' - to few data";
|
||||
@@ -673,15 +672,15 @@ void AssetListDialog::onUnmountButtonClicked()
|
||||
for(QModelIndex index: indexList)
|
||||
{
|
||||
InstrumentationAsset asset = m_model->assetByIndex(index);
|
||||
if(asset.id() > 0 )
|
||||
if(asset.id > 0 )
|
||||
{
|
||||
StructureElement se;
|
||||
if(m_dtc->getStructureElementInMntPointAssetByAssetId(asset.id(), se) == false)
|
||||
if(m_dtc->getStructureElementInMntPointAssetByAssetId(asset.id, se) == false)
|
||||
{
|
||||
WARNING_LOG(m_logger)<<" asset not mounted. name: "<<asset.name()<< " id: "<<asset.id();
|
||||
WARNING_LOG(m_logger)<<" asset not mounted. name: "<<asset.name<< " id: "<<asset.id;
|
||||
continue;
|
||||
}
|
||||
InstrumentationAssetUnmountRequest req(asset.id());
|
||||
InstrumentationAssetUnmountRequest req(asset.id);
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->instrumentationAssetUnmountRequest(req, this);
|
||||
@@ -776,7 +775,7 @@ void AssetListDialog::onReachabilityUpdateAction()
|
||||
bool bhasHostnameForTriggerUpdate = m_model->getReachable(ia, icon, str);
|
||||
if (bhasHostnameForTriggerUpdate)
|
||||
{
|
||||
m_hostsForUpdate.insert(QString::fromStdString(ia.hostname()));
|
||||
m_hostsForUpdate.insert(QString::fromStdString(ia.hostname));
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " trigger update for " << ia;
|
||||
}
|
||||
}
|
||||
@@ -804,7 +803,7 @@ void AssetListDialog::onHostsForUpdateNotifyTimeout()
|
||||
hostnameStd.push_back(item.toStdString());
|
||||
|
||||
ComponentMonitor::TriggerUpdate request;
|
||||
request.hostnames(hostnameStd);
|
||||
request.hostnames = hostnameStd;
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " TriggerUpdate - request = " << request;
|
||||
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ NGL::INGLLogger &m_logger;
|
||||
|
||||
QVector<QString> getExportString(const AssetFilterDialog::Export &exp, const QString &type = QString()) const;
|
||||
static QString exportData(const InstrumentationAsset &ia, const QString &separator = QLatin1String(";"));
|
||||
InstrumentationAsset importData(const QVector<QStringRef> &segments, bool *bOk) const;
|
||||
InstrumentationAsset importData(const QVector<QString> &segments, bool *bOk) const;
|
||||
bool updateInstrumentationAsset(const InstrumentationAsset &asset) const;
|
||||
void enaDisaBtnBoxBtns(const bool b);
|
||||
static bool rowContainsAlteredData(const QHash<int, bool> &data);
|
||||
|
||||
+30
-28
@@ -12,6 +12,7 @@
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QDebug>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
@@ -39,6 +40,7 @@ parent)
|
||||
, m_alteredCells()
|
||||
, m_alteredValues()
|
||||
, m_updateFilterTimer(new QTimer(this))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_intactStr = tr("Intact");
|
||||
updateFilterStates();
|
||||
@@ -86,21 +88,21 @@ QVariant AssetListDialogModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case ID:
|
||||
return currentAsset.id();
|
||||
return currentAsset.id;
|
||||
case NAME:
|
||||
return QString::fromStdString(currentAsset.name());
|
||||
return QString::fromStdString(currentAsset.name);
|
||||
case TYPE:
|
||||
return toString(currentAsset.mountingPointTypeId());
|
||||
return toString(currentAsset.mountingPointTypeId);
|
||||
case BARCODE:
|
||||
return QString::fromStdString(currentAsset.barcode());
|
||||
return QString::fromStdString(currentAsset.barcode);
|
||||
case HOSTNAME:
|
||||
return QString::fromStdString(currentAsset.hostname());
|
||||
return QString::fromStdString(currentAsset.hostname);
|
||||
case MOUNTINGPOINT:
|
||||
{
|
||||
StructureElement se;
|
||||
if (m_dtc->getStructureElementInMntPointAssetByAssetId(currentAsset.id(), se) && se.id() > 0 )
|
||||
if (m_dtc->getStructureElementInMntPointAssetByAssetId(currentAsset.id, se) && se.id > 0 )
|
||||
{
|
||||
return QString::fromStdString(se.displayName());
|
||||
return QString::fromStdString(se.displayName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -108,17 +110,17 @@ QVariant AssetListDialogModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
}
|
||||
case PROPERTIES:
|
||||
return QString::fromStdString(currentAsset.properties());
|
||||
return QString::fromStdString(currentAsset.properties);
|
||||
case STATE:
|
||||
{
|
||||
const InstrumentationAssetState &currAssetState = currentAsset.assetStateId().underlying();
|
||||
const InstrumentationAssetState &currAssetState = currentAsset.assetStateId;
|
||||
if(currAssetState == InstrumentationAssetState::Unmounted || currAssetState == InstrumentationAssetState::Mounted)
|
||||
{
|
||||
return m_intactStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return toString(currentAsset.assetStateId());
|
||||
return toString(currentAsset.assetStateId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -130,7 +132,7 @@ QVariant AssetListDialogModel::data(const QModelIndex &index, int role) const
|
||||
return str;
|
||||
}
|
||||
case LAST_UPDATED:
|
||||
return QDateTime::fromMSecsSinceEpoch(currentAsset.lastUpdated());
|
||||
return QDateTime::fromMSecsSinceEpoch(currentAsset.lastUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +142,7 @@ QVariant AssetListDialogModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (triggerUpdateRequestUseful(currentAsset))
|
||||
{
|
||||
return QDateTime::fromSecsSinceEpoch(m_reachabilityLastCheck[currentAsset.id()]);
|
||||
return QDateTime::fromSecsSinceEpoch(m_reachabilityLastCheck[currentAsset.id]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,15 +174,15 @@ QVariant AssetListDialogModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case TYPE:
|
||||
return currentAsset.mountingPointTypeId().underlying();
|
||||
return static_cast<int>(currentAsset.mountingPointTypeId);
|
||||
case STATE:
|
||||
if(currentAsset.assetStateId().underlying() == InstrumentationAssetState::Mounted ||
|
||||
currentAsset.assetStateId().underlying() == InstrumentationAssetState::Unmounted)
|
||||
if(currentAsset.assetStateId == InstrumentationAssetState::Mounted ||
|
||||
currentAsset.assetStateId == InstrumentationAssetState::Unmounted)
|
||||
{
|
||||
return m_intactStr;
|
||||
}
|
||||
else
|
||||
return currentAsset.assetStateId().underlying();
|
||||
return static_cast<int>(currentAsset.assetStateId);
|
||||
case REACHABILITY:
|
||||
{
|
||||
QIcon icon;
|
||||
@@ -212,17 +214,17 @@ bool AssetListDialogModel::getReachable(const InstrumentationAsset ¤tAsset
|
||||
{
|
||||
bool bEnableTriggerUpdate = false;
|
||||
|
||||
const bool bIsRelevant = isMptRelevant(currentAsset.mountingPointTypeId().underlying());
|
||||
const bool bIsRelevant = isMptRelevant(currentAsset.mountingPointTypeId);
|
||||
if (bIsRelevant)
|
||||
{
|
||||
const bool bIsMounted = currentAsset.assetStateId().underlying() == InfrastructureManagement::InstrumentationAssetState::Mounted;
|
||||
const bool bIsMounted = currentAsset.assetStateId == InfrastructureManagement::InstrumentationAssetState::Mounted;
|
||||
if (bIsMounted)
|
||||
{
|
||||
if (m_cmoDtc)
|
||||
{
|
||||
const ComponentMonitor::ComponentStatus &cs = m_cmoDtc->componentStatus(currentAsset.id());
|
||||
const ComponentMonitor::ComponentState state = cs.state();
|
||||
switch (state.underlying()) {
|
||||
const ComponentMonitor::ComponentStatus &cs = m_cmoDtc->componentStatus(currentAsset.id);
|
||||
const ComponentMonitor::ComponentState state = cs.state;
|
||||
switch (state) {
|
||||
case ComponentMonitor::ComponentState::Undefined:
|
||||
iconOut = m_reachabilityOrange;
|
||||
stringOut = tr("Undefined");
|
||||
@@ -288,12 +290,12 @@ void AssetListDialogModel::onComponentStatusChanged(const ComponentMonitor::Comp
|
||||
|
||||
Q_UNUSED(modType);
|
||||
|
||||
const int row = findRowForId(data.id());
|
||||
const int row = findRowForId(data.id);
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
|
||||
m_reachabilityLastCheck[data.id()] = data.last_check();
|
||||
m_reachabilityLastCheck[data.id] = data.last_check;
|
||||
|
||||
const auto idx(index(row, REACHABILITY));
|
||||
emit dataChanged(idx, idx, {Qt::DisplayRole, Qt::BackgroundRole, Qt::DecorationRole, Qt::ToolTipRole});
|
||||
@@ -329,8 +331,8 @@ bool AssetListDialogModel::initModel(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
auto cb = [this](const InfrastructureManagement::InstrumentationAsset & data)
|
||||
{
|
||||
|
||||
if(data.mountingPointTypeId() == MountingPointType::MeteoDataUnit ||
|
||||
data.mountingPointTypeId() == MountingPointType::BuildingControlUnit
|
||||
if(data.mountingPointTypeId == MountingPointType::MeteoDataUnit ||
|
||||
data.mountingPointTypeId == MountingPointType::BuildingControlUnit
|
||||
)
|
||||
{
|
||||
return;
|
||||
@@ -420,7 +422,7 @@ void AssetListDialogModel::updateFilterStates()
|
||||
}
|
||||
else
|
||||
{
|
||||
cfd.data = es;
|
||||
cfd.data = static_cast<int>(es);
|
||||
cfd.text = toString(es);
|
||||
}
|
||||
cfc.data.push_back(cfd);
|
||||
@@ -435,7 +437,7 @@ void AssetListDialogModel::updateFilterTypes()
|
||||
LtsWidgets::ComboboxFilterData cfd;
|
||||
QSet<InfrastructureManagement::MountingPointType> types;
|
||||
for (const auto &r : std::as_const(m_vecData))
|
||||
types.insert(r.mountingPointTypeId());
|
||||
types.insert(r.mountingPointTypeId);
|
||||
|
||||
for (const auto es : std::as_const(types))
|
||||
{
|
||||
@@ -445,7 +447,7 @@ void AssetListDialogModel::updateFilterTypes()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
cfd.data = es.underlying();
|
||||
cfd.data = static_cast<int>(es);
|
||||
cfd.text = toString(es);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
|
||||
+13
-11
@@ -6,6 +6,7 @@
|
||||
#include "ui_ism_edit_asset_dialog.h"
|
||||
#include "ism_set_properties_dialog.h"
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
@@ -13,6 +14,7 @@ namespace InfrastructureManagement
|
||||
|
||||
EditAssetDialog::EditAssetDialog(QWidget *parent, const std::shared_ptr<Interface::Ftc> &ftc, const std::vector<InstrumentationAsset> &assets)
|
||||
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_ui(new Ui::EditAssetDialog)
|
||||
, m_ftc(ftc)
|
||||
, m_asset(assets)
|
||||
@@ -22,7 +24,7 @@ EditAssetDialog::EditAssetDialog(QWidget *parent, const std::shared_ptr<Interfac
|
||||
|
||||
for(auto const &asset: assets)
|
||||
{
|
||||
m_ui->listWidget->addItem(QString::fromStdString(asset.name()));
|
||||
m_ui->listWidget->addItem(QString::fromStdString(asset.name));
|
||||
}
|
||||
connect(m_ui->toIntactBtn, &QPushButton::clicked, this, &EditAssetDialog::slotSetAssetToIntact);
|
||||
connect(m_ui->toDefectBtn, &QPushButton::clicked, this, &EditAssetDialog::slotSetAssetToDefect);
|
||||
@@ -76,23 +78,23 @@ bool EditAssetDialog::apply(const InstrumentationAssetState newState)
|
||||
|
||||
for(const auto &asset : std::as_const(m_asset))
|
||||
{
|
||||
if (asset.id() == -1)
|
||||
if (asset.id == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (asset.assetStateId() == newState)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((asset.assetStateId() == InstrumentationAssetState::Mounted) || (asset.assetStateId() == InstrumentationAssetState::Unmounted)) &&
|
||||
(newState == InstrumentationAssetState::Unmounted))
|
||||
if (asset.assetStateId == newState)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
req.id(asset.id());
|
||||
req.instrumentationAssetStateId(newState);
|
||||
if (((asset.assetStateId == InstrumentationAssetState::Mounted) || (asset.assetStateId == InstrumentationAssetState::Unmounted)) &&
|
||||
(newState == InstrumentationAssetState::Unmounted))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
req.id = asset.id;
|
||||
req.instrumentationAssetStateId = newState;
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->instrumentationAssetSetStateRequest(req, this);
|
||||
|
||||
+4
-2
@@ -6,6 +6,7 @@
|
||||
#include "ui_ism_filter_asset_dialog.h"
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
@@ -15,6 +16,7 @@ AssetFilterDialog::AssetFilterDialog(AssetListDialogModel *model, QWidget *paren
|
||||
: LtsWidgets::LtsFramelessDialog(parent)
|
||||
, m_model(model)
|
||||
, m_ui(new Ui::AssetFilterDialog)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
m_ui->setupUi(this);
|
||||
@@ -54,11 +56,11 @@ void AssetFilterDialog::fillAssetComboBoxes()
|
||||
QSet<InfrastructureManagement::MountingPointType> types;
|
||||
types.reserve(20);
|
||||
for (int i = 0; i < m_model->rowCount(); ++i)
|
||||
types += m_model->getRowData(i).mountingPointTypeId();
|
||||
types += m_model->getRowData(i).mountingPointTypeId;
|
||||
|
||||
m_ui->cmbType->addItem(QLatin1String("---"));
|
||||
for (const auto &type : std::as_const(types))
|
||||
m_ui->cmbType->addItem(InfrastructureManagement::toString(type), type.underlying());
|
||||
m_ui->cmbType->addItem(InfrastructureManagement::toString(type), static_cast<int>(type));
|
||||
m_ui->cmbType->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -9,11 +9,13 @@
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
using namespace InfrastructureManagement;
|
||||
|
||||
SetPropertiesDialog::SetPropertiesDialog(QLineEdit *lineEdit, QWidget *parent)
|
||||
: LtsWidgets::LtsFramelessDialog(parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_ui(new Ui::SetPropertiesDialog)
|
||||
, m_lineEdit(lineEdit)
|
||||
{
|
||||
|
||||
+3
-1
@@ -5,6 +5,7 @@
|
||||
#include "ui_ism_schedule.h"
|
||||
#include "ism_plan_dialog_model.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <QtCore/QDateTime>
|
||||
|
||||
@@ -14,6 +15,7 @@ namespace InfrastructureManagement
|
||||
CustomViewSchedule::CustomViewSchedule(QWidget *parent)
|
||||
: AbstractDisplayWidget(parent)
|
||||
, m_ui(new Ui::CustomViewSchedule)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
@@ -58,7 +60,7 @@ bool CustomViewSchedule::init(const QModelIndex &idx)
|
||||
m_ui->lblStatus->setText(rowData(idx, InfrastructureManagement::PlanDialogModel::STATUS).toString());
|
||||
|
||||
QPalette p = m_ui->lblStatus->palette();
|
||||
QColor newCol = rowData(idx, PlanDialogModel::STATUS, Qt::TextColorRole).value<QColor>();
|
||||
QColor newCol = rowData(idx, PlanDialogModel::STATUS, Qt::ForegroundRole).value<QColor>();
|
||||
p.setColor(m_ui->lblStatus->backgroundRole(), newCol);
|
||||
p.setColor(m_ui->lblStatus->foregroundRole(), newCol);
|
||||
m_ui->lblStatus->setPalette(p);
|
||||
|
||||
+20
-18
@@ -18,6 +18,7 @@
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonArray>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
using namespace LtsUtils;
|
||||
using namespace LtsWidgets;
|
||||
@@ -27,6 +28,7 @@ namespace InfrastructureManagement
|
||||
{
|
||||
ExerciseAssignmentDialog::ExerciseAssignmentDialog(LtsSession::LtsSession *session, QWidget *parent) noexcept(false)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::ExerciseAssignmentDialog)
|
||||
, m_model(nullptr)
|
||||
@@ -59,17 +61,17 @@ ExerciseAssignmentDialog::ExerciseAssignmentDialog(LtsSession::LtsSession *sessi
|
||||
|
||||
exmDtc->exercises([this](const ExerciseManagement::Exercise &data)
|
||||
{
|
||||
if (data.isDeleted())
|
||||
if (data.isDeleted)
|
||||
return;
|
||||
|
||||
switch(data.state().underlying())
|
||||
switch(data.state)
|
||||
{
|
||||
case ExerciseManagement::ExerciseState::Created:
|
||||
case ExerciseManagement::ExerciseState::Started:
|
||||
case ExerciseManagement::ExerciseState::Paused:
|
||||
case ExerciseManagement::ExerciseState::Stopped:
|
||||
{
|
||||
m_exercises.insert(data.id(), data);
|
||||
m_exercises.insert(data.id, data);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -78,7 +80,7 @@ ExerciseAssignmentDialog::ExerciseAssignmentDialog(LtsSession::LtsSession *sessi
|
||||
});
|
||||
|
||||
for (const auto &exercise : std::as_const(m_exercises))
|
||||
m_ui->cbExercises->addItem(QString::fromStdString(exercise.name()), exercise.id());
|
||||
m_ui->cbExercises->addItem(QString::fromStdString(exercise.name), exercise.id);
|
||||
|
||||
|
||||
if (m_ui->cbExercises->count() == 0)
|
||||
@@ -173,20 +175,20 @@ void ExerciseAssignmentDialog::retranslate()
|
||||
|
||||
void ExerciseAssignmentDialog::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &mse, DataModification modType)
|
||||
{
|
||||
auto seti = mse.structureElementTypeId();
|
||||
auto seti = mse.structureElementTypeId;
|
||||
if (seti != StructureElementType::Building &&
|
||||
seti != StructureElementType::Announcement)
|
||||
return;
|
||||
|
||||
|
||||
QString displayName(m_dtc->getBuildingDisplayName(mse.id()));
|
||||
QString displayName(m_dtc->getBuildingDisplayName(mse.id));
|
||||
if (displayName.isEmpty())
|
||||
displayName = QString::fromStdString(mse.name());
|
||||
displayName = QString::fromStdString(mse.name);
|
||||
|
||||
int exerciseId;
|
||||
try
|
||||
{
|
||||
exerciseId = JsonObject::fromJson(mse.properties()).value<JsonArray>(QStringLiteral("available_in_exercise")).at<int>(0);
|
||||
exerciseId = JsonObject::fromJson(mse.properties).value<JsonArray>(QStringLiteral("available_in_exercise")).at<int>(0);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
@@ -196,11 +198,11 @@ void ExerciseAssignmentDialog::onMainStructureElementChanged(const Infrastructur
|
||||
exerciseId = 0;
|
||||
|
||||
if (modType == DataModification::eModified)
|
||||
m_model->updateMse(mse.id(), mse.groupId(), displayName, exerciseId);
|
||||
m_model->updateMse(mse.id, mse.groupId, displayName, exerciseId);
|
||||
else if (modType == DataModification::eAdded)
|
||||
m_model->addMse(mse.id(), mse.groupId(), displayName, exerciseId);
|
||||
m_model->addMse(mse.id, mse.groupId, displayName, exerciseId);
|
||||
else
|
||||
m_model->removeMse(mse.id());
|
||||
m_model->removeMse(mse.id);
|
||||
}
|
||||
|
||||
bool ExerciseAssignmentDialog::apply()
|
||||
@@ -237,7 +239,7 @@ bool ExerciseAssignmentDialog::apply()
|
||||
QJsonObject root;
|
||||
try
|
||||
{
|
||||
root = JsonObject::fromJson(mse.properties()).object();
|
||||
root = JsonObject::fromJson(mse.properties).object();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -253,7 +255,7 @@ bool ExerciseAssignmentDialog::apply()
|
||||
else
|
||||
root.remove(QStringLiteral("available_in_exercise"));
|
||||
|
||||
mse.properties(QString::fromUtf8(QJsonDocument(root).toJson()).toStdString());
|
||||
mse.properties = QString::fromUtf8(QJsonDocument(root).toJson()).toStdString();
|
||||
|
||||
collector->addRequest(ri, request);
|
||||
}
|
||||
@@ -302,18 +304,18 @@ bool ExerciseAssignmentDialog::apply()
|
||||
|
||||
void ExerciseAssignmentDialog::setRecording(MainStructureElement &mse, bool state)
|
||||
{
|
||||
for(auto &el : mse.elements())
|
||||
for(auto &el : mse.elements)
|
||||
{
|
||||
if(el.mountingPointTypeId() != MountingPointType::IndoorCamera &&
|
||||
el.mountingPointTypeId() != MountingPointType::OutdoorCamera)
|
||||
if(el.mountingPointTypeId != MountingPointType::IndoorCamera &&
|
||||
el.mountingPointTypeId != MountingPointType::OutdoorCamera)
|
||||
continue;
|
||||
|
||||
QJsonDocument propsDoc = QJsonDocument::fromJson(QByteArray::fromStdString(el.properties()));
|
||||
QJsonDocument propsDoc = QJsonDocument::fromJson(QByteArray::fromStdString(el.properties));
|
||||
QJsonObject propsObj;
|
||||
if (propsDoc.isObject())
|
||||
propsObj = propsDoc.object();
|
||||
propsObj.insert(QLatin1String("record"), state);
|
||||
el.properties(QJsonDocument(propsObj).toJson(QJsonDocument::Compact).toStdString());
|
||||
el.properties = QJsonDocument(propsObj).toJson(QJsonDocument::Compact).toStdString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-7
@@ -7,8 +7,9 @@
|
||||
#include <QtGui/QFont>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#ifdef LTS_DEBUG
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QTimer>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,9 +19,10 @@ ExerciseAssignmentDialogModel::ExerciseAssignmentDialogModel(const QMap<qint32,
|
||||
: QAbstractItemModel(parent)
|
||||
, m_rootItem(new TreeItem(0, 0, tr("InvisibleRootItem"), -1))
|
||||
, m_exercises(exercises)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
for (int it = BuildingGroup::UnknownGroup;
|
||||
it <= BuildingGroup::Salchau;
|
||||
for (int it = static_cast<int>(BuildingGroup::UnknownGroup);
|
||||
it <= static_cast<int>(BuildingGroup::Salchau);
|
||||
++it)
|
||||
{
|
||||
m_rootItem->appendChild(new TreeItem(0, it, toString(static_cast<BuildingGroup>(it)), -1, m_rootItem));
|
||||
@@ -120,7 +122,7 @@ QVariant ExerciseAssignmentDialogModel::data(const QModelIndex &index, int role)
|
||||
return {};
|
||||
if (exerciseId == 0)
|
||||
return QStringLiteral("-");
|
||||
return QString::fromStdString(m_exercises.value(exerciseId).name());
|
||||
return QString::fromStdString(m_exercises.value(exerciseId).name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,13 +246,14 @@ QVector<RequestInfos> ExerciseAssignmentDialogModel::getRequestInfos(bool all) c
|
||||
|
||||
|
||||
|
||||
TreeItem::TreeItem(int mseId, int sectionId, const QString &displayName, int exerciseId, TreeItem *parentItem) : m_mseId(mseId)
|
||||
TreeItem::TreeItem(int mseId, int sectionId, const QString &displayName, int exerciseId, TreeItem *parentItem)
|
||||
: m_mseId(mseId)
|
||||
, m_sectionId(sectionId)
|
||||
, m_displayName(displayName)
|
||||
, m_exerciseId(exerciseId)
|
||||
, m_originalExerciseId(exerciseId)
|
||||
, m_parentItem(parentItem),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, m_parentItem(parentItem)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <InfrastructureManagement/logger.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QSortFilterProxyModel>
|
||||
#include <LtsUtilsCore/json_object.h>
|
||||
@@ -23,6 +24,7 @@ class ExerciseAssignmentDialogModelFilterProxy : public QSortFilterProxyModel
|
||||
public:
|
||||
ExerciseAssignmentDialogModelFilterProxy(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_exerciseId(0)
|
||||
{
|
||||
setRecursiveFilteringEnabled(true);
|
||||
|
||||
+35
-33
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_mounting_point_info_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
#include "ui_ism_mounting_point_info_dialog.h"
|
||||
|
||||
@@ -28,6 +29,7 @@ MountingPointInfoDialog::MountingPointInfoDialog(int32_t mountingPointId, int32_
|
||||
, m_dtc(nullptr)
|
||||
, m_ismIfc(nullptr)
|
||||
, m_avmIfc(nullptr)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->gbxAsset->hide();
|
||||
@@ -44,14 +46,14 @@ void MountingPointInfoDialog::retranslate()
|
||||
|
||||
StructureElement se;
|
||||
m_dtc->getStructureElementById(m_mountingPointId, se);
|
||||
QString seName = QString::fromStdString(se.displayName()).trimmed();
|
||||
QString seName = QString::fromStdString(se.displayName).trimmed();
|
||||
QString lbName;
|
||||
|
||||
|
||||
if(seName.isEmpty())
|
||||
{
|
||||
MainStructureElement mse= m_dtc->mainStructureElement(se.mainStructureElementId());
|
||||
lbName = QString::fromStdString(mse.name()) + QStringLiteral(" - ") + QString::fromStdString(se.name());
|
||||
MainStructureElement mse= m_dtc->mainStructureElement(se.mainStructureElementId);
|
||||
lbName = QString::fromStdString(mse.name) + QStringLiteral(" - ") + QString::fromStdString(se.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,22 +95,22 @@ bool MountingPointInfoDialog::init(const std::shared_ptr<InfrastructureManagemen
|
||||
))
|
||||
return false;
|
||||
|
||||
m_ui->lblNameEntry->setText(QString::fromStdString(mountingPointData.name()));
|
||||
m_ui->lblTypeEntry->setText(toString(mountingPointData.mountingPointTypeId()));
|
||||
m_ui->lblNameEntry->setText(QString::fromStdString(mountingPointData.name));
|
||||
m_ui->lblTypeEntry->setText(toString(mountingPointData.mountingPointTypeId));
|
||||
|
||||
if (mountingPointData.mountingPointTypeId() != MountingPointType::OutdoorCamera &&
|
||||
mountingPointData.mountingPointTypeId() != MountingPointType::MeteoDataUnit &&
|
||||
mountingPointData.mountingPointTypeId() != MountingPointType::VirtualIPS)
|
||||
if (mountingPointData.mountingPointTypeId != MountingPointType::OutdoorCamera &&
|
||||
mountingPointData.mountingPointTypeId != MountingPointType::MeteoDataUnit &&
|
||||
mountingPointData.mountingPointTypeId != MountingPointType::VirtualIPS)
|
||||
{
|
||||
|
||||
QMap<StructureElementType, QString> names;
|
||||
for (int parentId = mountingPointData.path().size() - 1; parentId >= 0; --parentId)
|
||||
for (int parentId = mountingPointData.path.size() - 1; parentId >= 0; --parentId)
|
||||
{
|
||||
StructureElement parent;
|
||||
m_dtc->getStructureElementById(mountingPointData.path().at(parentId), parent);
|
||||
names[parent.structureElementTypeId()] = QString::fromStdString(parent.displayName().size() > 0 ? parent.displayName() : parent.name());
|
||||
m_dtc->getStructureElementById(mountingPointData.path.at(parentId), parent);
|
||||
names[parent.structureElementTypeId] = QString::fromStdString(parent.displayName.size() > 0 ? parent.displayName : parent.name);
|
||||
|
||||
if (StructureElementType::Building == parent.structureElementTypeId().underlying())
|
||||
if (StructureElementType::Building == parent.structureElementTypeId)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -145,13 +147,13 @@ bool MountingPointInfoDialog::init(const std::shared_ptr<InfrastructureManagemen
|
||||
m_ui->lblRoomEntry->hide();
|
||||
m_ui->lblRoom->hide();
|
||||
|
||||
MainStructureElement mainStructure = m_dtc->mainStructureElement(mountingPointData.mainStructureElementId());
|
||||
m_ui->lblPositionEntry->setText(LtsCoordTrans::mgrsFromGeographic(mainStructure.geoPosition().lon(),
|
||||
mainStructure.geoPosition().lat()));
|
||||
MainStructureElement mainStructure = m_dtc->mainStructureElement(mountingPointData.mainStructureElementId);
|
||||
m_ui->lblPositionEntry->setText(LtsCoordTrans::mgrsFromGeographic(mainStructure.geoPosition.lon,
|
||||
mainStructure.geoPosition.lat));
|
||||
}
|
||||
|
||||
if (mountingPointData.mountingPointTypeId() == MountingPointType::OutdoorCamera ||
|
||||
mountingPointData.mountingPointTypeId() == MountingPointType::IndoorCamera)
|
||||
if (mountingPointData.mountingPointTypeId == MountingPointType::OutdoorCamera ||
|
||||
mountingPointData.mountingPointTypeId == MountingPointType::IndoorCamera)
|
||||
{
|
||||
connect(m_ui->pbShowStream, &QToolButton::clicked, this, &MountingPointInfoDialog::onShowStream);
|
||||
m_ui->pbShowStream->setVisible(m_avmIfc->hasAvsSession() && m_avmIfc->avaSession()->isEstablished());
|
||||
@@ -169,14 +171,14 @@ bool MountingPointInfoDialog::init(const std::shared_ptr<InfrastructureManagemen
|
||||
QMap<qint32, MountingPointAsset> mpAssets = m_dtc->mountingPointAssets();
|
||||
for (auto it = mpAssets.begin(); it != mpAssets.end(); ++it)
|
||||
{
|
||||
if (it.value().structureElementId() == m_mountingPointId)
|
||||
if (it.value().structureElementId == m_mountingPointId)
|
||||
{
|
||||
showAsset(m_dtc->instrumentationAsset(it.value().assetId()));
|
||||
showAsset(m_dtc->instrumentationAsset(it.value().assetId));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (mountingPointData.mountingPointTypeId().underlying())
|
||||
switch (mountingPointData.mountingPointTypeId)
|
||||
{
|
||||
case InfrastructureManagement::MountingPointType::BuildingSensorModule:
|
||||
setOnlineHelpFilename(QStringLiteral("Info_Dialog-Building_Sensor_Module"));
|
||||
@@ -216,7 +218,7 @@ bool MountingPointInfoDialog::init(const std::shared_ptr<InfrastructureManagemen
|
||||
break;
|
||||
case InfrastructureManagement::MountingPointType::Unknown:
|
||||
default:
|
||||
WARNING_LOG(m_logger) << "Unknown MountingPointType found for assetId " << m_assetId << ": " << toString(mountingPointData.mountingPointTypeId());
|
||||
WARNING_LOG(m_logger) << "Unknown MountingPointType found for assetId " << m_assetId << ": " << toString(mountingPointData.mountingPointTypeId);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -227,7 +229,7 @@ bool MountingPointInfoDialog::init(const std::shared_ptr<InfrastructureManagemen
|
||||
|
||||
void MountingPointInfoDialog::onInstrumentationAssetChanged(const InfrastructureManagement::InstrumentationAsset &data, DataModification modType)
|
||||
{
|
||||
if (data.id() != m_assetId)
|
||||
if (data.id != m_assetId)
|
||||
return;
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
@@ -238,18 +240,18 @@ void MountingPointInfoDialog::onInstrumentationAssetChanged(const Infrastructure
|
||||
|
||||
void MountingPointInfoDialog::onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, DataModification modType)
|
||||
{
|
||||
if (data.structureElementId() != m_mountingPointId)
|
||||
if (data.structureElementId != m_mountingPointId)
|
||||
return;
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
removeAsset();
|
||||
else
|
||||
showAsset(m_dtc->instrumentationAsset(data.assetId()));
|
||||
showAsset(m_dtc->instrumentationAsset(data.assetId));
|
||||
}
|
||||
|
||||
void MountingPointInfoDialog::onMainScheduleChanged(const InfrastructureManagement::MainSchedule &data, DataModification modType)
|
||||
{
|
||||
if (data.id() != m_scheduleId ||
|
||||
if (data.id != m_scheduleId ||
|
||||
modType != DataModification::eModified)
|
||||
return;
|
||||
|
||||
@@ -283,14 +285,14 @@ void MountingPointInfoDialog::showAsset(const InfrastructureManagement::Instrume
|
||||
removeAsset();
|
||||
DEBUG_LOG(m_logger) << "Showing new asset";
|
||||
|
||||
m_assetId = asset.id();
|
||||
m_assetId = asset.id;
|
||||
|
||||
addAssetProperty(tr("Name"), QString::fromStdString(asset.name()));
|
||||
addAssetProperty(tr("State"), toString(asset.assetStateId()));
|
||||
addAssetProperty(tr("Hostname"), QString::fromStdString(asset.hostname()));
|
||||
addAssetProperty(tr("Barcode"), QString::fromStdString(asset.barcode()));
|
||||
addAssetProperty(tr("Name"), QString::fromStdString(asset.name));
|
||||
addAssetProperty(tr("State"), toString(asset.assetStateId));
|
||||
addAssetProperty(tr("Hostname"), QString::fromStdString(asset.hostname));
|
||||
addAssetProperty(tr("Barcode"), QString::fromStdString(asset.barcode));
|
||||
|
||||
const QJsonObject dynamicProps(QJsonDocument::fromJson(QByteArray::fromStdString(asset.properties())).object());
|
||||
const QJsonObject dynamicProps(QJsonDocument::fromJson(QByteArray::fromStdString(asset.properties)).object());
|
||||
|
||||
for (auto it = dynamicProps.begin(); it != dynamicProps.end(); ++it)
|
||||
{
|
||||
@@ -342,9 +344,9 @@ void MountingPointInfoDialog::addAssetProperty(const QString &propName, const QS
|
||||
|
||||
void MountingPointInfoDialog::setIsIncluded(const MainSchedule &schedule)
|
||||
{
|
||||
for (const MountingPointPlan ¤tPlan : schedule.elements())
|
||||
for (const MountingPointPlan ¤tPlan : schedule.elements)
|
||||
{
|
||||
if (currentPlan.structureElementId() == m_mountingPointId)
|
||||
if (currentPlan.structureElementId == m_mountingPointId)
|
||||
{
|
||||
m_ui->lblIncludedEntry->setText(tr("Yes"));
|
||||
return;
|
||||
|
||||
+13
-11
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_mounting_point_list_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_ism_mounting_point_list_dialog.h"
|
||||
#include "ism_mounting_point_list_dialog_model.h"
|
||||
#include "ism_mounting_point_list_dialog_checkbox_proxy_model.h"
|
||||
@@ -69,6 +70,7 @@ MountingPointListDialog::MountingPointListDialog(const QString &menuGroup, QWidg
|
||||
, m_ddsSelector(nullptr)
|
||||
, m_scheduleId(-1)
|
||||
, m_ui(new Ui::MountingPointListDialog)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
@@ -357,7 +359,7 @@ void MountingPointListDialog::getMountingPointPlanData(const QModelIndex &index,
|
||||
|
||||
if (mppMap.contains(data.id))
|
||||
{
|
||||
if (data.aimState != mppMap[data.id].mountingPointState())
|
||||
if (data.aimState != mppMap[data.id].mountingPointState)
|
||||
modify.push_back(MountingPointPlan(data.id, data.aimState));
|
||||
}
|
||||
else if (data.aimState != MountingPointState::Idle)
|
||||
@@ -465,8 +467,8 @@ bool MountingPointListDialog::apply()
|
||||
MainSchedule mainSchedule = m_dataIfc->mainSchedule(m_dataIfc->scheduleId());
|
||||
|
||||
QHash<int,MountingPointPlan> mppMap;
|
||||
for(const auto &elem : mainSchedule.elements())
|
||||
mppMap[elem.structureElementId()] = elem;
|
||||
for(const auto &elem : mainSchedule.elements)
|
||||
mppMap[elem.structureElementId] = elem;
|
||||
|
||||
getMountingPointPlanData(root, modify, mppMap);
|
||||
|
||||
@@ -485,19 +487,19 @@ void MountingPointListDialog::onPrint()
|
||||
MainSchedule ms = m_dtc->mainSchedule(m_dataIfc->scheduleId());
|
||||
QString header;
|
||||
header += QStringLiteral("<p>");
|
||||
header += tr("Instrumentation Plan: %1").arg(QString::fromStdString(ms.name()));
|
||||
header += tr("Instrumentation Plan: %1").arg(QString::fromStdString(ms.name));
|
||||
header += QStringLiteral("<br/>");
|
||||
header += tr("Status: %1").arg(toString(ms.statusId()));
|
||||
header += tr("Status: %1").arg(toString(ms.statusId));
|
||||
header += QStringLiteral("<br/>");
|
||||
header += tr("Created: %1").arg(DTG::toStringMSec(ms.timeCreated()));
|
||||
header += tr("Created: %1").arg(DTG::toStringMSec(ms.timeCreated));
|
||||
header += QStringLiteral("<br/>");
|
||||
if (ms.timeStart().is_set())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(ms.timeStart().get()));
|
||||
if (ms.timeStart.has_value())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(ms.timeStart.get()));
|
||||
else
|
||||
header += tr("START: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral(" - ");
|
||||
if (ms.timeEnd().is_set())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(ms.timeEnd().get()));
|
||||
if (ms.timeEnd.has_value())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(ms.timeEnd.get()));
|
||||
else
|
||||
header += tr("END: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral("<br/>");
|
||||
@@ -688,7 +690,7 @@ void MountingPointListDialog::onUnmountButtonClicked()
|
||||
});
|
||||
|
||||
if (!ret)
|
||||
WARNING_LOG(m_logger)<<" couldn't unmount asset on MountingPoinAsset id: "<<req.id();
|
||||
WARNING_LOG(m_logger)<<" couldn't unmount asset on MountingPoinAsset id: "<<req.id;
|
||||
else
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load,false);
|
||||
}
|
||||
|
||||
+3
-3
@@ -29,13 +29,13 @@ void CheckboxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
|
||||
switch (value.toInt())
|
||||
{
|
||||
case MountingPointState::Equipped:
|
||||
case static_cast<int>(MountingPointState::Equipped):
|
||||
x = QPixmap(QStringLiteral(":/style/checkbox-true.svg"));
|
||||
break;
|
||||
case MountingPointState::Idle:
|
||||
case static_cast<int>(MountingPointState::Idle):
|
||||
x = QPixmap(QStringLiteral(":/style/checkbox-empty.svg"));
|
||||
break;
|
||||
case MountingPointState::Empty:
|
||||
case static_cast<int>(MountingPointState::Empty):
|
||||
x = QPixmap(QStringLiteral(":/style/checkbox-false.svg"));
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#include "ism_mounting_point_list_dialog_list_sort_model.h"
|
||||
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
|
||||
+41
-39
@@ -6,7 +6,8 @@
|
||||
#include "ism_mounting_point_list_dialog_list_sort_model.h"
|
||||
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
@@ -23,6 +24,7 @@ namespace InfrastructureManagement
|
||||
|
||||
MountingPointListDialogModel::MountingPointListDialogModel(QObject *parent)
|
||||
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), { tr("Name"), tr("Type"), tr("Asset"), tr("Aim State") })
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_visRoot(new NGLTreeItem(tr("Mounting Points")))
|
||||
, m_dtc(nullptr)
|
||||
, m_scheduleId(-1)
|
||||
@@ -85,17 +87,17 @@ QVariant MountingPointListDialogModel::data(const QModelIndex &index, int role)
|
||||
&& indexColumn == TYPE)
|
||||
{
|
||||
const SimpleMountingPointData itemData = item->data().value<SimpleMountingPointData>();
|
||||
if (itemData.mpType.underlying() == MountingPointType::Unknown)
|
||||
if (itemData.mpType == MountingPointType::Unknown)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "unknown!!!";
|
||||
return QVariant();
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
ERROR_LOG(m_logger) << "mpType = " << itemData.mpType.underlying();
|
||||
ERROR_LOG(m_logger) << "mpType = " << static_cast<int>(itemData.mpType);
|
||||
if(itemData.mpType == MountingPointType::OutdoorIPS)
|
||||
return MountingPointType::IndoorIPS;
|
||||
return static_cast<int>(MountingPointType::IndoorIPS);
|
||||
|
||||
return itemData.mpType.underlying();
|
||||
return static_cast<int>(itemData.mpType);
|
||||
}
|
||||
|
||||
if (role == Qt::CheckStateRole && index.column() == NAME)
|
||||
@@ -105,7 +107,7 @@ QVariant MountingPointListDialogModel::data(const QModelIndex &index, int role)
|
||||
return item->data().value<SimpleMountingPointData>().id;
|
||||
|
||||
if (role == (Qt::UserRole + 1) && item->data().canConvert<SimpleMountingPointData>())
|
||||
return item->data().value<SimpleMountingPointData>().aimState.underlying();
|
||||
return static_cast<int>(item->data().value<SimpleMountingPointData>().aimState);
|
||||
|
||||
return {};
|
||||
}
|
||||
@@ -176,42 +178,42 @@ void MountingPointListDialogModel::initData()
|
||||
for (const MainStructureElement &mse : mainStructEles)
|
||||
{
|
||||
|
||||
if (mse.structureElementTypeId() != StructureElementType::Building)
|
||||
if (mse.structureElementTypeId != StructureElementType::Building)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QModelIndex groupIndex;
|
||||
const StructureElement bse= setBuildingGroup(mse.groupId());
|
||||
|
||||
if (mse.groupId() != BuildingGroup::OutdoorCameras)
|
||||
const StructureElement bse= setBuildingGroup(mse.groupId);
|
||||
|
||||
if (mse.groupId != static_cast<int>(BuildingGroup::OutdoorCameras))
|
||||
{
|
||||
if (m_availableBuildingGroups.contains(bse.id()) == false)
|
||||
if (m_availableBuildingGroups.contains(bse.id) == false)
|
||||
{
|
||||
SimpleBuildingGroupData buildingGroup;
|
||||
buildingGroup.name = QString::fromStdString(bse.displayName());
|
||||
buildingGroup.name = QString::fromStdString(bse.displayName);
|
||||
NGLTreeItem *groupItem = new NGLTreeItem(QVariant::fromValue(buildingGroup));
|
||||
QModelIndex groupParentIndex;
|
||||
groupParentIndex = indexFromItem(m_visRoot);
|
||||
insertRow(rowCount(groupParentIndex), groupParentIndex, groupItem);
|
||||
groupIndex = index(groupItem->row(), 0, groupParentIndex);
|
||||
m_mountingPointIndexes.insert(bse.id(), groupIndex);
|
||||
m_availableBuildingGroups.insert(bse.id());
|
||||
m_mountingPointIndexes.insert(bse.id, groupIndex);
|
||||
m_availableBuildingGroups.insert(bse.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupIndex = m_mountingPointIndexes.value(bse.id(), indexFromItem(m_visRoot));
|
||||
groupIndex = m_mountingPointIndexes.value(bse.id, indexFromItem(m_visRoot));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (const StructureElement ¤tElement : mse.elements())
|
||||
for (const StructureElement ¤tElement : mse.elements)
|
||||
{
|
||||
NGLTreeItem *item;
|
||||
|
||||
if (currentElement.structureElementTypeId() == StructureElementType::MountingPoint)
|
||||
if (currentElement.structureElementTypeId == StructureElementType::MountingPoint)
|
||||
{
|
||||
const MountingPoint &mountingPoint = m_dataInterface->mountingPoint(currentElement.id());
|
||||
const MountingPoint &mountingPoint = m_dataInterface->mountingPoint(currentElement.id);
|
||||
|
||||
if (!mountingPoint.isValid())
|
||||
continue;
|
||||
@@ -225,7 +227,7 @@ void MountingPointListDialogModel::initData()
|
||||
continue;
|
||||
|
||||
SimpleMountingPointData mpData;
|
||||
mpData.seType = currentElement.structureElementTypeId();
|
||||
mpData.seType = currentElement.structureElementTypeId;
|
||||
mpData.id = mountingPoint.id();
|
||||
mpData.name = mountingPoint.name();
|
||||
mpData.aimState = mountingPoint.aimState();
|
||||
@@ -239,7 +241,7 @@ void MountingPointListDialogModel::initData()
|
||||
mpData.assetBarcode = QStringLiteral("-");
|
||||
if(assetId != -1)
|
||||
{
|
||||
mpData.assetBarcode = QString::fromStdString(m_dtc->instrumentationAsset(assetId).barcode());
|
||||
mpData.assetBarcode = QString::fromStdString(m_dtc->instrumentationAsset(assetId).barcode);
|
||||
}
|
||||
|
||||
item = new NGLTreeItem(QVariant::fromValue(mpData));
|
||||
@@ -247,17 +249,17 @@ void MountingPointListDialogModel::initData()
|
||||
else
|
||||
{
|
||||
SimpleStructureElementData ssed;
|
||||
ssed.mseId = mse.id();
|
||||
if (currentElement.structureElementTypeId() == StructureElementType::Floor)
|
||||
ssed.floor = QString::fromStdString(currentElement.name()).split(QLatin1Literal("_")).value(1, QLatin1String("-10")).toInt();
|
||||
ssed.mseId = mse.id;
|
||||
if (currentElement.structureElementTypeId == StructureElementType::Floor)
|
||||
ssed.floor = QString::fromStdString(currentElement.name).split(QStringLiteral("_")).value(1, QLatin1String("-10")).toInt();
|
||||
else
|
||||
ssed.floor = -20;
|
||||
ssed.name = currentElement.displayName().empty() ? QString::fromStdString(currentElement.name()) : QString::fromStdString(currentElement.displayName());
|
||||
ssed.name = currentElement.displayName.empty() ? QString::fromStdString(currentElement.name) : QString::fromStdString(currentElement.displayName);
|
||||
item = new NGLTreeItem(QVariant::fromValue(ssed));
|
||||
m_availableFloors << ssed.floor;
|
||||
}
|
||||
|
||||
const auto &path = currentElement.path();
|
||||
const auto &path = currentElement.path;
|
||||
|
||||
QModelIndex parentIndex;
|
||||
if (path.size() > 1)
|
||||
@@ -265,9 +267,9 @@ void MountingPointListDialogModel::initData()
|
||||
parentIndex = m_mountingPointIndexes.value(path.at(path.size() - 2), indexFromItem(m_visRoot));
|
||||
if (!parentIndex.isValid())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id() << " mseid: " << mse.id();
|
||||
for (const StructureElement &se : mse.elements())
|
||||
ERROR_LOG(m_logger) << " se: " << se.id() << ", " << se.displayName() << ", " << se.name();
|
||||
ERROR_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id << " mseid: " << mse.id;
|
||||
for (const StructureElement &se : mse.elements)
|
||||
ERROR_LOG(m_logger) << " se: " << se.id << ", " << se.displayName << ", " << se.name;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -284,7 +286,7 @@ void MountingPointListDialogModel::initData()
|
||||
}
|
||||
insertRow(rowCount(parentIndex), parentIndex, item);
|
||||
|
||||
m_mountingPointIndexes.insert(currentElement.id(), index(item->row(), 0, parentIndex));
|
||||
m_mountingPointIndexes.insert(currentElement.id, index(item->row(), 0, parentIndex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,15 +308,15 @@ StructureElement MountingPointListDialogModel::setBuildingGroup(int groupId)
|
||||
{
|
||||
StructureElement se{};
|
||||
InfrastructureManagement::BuildingGroup buildingGroup = static_cast<InfrastructureManagement::BuildingGroup>(groupId);
|
||||
if(buildingGroup == 0)
|
||||
if (static_cast<int>(buildingGroup) == 0)
|
||||
{
|
||||
buildingGroup = InfrastructureManagement::BuildingGroup::UnknownGroup;
|
||||
}
|
||||
|
||||
se.id() = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name() = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.displayName() = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId() = InfrastructureManagement::StructureElementType::Section;
|
||||
se.id = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.displayName = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId = InfrastructureManagement::StructureElementType::Section;
|
||||
return se;
|
||||
}
|
||||
|
||||
@@ -394,7 +396,7 @@ void MountingPointListDialogModel::setMntPointFilterTypes(QSet<MountingPointType
|
||||
{
|
||||
if (es == MountingPointType::OutdoorIPS)
|
||||
continue;
|
||||
cfd.data = es.underlying();
|
||||
cfd.data = static_cast<int>(es);
|
||||
cfd.text = toString(es);
|
||||
cfc.data.push_back(cfd);
|
||||
|
||||
@@ -428,7 +430,7 @@ void MountingPointListDialogModel::onMountingPointChanged(const MountingPoint &m
|
||||
|
||||
if(assetId != -1)
|
||||
{
|
||||
mpData.assetBarcode = QString::fromStdString(m_dtc->instrumentationAsset(assetId).barcode());
|
||||
mpData.assetBarcode = QString::fromStdString(m_dtc->instrumentationAsset(assetId).barcode);
|
||||
}
|
||||
item->setData(QVariant::fromValue(mpData));
|
||||
m_dataChangedTimer->start();
|
||||
|
||||
+7
-6
@@ -3,15 +3,16 @@
|
||||
|
||||
#include "ism_dds_selector.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <LtsUtils/LtsUtilsCore/dds_vector.h>
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
using namespace InfrastructureManagement;
|
||||
|
||||
DdsSelector::DdsSelector(const std::shared_ptr<Interface::Dtc> &dtc, const std::shared_ptr<Interface::Ftc> &ftc, const std::shared_ptr<ForeignDataInterface> &ismDataIfc, LtsUtils::RequestHelper *requestHelper)
|
||||
: MountingPointSelector(dtc, ftc, ismDataIfc, requestHelper, getLogger(QStringLiteral("DdsSelector")))
|
||||
: MountingPointSelector(dtc, ftc, ismDataIfc, requestHelper, NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -75,15 +76,15 @@ void DdsSelector::addMountingPoints(const QVector<int32_t> &mountingPointIds, co
|
||||
|
||||
MountingPointState aimState = override ? mps : mountingPoint.getNextMountingPointState(mountingPoint.aimState());
|
||||
|
||||
auto it = std::find_if(mainSchedule.elements().cbegin(), mainSchedule.elements().cend(), [currentMountingPointId](const MountingPointPlan &mpp){ return (mpp.structureElementId() == currentMountingPointId); });
|
||||
auto it = std::find_if(mainSchedule.elements.cbegin(), mainSchedule.elements.cend(), [currentMountingPointId](const MountingPointPlan &mpp){ return (mpp.structureElementId == currentMountingPointId); });
|
||||
|
||||
if (it != mainSchedule.elements().cend())
|
||||
if (it != mainSchedule.elements.cend())
|
||||
{
|
||||
if ((*it).mountingPointState() == aimState)
|
||||
if ((*it).mountingPointState == aimState)
|
||||
continue;
|
||||
|
||||
MountingPointPlan mpp = (*it);
|
||||
mpp.mountingPointState() = aimState;
|
||||
mpp.mountingPointState = aimState;
|
||||
modifyVec.push_back(mpp);
|
||||
}
|
||||
else if (aimState != MountingPointState::Idle)
|
||||
|
||||
+15
-13
@@ -6,6 +6,7 @@
|
||||
#include "ism_overview_conflicts_model.h"
|
||||
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <LtsPrinting/printing.h>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
@@ -19,6 +20,7 @@ ConflictsDialog::ConflictsDialog(const QString &menuGroup, QWidget *parent)
|
||||
, m_ui(new Ui::ConflictsDialog)
|
||||
, m_sourceModel(nullptr)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setOnlineHelpFilename(QStringLiteral("Ressourcen-Conflicts"));
|
||||
@@ -37,8 +39,8 @@ ConflictsDialog::~ConflictsDialog()
|
||||
|
||||
void ConflictsDialog::retranslate()
|
||||
{
|
||||
QString plan1 = QString::fromStdString(m_dtc->mainSchedule(m_scheduleId).name());
|
||||
QString plan2 = QString::fromStdString(m_dtc->mainSchedule(m_anotherScheduleId).name());
|
||||
QString plan1 = QString::fromStdString(m_dtc->mainSchedule(m_scheduleId).name);
|
||||
QString plan2 = QString::fromStdString(m_dtc->mainSchedule(m_anotherScheduleId).name);
|
||||
translate(m_ui, tr("Conflicts: %1 - %2").arg(plan1, plan2));
|
||||
}
|
||||
|
||||
@@ -116,7 +118,7 @@ void ConflictsDialog::updateModel()
|
||||
void ConflictsDialog::dataChanged(const InfrastructureManagement::MainSchedule &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
if (data.id() == m_scheduleId)
|
||||
if (data.id == m_scheduleId)
|
||||
m_sourceModel->initModel(m_scheduleId, m_anotherScheduleId, m_dtc);
|
||||
}
|
||||
|
||||
@@ -137,31 +139,31 @@ void ConflictsDialog::onPrint()
|
||||
header += QStringLiteral("<p>");
|
||||
header += QStringLiteral("<b>") + tr("Overview Conflicts") + QStringLiteral("</b>");
|
||||
header += QStringLiteral("<hr/>");
|
||||
header += tr("Current Instrumentation Plan: %1").arg(QString::fromStdString(plan1.name()));
|
||||
header += tr("Current Instrumentation Plan: %1").arg(QString::fromStdString(plan1.name));
|
||||
|
||||
header += QStringLiteral(" - ");
|
||||
if (plan1.timeStart().is_set())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(plan1.timeStart().get()));
|
||||
if (plan1.timeStart.has_value())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(plan1.timeStart.get()));
|
||||
else
|
||||
header += tr("START: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral(" - ");
|
||||
if (plan1.timeEnd().is_set())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(plan1.timeEnd().get()));
|
||||
if (plan1.timeEnd.has_value())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(plan1.timeEnd.get()));
|
||||
else
|
||||
header += tr("END: %1").arg(tr("[N/A]"));
|
||||
|
||||
header += QStringLiteral("<br/>");
|
||||
|
||||
header += tr("Compared Instrumentation Plan: %1").arg(QString::fromStdString(plan2.name()));
|
||||
header += tr("Compared Instrumentation Plan: %1").arg(QString::fromStdString(plan2.name));
|
||||
|
||||
header += QStringLiteral(" - ");
|
||||
if (plan2.timeStart().is_set())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(plan2.timeStart().get()));
|
||||
if (plan2.timeStart.has_value())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(plan2.timeStart.get()));
|
||||
else
|
||||
header += tr("START: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral(" - ");
|
||||
if (plan2.timeEnd().is_set())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(plan2.timeEnd().get()));
|
||||
if (plan2.timeEnd.has_value())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(plan2.timeEnd.get()));
|
||||
else
|
||||
header += tr("END: %1").arg(tr("[N/A]"));
|
||||
|
||||
|
||||
+53
-51
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "ism_overview_conflicts_model.h"
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QElapsedTimer>
|
||||
@@ -21,6 +22,7 @@ namespace InfrastructureManagement
|
||||
|
||||
ConflictsDialogModel::ConflictsDialogModel(QObject *parent)
|
||||
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), { tr("Name"), tr("Type"), tr("Aim State"), tr("Conflict State") })
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_dtc(nullptr)
|
||||
, m_scheduleId(-1)
|
||||
, m_anotherScheduleId(-1)
|
||||
@@ -99,8 +101,8 @@ QVariant ConflictsDialogModel::headerData(int section, Qt::Orientation orientati
|
||||
{
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
{
|
||||
QString plan1 = QString::fromStdString(m_dtc->mainSchedule(m_scheduleId).name());
|
||||
QString plan2 = QString::fromStdString(m_dtc->mainSchedule(m_anotherScheduleId).name());
|
||||
QString plan1 = QString::fromStdString(m_dtc->mainSchedule(m_scheduleId).name);
|
||||
QString plan2 = QString::fromStdString(m_dtc->mainSchedule(m_anotherScheduleId).name);
|
||||
|
||||
Columns col = static_cast<Columns>(section);
|
||||
switch (col)
|
||||
@@ -160,10 +162,10 @@ StructureElement ConflictsDialogModel::setBuildingGroup(int groupId)
|
||||
StructureElement se;
|
||||
BuildingGroup buildingGroup = static_cast<BuildingGroup>(groupId);
|
||||
|
||||
se.id() = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name() = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.displayName() = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId() = StructureElementType::Section;
|
||||
se.id = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.displayName = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId = StructureElementType::Section;
|
||||
return se;
|
||||
}
|
||||
|
||||
@@ -193,27 +195,27 @@ void ConflictsDialogModel::initData()
|
||||
#endif
|
||||
|
||||
InfrastructureManagement::MainSchedule currentSchedule = m_dtc->mainSchedule(m_scheduleId);
|
||||
for (const InfrastructureManagement::MountingPointPlan ¤tPlan : currentSchedule.elements())
|
||||
for (const InfrastructureManagement::MountingPointPlan ¤tPlan : currentSchedule.elements)
|
||||
{
|
||||
StructureElement se;
|
||||
if (!m_dtc->getStructureElementById(currentPlan.structureElementId(), se))
|
||||
if (!m_dtc->getStructureElementById(currentPlan.structureElementId, se))
|
||||
continue;
|
||||
|
||||
if (m_visibleTypes.contains(se.mountingPointTypeId()))
|
||||
currentMountingPoints.insert(currentPlan.structureElementId(), currentPlan);
|
||||
if (m_visibleTypes.contains(se.mountingPointTypeId))
|
||||
currentMountingPoints.insert(currentPlan.structureElementId, currentPlan);
|
||||
}
|
||||
|
||||
|
||||
InfrastructureManagement::MainSchedule compareSchedule = m_dtc->mainSchedule(m_anotherScheduleId);
|
||||
for (const InfrastructureManagement::MountingPointPlan &comparePlan : compareSchedule.elements())
|
||||
for (const InfrastructureManagement::MountingPointPlan &comparePlan : compareSchedule.elements)
|
||||
{
|
||||
if (!currentMountingPoints.contains(comparePlan.structureElementId()))
|
||||
if (!currentMountingPoints.contains(comparePlan.structureElementId))
|
||||
continue;
|
||||
|
||||
StructureElement structEl;
|
||||
if (!m_dtc->getStructureElementById(comparePlan.structureElementId(), structEl))
|
||||
if (!m_dtc->getStructureElementById(comparePlan.structureElementId, structEl))
|
||||
continue;
|
||||
if (!m_visibleTypes.contains(structEl.mountingPointTypeId()))
|
||||
if (!m_visibleTypes.contains(structEl.mountingPointTypeId))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -227,25 +229,25 @@ void ConflictsDialogModel::initData()
|
||||
|
||||
|
||||
|
||||
const MountingPointPlan &mp1 = currentMountingPoints[comparePlan.structureElementId()];
|
||||
if ((mp1.mountingPointState() == MountingPointState::Equipped && comparePlan.mountingPointState() == MountingPointState::Empty) ||
|
||||
(mp1.mountingPointState() == MountingPointState::Empty && comparePlan.mountingPointState() == MountingPointState::Equipped))
|
||||
const MountingPointPlan &mp1 = currentMountingPoints[comparePlan.structureElementId];
|
||||
if ((mp1.mountingPointState == MountingPointState::Equipped && comparePlan.mountingPointState == MountingPointState::Empty) ||
|
||||
(mp1.mountingPointState == MountingPointState::Empty && comparePlan.mountingPointState == MountingPointState::Equipped))
|
||||
{
|
||||
compareMountingPoints.insert(comparePlan.structureElementId(), comparePlan);
|
||||
compareMountingPoints.insert(comparePlan.structureElementId, comparePlan);
|
||||
StructureElement se;
|
||||
|
||||
if (!m_dtc->getStructureElementById(comparePlan.structureElementId(), se))
|
||||
if (!m_dtc->getStructureElementById(comparePlan.structureElementId, se))
|
||||
continue;
|
||||
|
||||
const std::vector<int> &path = se.path();
|
||||
const std::vector<int> &path = se.path;
|
||||
for(const auto &seId : path)
|
||||
conflictedStructElIds.insert(seId);
|
||||
|
||||
if(conflictedMainStructElements.contains(se.mainStructureElementId()))
|
||||
if(conflictedMainStructElements.contains(se.mainStructureElementId))
|
||||
continue;
|
||||
|
||||
const MainStructureElement &mse = m_dtc->mainStructureElement(se.mainStructureElementId());
|
||||
conflictedMainStructElements.insert(mse.id(), mse);
|
||||
const MainStructureElement &mse = m_dtc->mainStructureElement(se.mainStructureElementId);
|
||||
conflictedMainStructElements.insert(mse.id, mse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,64 +257,64 @@ void ConflictsDialogModel::initData()
|
||||
for (const MainStructureElement &mse : conflictedMainStructElements)
|
||||
{
|
||||
|
||||
if (mse.structureElementTypeId() != StructureElementType::Building)
|
||||
if (mse.structureElementTypeId != StructureElementType::Building)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
QModelIndex groupIndex;
|
||||
const StructureElement bse = setBuildingGroup(mse.groupId());
|
||||
if(!m_availableBuildingGroups.contains(bse.id()))
|
||||
const StructureElement bse = setBuildingGroup(mse.groupId);
|
||||
if(!m_availableBuildingGroups.contains(bse.id))
|
||||
{
|
||||
ConflictStructureElementData buildingGroup;
|
||||
buildingGroup.name = QString::fromStdString(bse.displayName());
|
||||
buildingGroup.name = QString::fromStdString(bse.displayName);
|
||||
NGLTreeItem *groupItem = new NGLTreeItem(QVariant::fromValue(buildingGroup));
|
||||
QModelIndex groupParentIndex;
|
||||
groupParentIndex = indexFromItem(m_rootItem);
|
||||
|
||||
insertRow(rowCount(groupParentIndex), groupParentIndex, groupItem);
|
||||
groupIndex = index(groupItem->row(), 0, groupParentIndex);
|
||||
m_mountingPointIndexes.insert(bse.id(), groupIndex);
|
||||
m_mountingPointIndexes.insert(bse.id, groupIndex);
|
||||
|
||||
m_availableBuildingGroups.insert(bse.id());
|
||||
m_availableBuildingGroups.insert(bse.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupIndex = m_mountingPointIndexes.value(bse.id(), indexFromItem(m_rootItem));
|
||||
groupIndex = m_mountingPointIndexes.value(bse.id, indexFromItem(m_rootItem));
|
||||
}
|
||||
|
||||
for (const StructureElement ¤tElement : mse.elements())
|
||||
for (const StructureElement ¤tElement : mse.elements)
|
||||
{
|
||||
NGLTreeItem *item = nullptr;
|
||||
if (!conflictedStructElIds.contains(currentElement.id()))
|
||||
if (!conflictedStructElIds.contains(currentElement.id))
|
||||
continue;
|
||||
|
||||
if (currentElement.structureElementTypeId() == StructureElementType::MountingPoint)
|
||||
if (currentElement.structureElementTypeId == StructureElementType::MountingPoint)
|
||||
{
|
||||
if (!currentMountingPoints.contains(currentElement.id()))
|
||||
if (!currentMountingPoints.contains(currentElement.id))
|
||||
continue;
|
||||
|
||||
const MountingPointPlan &mountingPoint = currentMountingPoints[currentElement.id()];
|
||||
const MountingPointPlan &mountingPoint = currentMountingPoints[currentElement.id];
|
||||
|
||||
|
||||
if (mountingPoint.mountingPointState() == MountingPointState::Idle)
|
||||
if (mountingPoint.mountingPointState == MountingPointState::Idle)
|
||||
continue;
|
||||
|
||||
auto compareMountingPointState = compareMountingPoints.value(currentElement.id()).mountingPointState();
|
||||
auto compareMountingPointState = compareMountingPoints.value(currentElement.id).mountingPointState;
|
||||
|
||||
if (mountingPoint.mountingPointState() == compareMountingPointState)
|
||||
if (mountingPoint.mountingPointState == compareMountingPointState)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "No conflict for mounting point id = " << currentElement.id() << " - " << currentElement.name();
|
||||
DEBUG_LOG(m_logger) << "No conflict for mounting point id = " << currentElement.id << " - " << currentElement.name;
|
||||
continue;
|
||||
}
|
||||
|
||||
ConflictMountingPointData mpData;
|
||||
mpData.seType = currentElement.structureElementTypeId();
|
||||
mpData.id = currentElement.id();
|
||||
mpData.name = currentElement.displayName().empty() ? QString::fromStdString(currentElement.name()) : QString::fromStdString(currentElement.displayName());
|
||||
mpData.aimState = mountingPoint.mountingPointState();
|
||||
mpData.seType = currentElement.structureElementTypeId;
|
||||
mpData.id = currentElement.id;
|
||||
mpData.name = currentElement.displayName.empty() ? QString::fromStdString(currentElement.name) : QString::fromStdString(currentElement.displayName);
|
||||
mpData.aimState = mountingPoint.mountingPointState;
|
||||
mpData.conflictState = compareMountingPointState;
|
||||
mpData.mpType = currentElement.mountingPointTypeId();
|
||||
mpData.mpType = currentElement.mountingPointTypeId;
|
||||
|
||||
DEBUG_LOG(m_logger) << "## MP Id = " << mpData.id;
|
||||
DEBUG_LOG(m_logger) << "## MP Name = " << mpData.name;
|
||||
@@ -325,12 +327,12 @@ void ConflictsDialogModel::initData()
|
||||
else
|
||||
{
|
||||
ConflictStructureElementData ssed;
|
||||
ssed.name = currentElement.displayName().empty() ? QString::fromStdString(currentElement.name()) : QString::fromStdString(currentElement.displayName());
|
||||
ssed.name = currentElement.displayName.empty() ? QString::fromStdString(currentElement.name) : QString::fromStdString(currentElement.displayName);
|
||||
|
||||
item = new NGLTreeItem(QVariant::fromValue(ssed));
|
||||
}
|
||||
|
||||
const auto &path = currentElement.path();
|
||||
const auto &path = currentElement.path;
|
||||
|
||||
QModelIndex parentIndex;
|
||||
if (path.size() > 1)
|
||||
@@ -338,21 +340,21 @@ void ConflictsDialogModel::initData()
|
||||
parentIndex = m_mountingPointIndexes.value(path.at(path.size() - 2), indexFromItem(m_rootItem));
|
||||
if (!parentIndex.isValid())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id() << " mseid: " << mse.id();
|
||||
for (const StructureElement &se : mse.elements())
|
||||
DEBUG_LOG(m_logger) << " se: " << se.id() << ", " << se.displayName() << ", " << se.name();
|
||||
DEBUG_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id << " mseid: " << mse.id;
|
||||
for (const StructureElement &se : mse.elements)
|
||||
DEBUG_LOG(m_logger) << " se: " << se.id << ", " << se.displayName << ", " << se.name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
parentIndex = groupIndex.isValid() ? groupIndex : indexFromItem(m_rootItem);
|
||||
DEBUG_LOG(m_logger) << "Insert row under root: " << currentElement.displayName();
|
||||
DEBUG_LOG(m_logger) << "Insert row under root: " << currentElement.displayName;
|
||||
}
|
||||
|
||||
insertRow(rowCount(parentIndex), parentIndex, item);
|
||||
|
||||
m_mountingPointIndexes.insert(currentElement.id(), index(item->row(), 0, parentIndex));
|
||||
m_mountingPointIndexes.insert(currentElement.id, index(item->row(), 0, parentIndex));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
-10
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_overview_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ism_overview_conflicts_dialog.h"
|
||||
#include "ui_ism_overview_dialog.h"
|
||||
#include "ism_overview_dialog_model.h"
|
||||
@@ -25,6 +26,7 @@ OverviewDialog::OverviewDialog(const QString &menuGroup, LtsSession::LtsSession
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::OverviewDialog)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
m_ui->setupUi(this);
|
||||
@@ -104,7 +106,7 @@ void OverviewDialog::setCbBasePlan()
|
||||
m_ui->cbBasePlan->addItem(tr("Actual Mountings"), 0);
|
||||
m_ui->cbBasePlan->insertSeparator(1);
|
||||
for (auto ms : m_dtc->mainSchedules())
|
||||
m_ui->cbBasePlan->addItem(QString::fromStdString(ms.name()), ms.id());
|
||||
m_ui->cbBasePlan->addItem(QString::fromStdString(ms.name), ms.id);
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
@@ -116,8 +118,8 @@ void OverviewDialog::setCbComparePlan()
|
||||
m_ui->cbComparePlan->addItem(tr("All active(*) plans"),0);
|
||||
m_ui->cbComparePlan->insertSeparator(1);
|
||||
for (auto ms : m_dtc->mainSchedules())
|
||||
m_ui->cbComparePlan->addItem((ms.statusId() == ScheduleStatus::Active ? QLatin1Literal("* ") : QLatin1Literal(" ")) +
|
||||
QString::fromStdString(ms.name()), ms.id());
|
||||
m_ui->cbComparePlan->addItem((ms.statusId == ScheduleStatus::Active ? QStringLiteral("* ") : QStringLiteral(" ")) +
|
||||
QString::fromStdString(ms.name), ms.id);
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
@@ -127,19 +129,19 @@ void OverviewDialog::onPrint()
|
||||
|
||||
QString header;
|
||||
header += QStringLiteral("<p>");
|
||||
header += tr("Instrumentation Plan: %1").arg(QString::fromStdString(ms.name()));
|
||||
header += tr("Instrumentation Plan: %1").arg(QString::fromStdString(ms.name));
|
||||
header += QStringLiteral("<br/>");
|
||||
header += tr("Status: %1").arg(toString(ms.statusId()));
|
||||
header += tr("Status: %1").arg(toString(ms.statusId));
|
||||
header += QStringLiteral("<br/>");
|
||||
header += tr("Created: %1").arg(DTG::toStringMSec(ms.timeCreated()));
|
||||
header += tr("Created: %1").arg(DTG::toStringMSec(ms.timeCreated));
|
||||
header += QStringLiteral("<br/>");
|
||||
if (ms.timeStart().is_set())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(ms.timeStart().get()));
|
||||
if (ms.timeStart.has_value())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(ms.timeStart.get()));
|
||||
else
|
||||
header += tr("START: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral(" - ");
|
||||
if (ms.timeEnd().is_set())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(ms.timeEnd().get()));
|
||||
if (ms.timeEnd.has_value())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(ms.timeEnd.get()));
|
||||
else
|
||||
header += tr("END: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral("<br/>");
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <InfrastructureManagement/ism_dtc.h>
|
||||
#include <InfrastructureManagement/ism_data_plugin.h>
|
||||
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
|
||||
#include <InfrastructureManagement/logger.h>
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
|
||||
|
||||
+41
-39
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_overview_dialog_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
@@ -30,6 +31,7 @@ OverviewDialogModel::OverviewDialogModel(QObject *parent)
|
||||
, m_loadedScheduleId(-1)
|
||||
, m_comparedScheduleId(0)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
@@ -186,10 +188,10 @@ MountingPointType OverviewDialogModel::getMountingPointTypeId(int structureEleme
|
||||
|
||||
StructureElement se;
|
||||
if (!m_dtc->getStructureElementById(structureElementId, se))
|
||||
return MountingPointType::get_default();
|
||||
return MountingPointType::Unknown;
|
||||
|
||||
|
||||
const MountingPointType mpType = (se.mountingPointTypeId() == MountingPointType::OutdoorIPS) ? MountingPointType::IndoorIPS : se.mountingPointTypeId();
|
||||
const MountingPointType mpType = (se.mountingPointTypeId == MountingPointType::OutdoorIPS) ? MountingPointType::IndoorIPS : se.mountingPointTypeId;
|
||||
m_availableMountingPointTypes.insert(structureElementId, mpType);
|
||||
return mpType;
|
||||
}
|
||||
@@ -198,7 +200,7 @@ bool OverviewDialogModel::hasMountedAsset(int seId)
|
||||
{
|
||||
for (const InfrastructureManagement::MountingPointAsset &asset : std::as_const(m_mountingPointAssets))
|
||||
{
|
||||
if (asset.structureElementId() == seId)
|
||||
if (asset.structureElementId == seId)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -219,46 +221,46 @@ QHash<int, MountingPointPlan> OverviewDialogModel::mergePlans(const QHash<int, M
|
||||
const auto msConst = m_dtc->mainSchedules();
|
||||
for (const auto &schedule : msConst)
|
||||
{
|
||||
if (cmpPlanId == 0 && schedule.statusId() != ScheduleStatus::Active)
|
||||
if (cmpPlanId == 0 && schedule.statusId != ScheduleStatus::Active)
|
||||
continue;
|
||||
if (cmpPlanId != 0 && cmpPlanId != schedule.id())
|
||||
if (cmpPlanId != 0 && cmpPlanId != schedule.id)
|
||||
continue;
|
||||
|
||||
for (const MountingPointPlan ¤tMpp : schedule.elements())
|
||||
for (const MountingPointPlan ¤tMpp : schedule.elements)
|
||||
{
|
||||
if (m_conflictedStructureElementIds.contains(currentMpp.structureElementId()))
|
||||
if (m_conflictedStructureElementIds.contains(currentMpp.structureElementId))
|
||||
continue;
|
||||
|
||||
const MountingPointType mpType = getMountingPointTypeId(currentMpp.structureElementId());
|
||||
const MountingPointType mpType = getMountingPointTypeId(currentMpp.structureElementId);
|
||||
|
||||
if (!m_refMap.contains(mpType))
|
||||
continue;
|
||||
|
||||
if (currPlan.contains(currentMpp.structureElementId()))
|
||||
if (currPlan.contains(currentMpp.structureElementId))
|
||||
{
|
||||
const MountingPointPlan &basePlanMpp = currPlan[currentMpp.structureElementId()];
|
||||
const MountingPointPlan &basePlanMpp = currPlan[currentMpp.structureElementId];
|
||||
|
||||
|
||||
|
||||
if ((basePlanMpp.mountingPointState() == MountingPointState::Equipped && currentMpp.mountingPointState() == MountingPointState::Empty) ||
|
||||
(basePlanMpp.mountingPointState() == MountingPointState::Empty && currentMpp.mountingPointState() == MountingPointState::Equipped))
|
||||
if ((basePlanMpp.mountingPointState == MountingPointState::Equipped && currentMpp.mountingPointState == MountingPointState::Empty) ||
|
||||
(basePlanMpp.mountingPointState == MountingPointState::Empty && currentMpp.mountingPointState == MountingPointState::Equipped))
|
||||
{
|
||||
DEBUG_LOG(m_logger)<<" conflicted name: "<<currentMpp.structureElementId();
|
||||
mergedPlan[currentMpp.structureElementId()].mountingPointState(MountingPointState::Idle);
|
||||
m_conflictedStructureElementIds.insert(basePlanMpp.structureElementId());
|
||||
DEBUG_LOG(m_logger)<<" conflicted name: "<<currentMpp.structureElementId;
|
||||
mergedPlan[currentMpp.structureElementId].mountingPointState = MountingPointState::Idle;
|
||||
m_conflictedStructureElementIds.insert(basePlanMpp.structureElementId);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(basePlanMpp.mountingPointState().underlying())
|
||||
switch(basePlanMpp.mountingPointState)
|
||||
{
|
||||
case MountingPointState::Empty:
|
||||
mergedPlan[currentMpp.structureElementId()].mountingPointState(MountingPointState::Empty);
|
||||
mergedPlan[currentMpp.structureElementId].mountingPointState = MountingPointState::Empty;
|
||||
break;
|
||||
case MountingPointState::Equipped:
|
||||
mergedPlan[currentMpp.structureElementId()].mountingPointState(MountingPointState::Equipped);
|
||||
mergedPlan[currentMpp.structureElementId].mountingPointState = MountingPointState::Equipped;
|
||||
break;
|
||||
case MountingPointState::Idle:
|
||||
mergedPlan[currentMpp.structureElementId()].mountingPointState(currentMpp.mountingPointState());
|
||||
mergedPlan[currentMpp.structureElementId].mountingPointState = currentMpp.mountingPointState;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -267,7 +269,7 @@ QHash<int, MountingPointPlan> OverviewDialogModel::mergePlans(const QHash<int, M
|
||||
}
|
||||
else
|
||||
{
|
||||
mergedPlan[currentMpp.structureElementId()] = currentMpp;
|
||||
mergedPlan[currentMpp.structureElementId] = currentMpp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,20 +301,20 @@ void OverviewDialogModel::setNewData()
|
||||
for (const InstrumentationAsset &asset : iaConst )
|
||||
{
|
||||
|
||||
const MountingPointType mpType = (asset.mountingPointTypeId() == MountingPointType::OutdoorIPS) ? MountingPointType::IndoorIPS : asset.mountingPointTypeId();
|
||||
const MountingPointType mpType = (asset.mountingPointTypeId == MountingPointType::OutdoorIPS) ? MountingPointType::IndoorIPS : asset.mountingPointTypeId;
|
||||
if (!m_refMap.contains(mpType))
|
||||
continue;
|
||||
|
||||
++m_vecData[m_refMap[mpType]].assetCount;
|
||||
|
||||
|
||||
if (asset.assetStateId() == InstrumentationAssetState::Defect)
|
||||
if (asset.assetStateId == InstrumentationAssetState::Defect)
|
||||
++m_vecData[m_refMap[mpType]].assetsDefect;
|
||||
|
||||
if (asset.assetStateId() == InstrumentationAssetState::Unmounted)
|
||||
if (asset.assetStateId == InstrumentationAssetState::Unmounted)
|
||||
++m_vecData[m_refMap[mpType]].assetsFree;
|
||||
|
||||
if (asset.assetStateId() == InstrumentationAssetState::Mounted)
|
||||
if (asset.assetStateId == InstrumentationAssetState::Mounted)
|
||||
{
|
||||
++m_vecData[m_refMap[mpType]].assetsMounted;
|
||||
if (m_basePlanId == 0)
|
||||
@@ -333,16 +335,16 @@ void OverviewDialogModel::setNewData()
|
||||
{
|
||||
MainSchedule baseSchedule = m_dtc->mainSchedules().value(m_basePlanId);
|
||||
|
||||
for (const MountingPointPlan &mpp : baseSchedule.elements())
|
||||
for (const MountingPointPlan &mpp : baseSchedule.elements)
|
||||
{
|
||||
const MountingPointType mpType = getMountingPointTypeId(mpp.structureElementId());
|
||||
const MountingPointType mpType = getMountingPointTypeId(mpp.structureElementId);
|
||||
|
||||
if (!m_refMap.contains(mpType))
|
||||
continue;
|
||||
|
||||
baseMountingPointPlans.insert(mpp.structureElementId(), mpp);
|
||||
baseMountingPointPlans.insert(mpp.structureElementId, mpp);
|
||||
|
||||
if (mpp.mountingPointState() == MountingPointState::Equipped)
|
||||
if (mpp.mountingPointState == MountingPointState::Equipped)
|
||||
++m_vecData[m_refMap[mpType]].basePlanDemand;
|
||||
}
|
||||
}
|
||||
@@ -351,9 +353,9 @@ void OverviewDialogModel::setNewData()
|
||||
|
||||
const auto msesConst = m_dtc->mainStructureElements();
|
||||
for(const auto &mse : msesConst)
|
||||
for (const auto &se : mse.elements())
|
||||
if (hasMountedAsset(se.id()))
|
||||
baseMountingPointPlans.insert(se.id(), MountingPointPlan(se.id(), MountingPointState::Equipped));
|
||||
for (const auto &se : mse.elements)
|
||||
if (hasMountedAsset(se.id))
|
||||
baseMountingPointPlans.insert(se.id, MountingPointPlan(se.id, MountingPointState::Equipped));
|
||||
}
|
||||
|
||||
|
||||
@@ -376,33 +378,33 @@ void OverviewDialogModel::setNewData()
|
||||
|
||||
for(const auto &bla: totalMPPs)
|
||||
{
|
||||
MountingPointPlan compareMpp = comparedMountingPointPlans.value(bla.structureElementId(), MountingPointPlan(bla.structureElementId(), MountingPointState::Idle));
|
||||
MountingPointPlan baseMpp = baseMountingPointPlans.value(bla.structureElementId(), MountingPointPlan(bla.structureElementId(), MountingPointState::Idle));
|
||||
MountingPointPlan compareMpp = comparedMountingPointPlans.value(bla.structureElementId, MountingPointPlan(bla.structureElementId, MountingPointState::Idle));
|
||||
MountingPointPlan baseMpp = baseMountingPointPlans.value(bla.structureElementId, MountingPointPlan(bla.structureElementId, MountingPointState::Idle));
|
||||
|
||||
const MountingPointType mpType = getMountingPointTypeId(bla.structureElementId());
|
||||
const MountingPointType mpType = getMountingPointTypeId(bla.structureElementId);
|
||||
if (!m_refMap.contains(mpType))
|
||||
continue;
|
||||
|
||||
|
||||
switch(baseMpp.mountingPointState().underlying())
|
||||
switch(baseMpp.mountingPointState)
|
||||
{
|
||||
case MountingPointState::Empty:
|
||||
if (compareMpp.mountingPointState() == MountingPointState::Equipped)
|
||||
if (compareMpp.mountingPointState == MountingPointState::Equipped)
|
||||
++m_vecData[m_refMap[mpType]].totalDemand;
|
||||
break;
|
||||
case MountingPointState::Equipped:
|
||||
if (compareMpp.mountingPointState() != MountingPointState::Equipped)
|
||||
if (compareMpp.mountingPointState != MountingPointState::Equipped)
|
||||
--m_vecData[m_refMap[mpType]].totalDemand;
|
||||
break;
|
||||
case MountingPointState::Idle:
|
||||
if (compareMpp.mountingPointState() == MountingPointState::Equipped)
|
||||
if (compareMpp.mountingPointState == MountingPointState::Equipped)
|
||||
++m_vecData[m_refMap[mpType]].totalDemand;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(compareMpp.mountingPointState().underlying())
|
||||
switch(compareMpp.mountingPointState)
|
||||
{
|
||||
case MountingPointState::Equipped:
|
||||
++m_vecData[m_refMap[mpType]].comparePlanDemand;
|
||||
|
||||
+10
-8
@@ -15,6 +15,7 @@
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QHeaderView>
|
||||
#include <qscrollbar.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
using namespace InfrastructureManagement;
|
||||
|
||||
@@ -26,6 +27,7 @@ OverviewMountingPointListDialog::OverviewMountingPointListDialog(const QString &
|
||||
, m_actionMenu(new QMenu(this))
|
||||
, m_printMountingAction(new QAction(tr("To Mount"), this))
|
||||
, m_printUnmountingAction(new QAction(tr("To Unmount"), this))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
@@ -226,7 +228,7 @@ void OverviewMountingPointListDialog::retranslate()
|
||||
if (m_dtc)
|
||||
{
|
||||
MainSchedule ms = m_dtc->mainSchedule(m_scheduleId);
|
||||
const QString msName = QString::fromStdString(ms.name());
|
||||
const QString msName = QString::fromStdString(ms.name);
|
||||
translate(m_ui, tr("Completeness Check '%1'").arg(msName));
|
||||
}
|
||||
else
|
||||
@@ -242,7 +244,7 @@ void OverviewMountingPointListDialog::addMountingPointTypeFilter(MountingPointTy
|
||||
|
||||
m_mountedPointSortProxyModel->addToTypeFilter(mpt, isInitChecked);
|
||||
m_unmountedPointSortProxyModel->addToTypeFilter(mpt, isInitChecked);
|
||||
lwi->setData(Qt::UserRole, mpt.underlying());
|
||||
lwi->setData(Qt::UserRole, static_cast<int>(mpt));
|
||||
const QString text = toString(mpt);
|
||||
lwi->setText(text);
|
||||
lwi->setSelected(isInitChecked);
|
||||
@@ -266,17 +268,17 @@ void OverviewMountingPointListDialog::onPrint(QAction *action)
|
||||
MainSchedule ms = m_dtc->mainSchedule(m_dataIfc->scheduleId());
|
||||
QString header;
|
||||
header += QStringLiteral("<p>");
|
||||
header += tr("Instrumentation Plan: %1").arg(QString::fromStdString(ms.name()));
|
||||
header += tr("Instrumentation Plan: %1").arg(QString::fromStdString(ms.name));
|
||||
header += QStringLiteral("<br/>");
|
||||
header += tr("Created: %1").arg(DTG::toStringMSec(ms.timeCreated()));
|
||||
header += tr("Created: %1").arg(DTG::toStringMSec(ms.timeCreated));
|
||||
header += QStringLiteral("<br/>");
|
||||
if (ms.timeStart().is_set())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(ms.timeStart().get()));
|
||||
if (ms.timeStart.has_value())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(ms.timeStart.get()));
|
||||
else
|
||||
header += tr("START: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral(" - ");
|
||||
if (ms.timeEnd().is_set())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(ms.timeEnd().get()));
|
||||
if (ms.timeEnd.has_value())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(ms.timeEnd.get()));
|
||||
else
|
||||
header += tr("END: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral("<br/>");
|
||||
|
||||
+36
-34
@@ -6,7 +6,8 @@
|
||||
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QTimer>
|
||||
@@ -24,6 +25,7 @@ namespace InfrastructureManagement
|
||||
static const int maxIntValue = std::numeric_limits<int>::max();
|
||||
ViewMountingPointListModel::ViewMountingPointListModel(QObject *parent)
|
||||
: NGLTreeModel(parent, new NGLTreeItem(QVariant()), { tr("Name"), tr("Type"), tr("Aim State") })
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_visRoot(new NGLTreeItem(tr("Mounting Points")))
|
||||
, m_dtc(nullptr)
|
||||
, m_dataChangedTimer(new QTimer(this))
|
||||
@@ -96,7 +98,7 @@ QVariant ViewMountingPointListModel::data(const QModelIndex &index, int role) co
|
||||
else if (role == Qt::UserRole && item->data().canConvert<OverviewSimpleMountingPointData>())
|
||||
return item->data().value<OverviewSimpleMountingPointData>().id;
|
||||
else if (role == (Qt::UserRole + 1) && item->data().canConvert<OverviewSimpleMountingPointData>())
|
||||
return item->data().value<OverviewSimpleMountingPointData>().aimState.underlying();
|
||||
return static_cast<int>(item->data().value<OverviewSimpleMountingPointData>().aimState);
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
@@ -152,15 +154,15 @@ inline StructureElement setBuildingGroup(int groupId)
|
||||
{
|
||||
StructureElement se;
|
||||
InfrastructureManagement::BuildingGroup buildingGroup = static_cast<InfrastructureManagement::BuildingGroup>(groupId);
|
||||
if(buildingGroup == 0)
|
||||
if(static_cast<int>(buildingGroup) == 0)
|
||||
{
|
||||
buildingGroup = InfrastructureManagement::BuildingGroup::UnknownGroup;
|
||||
}
|
||||
|
||||
se.id() = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name() = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.displayName() = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId() = InfrastructureManagement::StructureElementType::Section;
|
||||
se.id = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.displayName = InfrastructureManagement::toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId = InfrastructureManagement::StructureElementType::Section;
|
||||
return se;
|
||||
}
|
||||
|
||||
@@ -168,7 +170,7 @@ inline StructureElement setBuildingGroup(int groupId)
|
||||
inline int getFakeBuildingGroupId(int seId)
|
||||
{
|
||||
InfrastructureManagement::BuildingGroup buildingGroup = static_cast<InfrastructureManagement::BuildingGroup>(seId);
|
||||
if(buildingGroup == 0)
|
||||
if(static_cast<int>(buildingGroup) == 0)
|
||||
{
|
||||
buildingGroup = InfrastructureManagement::BuildingGroup::UnknownGroup;
|
||||
}
|
||||
@@ -206,8 +208,8 @@ void ViewMountingPointListModel::initData()
|
||||
{
|
||||
|
||||
const InfrastructureManagement::MainSchedule ¤tSchedule = m_dtc->mainSchedule(m_scheduleId);
|
||||
for (const MountingPointPlan &mpp : std::as_const(currentSchedule.elements()))
|
||||
mountingPointPlanCont.insert(mpp.structureElementId(), mpp);
|
||||
for (const MountingPointPlan &mpp : std::as_const(currentSchedule.elements))
|
||||
mountingPointPlanCont.insert(mpp.structureElementId, mpp);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,39 +227,39 @@ void ViewMountingPointListModel::initData()
|
||||
for (const MainStructureElement &mse : mainStructEles)
|
||||
{
|
||||
|
||||
if (mse.structureElementTypeId() != StructureElementType::Building)
|
||||
if (mse.structureElementTypeId != StructureElementType::Building)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
|
||||
QModelIndex groupIndex;
|
||||
const StructureElement bse= setBuildingGroup(mse.groupId());
|
||||
if (m_availableBuildingGroups.contains(bse.id()) == false)
|
||||
const StructureElement bse= setBuildingGroup(mse.groupId);
|
||||
if (m_availableBuildingGroups.contains(bse.id) == false)
|
||||
{
|
||||
OverviewSimpleBuildingGroupData buildingGroup;
|
||||
buildingGroup.name = QString::fromStdString(bse.displayName());
|
||||
buildingGroup.id = bse.id();
|
||||
buildingGroup.name = QString::fromStdString(bse.displayName);
|
||||
buildingGroup.id = bse.id;
|
||||
NGLTreeItem *groupItem = new NGLTreeItem(QVariant::fromValue(buildingGroup));
|
||||
QModelIndex groupParentIndex;
|
||||
groupParentIndex = indexFromItem(m_visRoot);
|
||||
insertRow(rowCount(groupParentIndex), groupParentIndex, groupItem);
|
||||
groupIndex = index(groupItem->row(), 0, groupParentIndex);
|
||||
m_mountingPointIndexes.insert(bse.id(), groupIndex);
|
||||
m_availableBuildingGroups.insert(bse.id());
|
||||
m_mountingPointIndexes.insert(bse.id, groupIndex);
|
||||
m_availableBuildingGroups.insert(bse.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
groupIndex = m_mountingPointIndexes.value(bse.id(), indexFromItem(m_visRoot));
|
||||
groupIndex = m_mountingPointIndexes.value(bse.id, indexFromItem(m_visRoot));
|
||||
}
|
||||
|
||||
for (const StructureElement ¤tElement : mse.elements())
|
||||
for (const StructureElement ¤tElement : mse.elements)
|
||||
{
|
||||
NGLTreeItem *item = nullptr;
|
||||
|
||||
if (currentElement.structureElementTypeId() == StructureElementType::MountingPoint)
|
||||
if (currentElement.structureElementTypeId == StructureElementType::MountingPoint)
|
||||
{
|
||||
MountingPoint mountingPoint = m_dataInterface->mountingPoint(currentElement.id());
|
||||
MountingPoint mountingPoint = m_dataInterface->mountingPoint(currentElement.id);
|
||||
|
||||
if (!mountingPoint.isValid())
|
||||
continue;
|
||||
@@ -269,7 +271,7 @@ void ViewMountingPointListModel::initData()
|
||||
continue;
|
||||
|
||||
OverviewSimpleMountingPointData mpData;
|
||||
mpData.seType = currentElement.structureElementTypeId();
|
||||
mpData.seType = currentElement.structureElementTypeId;
|
||||
mpData.id = mountingPoint.id();
|
||||
mpData.name = mountingPoint.name();
|
||||
mpData.mpType = mountingPoint.type();
|
||||
@@ -284,7 +286,7 @@ void ViewMountingPointListModel::initData()
|
||||
if (mountingPointPlanCont.contains(mpId_StructEleId))
|
||||
{
|
||||
const MountingPointPlan &mpp = mountingPointPlanCont.value(mpId_StructEleId);
|
||||
mpData.aimState = mpp.mountingPointState();
|
||||
mpData.aimState = mpp.mountingPointState;
|
||||
} else {
|
||||
mpData.aimState = MountingPointState::Idle;
|
||||
}
|
||||
@@ -295,15 +297,15 @@ void ViewMountingPointListModel::initData()
|
||||
else
|
||||
{
|
||||
OverviewSimpleStructureElementData ssed;
|
||||
if (currentElement.structureElementTypeId() == StructureElementType::Floor)
|
||||
ssed.floor = QString::fromStdString(currentElement.name()).split(QLatin1Literal("_")).value(1, QLatin1String("-10")).toInt();
|
||||
if (currentElement.structureElementTypeId == StructureElementType::Floor)
|
||||
ssed.floor = QString::fromStdString(currentElement.name).split(QStringLiteral("_")).value(1, QLatin1String("-10")).toInt();
|
||||
else
|
||||
ssed.floor = -20;
|
||||
ssed.name = currentElement.displayName().empty() ? QString::fromStdString(currentElement.name()) : QString::fromStdString(currentElement.displayName());
|
||||
ssed.name = currentElement.displayName.empty() ? QString::fromStdString(currentElement.name) : QString::fromStdString(currentElement.displayName);
|
||||
item = new NGLTreeItem(QVariant::fromValue(ssed));
|
||||
}
|
||||
|
||||
const auto &path = currentElement.path();
|
||||
const auto &path = currentElement.path;
|
||||
|
||||
QModelIndex parentIndex;
|
||||
if (path.size() > 1)
|
||||
@@ -311,9 +313,9 @@ void ViewMountingPointListModel::initData()
|
||||
parentIndex = m_mountingPointIndexes.value(path.at(path.size() - 2), indexFromItem(m_visRoot));
|
||||
if (!parentIndex.isValid())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id() << " mseid: " << mse.id();
|
||||
for (const StructureElement &se : mse.elements())
|
||||
ERROR_LOG(m_logger) << " se: " << se.id() << ", " << se.displayName() << ", " << se.name();
|
||||
ERROR_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id << " mseid: " << mse.id;
|
||||
for (const StructureElement &se : mse.elements)
|
||||
ERROR_LOG(m_logger) << " se: " << se.id << ", " << se.displayName << ", " << se.name;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -330,7 +332,7 @@ void ViewMountingPointListModel::initData()
|
||||
|
||||
insertRow(rowCount(parentIndex), parentIndex, item);
|
||||
|
||||
m_mountingPointIndexes.insert(currentElement.id(), index(item->row(), 0, parentIndex));
|
||||
m_mountingPointIndexes.insert(currentElement.id, index(item->row(), 0, parentIndex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,8 +340,8 @@ void ViewMountingPointListModel::initData()
|
||||
|
||||
#ifdef BENCHMARK
|
||||
const InfrastructureManagement::MainSchedule ¤tSchedule = m_dtc->mainSchedule(m_scheduleId);
|
||||
qCritical() << " ViewMountingPointListModel::initData-BENCHMARK: m_scheduleId=" << currentSchedule.id();
|
||||
qCritical() << " ViewMountingPointListModel::initData-BENCHMARK: m_scheduleId=" << currentSchedule.name().c_str();
|
||||
qCritical() << " ViewMountingPointListModel::initData-BENCHMARK: m_scheduleId=" << currentSchedule.id;
|
||||
qCritical() << " ViewMountingPointListModel::initData-BENCHMARK: m_scheduleId=" << currentSchedule.name.c_str();
|
||||
|
||||
|
||||
qCritical() << " ViewMountingPointListModel::initData-BENCHMARK: m_scheduleId=" << m_scheduleId << " took " << elapsedTimer1.elapsed() << " [ms]";
|
||||
@@ -353,7 +355,7 @@ bool ViewMountingPointListModel::mountingPointHasAssetMounted(int32_t mountingPo
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
for (const MountingPointAsset &mpa : mountingPointAssetMap)
|
||||
{
|
||||
if (mpa.structureElementId() == mountingPointId)
|
||||
if (mpa.structureElementId == mountingPointId)
|
||||
return true;
|
||||
}
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
|
||||
+3
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "new_plan_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_new_plan_dialog.h"
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <QtCore/QDateTime>
|
||||
@@ -41,7 +42,7 @@ NewPlanDialog::~NewPlanDialog()
|
||||
void NewPlanDialog::init(const std::shared_ptr<ForeignGuiComboboxInterface> &ismCbx)
|
||||
{
|
||||
ismCbx->fillScheduleStatusComboBox(m_ui->cbStatus);
|
||||
m_ui->cbStatus->setCurrentIndex(m_ui->cbStatus->findData(ScheduleStatus::Inactive));
|
||||
m_ui->cbStatus->setCurrentIndex(m_ui->cbStatus->findData(static_cast<int>(ScheduleStatus::Inactive)));
|
||||
}
|
||||
|
||||
bool NewPlanDialog::getData(QString &name, qint64 &begin, qint64 &end, int &status)
|
||||
@@ -52,7 +53,7 @@ bool NewPlanDialog::getData(QString &name, qint64 &begin, qint64 &end, int &stat
|
||||
name = m_ui->lePlanName->text();
|
||||
begin = m_ui->dteBegin->msecsSinceEpoch();
|
||||
end = m_ui->dteEnd->msecsSinceEpoch();
|
||||
status = static_cast<ScheduleStatus>(m_ui->cbStatus->currentData().toInt());
|
||||
status = m_ui->cbStatus->currentData().toInt();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <InfrastructureManagement/logger.h>
|
||||
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
|
||||
#include <InfrastructureManagement/ism_data_plugin.h>
|
||||
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
#include <QtWidgets/QDialog>
|
||||
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@
|
||||
#include "ism_plan_dialog_model.h"
|
||||
#include "CustomViews/ism_schedule.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <ConnectDialog/connect_dialog_nt.h>
|
||||
@@ -111,7 +112,7 @@ void PlanChooser::slotPlanSelected()
|
||||
const QModelIndex idx = m_ui->widget->currentIndex();
|
||||
const MainSchedule ms = m_model->getRowData(idx.row());
|
||||
|
||||
int id = ms.id();
|
||||
int id = ms.id;
|
||||
|
||||
if (id <= 0)
|
||||
return;
|
||||
|
||||
+2
-2
@@ -89,12 +89,12 @@ void ScheduleDifferencesListDialog::onPrint()
|
||||
header += QStringLiteral("<br/>");
|
||||
header += tr("Created: %1").arg(DTG::toStringMSec(ms.timeCreated()));
|
||||
header += QStringLiteral("<br/>");
|
||||
if (ms.timeStart().is_set())
|
||||
if (ms.timeStart().has_value())
|
||||
header += tr("START: %1").arg(DTG::toStringMSec(ms.timeStart().get()));
|
||||
else
|
||||
header += tr("START: %1").arg(tr("[N/A]"));
|
||||
header += QStringLiteral(" - ");
|
||||
if (ms.timeEnd().is_set())
|
||||
if (ms.timeEnd().has_value())
|
||||
header += tr("END: %1").arg(DTG::toStringMSec(ms.timeEnd().get()));
|
||||
else
|
||||
header += tr("END: %1").arg(tr("[N/A]"));
|
||||
|
||||
+1
-1
@@ -272,7 +272,7 @@ void PlanTimeLineDialog::onItemsSelected(const QVector<int> &itemIds)
|
||||
if (m_scheduleId != seId && seId != -1)
|
||||
{
|
||||
MainSchedule mse = m_dtc->mainSchedule(seId);
|
||||
if (mse.timeStart().is_set())
|
||||
if (mse.timeStart().has_value())
|
||||
m_ui->timeline->setCurrentTime(mse.timeStart().get());
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, true);
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, true);
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
#include <InfrastructureManagement/logger.h>
|
||||
|
||||
#include <LtsTimeline/item_delegate.h>
|
||||
#include <InfrastructureManagement/ism_data_plugin.h>
|
||||
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
|
||||
+5
-5
@@ -80,19 +80,19 @@ bool PlanTimelineModel::setModel()
|
||||
|
||||
if (scheduleId == m_scheduleId)
|
||||
{
|
||||
if (!mse.timeStart().is_set() || !mse.timeEnd().is_set())
|
||||
if (!mse.timeStart().has_value() || !mse.timeEnd().has_value())
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(m_tlv, tr("Invalid Begin/End time for Instrumentation Plan with Id = %1").arg(m_scheduleId));
|
||||
return true;
|
||||
}
|
||||
if (mse.timeStart().is_set())
|
||||
if (mse.timeStart().has_value())
|
||||
m_startTime = mse.timeStart().get();
|
||||
if (mse.timeEnd().is_set())
|
||||
if (mse.timeEnd().has_value())
|
||||
m_endTime = mse.timeEnd().get();
|
||||
m_duration = m_endTime - m_startTime;
|
||||
}
|
||||
QColor color = (mse.id() == m_scheduleId) ? QColor(2,47,102) : getColor(mse.id());
|
||||
if (mse.timeStart().is_set() && mse.timeEnd().is_set())
|
||||
if (mse.timeStart().has_value() && mse.timeEnd().has_value())
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -193,7 +193,7 @@ void PlanTimelineModel::onScheduleIdChanged(int32_t scheduleId)
|
||||
QColor PlanTimelineModel::getColor(int planId)
|
||||
{
|
||||
MainSchedule ms = m_dtc->mainSchedule(planId);
|
||||
switch (ms.statusId().underlying())
|
||||
switch (ms.statusId())
|
||||
{
|
||||
case ScheduleStatus::Active:
|
||||
return QColor(Qt::darkGreen);
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
#include <InfrastructureManagement/logger.h>
|
||||
#include <InfrastructureManagement/ism_data_plugin.h>
|
||||
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
|
||||
#include <Timeline/tln_data_plugin_interface.h>
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
|
||||
|
||||
+34
-32
@@ -9,6 +9,7 @@
|
||||
#include <InfrastructureManagement/ism_operator_rights.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtCore/QTextStream>
|
||||
@@ -17,6 +18,7 @@ using namespace InfrastructureManagement;
|
||||
|
||||
BuildingMountPointDialog::BuildingMountPointDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_ui(new Ui::BuildingMountPointDialog)
|
||||
, m_model(new BuildingMountPointModel(this))
|
||||
, m_proxyModel(new BuildingMountPointSortModel(this))
|
||||
@@ -148,7 +150,7 @@ bool BuildingMountPointDialog::exportData(const std::vector<StructureElement> &s
|
||||
QHash<int, QString> names;
|
||||
names.reserve(structureElements.size());
|
||||
for (const StructureElement &se : structureElements)
|
||||
names.insert(se.id(), QString::fromStdString(se.name()));
|
||||
names.insert(se.id, QString::fromStdString(se.name));
|
||||
|
||||
static const QStringList headerNames = { QStringLiteral("Data Matrix Code"),
|
||||
QStringLiteral("Anbringungspunkt Id"),
|
||||
@@ -163,7 +165,7 @@ bool BuildingMountPointDialog::exportData(const std::vector<StructureElement> &s
|
||||
const QString header = headerNames.join(QLatin1Char(';'));
|
||||
out << header << "\n";
|
||||
|
||||
QString bldgName = m_model->getMainStructureElementName(structureElements.at(0).mainStructureElementId());
|
||||
QString bldgName = m_model->getMainStructureElementName(structureElements.at(0).mainStructureElementId);
|
||||
if (bldgName.startsWith(QLatin1String("bldg_")))
|
||||
bldgName = bldgName.mid(QLatin1String("bldg_").size());
|
||||
bldgName = bldgName.left(11);
|
||||
@@ -173,21 +175,21 @@ bool BuildingMountPointDialog::exportData(const std::vector<StructureElement> &s
|
||||
sl.reserve(8);
|
||||
for (const StructureElement &se : structureElements)
|
||||
{
|
||||
if (se.structureElementTypeId() != StructureElementType::MountingPoint)
|
||||
if (se.structureElementTypeId != StructureElementType::MountingPoint)
|
||||
continue;
|
||||
|
||||
sl.clear();
|
||||
const QString mountingPointType = (se.mountingPointTypeId() == MountingPointType::Unknown) ? QString() : toString(se.mountingPointTypeId());
|
||||
const QString mountingPointType = (se.mountingPointTypeId == MountingPointType::Unknown) ? QString() : toString(se.mountingPointTypeId);
|
||||
|
||||
|
||||
sl << QString::fromStdString(se.barcode);
|
||||
|
||||
sl << QString::number(se.mountingPointId);
|
||||
|
||||
|
||||
sl << QString::fromStdString(se.barcode());
|
||||
|
||||
sl << QString::number(se.mountingPointId());
|
||||
|
||||
sl << bldgName;
|
||||
|
||||
|
||||
name.clear();
|
||||
for (const int pathId : se.path())
|
||||
for (const int pathId : se.path)
|
||||
{
|
||||
static const QString room = QStringLiteral("SW_room_");
|
||||
static const QString floor = QStringLiteral("floor_");
|
||||
@@ -201,9 +203,9 @@ bool BuildingMountPointDialog::exportData(const std::vector<StructureElement> &s
|
||||
const QString strName = name.join(QLatin1Char('/'));
|
||||
sl << strName;
|
||||
|
||||
sl << QString::number(se.relPosition().offsetX());
|
||||
sl << QString::number(se.relPosition().offsetY());
|
||||
sl << QString::number(se.relPosition().offsetZ());
|
||||
sl << QString::number(se.relPosition.offsetX);
|
||||
sl << QString::number(se.relPosition.offsetY);
|
||||
sl << QString::number(se.relPosition.offsetZ);
|
||||
|
||||
sl << mountingPointType;
|
||||
|
||||
@@ -228,7 +230,7 @@ void BuildingMountPointDialog::onExportClicked()
|
||||
const QModelIndex &idx = m_proxyModel->mapToSource(indexList.first());
|
||||
const auto structureElements = m_model->getChildren(idx, false);
|
||||
|
||||
const QString bldgName = QString::fromStdString(m_model->getMainStructureElement(idx).name());
|
||||
const QString bldgName = QString::fromStdString(m_model->getMainStructureElement(idx).name);
|
||||
const QString fileName = QFileDialog::getSaveFileName(this, tr("Export"),
|
||||
bldgName + QStringLiteral("_structure") + QStringLiteral(".csv"),
|
||||
tr("CSV-Files (*.csv)"));
|
||||
@@ -263,7 +265,7 @@ void BuildingMountPointDialog::onExportClicked()
|
||||
{
|
||||
const QModelIndex &idx = m_proxyModel->mapToSource(idxItem);
|
||||
const auto structureElements = m_model->getChildren(idx, false);
|
||||
const QString bldgName = QString::fromStdString(m_model->getMainStructureElement(idx).name());
|
||||
const QString bldgName = QString::fromStdString(m_model->getMainStructureElement(idx).name);
|
||||
if (bldgName.isEmpty())
|
||||
{
|
||||
ERROR_LOG(m_logger) << " bldgName is empty";
|
||||
@@ -300,7 +302,7 @@ void BuildingMountPointDialog::onExportAllClicked()
|
||||
if (structureElements.empty())
|
||||
continue;
|
||||
|
||||
const QString bldgName = QString::fromStdString(m_model->getMainStructureElement(sourceIdx).name());
|
||||
const QString bldgName = QString::fromStdString(m_model->getMainStructureElement(sourceIdx).name);
|
||||
const QString fileName = dirName + QLatin1Char('/') + bldgName + QStringLiteral(".csv");
|
||||
if (!exportData(structureElements, fileName))
|
||||
return;
|
||||
@@ -353,7 +355,7 @@ void BuildingMountPointDialog::onImportClicked()
|
||||
QString line;
|
||||
while (in.readLineInto(&line))
|
||||
{
|
||||
const QVector<QStringRef> values = line.splitRef(QLatin1Char(';'));
|
||||
const QStringList values = line.split(QLatin1Char(';'));
|
||||
|
||||
if (colMountingPointId >= values.size() ||
|
||||
colBarcode >= values.size())
|
||||
@@ -361,7 +363,7 @@ void BuildingMountPointDialog::onImportClicked()
|
||||
WARNING_LOG(m_logger) << "skipping line - to few data: '" << line << "'";
|
||||
continue;
|
||||
}
|
||||
QString newBarCode = values.at(colBarcode).toString();
|
||||
QString newBarCode = values.at(colBarcode);
|
||||
if (newBarCode.size() > 1 && newBarCode.startsWith(QLatin1Char('"')) && newBarCode.endsWith(QLatin1Char('"')))
|
||||
newBarCode = newBarCode.mid(1, newBarCode.size() - 2);
|
||||
|
||||
@@ -405,18 +407,18 @@ bool BuildingMountPointDialog::apply()
|
||||
MainStructureElement mainStructureElement = m_model->getMainStructureElement(m_importedModelIndex);
|
||||
MainStructureElementModifyRequest request;
|
||||
|
||||
request.name(mainStructureElement.name());
|
||||
request.description(mainStructureElement.description());
|
||||
request.geoPosition(mainStructureElement.geoPosition());
|
||||
request.angle(mainStructureElement.angle());
|
||||
request.externalWlsId(mainStructureElement.externalWlsId());
|
||||
request.elements(mainStructureElement.elements());
|
||||
request.structureElementId(mainStructureElement.structureElementId());
|
||||
request.structureElementTypeId(mainStructureElement.structureElementTypeId());
|
||||
request.id(mainStructureElement.id());
|
||||
request.properties(mainStructureElement.properties());
|
||||
request.modelId(mainStructureElement.modelId());
|
||||
request.groupId(mainStructureElement.groupId());
|
||||
request.name = mainStructureElement.name;
|
||||
request.description = mainStructureElement.description;
|
||||
request.geoPosition = mainStructureElement.geoPosition;
|
||||
request.angle = mainStructureElement.angle;
|
||||
request.externalWlsId = mainStructureElement.externalWlsId;
|
||||
request.elements = mainStructureElement.elements;
|
||||
request.structureElementId = mainStructureElement.structureElementId;
|
||||
request.structureElementTypeId = mainStructureElement.structureElementTypeId;
|
||||
request.id = mainStructureElement.id;
|
||||
request.properties = mainStructureElement.properties;
|
||||
request.modelId = mainStructureElement.modelId;
|
||||
request.groupId = mainStructureElement.groupId;
|
||||
|
||||
m_requestHelper->startSingleRequest([this, request]() {
|
||||
return m_ftc->mainStructureElementModifyRequest(request, this);
|
||||
@@ -507,7 +509,7 @@ void BuildingMountPointDialog::onShowMntPointInfo(const QModelIndex &index)
|
||||
return;
|
||||
}
|
||||
|
||||
m_ismGuiIfc->showMountingPointInfoWindows(QVector<int>() << structureElements.at(0).id());
|
||||
m_ismGuiIfc->showMountingPointInfoWindows(QVector<int>() << structureElements.at(0).id);
|
||||
m_ui->tvBuildings->selectionModel()->clear();
|
||||
}
|
||||
|
||||
|
||||
+102
-100
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_building_mount_point_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
#include <QtCore/QDataStream>
|
||||
#include <QtCore/QVector>
|
||||
@@ -28,6 +29,7 @@ BuildingMountPointModel::BuildingMountPointModel(QObject *parent)
|
||||
tr("Barcode (new)"),
|
||||
tr("Mounted Asset"),
|
||||
tr("Properties")})
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,7 +51,7 @@ Qt::ItemFlags BuildingMountPointModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
ret.setFlag(Qt::ItemIsSelectable, false);
|
||||
}
|
||||
else if(sitem->data.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
|
||||
else if(sitem->data.structureElementTypeId == InfrastructureManagement::StructureElementType::Building)
|
||||
{
|
||||
ret.setFlag(Qt::ItemIsSelectable, true);
|
||||
}
|
||||
@@ -78,10 +80,10 @@ QVariant BuildingMountPointModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role == Qt::BackgroundRole)
|
||||
{
|
||||
if (item->data.id() < 0)
|
||||
if (item->data.id < 0)
|
||||
return QColor(Qt::red);
|
||||
|
||||
if (item->newBarcode != QString::fromStdString(item->data.barcode()))
|
||||
if (item->newBarcode != QString::fromStdString(item->data.barcode))
|
||||
return QColor(Qt::darkYellow);
|
||||
return NGLTreeModel::data(index, role);
|
||||
}
|
||||
@@ -91,29 +93,29 @@ QVariant BuildingMountPointModel::data(const QModelIndex &index, int role) const
|
||||
case ColName:
|
||||
return item->displayName();
|
||||
case ColId:
|
||||
return item->data.id();
|
||||
return item->data.id;
|
||||
case ColInternalName:
|
||||
return QString::fromStdString(item->data.name());
|
||||
return QString::fromStdString(item->data.name);
|
||||
case ColRelPosX:
|
||||
return QString::number(item->data.relPosition().offsetX());
|
||||
return QString::number(item->data.relPosition.offsetX);
|
||||
case ColRelPosY:
|
||||
return QString::number(item->data.relPosition().offsetY());
|
||||
return QString::number(item->data.relPosition.offsetY);
|
||||
case ColRelPosZ:
|
||||
return QString::number(item->data.relPosition().offsetZ());
|
||||
return QString::number(item->data.relPosition.offsetZ);
|
||||
case ColMountingPointTypeId:
|
||||
if (item->data.mountingPointTypeId() != MountingPointType::Unknown)
|
||||
return toString(item->data.mountingPointTypeId());
|
||||
if (item->data.mountingPointTypeId != MountingPointType::Unknown)
|
||||
return toString(item->data.mountingPointTypeId);
|
||||
return QString();
|
||||
case ColMountingPointId:
|
||||
return item->data.mountingPointId();
|
||||
return item->data.mountingPointId;
|
||||
case ColMountedAsset:
|
||||
{
|
||||
if(item->data.mountingPointTypeId() != MountingPointType::Unknown)
|
||||
if(item->data.mountingPointTypeId != MountingPointType::Unknown)
|
||||
{
|
||||
const int assetId = m_dtc->getMountedAssetId(item->data.id());
|
||||
const int assetId = m_dtc->getMountedAssetId(item->data.id);
|
||||
if(assetId != -1)
|
||||
{
|
||||
return QString::fromStdString(m_dtc->instrumentationAsset(assetId).barcode());
|
||||
return QString::fromStdString(m_dtc->instrumentationAsset(assetId).barcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -123,13 +125,13 @@ QVariant BuildingMountPointModel::data(const QModelIndex &index, int role) const
|
||||
return QString();
|
||||
}
|
||||
case ColType:
|
||||
return toString(item->data.structureElementTypeId());
|
||||
return toString(item->data.structureElementTypeId);
|
||||
case ColBarcode:
|
||||
return QString::fromStdString(item->data.barcode());
|
||||
return QString::fromStdString(item->data.barcode);
|
||||
case ColBarcodeNew:
|
||||
return item->newBarcode;
|
||||
case ColProperties:
|
||||
return QString::fromStdString(item->data.properties());
|
||||
return QString::fromStdString(item->data.properties);
|
||||
}
|
||||
}
|
||||
return NGLTreeModel::data(index, role);
|
||||
@@ -142,7 +144,7 @@ bool BuildingMountPointModel::initModel(const std::shared_ptr<Interface::Dtc> &d
|
||||
this, &BuildingMountPointModel::onMainStructureElementChanged);
|
||||
auto cb = [this](const MainStructureElement & mse)
|
||||
{
|
||||
if (mse.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
|
||||
if (mse.structureElementTypeId == InfrastructureManagement::StructureElementType::Building)
|
||||
addBuilding(mse);
|
||||
};
|
||||
resetModel();
|
||||
@@ -158,8 +160,8 @@ void BuildingMountPointModel::onMountingPointAssetChanged(const InfrastructureMa
|
||||
Q_UNUSED(modType)
|
||||
|
||||
InfrastructureManagement::StructureElement newSe;
|
||||
m_dtc->getStructureElementById(mpa.structureElementId(), newSe);
|
||||
StructureElementTreeItem *seItem = findItemByStructureElementId(newSe.id(), m_rootItem);
|
||||
m_dtc->getStructureElementById(mpa.structureElementId, newSe);
|
||||
StructureElementTreeItem *seItem = findItemByStructureElementId(newSe.id, m_rootItem);
|
||||
if(seItem == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -180,7 +182,7 @@ StructureElementTreeItem* BuildingMountPointModel::findItemByStructureElementId(
|
||||
}
|
||||
|
||||
StructureElementTreeItem *item = static_cast<StructureElementTreeItem*>(parent);
|
||||
if(item && item->data.structureElementTypeId() == InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
if(item && item->data.structureElementTypeId == InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
@@ -188,7 +190,7 @@ StructureElementTreeItem* BuildingMountPointModel::findItemByStructureElementId(
|
||||
for(int i=0; i<rows; ++i)
|
||||
{
|
||||
StructureElementTreeItem *seItem = findItemByStructureElementId(id, parent->child(i));
|
||||
if(seItem && seItem->data.id() == id)
|
||||
if(seItem && seItem->data.id == id)
|
||||
{
|
||||
|
||||
return seItem;
|
||||
@@ -201,22 +203,22 @@ StructureElement BuildingMountPointModel::setBuildingGroup(int groupId)
|
||||
{
|
||||
StructureElement se;
|
||||
InfrastructureManagement::BuildingGroup buildingGroup = static_cast<InfrastructureManagement::BuildingGroup>(groupId);
|
||||
if(buildingGroup == 0)
|
||||
if(static_cast<int>(buildingGroup) == 0)
|
||||
{
|
||||
buildingGroup = InfrastructureManagement::BuildingGroup::UnknownGroup;
|
||||
}
|
||||
|
||||
se.id() = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name() = toString(buildingGroup).toStdString();
|
||||
se.displayName() = toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId() = InfrastructureManagement::StructureElementType::Section;
|
||||
se.id = maxIntValue - static_cast<int>(buildingGroup);
|
||||
se.name = toString(buildingGroup).toStdString();
|
||||
se.displayName = toString(buildingGroup).toStdString();
|
||||
se.structureElementTypeId = InfrastructureManagement::StructureElementType::Section;
|
||||
return se;
|
||||
}
|
||||
|
||||
int BuildingMountPointModel::getSectionId(int groupId)
|
||||
{
|
||||
InfrastructureManagement::BuildingGroup buildingGroup = static_cast<InfrastructureManagement::BuildingGroup>(groupId);
|
||||
if(buildingGroup == 0)
|
||||
if(static_cast<int>(buildingGroup) == 0)
|
||||
{
|
||||
buildingGroup = InfrastructureManagement::BuildingGroup::UnknownGroup;
|
||||
}
|
||||
@@ -231,7 +233,7 @@ StructureElementTreeItem *BuildingMountPointModel::getStructureTreeItemById(int
|
||||
for(int i =0; i<parent->childCount(); ++i)
|
||||
{
|
||||
StructureElementTreeItem *item = static_cast<StructureElementTreeItem*>(parent->child(i));
|
||||
if (item != nullptr && item->data.id() == id)
|
||||
if (item != nullptr && item->data.id == id)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
@@ -247,7 +249,7 @@ StructureElementTreeItem *BuildingMountPointModel::getStructureTreeItemByMSEId(i
|
||||
for(int i =0; i<parent->childCount(); ++i)
|
||||
{
|
||||
StructureElementTreeItem *item = static_cast<StructureElementTreeItem*>(parent->child(i));
|
||||
if (item != nullptr && item->data.mainStructureElementId() == id)
|
||||
if (item != nullptr && item->data.mainStructureElementId == id)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
@@ -275,10 +277,10 @@ void BuildingMountPointModel::onMainStructureElementChanged(const Infrastructure
|
||||
|
||||
void BuildingMountPointModel::addBuilding(const MainStructureElement &mse)
|
||||
{
|
||||
if (mse.structureElementTypeId() != InfrastructureManagement::StructureElementType::Building)
|
||||
if (mse.structureElementTypeId != InfrastructureManagement::StructureElementType::Building)
|
||||
return;
|
||||
|
||||
m_mainStructureElements[mse.id()] = mse;
|
||||
m_mainStructureElements[mse.id] = mse;
|
||||
QHash<int, StructureElement> structureElements;
|
||||
QHash<int, QVector<int>> parentId2id;
|
||||
int gParentId =0;
|
||||
@@ -286,38 +288,38 @@ void BuildingMountPointModel::addBuilding(const MainStructureElement &mse)
|
||||
|
||||
|
||||
|
||||
const StructureElement gse = setBuildingGroup(mse.groupId());
|
||||
if (m_availableBuildingGroups.contains(gse.id()) == false)
|
||||
const StructureElement gse = setBuildingGroup(mse.groupId);
|
||||
if (m_availableBuildingGroups.contains(gse.id) == false)
|
||||
{
|
||||
m_availableBuildingGroups.insert(gse.id());
|
||||
structureElements[gse.id()] = gse;
|
||||
parentId2id[0].push_back(gse.id());
|
||||
m_availableBuildingGroups.insert(gse.id);
|
||||
structureElements[gse.id] = gse;
|
||||
parentId2id[0].push_back(gse.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
gParentId = gse.id();
|
||||
gParentId = gse.id;
|
||||
}
|
||||
|
||||
for (const StructureElement &se : mse.elements())
|
||||
for (const StructureElement &se : mse.elements)
|
||||
{
|
||||
if (se.mountingPointTypeId() == InfrastructureManagement::MountingPointType::BuildingControlUnit)
|
||||
if (se.mountingPointTypeId == InfrastructureManagement::MountingPointType::BuildingControlUnit)
|
||||
continue;
|
||||
|
||||
int parentId = getParent(se.path());
|
||||
int parentId = getParent(se.path);
|
||||
if(parentId == 0)
|
||||
{
|
||||
parentId = gse.id();
|
||||
parentId = gse.id;
|
||||
}
|
||||
|
||||
structureElements[se.id()] = se;
|
||||
parentId2id[parentId].push_back(se.id());
|
||||
structureElements[se.id] = se;
|
||||
parentId2id[parentId].push_back(se.id);
|
||||
}
|
||||
|
||||
|
||||
if(gParentId != 0)
|
||||
{
|
||||
StructureElementTreeItem *item = getStructureTreeItemById(gParentId,m_rootItem);
|
||||
if (item != nullptr && item->data.id() == gParentId)
|
||||
if (item != nullptr && item->data.id == gParentId)
|
||||
{
|
||||
gParentIndex = indexFromItem(item);
|
||||
}
|
||||
@@ -327,15 +329,15 @@ void BuildingMountPointModel::addBuilding(const MainStructureElement &mse)
|
||||
|
||||
void BuildingMountPointModel::modifyBuilding(const MainStructureElement &mse)
|
||||
{
|
||||
auto it = m_mainStructureElements.find(mse.id());
|
||||
auto it = m_mainStructureElements.find(mse.id);
|
||||
if (it == m_mainStructureElements.end())
|
||||
{
|
||||
return addBuilding(mse);
|
||||
}
|
||||
|
||||
|
||||
const StructureElement gse = setBuildingGroup(mse.groupId());
|
||||
int gParentId = gse.id();
|
||||
const StructureElement gse = setBuildingGroup(mse.groupId);
|
||||
int gParentId = gse.id;
|
||||
StructureElementTreeItem *building = nullptr;
|
||||
|
||||
|
||||
@@ -345,7 +347,7 @@ void BuildingMountPointModel::modifyBuilding(const MainStructureElement &mse)
|
||||
StructureElementTreeItem *gItem = getStructureTreeItemById(gParentId, m_rootItem);
|
||||
if (gItem != nullptr)
|
||||
{
|
||||
StructureElementTreeItem *bItem = getStructureTreeItemByMSEId(mse.id(), gItem);
|
||||
StructureElementTreeItem *bItem = getStructureTreeItemByMSEId(mse.id, gItem);
|
||||
if (bItem != nullptr)
|
||||
{
|
||||
building = bItem;
|
||||
@@ -356,7 +358,7 @@ void BuildingMountPointModel::modifyBuilding(const MainStructureElement &mse)
|
||||
if (!building)
|
||||
{
|
||||
|
||||
WARNING_LOG(m_logger)<<">>> not found section: "<<gse.id()<<" not exist. new one will be added ";
|
||||
WARNING_LOG(m_logger)<<">>> not found section: "<<gse.id<<" not exist. new one will be added ";
|
||||
findAndRemoveBuilding(mse);
|
||||
return addBuilding(mse);
|
||||
}
|
||||
@@ -368,17 +370,17 @@ void BuildingMountPointModel::modifyBuilding(const MainStructureElement &mse)
|
||||
int buildingSeId = 0;
|
||||
QHash<int, StructureElement> structureElements;
|
||||
QHash<int, QVector<int>> parentId2id;
|
||||
for (const StructureElement &se : mse.elements())
|
||||
for (const StructureElement &se : mse.elements)
|
||||
{
|
||||
if (se.structureElementTypeId() == StructureElementType::Building)
|
||||
buildingSeId = se.id();
|
||||
int parentId = getParent(se.path());
|
||||
if (se.structureElementTypeId == StructureElementType::Building)
|
||||
buildingSeId = se.id;
|
||||
int parentId = getParent(se.path);
|
||||
if(parentId == 0)
|
||||
{
|
||||
parentId = gParentId;
|
||||
}
|
||||
structureElements[se.id()] = se;
|
||||
parentId2id[parentId].push_back(se.id());
|
||||
structureElements[se.id] = se;
|
||||
parentId2id[parentId].push_back(se.id);
|
||||
}
|
||||
|
||||
if (!buildingSeId)
|
||||
@@ -416,7 +418,7 @@ void BuildingMountPointModel::updateChildren(int parentId,
|
||||
bool bFound = false;
|
||||
for (int j = 0; j < childIds.size(); ++j)
|
||||
{
|
||||
if (childIds.at(j) == child->data.id())
|
||||
if (childIds.at(j) == child->data.id)
|
||||
{
|
||||
bFound = true;
|
||||
childIds.remove(j);
|
||||
@@ -433,7 +435,7 @@ void BuildingMountPointModel::updateChildren(int parentId,
|
||||
}
|
||||
|
||||
|
||||
StructureElement newSe = structureElements.value(child->data.id());
|
||||
StructureElement newSe = structureElements.value(child->data.id);
|
||||
if (child->data != newSe)
|
||||
{
|
||||
std::swap(child->data, newSe);
|
||||
@@ -442,7 +444,7 @@ void BuildingMountPointModel::updateChildren(int parentId,
|
||||
}
|
||||
|
||||
|
||||
updateChildren(child->data.id(), child, parentId2id, structureElements);
|
||||
updateChildren(child->data.id, child, parentId2id, structureElements);
|
||||
}
|
||||
|
||||
|
||||
@@ -456,9 +458,9 @@ void BuildingMountPointModel::updateChildren(int parentId,
|
||||
|
||||
void BuildingMountPointModel::removeBuildingByGroupId(const MainStructureElement &mse)
|
||||
{
|
||||
m_mainStructureElements.remove(mse.id());
|
||||
m_mainStructureElements.remove(mse.id);
|
||||
|
||||
int section = getSectionId(mse.groupId());
|
||||
int section = getSectionId(mse.groupId);
|
||||
bool bfound = false;
|
||||
StructureElementTreeItem *gItem = getStructureTreeItemById(section, m_rootItem);
|
||||
if (gItem != nullptr)
|
||||
@@ -466,7 +468,7 @@ void BuildingMountPointModel::removeBuildingByGroupId(const MainStructureElement
|
||||
for (int i = 0; i < gItem->childCount(); ++i)
|
||||
{
|
||||
StructureElementTreeItem *item = static_cast<StructureElementTreeItem*>(gItem->child(i));
|
||||
if (item->data.mainStructureElementId() == mse.id())
|
||||
if (item->data.mainStructureElementId == mse.id)
|
||||
{
|
||||
const QModelIndex parentIdx = indexFromItem(gItem);
|
||||
beginRemoveRows(parentIdx, i, i);
|
||||
@@ -480,7 +482,7 @@ void BuildingMountPointModel::removeBuildingByGroupId(const MainStructureElement
|
||||
|
||||
if (bfound == false)
|
||||
{
|
||||
ERROR_LOG(m_logger)<<"No mse with Id: ( "<<mse.id()<<" ) | groupId: "<<mse.groupId()<<" | sectionId: "<<section<<" found!";
|
||||
ERROR_LOG(m_logger)<<"No mse with Id: ( "<<mse.id<<" ) | groupId: "<<mse.groupId<<" | sectionId: "<<section<<" found!";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -498,7 +500,7 @@ void BuildingMountPointModel::findAndRemoveBuilding(const MainStructureElement &
|
||||
for (int gcIndex = 0; gcIndex < groupItem->childCount(); ++gcIndex)
|
||||
{
|
||||
StructureElementTreeItem *item = static_cast<StructureElementTreeItem*>(groupItem->child(gcIndex));
|
||||
if (item->data.mainStructureElementId() == mse.id())
|
||||
if (item->data.mainStructureElementId == mse.id)
|
||||
{
|
||||
const QModelIndex parentIdx = indexFromItem(groupItem);
|
||||
beginRemoveRows(parentIdx, gcIndex, gcIndex);
|
||||
@@ -543,7 +545,7 @@ void BuildingMountPointModel::insertChildren(int parentId,
|
||||
|
||||
|
||||
const QModelIndex childIdx = index(insertPos, 0, parentIdx);
|
||||
insertChildren(data.id(), childIdx, parentId2id, structureElements);
|
||||
insertChildren(data.id, childIdx, parentId2id, structureElements);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,7 +571,7 @@ std::vector<StructureElement> BuildingMountPointModel::getChildren(NGLTreeItem *
|
||||
StructureElement structureElement = sitem->data;
|
||||
|
||||
if (bUseNewBarcode)
|
||||
structureElement.barcode(sitem->newBarcode.toStdString());
|
||||
structureElement.barcode = sitem->newBarcode.toStdString();
|
||||
|
||||
ret.push_back(std::move(structureElement));
|
||||
|
||||
@@ -586,22 +588,22 @@ MainStructureElement BuildingMountPointModel::getMainStructureElement(const QMod
|
||||
return ret;
|
||||
const StructureElementTreeItem *sitem = static_cast<StructureElementTreeItem*>(item);
|
||||
|
||||
auto it = m_mainStructureElements.find(sitem->data.mainStructureElementId());
|
||||
auto it = m_mainStructureElements.find(sitem->data.mainStructureElementId);
|
||||
if (it == m_mainStructureElements.end())
|
||||
return ret;
|
||||
|
||||
ret = it.value();
|
||||
|
||||
MainStructureElement mseFromDtc = m_dtc->mainStructureElement(ret.id());
|
||||
MainStructureElement mseFromDtc = m_dtc->mainStructureElement(ret.id);
|
||||
|
||||
auto children = getChildren(item, true);
|
||||
auto comp = [](const StructureElement &a, const StructureElement &b)
|
||||
{
|
||||
const int idA = std::abs(a.id());
|
||||
const int idB = std::abs(b.id());
|
||||
const int idA = std::abs(a.id);
|
||||
const int idB = std::abs(b.id);
|
||||
if (idA != idB)
|
||||
return idA < idB;
|
||||
return QString::fromStdString(a.name()) < QString::fromStdString(b.name());
|
||||
return QString::fromStdString(a.name) < QString::fromStdString(b.name);
|
||||
};
|
||||
std::sort(children.begin(), children.end(), comp);
|
||||
|
||||
@@ -610,45 +612,45 @@ MainStructureElement BuildingMountPointModel::getMainStructureElement(const QMod
|
||||
QSet<int> setIds;
|
||||
for (const StructureElement &se : std::as_const(children))
|
||||
{
|
||||
setIds.insert(se.id());
|
||||
auto &ref = maxIds[se.mountingPointTypeId()];
|
||||
ref = std::max(ref, se.mountingPointId());
|
||||
if (se.id() <= 0)
|
||||
setIds.insert(se.id);
|
||||
auto &ref = maxIds[se.mountingPointTypeId];
|
||||
ref = std::max(ref, se.mountingPointId);
|
||||
if (se.id <= 0)
|
||||
hasNewMountingPoints = true;
|
||||
}
|
||||
if (hasNewMountingPoints)
|
||||
{
|
||||
for (StructureElement &se : children)
|
||||
{
|
||||
if (se.id() > 0 || se.mountingPointId() > 0)
|
||||
if (se.id > 0 || se.mountingPointId > 0)
|
||||
continue;
|
||||
auto &ref = maxIds[se.mountingPointTypeId()];
|
||||
se.mountingPointId(++ref);
|
||||
auto &ref = maxIds[se.mountingPointTypeId];
|
||||
se.mountingPointId = ++ref;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& obj : mseFromDtc.elements())
|
||||
for (const auto& obj : mseFromDtc.elements)
|
||||
{
|
||||
if(setIds.contains(obj.id()))
|
||||
if(setIds.contains(obj.id))
|
||||
continue;
|
||||
|
||||
|
||||
if(obj.mountingPointTypeId() == MountingPointType::BuildingControlUnit)
|
||||
if(obj.mountingPointTypeId == MountingPointType::BuildingControlUnit)
|
||||
{
|
||||
children.insert(children.begin() + 1 , obj);
|
||||
setIds.insert(obj.id());
|
||||
setIds.insert(obj.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ret.elements(children);
|
||||
ret.elements = children;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString BuildingMountPointModel::getMainStructureElementName(qint32 mainStructureElementId) const
|
||||
{
|
||||
return QString::fromStdString(m_mainStructureElements.value(mainStructureElementId).name());
|
||||
return QString::fromStdString(m_mainStructureElements.value(mainStructureElementId).name);
|
||||
}
|
||||
|
||||
|
||||
@@ -667,29 +669,29 @@ void BuildingMountPointModel::updateBarcodes(NGLTreeItem *item,
|
||||
return;
|
||||
|
||||
StructureElementTreeItem *sitem = static_cast<StructureElementTreeItem*>(item);
|
||||
if (sitem->data.mountingPointTypeId() != MountingPointType::Unknown)
|
||||
if (sitem->data.mountingPointTypeId != MountingPointType::Unknown)
|
||||
{
|
||||
auto it = barcodes.find(sitem->data.mountingPointId());
|
||||
auto it = barcodes.find(sitem->data.mountingPointId);
|
||||
if (it != barcodes.end())
|
||||
{
|
||||
sitem->newBarcode = it.value();
|
||||
barcodes.erase(it);
|
||||
auto itNewBc = additionalBarcodes.find(sitem->data.mountingPointId());
|
||||
auto itNewBc = additionalBarcodes.find(sitem->data.mountingPointId);
|
||||
if (itNewBc != additionalBarcodes.end())
|
||||
{
|
||||
const QString name = QString::fromStdString(sitem->data.name());
|
||||
const QString name = QString::fromStdString(sitem->data.name);
|
||||
const QString displayName = sitem->displayName();
|
||||
const QVector<QString> newBarcodes = itNewBc.value();
|
||||
StructureElement newSe(sitem->data);
|
||||
newSe.mountingPointId(0);
|
||||
newSe.mountingPointId = 0;
|
||||
const int itemRow = item->row();
|
||||
for (int i = 0; i < newBarcodes.size(); ++i)
|
||||
{
|
||||
const int rowToInsert = itemRow + i + 1;
|
||||
newSe.barcode() = std::string();
|
||||
newSe.id(-sitem->data.id());
|
||||
newSe.name(QString(name + QLatin1Char('_') + QString::number(i + 1)).toStdString());
|
||||
newSe.displayName(QString(displayName + QLatin1Char('_') + QString::number(i + 1)).toStdString());
|
||||
newSe.barcode = std::string();
|
||||
newSe.id = -sitem->data.id;
|
||||
newSe.name = QString(name + QLatin1Char('_') + QString::number(i + 1)).toStdString();
|
||||
newSe.displayName = QString(displayName + QLatin1Char('_') + QString::number(i + 1)).toStdString();
|
||||
StructureElementTreeItem *childItem = static_cast<StructureElementTreeItem*>(createItem(QVariant(), QIcon()));
|
||||
childItem->newBarcode = newBarcodes.at(i);
|
||||
childItem->data = newSe;
|
||||
@@ -700,14 +702,14 @@ void BuildingMountPointModel::updateBarcodes(NGLTreeItem *item,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sitem->data.id() > 0)
|
||||
if (sitem->data.id > 0)
|
||||
sitem->newBarcode.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
barcodes.remove(sitem->data.mountingPointId());
|
||||
additionalBarcodes.remove(sitem->data.mountingPointId());
|
||||
barcodes.remove(sitem->data.mountingPointId);
|
||||
additionalBarcodes.remove(sitem->data.mountingPointId);
|
||||
}
|
||||
|
||||
for (int i = 0; i < item->childCount(); ++i)
|
||||
@@ -720,7 +722,7 @@ void BuildingMountPointModel::resetNewItems(const QModelIndex &idx)
|
||||
if (!sitem)
|
||||
return;
|
||||
|
||||
if (sitem->data.id() < 0 && sitem->parent())
|
||||
if (sitem->data.id < 0 && sitem->parent())
|
||||
{
|
||||
beginRemoveRows(idx.parent(), idx.row(), idx.row());
|
||||
sitem->parent()->removeChild(sitem);
|
||||
@@ -743,7 +745,7 @@ void BuildingMountPointModel::resetNewBarcodes(NGLTreeItem *parent)
|
||||
return;
|
||||
|
||||
StructureElementTreeItem *sitem = static_cast<StructureElementTreeItem*>(parent);
|
||||
sitem->newBarcode = QString::fromStdString(sitem->data.barcode());
|
||||
sitem->newBarcode = QString::fromStdString(sitem->data.barcode);
|
||||
|
||||
for (int i = 0; i < parent->childCount(); ++i)
|
||||
resetNewBarcodes(parent->child(i));
|
||||
@@ -770,8 +772,8 @@ bool BuildingMountPointSortModel::lessThan(const QModelIndex &source_left, const
|
||||
|
||||
if (itemLeft->displayName() != itemRight->displayName())
|
||||
return itemLeft->displayName() < itemRight->displayName();
|
||||
const int idLeft = qAbs(itemLeft->data.id());
|
||||
const int idRight = qAbs(itemLeft->data.id());
|
||||
const int idLeft = qAbs(itemLeft->data.id);
|
||||
const int idRight = qAbs(itemLeft->data.id);
|
||||
return idLeft < idRight;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -19,11 +19,10 @@ struct StructureElementTreeItem : public NGLTreeItem
|
||||
QString displayName() const
|
||||
{
|
||||
if (m_dispName.isNull())
|
||||
m_dispName = QString::fromStdString(data.displayName());
|
||||
m_dispName = QString::fromStdString(data.displayName);
|
||||
return m_dispName;
|
||||
}
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
mutable QString m_dispName;
|
||||
};
|
||||
|
||||
@@ -103,6 +102,7 @@ private:
|
||||
QHash<int, QModelIndex> m_buildingsIndexes;
|
||||
const int maxIntValue = std::numeric_limits<int>::max();
|
||||
QMap<int, MainStructureElement> m_mainStructureElements;
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<Interface::Dtc> m_dtc{nullptr};
|
||||
QSet<int> m_availableBuildingGroups;
|
||||
};
|
||||
|
||||
+30
-30
@@ -137,7 +137,7 @@ void PlanDialog::setScheduleId(const int scheduleId)
|
||||
|
||||
|
||||
MainSchedule ms = ismIfc->mainSchedule(m_scheduleId);
|
||||
QString msName = QString::fromStdString(ms.name());
|
||||
QString msName = QString::fromStdString(ms.name);
|
||||
|
||||
if (m_session && m_session->baseLayout())
|
||||
m_session->baseLayout()->setCustomText(tr("Instrumentation Plan: '%1'").arg(msName));
|
||||
@@ -155,7 +155,7 @@ void PlanDialog::onPrint()
|
||||
void PlanDialog::onMainScheduleChanged(const MainSchedule &data, DataModification modType)
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
m_scheduleId = data.id();
|
||||
m_scheduleId = data.id;
|
||||
enaDisa();
|
||||
Q_UNUSED(modType);
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
@@ -177,13 +177,13 @@ void PlanDialog::onLoad()
|
||||
|
||||
MainSchedule item{m_model->getRowData(indexList.front().row())};
|
||||
|
||||
if (item.id() == m_scheduleId)
|
||||
if (item.id == m_scheduleId)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("This instrumentation plan is already loaded"));
|
||||
return;
|
||||
}
|
||||
|
||||
m_scheduleId = item.id();
|
||||
m_scheduleId = item.id;
|
||||
setScheduleId(m_scheduleId);
|
||||
m_ismGuiIfc->setPlanId(m_scheduleId);
|
||||
enaDisa();
|
||||
@@ -200,7 +200,7 @@ void PlanDialog::onRemove()
|
||||
|
||||
MainSchedule item{m_model->getRowData(indexList.front().row())};
|
||||
|
||||
if (item.id() == m_scheduleId)
|
||||
if (item.id == m_scheduleId)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, tr("Cannot remove current instrumentation plan"));
|
||||
return;
|
||||
@@ -210,24 +210,24 @@ void PlanDialog::onRemove()
|
||||
InstrumentationAssetModifyRequest req;
|
||||
InstrumentationAsset asset;
|
||||
|
||||
for (const auto &element : std::as_const(item.elements()))
|
||||
for (const auto &element : std::as_const(item.elements))
|
||||
{
|
||||
QMap<qint32, MountingPointAsset> mntPntAssets = m_dtc->mountingPointAssets();
|
||||
for (const auto &mntPntAsset : std::as_const(mntPntAssets))
|
||||
{
|
||||
if (mntPntAsset.structureElementId() == element.structureElementId())
|
||||
if (mntPntAsset.structureElementId == element.structureElementId)
|
||||
{
|
||||
asset = m_dtc->instrumentationAsset(mntPntAsset.assetId());
|
||||
asset = m_dtc->instrumentationAsset(mntPntAsset.assetId);
|
||||
req = InstrumentationAssetModifyRequest(
|
||||
1,
|
||||
asset.name(),
|
||||
asset.mountingPointTypeId(),
|
||||
asset.barcode(),
|
||||
asset.hostname(),
|
||||
asset.properties(),
|
||||
asset.name,
|
||||
asset.mountingPointTypeId,
|
||||
asset.barcode,
|
||||
asset.hostname,
|
||||
asset.properties,
|
||||
InstrumentationAssetState::Unmounted,
|
||||
asset.lastUpdated(),
|
||||
asset.availableInExercise()
|
||||
asset.lastUpdated,
|
||||
asset.availableInExercise
|
||||
);
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ void PlanDialog::onRemove()
|
||||
m_requestHelper->startRequests();
|
||||
|
||||
|
||||
Core::RemoveElementRequest rmReq{item.id()};
|
||||
Core::RemoveElementRequest rmReq{item.id};
|
||||
m_requestHelper->startSingleRequest([rmReq, this]()
|
||||
{
|
||||
return m_ftc->mainScheduleRemoveRequest(rmReq, this);
|
||||
@@ -264,11 +264,11 @@ void PlanDialog::enaDisa()
|
||||
return;
|
||||
|
||||
MainSchedule item{m_model->getRowData(indexList.front().row())};
|
||||
bool isComplete = m_dtc->checkSchedule(item.id());
|
||||
bool isComplete = m_dtc->checkSchedule(item.id);
|
||||
|
||||
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, !(item.id() == m_scheduleId || item.statusId() == ScheduleStatus::Active) );
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, !(item.id() == m_scheduleId) );
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, !(item.id == m_scheduleId || item.statusId == ScheduleStatus::Active) );
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Load, !(item.id == m_scheduleId) );
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, (indexList.size() == 1) );
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, (indexList.size() == 1) );
|
||||
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Save, (indexList.size() == 1 && !isComplete) );
|
||||
@@ -283,19 +283,19 @@ void PlanDialog::onEdit()
|
||||
return;
|
||||
|
||||
MainSchedule item{m_model->getRowData(indexList.front().row())};
|
||||
if (item.id() < 0 )
|
||||
if (item.id < 0 )
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "onEdit schedule with id = " << item.id();
|
||||
DEBUG_LOG(m_logger) << "onEdit schedule with id = " << item.id;
|
||||
|
||||
PlanEditDialog *dialog = new PlanEditDialog(this);
|
||||
if (!dialog->init(m_session, item.id(), m_dtc, m_ftc, m_ismGuiCbx))
|
||||
if (!dialog->init(m_session, item.id, m_dtc, m_ftc, m_ismGuiCbx))
|
||||
{
|
||||
delete dialog;
|
||||
return;
|
||||
}
|
||||
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("EditSchedule%1").arg(item.id()), LtsWidgets::LayoutArea::eDialogTab);
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("EditSchedule%1").arg(item.id), LtsWidgets::LayoutArea::eDialogTab);
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
@@ -319,10 +319,10 @@ void PlanDialog::onCheck()
|
||||
return;
|
||||
|
||||
MainSchedule item{m_model->getRowData(indexList.front().row())};
|
||||
if (item.id() < 0 )
|
||||
if (item.id < 0 )
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "show Differences schedule with id = " << item.id();
|
||||
DEBUG_LOG(m_logger) << "show Differences schedule with id = " << item.id;
|
||||
|
||||
|
||||
|
||||
@@ -333,14 +333,14 @@ void PlanDialog::onCheck()
|
||||
|
||||
|
||||
OverviewMountingPointListDialog *dialog = new OverviewMountingPointListDialog(m_menuGroup, this);
|
||||
const int32_t scheduleId = item.id();
|
||||
const int32_t scheduleId = item.id;
|
||||
if (!dialog->init(m_session, m_dtc, m_ftc, m_dataIfc, scheduleId))
|
||||
{
|
||||
delete dialog;
|
||||
return;
|
||||
}
|
||||
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("ShowDifferences%1").arg(item.id()), LtsWidgets::LayoutArea::eDialogTab);
|
||||
addDialog(dialog, m_menuGroup, QStringLiteral("ShowDifferences%1").arg(item.id), LtsWidgets::LayoutArea::eDialogTab);
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
|
||||
}
|
||||
|
||||
@@ -353,13 +353,13 @@ void PlanDialog::onCopy()
|
||||
return;
|
||||
|
||||
MainSchedule item{m_model->getRowData(indexList.front().row())};
|
||||
if (item.id() < 0 )
|
||||
if (item.id < 0 )
|
||||
return;
|
||||
|
||||
DEBUG_LOG(m_logger) << "onCopy schedule with id = " << item.id();
|
||||
DEBUG_LOG(m_logger) << "onCopy schedule with id = " << item.id;
|
||||
|
||||
MainScheduleCopyRequest req;
|
||||
req.id(item.id());
|
||||
req.id = item.id;
|
||||
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#include <InfrastructureManagement/ism_ftc.h>
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
|
||||
#include <InfrastructureManagement/ism_data_plugin.h>
|
||||
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
||||
+16
-14
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include "ism_plan_dialog_model.h"
|
||||
|
||||
@@ -17,6 +18,7 @@ PlanDialogModel::PlanDialogModel(QObject *parent)
|
||||
tr("End"),
|
||||
tr("Complete")},
|
||||
parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
, m_dtc(nullptr)
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
@@ -56,20 +58,20 @@ QVariant PlanDialogModel::data(const QModelIndex &index, int role) const
|
||||
static const QIcon red(QLatin1String("icon:red_light.svg"));
|
||||
if (index.column() == PlanDialogModel::Columns::COMPLETE)
|
||||
{
|
||||
|
||||
bool isComplete = m_dtc->checkSchedule(ms.id());
|
||||
|
||||
bool isComplete = m_dtc->checkSchedule(ms.id);
|
||||
return (isComplete ? green : red);
|
||||
}
|
||||
}
|
||||
else if (role == Qt::TextColorRole)
|
||||
else if (role == Qt::ForegroundRole)
|
||||
{
|
||||
if (index.column() == PlanDialogModel::Columns::STATUS)
|
||||
{
|
||||
switch (ms.statusId().underlying())
|
||||
switch (static_cast<int>(ms.statusId))
|
||||
{
|
||||
case ScheduleStatus::Active:
|
||||
case static_cast<int>(ScheduleStatus::Active):
|
||||
return QColor(Qt::darkGreen);
|
||||
case ScheduleStatus::Inactive:
|
||||
case static_cast<int>(ScheduleStatus::Inactive):
|
||||
return QColor(Qt::red);
|
||||
}
|
||||
}
|
||||
@@ -79,21 +81,21 @@ QVariant PlanDialogModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case ID:
|
||||
return ms.id();
|
||||
return ms.id;
|
||||
case NAME:
|
||||
return QString::fromStdString(ms.name());
|
||||
return QString::fromStdString(ms.name);
|
||||
case STATUS:
|
||||
return toString(ms.statusId());
|
||||
return toString(ms.statusId);
|
||||
case CREATED:
|
||||
return DTG::toStringMSec(ms.timeCreated());
|
||||
return DTG::toStringMSec(ms.timeCreated);
|
||||
case START:
|
||||
return (ms.timeStart().is_set() ? DTG::toStringMSec(ms.timeStart().get()) : QVariant()) ;
|
||||
return (ms.timeStart.has_value() ? DTG::toStringMSec(ms.timeStart.value()) : QVariant()) ;
|
||||
case END:
|
||||
return (ms.timeEnd().is_set() ? DTG::toStringMSec(ms.timeEnd().get()) : QVariant());
|
||||
return (ms.timeEnd.has_value() ? DTG::toStringMSec(ms.timeEnd.value()) : QVariant());
|
||||
case COMPLETE:
|
||||
{
|
||||
|
||||
bool isComplete = m_dtc->checkSchedule(ms.id());
|
||||
|
||||
bool isComplete = m_dtc->checkSchedule(ms.id);
|
||||
return (isComplete ? tr("Yes") : tr("No"));
|
||||
}
|
||||
}
|
||||
|
||||
+25
-23
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "ism_plan_edit_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_ism_plan_edit_dialog.h"
|
||||
#include "ism_plan_dialog_model.h"
|
||||
|
||||
@@ -19,6 +20,7 @@ PlanEditDialog::PlanEditDialog(QWidget *parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -56,20 +58,20 @@ bool PlanEditDialog::init(LtsSession::LtsSession *session,
|
||||
{
|
||||
MainSchedule data = dtc->mainSchedule(m_scheduleId);
|
||||
|
||||
m_currentState = data.statusId();
|
||||
m_ui->cbStatus->setCurrentIndex(m_ui->cbStatus->findData(data.statusId().underlying()));
|
||||
m_currentState = data.statusId;
|
||||
m_ui->cbStatus->setCurrentIndex(m_ui->cbStatus->findData(static_cast<int>(data.statusId)));
|
||||
|
||||
m_ui->leName->setText(QString::fromStdString(data.name()));
|
||||
if (data.timeStart().is_set())
|
||||
m_ui->dteBegin->setMsecsSinceEpoch(data.timeStart().get());
|
||||
if (data.timeEnd().is_set())
|
||||
m_ui->dteEnd->setMsecsSinceEpoch(data.timeEnd().get());
|
||||
m_ui->leName->setText(QString::fromStdString(data.name));
|
||||
if (data.timeStart.has_value())
|
||||
m_ui->dteBegin->setMsecsSinceEpoch(data.timeStart.get());
|
||||
if (data.timeEnd.has_value())
|
||||
m_ui->dteEnd->setMsecsSinceEpoch(data.timeEnd.get());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentState = ScheduleStatus::Active;
|
||||
m_ui->cbStatus->setCurrentIndex(m_ui->cbStatus->findData(ScheduleStatus::Inactive));
|
||||
m_ui->cbStatus->setCurrentIndex(m_ui->cbStatus->findData(static_cast<int>(ScheduleStatus::Inactive)));
|
||||
m_ui->cbStatus->setEnabled(true);
|
||||
}
|
||||
|
||||
@@ -93,7 +95,7 @@ bool PlanEditDialog::apply()
|
||||
|
||||
for(auto schedule : m_dtc->mainSchedules())
|
||||
{
|
||||
if(schedule.name() == m_ui->leName->text().toStdString())
|
||||
if(schedule.name == m_ui->leName->text().toStdString())
|
||||
{
|
||||
if(m_scheduleId <= 0)
|
||||
{
|
||||
@@ -103,7 +105,7 @@ bool PlanEditDialog::apply()
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_scheduleId != schedule.id() && schedule.name() == m_ui->leName->text().toStdString())
|
||||
if(m_scheduleId != schedule.id && schedule.name == m_ui->leName->text().toStdString())
|
||||
{
|
||||
|
||||
QString msg = tr("The name is already in use.");
|
||||
@@ -116,13 +118,13 @@ bool PlanEditDialog::apply()
|
||||
|
||||
|
||||
MainScheduleModifyRequest data;
|
||||
data.name((m_ui->leName->text().toStdString()));
|
||||
data.name = (m_ui->leName->text().toStdString());
|
||||
|
||||
ScheduleStatus newStatus = static_cast<ScheduleStatus>(m_ui->cbStatus->currentData().toInt());
|
||||
|
||||
if (newStatus != m_currentState)
|
||||
{
|
||||
switch (newStatus.underlying())
|
||||
switch (newStatus)
|
||||
{
|
||||
case ScheduleStatus::Active:
|
||||
|
||||
@@ -140,27 +142,27 @@ bool PlanEditDialog::apply()
|
||||
if (m_scheduleId > 0)
|
||||
{
|
||||
MainSchedule ms = m_dtc->mainSchedule(m_scheduleId);
|
||||
data.id(ms.id());
|
||||
data.exerciseId(ms.exerciseId());
|
||||
data.description(ms.description());
|
||||
data.timeCreated(ms.timeCreated());
|
||||
data.id = ms.id;
|
||||
data.exerciseId = ms.exerciseId;
|
||||
data.description = ms.description;
|
||||
data.timeCreated = ms.timeCreated;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.id(0);
|
||||
data.timeCreated(QDateTime::currentMSecsSinceEpoch());
|
||||
data.id = 0;
|
||||
data.timeCreated = QDateTime::currentMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
if (!m_ui->dteBegin->isEmpty() && m_ui->dteBegin->isValidDate())
|
||||
data.timeStart(m_ui->dteBegin->msecsSinceEpoch());
|
||||
data.timeStart = m_ui->dteBegin->msecsSinceEpoch();
|
||||
else
|
||||
data.timeStart();
|
||||
data.timeStart;
|
||||
if (!m_ui->dteEnd->isEmpty() && m_ui->dteEnd->isValidDate())
|
||||
data.timeEnd(m_ui->dteEnd->msecsSinceEpoch());
|
||||
data.timeEnd = m_ui->dteEnd->msecsSinceEpoch();
|
||||
else
|
||||
data.timeEnd();
|
||||
data.timeEnd;
|
||||
|
||||
data.statusId(static_cast<ScheduleStatus>(m_ui->cbStatus->currentData().toInt()));
|
||||
data.statusId = static_cast<ScheduleStatus>(m_ui->cbStatus->currentData().toInt());
|
||||
|
||||
m_requestHelper->addRequest([data,this](){
|
||||
return m_ftc->mainScheduleModifyRequest(data, this);
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
#include <InfrastructureManagement/ism_combobox_gui_plugin_interface.h>
|
||||
#include <InfrastructureManagement/logger.h>
|
||||
#include <InfrastructureManagement/ism_data_plugin.h>
|
||||
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
|
||||
namespace Ui
|
||||
|
||||
+7
-7
@@ -575,15 +575,15 @@ void InterfaceImpl::slotNewPlan()
|
||||
}
|
||||
|
||||
MainScheduleModifyRequest req;
|
||||
req.name(name.toStdString());
|
||||
req.name = name.toStdString();
|
||||
|
||||
|
||||
req.id(0);
|
||||
req.statusId(static_cast<ScheduleStatus>(status));
|
||||
req.timeCreated(QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||
req.id = 0;
|
||||
req.statusId = static_cast<ScheduleStatus>(status);
|
||||
req.timeCreated = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||
if(tbegin > 0)
|
||||
req.timeStart(tbegin);
|
||||
req.timeEnd(tend);
|
||||
req.timeStart = tbegin;
|
||||
req.timeEnd = tend;
|
||||
if (m_requestHelper->startSingleRequest([req, ismFtc, this]()
|
||||
{
|
||||
return ismFtc->mainScheduleModifyRequest(req, this);
|
||||
@@ -663,7 +663,7 @@ void InterfaceImpl::setPlanId(const int planId)
|
||||
|
||||
|
||||
MainSchedule ms = ismIfc->mainSchedule(m_planId);
|
||||
QString msName = QString::fromStdString(ms.name());
|
||||
QString msName = QString::fromStdString(ms.name);
|
||||
connect(m_session, &LtsSession::LtsSession::signalDoneInitializingSession,
|
||||
this, [this, msName] ()
|
||||
{
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
#include <AudioVideoManagement/avm_data_plugin_interface.h>
|
||||
#include <InfrastructureManagement/ism_data_plugin.h>
|
||||
#include <Plugins/InfrastructureManagement/Data/ism_data_plugin.h>
|
||||
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
|
||||
#include <SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
|
||||
|
||||
+5
-3
@@ -6,7 +6,7 @@
|
||||
* that extend MountingPoint functionality.
|
||||
*/
|
||||
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/ism.hpp>
|
||||
#include <InfrastructureManagement/ism_enums.hpp>
|
||||
#include <QtGui/QImage>
|
||||
@@ -121,11 +121,13 @@ void MountingPoint::init() {
|
||||
}
|
||||
|
||||
QString MountingPoint::name() const {
|
||||
return QString::fromStdString(m_data.name());
|
||||
// Qt6: legacy codegen exposed name() as a method; new codegen exposes 'name' as a public member.
|
||||
return QString::fromStdString(m_data.name);
|
||||
}
|
||||
|
||||
QString MountingPoint::fileName() const {
|
||||
return QString::fromStdString(m_data.name());
|
||||
// Qt6: legacy codegen exposed name() as a method; new codegen exposes 'name' as a public member.
|
||||
return QString::fromStdString(m_data.name);
|
||||
}
|
||||
|
||||
QImage MountingPoint::toImage(int32_t edgeLength) const {
|
||||
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The MountingPoint class wraps all information from InfrastructureManagement which defines a mounting point
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-01-16
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/InfrastructureManagement/Shared/ismshared_export.h>
|
||||
#include <InfrastructureManagement/ism.hpp>
|
||||
#include <InfrastructureManagement/ism_enums.hpp>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QString>
|
||||
|
||||
|
||||
namespace dds
|
||||
{
|
||||
namespace core
|
||||
{
|
||||
static inline uint qHash(const InfrastructureManagement::MountingPointType &mpt)
|
||||
{
|
||||
return ::qHash(static_cast<int>(mpt));
|
||||
}
|
||||
} // namespace core
|
||||
} // namespace dds
|
||||
|
||||
namespace InfrastructureManagement
|
||||
{
|
||||
|
||||
class ISMSHARED_EXPORT MountingPoint
|
||||
{
|
||||
public:
|
||||
explicit MountingPoint();
|
||||
explicit MountingPoint(const StructureElement &data, int floorId);
|
||||
static void init();
|
||||
|
||||
const StructureElement &data() const { return m_data; }
|
||||
void updateData(const StructureElement &data, int floorId) { m_data = data; m_floor = floorId; }
|
||||
int32_t id() const { return m_data.id; }
|
||||
int32_t associatedAssetId() const { return m_associatedAssetId; }
|
||||
bool hasAssociatedAsset() const { return m_associatedAssetId > 0; }
|
||||
bool hasAssociatedAssetDefect() const { return m_hasAssociatedAssetDefect; }
|
||||
|
||||
/*! \name aimState depends on the (loaded) plan/schedule!!! */
|
||||
//@{
|
||||
|
||||
//! \brief aimState of currently loaded schedule!!!
|
||||
//! \return aimState
|
||||
MountingPointState aimState() const { return m_aimState; }
|
||||
void setAimState(const MountingPointState &mps) { m_aimState = mps;}
|
||||
|
||||
//@}
|
||||
|
||||
bool isValid() const { return m_isValid; }
|
||||
Core::GeoPosition geoPosition() const { return m_data.geoPosition; }
|
||||
Core::RelativePosition relPosition() const { return m_data.relPosition; }
|
||||
MountingPointType type() const { return m_data.mountingPointTypeId; }
|
||||
int32_t buildingId() const { return m_data.mainStructureElementId; }
|
||||
QString name() const;
|
||||
QString fileName() const;
|
||||
QByteArray properties() const { return m_data.properties.c_str(); }
|
||||
|
||||
QImage toImage(int32_t edgeLength = 100) const;
|
||||
bool writeFile(int32_t edgeLength = 25) const;
|
||||
int floor() const { return m_floor; }
|
||||
void setFloor(int floor) { m_floor = floor; }
|
||||
|
||||
void setAssociatedAssetId(int32_t id);
|
||||
void setHasAssociatedAssetDefect(bool hasAssociatedAssetDefect);
|
||||
MountingPointState getNextMountingPointState(const MountingPointState currState);
|
||||
|
||||
private: // methods
|
||||
|
||||
private: // attributes
|
||||
StructureElement m_data;
|
||||
int32_t m_associatedAssetId;
|
||||
MountingPointState m_aimState{};
|
||||
bool m_hasAssociatedAssetDefect;
|
||||
bool m_isValid;
|
||||
int m_floor;
|
||||
|
||||
public:
|
||||
|
||||
enum class MpColor
|
||||
{
|
||||
GRAY,
|
||||
BLUE,
|
||||
RED,
|
||||
GREEN,
|
||||
ORANGE
|
||||
};
|
||||
static QString mpColorToString(MpColor mpColor);
|
||||
static QString mpColorToPostfix(MpColor mpColor);
|
||||
|
||||
struct NameImagePair
|
||||
{
|
||||
NameImagePair(const QString &name = QString(),
|
||||
const QImage &img = QImage())
|
||||
: m_name(name), m_img(img)
|
||||
{}
|
||||
QString m_name; // like announcement_BLUE
|
||||
QImage m_img;
|
||||
};
|
||||
struct MpNameImageData
|
||||
{
|
||||
NameImagePair nipGray;
|
||||
NameImagePair nipBlue;
|
||||
NameImagePair nipRed;
|
||||
NameImagePair nipGreen;
|
||||
NameImagePair nipOrange;
|
||||
};
|
||||
|
||||
//
|
||||
// Some methods regarding ImageTable:
|
||||
//
|
||||
static QMap<MountingPointType, MpNameImageData> &getImageTable(); // contains images in good quality (100*100px)
|
||||
|
||||
static bool getImageAttributePlanActivity(const MountingPoint& mp,
|
||||
QImage &imgOut, QString &attribNameOut);
|
||||
static bool getImageAttributePlanDefinition(const MountingPoint& mp,
|
||||
QImage &imgOut, QString &attribNameOut);
|
||||
|
||||
static bool getImageAttribute(const MountingPoint& mp, MpColor mpColor,
|
||||
QImage &img, QString &attribName);
|
||||
|
||||
private:
|
||||
static QMap<MountingPointType, MpNameImageData> &getImageTableInternal();
|
||||
static void insertHelper(MountingPointType type,
|
||||
const QString &name,
|
||||
const QString &colorCodeGray,
|
||||
const QString &colorCodeGreen,
|
||||
const QString &colorCodeRed,
|
||||
const QString &colorCodeOrange,
|
||||
const QString &defName = QString());
|
||||
|
||||
}; // class MountingPoint
|
||||
|
||||
} // namespace InfrastructureManagement
|
||||
+1
-3
@@ -5,7 +5,7 @@
|
||||
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
|
||||
|
||||
#include <InfrastructureManagement/ism.hpp>
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/ism_dtc.h>
|
||||
#include <InfrastructureManagement/ism_ftc.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
@@ -31,8 +31,6 @@ namespace InfrastructureManagement
|
||||
{
|
||||
class ForeignDataInterface;
|
||||
|
||||
// Forward declaration for MainSchedule from ParticipantManagement
|
||||
using ParticipantManagement::MainSchedule;
|
||||
|
||||
|
||||
class ISMDATAPLUGININTERFACE_EXPORT DataInterface : public DataPluginBase::Interface
|
||||
|
||||
Reference in new issue
Block a user