198 lines
6.1 KiB
C++
Executable File
198 lines
6.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* ExerciseManangement - Exercise Overview Dialog
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Mike Wille, SLSE, 2017-02-10
|
|
*/
|
|
|
|
#include "tln_legend.h"
|
|
#include "ui_tln_legend.h"
|
|
#include "EventTypes/BiteMessage/tln_bite_message_item.h"
|
|
#include "EventTypes/Block/tln_block_item.h"
|
|
#include "EventTypes/CameraVideo/tln_camera_video_item.h"
|
|
#include "EventTypes/CrossBorderline/tln_cross_borderline_item.h"
|
|
#include "EventTypes/FireEvent/tln_fire_event_item.h"
|
|
#include "EventTypes/Hit/tln_hit_item.h"
|
|
#include "EventTypes/HitBuilding/tln_hit_building_item.h"
|
|
#include "EventTypes/HitEffectSimulation/tln_hit_effect_simulation_item.h"
|
|
#include "EventTypes/Manipulation/tln_manipulation_item.h"
|
|
#include "EventTypes/Marker/tln_marker_item.h"
|
|
#include "EventTypes/RadioCnr/tln_radio_cnr_item.h"
|
|
#include "EventTypes/RadioTvc/tln_radio_tvc_item.h"
|
|
#include "EventTypes/WeaponAssignment/tln_weapon_assignment_item.h"
|
|
|
|
#include <LtsUtilsSettings/settings.h>
|
|
|
|
#include <QLabel>
|
|
#include <QImage>
|
|
#include <QPixmap>
|
|
#include <QPainter>
|
|
|
|
|
|
namespace Timeline
|
|
{
|
|
|
|
|
|
QVector<EventType> TimelineLegend::possibleEvents()
|
|
{
|
|
QVector<EventType> ret({
|
|
EventType::Hit,
|
|
EventType::WeaponAssignment,
|
|
EventType::BiteMessage,
|
|
EventType::FireEvent,
|
|
EventType::HitBuilding,
|
|
EventType::Manipulation,
|
|
EventType::CameraVideo,
|
|
EventType::RadioCnr,
|
|
EventType::RadioTvc,
|
|
EventType::HitEffectSimulation,
|
|
EventType::CrossBorderline,
|
|
EventType::Marker,
|
|
EventType::Block
|
|
});
|
|
|
|
LtsUtils::ProjectSettings *settings = LtsUtils::ProjectSettings::getInstance();
|
|
|
|
if (settings->value(QStringLiteral("tln"), QStringLiteral("showEffectSimulationEvents")).toBool())
|
|
{
|
|
ret += EventType::MineArea;
|
|
ret += EventType::DangerArea;
|
|
ret += EventType::FunctionalArea;
|
|
ret += EventType::MineCorridor;
|
|
ret += EventType::Borderline;
|
|
if (settings->value(QStringLiteral("aes"), QStringLiteral("enableNuclearContaminations")).toBool())
|
|
ret += EventType::NContamination;
|
|
if (settings->value(QStringLiteral("aes"), QStringLiteral("enableNuclearContaminations")).toBool() ||
|
|
settings->value(QStringLiteral("aes"), QStringLiteral("enableNuclearContaminations")).toBool())
|
|
ret += EventType::BCContamination;
|
|
}
|
|
|
|
if (settings->value(QStringLiteral("tln"), QStringLiteral("showEnterLeaveEvents")).toBool())
|
|
{
|
|
ret += EventType::EnterDangerArea;
|
|
ret += EventType::LeaveDangerArea;
|
|
ret += EventType::EnterMineArea;
|
|
ret += EventType::LeaveMineArea;
|
|
ret += EventType::EnterFunctionalArea;
|
|
ret += EventType::LeaveFunctionalArea;
|
|
if (settings->value(QStringLiteral("aes"), QStringLiteral("enableNuclearContaminations")).toBool())
|
|
{
|
|
ret += EventType::EnterNuclear;
|
|
ret += EventType::LeaveNuclear;
|
|
}
|
|
}
|
|
|
|
if (settings->value(QStringLiteral("aes"), QStringLiteral("enableGasPipes")).toBool())
|
|
{
|
|
ret += EventType::GasPipe;
|
|
//ret += EventType::HitGasPipe; covered by HitEffectSimulation yes or no ??
|
|
}
|
|
|
|
const bool showPvSan = LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("ParticipantInformation"), QStringLiteral("HasPvSan"));
|
|
if (showPvSan)
|
|
ret += EventType::Sanitation;
|
|
|
|
return ret;
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief
|
|
* @details Shows which icon represents which event
|
|
* @param parent
|
|
*/
|
|
TimelineLegend::TimelineLegend(QWidget *parent)
|
|
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
|
, m_ui(new Ui::TimelineLegend)
|
|
, m_logger(getLogger("TimelineLegend"))
|
|
{
|
|
m_ui->setupUi(this);
|
|
|
|
EventTypes eventTypes = possibleEvents();
|
|
std::sort(eventTypes.begin(), eventTypes.end(), [](EventType left, EventType right)
|
|
{
|
|
if (left == EventType::Marker)
|
|
return true;
|
|
else if (right == EventType::Marker)
|
|
return false;
|
|
int categoryLeft = eventTypeCategory(left);
|
|
int categoryRight = eventTypeCategory(right);
|
|
if (categoryLeft != categoryRight)
|
|
return categoryLeft < categoryRight;
|
|
return eventTypeString(left) < eventTypeString(right);
|
|
});
|
|
|
|
int row = 1;
|
|
for (EventType eventType : eventTypes)
|
|
{
|
|
QLabel *pixmapContainerLabel = new QLabel;
|
|
switch (eventType)
|
|
{
|
|
case EventType::Marker:
|
|
pixmapContainerLabel->setPixmap(MarkerItem::pixmap);
|
|
break;
|
|
case EventType::Block:
|
|
pixmapContainerLabel->setPixmap(BlockItem::pixmap);
|
|
break;
|
|
case EventType::Hit:
|
|
pixmapContainerLabel->setPixmap(HitItem::pixmap);
|
|
break;
|
|
case EventType::WeaponAssignment:
|
|
pixmapContainerLabel->setPixmap(WeaponAssignmentItem::pixmap);
|
|
break;
|
|
case EventType::BiteMessage:
|
|
pixmapContainerLabel->setPixmap(BiteMessageItem::pixmap);
|
|
break;
|
|
case EventType::FireEvent:
|
|
pixmapContainerLabel->setPixmap(FireEventItem::pixmap);
|
|
break;
|
|
case EventType::HitBuilding:
|
|
pixmapContainerLabel->setPixmap(HitBuildingItem::pixmap);
|
|
break;
|
|
case EventType::Manipulation:
|
|
pixmapContainerLabel->setPixmap(ManipulationItem::pixmap);
|
|
break;
|
|
case EventType::CameraVideo:
|
|
pixmapContainerLabel->setPixmap(CameraVideoItem::pixmap);
|
|
break;
|
|
case EventType::RadioCnr:
|
|
pixmapContainerLabel->setPixmap(RadioCnrItem::pixmap);
|
|
break;
|
|
case EventType::RadioTvc:
|
|
pixmapContainerLabel->setPixmap(RadioTvcItem::pixmap);
|
|
break;
|
|
case EventType::HitEffectSimulation:
|
|
pixmapContainerLabel->setPixmap(HitEffectSimulationItem::pixmap);
|
|
break;
|
|
case EventType::CrossBorderline:
|
|
pixmapContainerLabel->setPixmap(CrossBorderlineItem::pixmap);
|
|
break;
|
|
default:
|
|
continue;
|
|
}
|
|
m_ui->gridLayout->addWidget(pixmapContainerLabel, row, 0);
|
|
m_ui->gridLayout->addWidget(new QLabel(eventTypeString(eventType)), row, 1);
|
|
m_ui->gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), row, 2);
|
|
++row;
|
|
}
|
|
m_ui->gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), row, 0);
|
|
}
|
|
|
|
TimelineLegend::~TimelineLegend()
|
|
{
|
|
delete m_ui;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// PRIVATE
|
|
|
|
void TimelineLegend::retranslate()
|
|
{
|
|
translate(m_ui, tr("Timeline Legend"));
|
|
}
|
|
|
|
} // namespace Timeline
|