Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Hannes Baeuerle, SLSE, 2017-02-24
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
#ADD_SUBDIRECTORY(Data)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(OreOnlineReportsGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ore_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Hannes Baeuerle, SLSE, 2017-02-24
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(OnlineReports)
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Hannes Baeuerle, SLSE, 2017-02-24
|
||||
#
|
||||
|
||||
FIND_PACKAGE(KDChart REQUIRED)
|
||||
|
||||
SET(ore_online_reports_gui_SRCS
|
||||
ore_online_reports_gui_plugin.h
|
||||
ore_online_reports_gui_plugin.cpp
|
||||
ore_create_report_dialog.h
|
||||
ore_create_report_dialog.cpp
|
||||
ore_report_dialog.h
|
||||
ore_report_dialog.cpp
|
||||
ore_type_model.h
|
||||
ore_type_model.cpp
|
||||
|
||||
Charts/ore_abstract_chart_model.h
|
||||
Charts/ore_abstract_chart_model.cpp
|
||||
Charts/ore_detailed_chart_model.h
|
||||
Charts/ore_detailed_chart_model.cpp
|
||||
Charts/ore_simple_chart_model.h
|
||||
Charts/ore_simple_chart_model.cpp
|
||||
)
|
||||
|
||||
NGL_WRAP_UI (ore_online_reports_gui_SRCS
|
||||
ore_create_report_dialog.ui
|
||||
ore_report_dialog.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS OreOnlineReportsGuiPlugin MODULE ${ore_online_reports_gui_SRCS})
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(OreOnlineReportsGuiPlugin
|
||||
AsbDataPluginInterface
|
||||
LtsSession
|
||||
OreOnlineReportsGuiPluginInterface
|
||||
svcOreDummy
|
||||
GuiPluginInterface
|
||||
Qt5::Widgets
|
||||
PpmCommon
|
||||
KDChart::KDChart
|
||||
LtsUtilsSettings
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(OreOnlineReportsGuiPlugin)
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Base class and factory for further ChartModel classes
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-01
|
||||
*/
|
||||
|
||||
#include "ore_abstract_chart_model.h"
|
||||
#include "ore_detailed_chart_model.h"
|
||||
#include "ore_simple_chart_model.h"
|
||||
|
||||
OnlineReports::AbstractChartModel *OnlineReports::AbstractChartModel::create(const OnlineReports::AbstractChartModel::ChartConfig &config, QObject *parent)
|
||||
{
|
||||
switch (config.levelOfDetail)
|
||||
{
|
||||
case ChartLevelOfDetail::HIGH:
|
||||
return new DetailedChartModel(config, parent);
|
||||
case ChartLevelOfDetail::LOW:
|
||||
default:
|
||||
return new SimpleChartModel(config, parent);
|
||||
}
|
||||
}
|
||||
|
||||
OnlineReports::AbstractChartModel::AbstractChartModel(const OnlineReports::AbstractChartModel::ChartConfig &config, QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
, m_config(config)
|
||||
{
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Base class and factory for further ChartModel classes
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-01
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSet>
|
||||
#include <QAbstractTableModel>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QVariantList>
|
||||
#include <QBrush>
|
||||
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
class AbstractChartModel
|
||||
: public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public: // other
|
||||
enum class ChartType
|
||||
{
|
||||
PIE,
|
||||
BAR
|
||||
}; // enum class ChartType
|
||||
|
||||
enum class ChartLevelOfDetail
|
||||
{
|
||||
LOW = 0,
|
||||
HIGH = 1,
|
||||
}; // enum class ChartLevelOfDetail
|
||||
|
||||
struct ChartConfig
|
||||
{
|
||||
QString name;
|
||||
ChartLevelOfDetail levelOfDetail;
|
||||
ChartType type;
|
||||
bool isSeparatedByTypeClass;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc;
|
||||
QSet<int32_t> participantIds;
|
||||
|
||||
explicit ChartConfig(const QString &name,
|
||||
ChartLevelOfDetail levelOfDetail,
|
||||
ChartType type,
|
||||
bool isSeparatedByTypeClass,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const QSet<int32_t> &participantIds)
|
||||
: name(name)
|
||||
, levelOfDetail(levelOfDetail)
|
||||
, type(type)
|
||||
, isSeparatedByTypeClass(isSeparatedByTypeClass)
|
||||
, ppmDtc(ppmDtc)
|
||||
, participantIds(participantIds)
|
||||
{}
|
||||
|
||||
public:
|
||||
QJsonDocument toJson() const
|
||||
{
|
||||
QJsonObject jsonObj;
|
||||
|
||||
jsonObj.insert(QStringLiteral("name"), name);
|
||||
QString detail;
|
||||
switch (levelOfDetail)
|
||||
{
|
||||
case ChartLevelOfDetail::HIGH:
|
||||
detail = QStringLiteral("HIGH");
|
||||
break;
|
||||
case ChartLevelOfDetail::LOW:
|
||||
detail = QStringLiteral("LOW");
|
||||
break;
|
||||
default:
|
||||
detail = QStringLiteral("UNKNOWN");
|
||||
}
|
||||
jsonObj.insert(QStringLiteral("level_of_detail"), detail);
|
||||
|
||||
QString chartType;
|
||||
switch (type)
|
||||
{
|
||||
case ChartType::BAR:
|
||||
chartType = QStringLiteral("BAR");
|
||||
break;
|
||||
case ChartType::PIE:
|
||||
chartType = QStringLiteral("PIE");
|
||||
break;
|
||||
default:
|
||||
chartType = QStringLiteral("UNKNOWN");
|
||||
}
|
||||
jsonObj.insert(QStringLiteral("chart_type"), chartType);
|
||||
|
||||
jsonObj.insert(QStringLiteral("is_separated_by_typeclass"), isSeparatedByTypeClass);
|
||||
jsonObj.insert(QStringLiteral("is_ppm_dtc_set"), ppmDtc != nullptr);
|
||||
|
||||
QVariantList variantList;
|
||||
variantList.reserve(participantIds.size());
|
||||
for (int32_t participantId : participantIds)
|
||||
variantList += participantId;
|
||||
|
||||
jsonObj.insert(QStringLiteral("participant_ids"), QJsonArray::fromVariantList(variantList));
|
||||
|
||||
return QJsonDocument(jsonObj);
|
||||
}
|
||||
}; // struct ChartConfig
|
||||
|
||||
public: // methods
|
||||
static AbstractChartModel *create(const ChartConfig &config, QObject *parent = nullptr);
|
||||
|
||||
virtual int rowCount(const QModelIndex &parent) const = 0;
|
||||
virtual int columnCount(const QModelIndex &parent) const = 0;
|
||||
virtual QVariant data(const QModelIndex &index, int role) const = 0;
|
||||
|
||||
protected: // methods
|
||||
explicit AbstractChartModel(const ChartConfig &config, QObject *parent);
|
||||
|
||||
protected: // attributes
|
||||
ChartConfig m_config;
|
||||
|
||||
}; // class AbstractChartModel
|
||||
} // namespace OnlineReports
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChartModel for detailed unit power data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-01
|
||||
*/
|
||||
|
||||
#include "ore_detailed_chart_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <ProjectDataManagement/pdm_to_string.h>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
|
||||
int DetailedChartModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : 1;
|
||||
}
|
||||
|
||||
int DetailedChartModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : COUNT;
|
||||
}
|
||||
|
||||
QVariant DetailedChartModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!(index.isValid() &&
|
||||
role == Qt::DisplayRole))
|
||||
return QVariant();
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case COMBAT_READY:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::CombatReady).size();
|
||||
case LIGHT_DAMAGE:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::LightDamage).size();
|
||||
case MEDIUM_DAMAGE:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::MediumDamage).size();
|
||||
case HEAVY_DAMAGE:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::HeavyDamage).size();
|
||||
case MOBILITY_KILL:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::MobilityKill).size();
|
||||
case VISIBLE_MOBILITY_KILL:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::VisibleMobilityKill).size();
|
||||
case WEAPON_SYSTEM_DAMAGE:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::WeaponSystemDamage).size();
|
||||
case VISIBLE_WEAPON_SYSTEM_DAMAGE:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::VisibleWeaponSystemDamage).size();
|
||||
case CATASTROPHIC_KILL:
|
||||
return m_participantStates.value(ProjectDataManagement::VulnerabilityState::CatastrophicKill).size();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant DetailedChartModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (!(orientation == Qt::Horizontal &&
|
||||
role == Qt::DisplayRole))
|
||||
return QVariant();
|
||||
|
||||
switch (section)
|
||||
{
|
||||
case COMBAT_READY:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::CombatReady);
|
||||
case LIGHT_DAMAGE:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::LightDamage);
|
||||
case MEDIUM_DAMAGE:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::MediumDamage);
|
||||
case HEAVY_DAMAGE:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::HeavyDamage);
|
||||
case MOBILITY_KILL:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::MobilityKill);
|
||||
case VISIBLE_MOBILITY_KILL:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::VisibleMobilityKill);
|
||||
case WEAPON_SYSTEM_DAMAGE:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::WeaponSystemDamage);
|
||||
case VISIBLE_WEAPON_SYSTEM_DAMAGE:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::VisibleWeaponSystemDamage);
|
||||
case CATASTROPHIC_KILL:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::CatastrophicKill);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
void DetailedChartModel::onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
|
||||
const ParticipantManagement::StateInformation &stateInfo = m_config.ppmDtc->youngestStateInformation(data.stateHistory());
|
||||
|
||||
if (!m_config.participantIds.contains(data.participantId()) ||
|
||||
stateInfo.vulnerabilityState() > ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
return;
|
||||
|
||||
// first remove the id
|
||||
for (auto it = m_participantStates.begin(); it != m_participantStates.end(); ++it)
|
||||
it.value() -= data.participantId();
|
||||
|
||||
m_participantStates[stateInfo.vulnerabilityState()] += data.participantId();
|
||||
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
DetailedChartModel::DetailedChartModel(const AbstractChartModel::ChartConfig &config, QObject *parent)
|
||||
: AbstractChartModel(config, parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("OnlineReportDetailedChartModel"))
|
||||
{
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::CombatReady, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::LightDamage, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::MediumDamage, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::HeavyDamage, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::MobilityKill, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::VisibleMobilityKill, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::WeaponSystemDamage, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::VisibleWeaponSystemDamage, QSet<int32_t>());
|
||||
m_participantStates.insert(ProjectDataManagement::VulnerabilityState::CatastrophicKill, QSet<int32_t>());
|
||||
|
||||
auto cb = [this](const ParticipantManagement::DynamicParticipantData & data)
|
||||
{
|
||||
if (!m_config.participantIds.contains(data.participantId()))
|
||||
return;
|
||||
onDynamicParticipantDataChanged(data, DataModification::eAdded);
|
||||
};
|
||||
m_config.ppmDtc->dynamicParticipantDatas(cb);
|
||||
|
||||
connect(m_config.ppmDtc.get(), &ParticipantManagement::Interface::Dtc::dynamicParticipantDataChanged,
|
||||
this, &DetailedChartModel::onDynamicParticipantDataChanged);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChartModel for detailed unit power data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-01
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ore_abstract_chart_model.h"
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
class DetailedChartModel
|
||||
: public AbstractChartModel
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class AbstractChartModel;
|
||||
|
||||
public:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override final;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override final;
|
||||
QVariant data(const QModelIndex &index, int role) const override final;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override final;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
||||
|
||||
private: // methods
|
||||
explicit DetailedChartModel(const AbstractChartModel::ChartConfig &config, QObject *parent);
|
||||
|
||||
private: //other
|
||||
enum Columns
|
||||
{
|
||||
COMBAT_READY,
|
||||
LIGHT_DAMAGE,
|
||||
MEDIUM_DAMAGE,
|
||||
HEAVY_DAMAGE,
|
||||
MOBILITY_KILL,
|
||||
VISIBLE_MOBILITY_KILL,
|
||||
WEAPON_SYSTEM_DAMAGE,
|
||||
VISIBLE_WEAPON_SYSTEM_DAMAGE,
|
||||
CATASTROPHIC_KILL,
|
||||
COUNT
|
||||
};
|
||||
|
||||
private: // attributes
|
||||
QMap<ProjectDataManagement::VulnerabilityState, QSet<int32_t> > m_participantStates;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
}; // class DetailedChartModel
|
||||
} // namespace OnlineReports
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChartModel for simple unit power data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-01
|
||||
*/
|
||||
|
||||
#include "ore_simple_chart_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <ProjectDataManagement/pdm_to_string.h>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
|
||||
int SimpleChartModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : 1;
|
||||
}
|
||||
|
||||
int SimpleChartModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : COUNT;
|
||||
}
|
||||
|
||||
QVariant SimpleChartModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!(role == Qt::DisplayRole &&
|
||||
index.isValid()))
|
||||
return QVariant();
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case COMBAT_READY:
|
||||
return m_combatReadyParticipants.size();
|
||||
case CATASTROPHIC_KILL:
|
||||
return m_catastrophicKilledParticipants.size();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant SimpleChartModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (!(orientation == Qt::Horizontal &&
|
||||
role == Qt::DisplayRole))
|
||||
return QVariant();
|
||||
|
||||
switch (section)
|
||||
{
|
||||
case 0:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::CombatReady);
|
||||
case 1:
|
||||
return ProjectDataManagement::toString(ProjectDataManagement::VulnerabilityState::CatastrophicKill);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleChartModel::onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
|
||||
if (!m_config.participantIds.contains(data.participantId()))
|
||||
return;
|
||||
|
||||
const ParticipantManagement::StateInformation &stateInfo = m_config.ppmDtc->youngestStateInformation(data.stateHistory());
|
||||
|
||||
DEBUG_LOG(m_logger) << "Participant id = " << data.participantId();
|
||||
DEBUG_LOG(m_logger) << "State Info Vulnerability = " << stateInfo.vulnerabilityState();
|
||||
|
||||
if (stateInfo.vulnerabilityState() < ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
setCombatReady(data.participantId());
|
||||
else
|
||||
setKilled(data.participantId());
|
||||
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
SimpleChartModel::SimpleChartModel(const AbstractChartModel::ChartConfig &config, QObject *parent)
|
||||
: AbstractChartModel(config, parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("OnlineReportSimpleChartModel"))
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::DynamicParticipantData & data)
|
||||
{
|
||||
if (!m_config.participantIds.contains(data.participantId()))
|
||||
return;
|
||||
onDynamicParticipantDataChanged(data, DataModification::eAdded);
|
||||
};
|
||||
m_config.ppmDtc->dynamicParticipantDatas(cb);
|
||||
|
||||
connect(m_config.ppmDtc.get(), &ParticipantManagement::Interface::Dtc::dynamicParticipantDataChanged,
|
||||
this, &SimpleChartModel::onDynamicParticipantDataChanged);
|
||||
}
|
||||
|
||||
void SimpleChartModel::setCombatReady(int32_t participantId)
|
||||
{
|
||||
m_catastrophicKilledParticipants -= participantId;
|
||||
m_combatReadyParticipants += participantId;
|
||||
}
|
||||
|
||||
void SimpleChartModel::setKilled(int32_t participantId)
|
||||
{
|
||||
m_catastrophicKilledParticipants += participantId;
|
||||
m_combatReadyParticipants -= participantId;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ChartModel for simple unit power data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-01
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ore_abstract_chart_model.h"
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
class SimpleChartModel
|
||||
: public AbstractChartModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class AbstractChartModel;
|
||||
public:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override final;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override final;
|
||||
QVariant data(const QModelIndex &index, int role) const override final;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override final;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
||||
|
||||
private: // methods
|
||||
explicit SimpleChartModel(const AbstractChartModel::ChartConfig &config, QObject *parent);
|
||||
|
||||
void setCombatReady(int32_t participantId);
|
||||
void setKilled(int32_t participantId);
|
||||
|
||||
private: //other
|
||||
enum Columns
|
||||
{
|
||||
COMBAT_READY,
|
||||
CATASTROPHIC_KILL,
|
||||
COUNT
|
||||
};
|
||||
|
||||
private: //attributes
|
||||
QSet<int32_t> m_combatReadyParticipants;
|
||||
QSet<int32_t> m_catastrophicKilledParticipants;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
}; // class SimpleChartModel
|
||||
} //namespace OnlineReports
|
||||
@@ -0,0 +1,275 @@
|
||||
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog to create a new online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#include "ore_create_report_dialog.h"
|
||||
#include "ui_ore_create_report_dialog.h"
|
||||
|
||||
#include "ore_type_model.h"
|
||||
#include "Charts/ore_abstract_chart_model.h"
|
||||
#include "ore_report_dialog.h"
|
||||
|
||||
#include <ParticipantManagement/Gui/Common/participant_edit_model.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
CreateReportDialog::CreateReportDialog(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ui(new Ui::CreateReportDialog)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_ppmGuiCbxIfc(nullptr)
|
||||
, m_participantModel(nullptr)
|
||||
, m_typeModel(nullptr)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("CreateReportDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->treeViewParticipants->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
this, &CreateReportDialog::slotChangesMade);
|
||||
connect(m_ui->treeViewParticipantTypes->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
this, &CreateReportDialog::slotChangesMade);
|
||||
|
||||
m_uiRequirements->addRequirement({ m_ui->lblName, [this]() { return !m_ui->leName->text().isEmpty(); }});
|
||||
|
||||
m_uiRequirements->addRequirement({ m_ui->lblParticipantView, [this]()
|
||||
{
|
||||
if (m_ui->treeViewParticipants->isVisible())
|
||||
return (m_ui->treeViewParticipants->selectionModel()->selectedRows().count() > 0);
|
||||
else
|
||||
return true;
|
||||
}});
|
||||
|
||||
m_uiRequirements->addRequirement({ m_ui->lblParticipantTypesView, [this]()
|
||||
{
|
||||
if (m_ui->treeViewParticipantTypes->isVisible())
|
||||
return (m_ui->treeViewParticipantTypes->selectionModel()->selectedRows().count() > 0);
|
||||
else
|
||||
return true;
|
||||
}});
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Situation-Add_Online_Report"));
|
||||
}
|
||||
|
||||
CreateReportDialog::~CreateReportDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CreateReportDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, QString(), true, tr("Online Report"));
|
||||
}
|
||||
|
||||
bool CreateReportDialog::init(LtsSession::LtsSessionDataDds *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &guiCbxIfc)
|
||||
{
|
||||
m_ppmDtc = ppmDtc;
|
||||
m_ppmGuiCbxIfc = guiCbxIfc;
|
||||
|
||||
if (!m_ppmDtc || !m_ppmGuiCbxIfc)
|
||||
return false;
|
||||
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> asb;
|
||||
session->getForeignDataInterface<AdvancedSymbology::DataInterface>(asb);
|
||||
m_participantModel = new ParticipantManagement::ParticipantEditModel(this,
|
||||
m_ppmDtc,
|
||||
asb);
|
||||
m_ui->treeViewParticipants->setModel(m_participantModel);
|
||||
connect(m_ui->cbParty,
|
||||
static_cast<void (LtsWidgets::LtsComboBox::*)(int)>(&LtsWidgets::LtsComboBox::currentIndexChanged),
|
||||
this, [this]()
|
||||
{
|
||||
m_participantModel->onReinitModel(m_ui->cbParty->currentData().toInt());
|
||||
m_ui->treeViewParticipants->expandAll();
|
||||
if (m_ui->cbAllParticipants->isChecked())
|
||||
m_ui->treeViewParticipants->selectAll();
|
||||
});
|
||||
|
||||
m_typeModel = new TypeModel(m_ppmDtc, this);
|
||||
|
||||
if (!m_typeModel)
|
||||
return false;
|
||||
|
||||
m_ui->treeViewParticipantTypes->setModel(m_typeModel);
|
||||
|
||||
connect(m_ui->cbAllParticipants, &QCheckBox::clicked,
|
||||
m_ui->treeViewParticipants, &QTreeView::setDisabled);
|
||||
connect(m_ui->cbAllTypes, &QCheckBox::clicked,
|
||||
m_ui->treeViewParticipantTypes, &QTreeView::setDisabled);
|
||||
connect(m_ui->cbAllParticipants, &QCheckBox::clicked,
|
||||
this, [this](bool checked)
|
||||
{
|
||||
if (checked)
|
||||
m_ui->treeViewParticipants->selectAll();
|
||||
else
|
||||
m_ui->treeViewParticipants->clearSelection();
|
||||
});
|
||||
connect(m_ui->cbAllTypes, &QCheckBox::clicked,
|
||||
this, [this](bool checked)
|
||||
{
|
||||
if (checked)
|
||||
m_ui->treeViewParticipantTypes->selectAll();
|
||||
else
|
||||
m_ui->treeViewParticipantTypes->clearSelection();
|
||||
});
|
||||
|
||||
m_ppmGuiCbxIfc->fillPartyComboBox(m_ui->cbParty);
|
||||
m_participantModel->onReinitModel(m_ui->cbParty->currentData().toInt());
|
||||
m_ui->treeViewParticipants->expandAll();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CreateReportDialog::apply()
|
||||
{
|
||||
AbstractChartModel::ChartLevelOfDetail levelOfDetail;
|
||||
AbstractChartModel::ChartType chartType;
|
||||
|
||||
// get types ---
|
||||
const QModelIndexList typeIndices = m_ui->treeViewParticipantTypes->selectionModel()->selectedRows();
|
||||
|
||||
QVector<int32_t> typeIds;
|
||||
typeIds.reserve(typeIndices.size());
|
||||
|
||||
for (const QModelIndex &index : typeIndices)
|
||||
typeIds.append(m_typeModel->getTypeId(index));
|
||||
typeIds.removeAll(-1);
|
||||
// -------------
|
||||
|
||||
// get participant IDs ---
|
||||
QSet<int32_t> participantIds;
|
||||
|
||||
if (!m_ui->cbAllParticipants->isChecked())
|
||||
{
|
||||
const QModelIndexList currentlySelectedParticipants = m_ui->treeViewParticipants->selectionModel()->selectedIndexes();
|
||||
|
||||
for (const QModelIndex &index : currentlySelectedParticipants)
|
||||
setChildrenSelected(index);
|
||||
}
|
||||
|
||||
const QModelIndexList participantIndices = m_ui->treeViewParticipants->selectionModel()->selectedRows();
|
||||
participantIds.reserve(participantIndices.size());
|
||||
for (const QModelIndex &index : participantIndices)
|
||||
{
|
||||
ParticipantManagement::ParticipantData data = m_participantModel->getParticipantData(index);
|
||||
|
||||
if (data.id() != 0 &&
|
||||
data.equipmentNumber().is_set() &&
|
||||
typeIds.contains(data.typeId()))
|
||||
participantIds.insert(data.id());
|
||||
}
|
||||
// -----------------------
|
||||
|
||||
if (m_ui->rbHighDetail->isChecked())
|
||||
levelOfDetail = AbstractChartModel::ChartLevelOfDetail::HIGH;
|
||||
else
|
||||
levelOfDetail = AbstractChartModel::ChartLevelOfDetail::LOW;
|
||||
|
||||
if (m_ui->rbPieChart->isChecked())
|
||||
chartType = AbstractChartModel::ChartType::PIE;
|
||||
else
|
||||
chartType = AbstractChartModel::ChartType::BAR;
|
||||
|
||||
AbstractChartModel::ChartConfig chartConfig(makeUnique(m_ui->leName->text()),
|
||||
levelOfDetail,
|
||||
chartType,
|
||||
m_ui->cbSeparateByTypeClass->isChecked(),
|
||||
m_ppmDtc,
|
||||
participantIds);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Creating new ReportDialog with config: "
|
||||
<< chartConfig.toJson().toJson();
|
||||
ReportDialog *dialog = new ReportDialog(chartConfig, this);
|
||||
|
||||
connect(dialog, &ReportDialog::removeName,
|
||||
this, &CreateReportDialog::onRemoveName);
|
||||
|
||||
addDialog(dialog, m_menuGroup, chartConfig.name, LtsWidgets::LayoutArea::eInfoTab);
|
||||
|
||||
__unchange__();
|
||||
return false; // don't close the dialog, keep it open as this is a non savable live report
|
||||
}
|
||||
|
||||
void CreateReportDialog::onRemoveName(const QString &name)
|
||||
{
|
||||
m_usedNames.removeAll(name);
|
||||
}
|
||||
|
||||
void CreateReportDialog::setChildrenSelected(const QModelIndex &parent)
|
||||
{
|
||||
if (!(parent.isValid() &&
|
||||
m_participantModel->hasChildren(parent)))
|
||||
return;
|
||||
|
||||
for (int currentRow = 0; currentRow < m_participantModel->rowCount(parent); ++currentRow)
|
||||
{
|
||||
QModelIndex childIndex = m_participantModel->index(currentRow, 0, parent);
|
||||
|
||||
if (m_participantModel->hasChildren(childIndex))
|
||||
setChildrenSelected(childIndex);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Setting row "
|
||||
<< childIndex.row()
|
||||
<< " selected";
|
||||
|
||||
m_ui->treeViewParticipants->selectionModel()->select(childIndex, QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
}
|
||||
}
|
||||
|
||||
QString CreateReportDialog::makeUnique(const QString &name)
|
||||
{
|
||||
if (!m_usedNames.contains(name) && !name.isEmpty())
|
||||
{
|
||||
m_usedNames << name;
|
||||
return name;
|
||||
}
|
||||
|
||||
QString result = name;
|
||||
|
||||
if (result.isEmpty())
|
||||
result = QStringLiteral("Online Report 1");
|
||||
|
||||
while (m_usedNames.contains(result))
|
||||
{
|
||||
QChar lastIndex = result.at(result.length() - 1);
|
||||
|
||||
if (lastIndex.isDigit())
|
||||
{
|
||||
QString number;
|
||||
|
||||
while (lastIndex.isDigit())
|
||||
{
|
||||
number.prepend(lastIndex);
|
||||
result.chop(1);
|
||||
lastIndex = result.at(result.length() - 1);
|
||||
}
|
||||
|
||||
if (result.endsWith(QLatin1Char(' ')))
|
||||
result.chop(1);
|
||||
|
||||
result.append(QStringLiteral(" %1").arg(number.toInt() + 1));
|
||||
}
|
||||
else
|
||||
result.append(QStringLiteral(" 1"));
|
||||
}
|
||||
|
||||
m_usedNames << result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog to create a new online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CreateReportDialog;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSessionDataDds;
|
||||
}
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ParticipantEditModel;
|
||||
class ForeignGuiComboboxInterface;
|
||||
}
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
class TypeModel;
|
||||
|
||||
class CreateReportDialog : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CreateReportDialog(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~CreateReportDialog();
|
||||
|
||||
bool init(LtsSession::LtsSessionDataDds *session,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &guiCbxIfc);
|
||||
|
||||
private slots:
|
||||
void onRemoveName(const QString &name);
|
||||
|
||||
private: // methods
|
||||
bool apply() override;
|
||||
void retranslate() override;
|
||||
void setChildrenSelected(const QModelIndex &parent);
|
||||
QString makeUnique(const QString &name);
|
||||
|
||||
private: // attributes
|
||||
Ui::CreateReportDialog *m_ui;
|
||||
QString m_menuGroup;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
||||
ParticipantManagement::ParticipantEditModel *m_participantModel;
|
||||
TypeModel *m_typeModel;
|
||||
QStringList m_usedNames;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace OnlineReports
|
||||
@@ -0,0 +1,294 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateReportDialog</class>
|
||||
<widget class="QWidget" name="CreateReportDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>883</width>
|
||||
<height>716</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Online Reports</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>867</width>
|
||||
<height>700</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>45</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="rbPieChart">
|
||||
<property name="text">
|
||||
<string>Pie &Graph</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rbBarChart">
|
||||
<property name="text">
|
||||
<string>Bar &Graph</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Level of detail:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="rbLowDetail">
|
||||
<property name="text">
|
||||
<string>&Low</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rbHighDetail">
|
||||
<property name="text">
|
||||
<string>Hi&gh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cbSeparateByTypeClass">
|
||||
<property name="text">
|
||||
<string>Separate by type class</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Data:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="partyLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblParty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Party:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsComboBox" name="cbParty">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblParticipants">
|
||||
<property name="text">
|
||||
<string>Party Element / Participant:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="cbAllParticipants">
|
||||
<property name="text">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblParticipantView">
|
||||
<property name="text">
|
||||
<string>Select at least one participant:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeViewParticipants">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="participantsLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblParticipantTypes">
|
||||
<property name="text">
|
||||
<string>Participant Types:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="cbAllTypes">
|
||||
<property name="text">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblParticipantTypesView">
|
||||
<property name="text">
|
||||
<string>Select at least one participant type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeViewParticipantTypes">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LtsWidgets/lts_combo_box.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
<tabstop>leName</tabstop>
|
||||
<tabstop>rbPieChart</tabstop>
|
||||
<tabstop>rbBarChart</tabstop>
|
||||
<tabstop>rbLowDetail</tabstop>
|
||||
<tabstop>rbHighDetail</tabstop>
|
||||
<tabstop>cbSeparateByTypeClass</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for OnlineReports
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#include "ore_online_reports_gui_plugin.h"
|
||||
#include "ore_create_report_dialog.h"
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <Services/OnlineReports/ore_operator_rights.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("OnlineReports"))
|
||||
{
|
||||
}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
return m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc) &&
|
||||
m_session->getForeignGuiInterface<ParticipantManagement::ForeignGuiComboboxInterface>(m_ppmGuiCbxIfc);
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_ppmGuiCbxIfc = nullptr;
|
||||
m_ppmDtc = nullptr;
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Reports"); //Same as Offline Reports
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
if (m_session->isReplayPartition())
|
||||
return QVector<LtsWidgets::PluginData>();
|
||||
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableOnlineReports = ps->value(QStringLiteral("ore"),
|
||||
QStringLiteral("enableOnlineReports")).toBool();
|
||||
if (enableOnlineReports)
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Add Online Report");
|
||||
plData.identifier = QLatin1String("oreDialog");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:add_reports_display.svg"));
|
||||
plData.operatorRight = OperatorRights::OnlineReportsShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eExecution;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowOnlineReportsDialog(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowOnlineReportsDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new CreateReportDialog(menuGroup(), parent),
|
||||
m_session, m_ppmDtc, m_ppmGuiCbxIfc);
|
||||
}
|
||||
|
||||
} // namespace OnlineReports
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for OnlineReports
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-27
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Plugins/OnlineReports/ore_gui_plugin_interface.h>
|
||||
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
class ForeignGuiComboboxInterface;
|
||||
}
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:ore.onlinereports")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("OnlineReportsGuiPlugin"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Exercise ||
|
||||
partition == IDL::PartitionType::Replay);
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
QString menuGroup() const override;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
|
||||
private: // methods
|
||||
LtsWidgets::LtsDialog *onShowOnlineReportsDialog(QWidget *parent);
|
||||
|
||||
private: // attributes
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
||||
};
|
||||
|
||||
} // namespace OnlineReports
|
||||
@@ -0,0 +1,220 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog which shows a single online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-28
|
||||
*/
|
||||
|
||||
#include "ore_report_dialog.h"
|
||||
#include "ui_ore_report_dialog.h"
|
||||
|
||||
#include "Charts/ore_abstract_chart_model.h"
|
||||
|
||||
#include <KDChart/KDChartChart>
|
||||
#include <KDChart/KDChartPieDiagram.h>
|
||||
#include <KDChart/KDChartBarDiagram>
|
||||
#include <KDChart/KDChartDataValueAttributes>
|
||||
#include <KDChart/KDChartLegend>
|
||||
#include <KDChart/KDChartPieAttributes>
|
||||
#include <KDChart/KDChartThreeDPieAttributes>
|
||||
#include <KDChart/KDChartThreeDBarAttributes>
|
||||
#include <KDChart/KDChartHeaderFooter>
|
||||
#include <KDChart/KDChartFrameAttributes>
|
||||
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
ReportDialog::ReportDialog(const AbstractChartModel::ChartConfig &config, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent)
|
||||
, m_ui(new Ui::ReportDialog)
|
||||
, m_name(config.name)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("OnlineReportDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
if (config.participantIds.isEmpty())
|
||||
{
|
||||
QString errorStr = tr("Not possible to draw diagram. There are no participants to be looked at");
|
||||
m_ui->verticalLayout->addWidget(new QLabel(errorStr, this));
|
||||
ERROR_LOG(m_logger) << errorStr;
|
||||
return;
|
||||
}
|
||||
|
||||
using namespace KDChart;
|
||||
|
||||
QPen pen;
|
||||
pen.setColor(QRgb(0x3e3d40));
|
||||
pen.setWidth(1);
|
||||
|
||||
if (config.isSeparatedByTypeClass)
|
||||
{
|
||||
QMap<ParticipantManagement::TypeClass, QSet<int32_t> > participantIdsByTypeClass;
|
||||
|
||||
for (int32_t participantId :config.participantIds)
|
||||
{
|
||||
ParticipantManagement::Participant participant = config.ppmDtc->participant(participantId);
|
||||
ParticipantManagement::TypeClass typeClass = config.ppmDtc->type(participant.typeId()).typeClass();
|
||||
|
||||
participantIdsByTypeClass[typeClass] += participantId;
|
||||
}
|
||||
|
||||
bool hasToCreateLegend = true;
|
||||
|
||||
for (auto it = participantIdsByTypeClass.constBegin(); it != participantIdsByTypeClass.constEnd(); ++it)
|
||||
{
|
||||
AbstractChartModel::ChartConfig newConfig = config;
|
||||
|
||||
newConfig.participantIds = it.value();
|
||||
|
||||
m_ui->verticalLayout->addWidget(createNewChart(newConfig, pen, hasToCreateLegend, toString(it.key())));
|
||||
hasToCreateLegend = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_ui->verticalLayout->addWidget(createNewChart(config, pen, true));
|
||||
}
|
||||
|
||||
ReportDialog::~ReportDialog()
|
||||
{
|
||||
emit removeName(m_name);
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void ReportDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_name, false, tr("Report"));
|
||||
}
|
||||
|
||||
QVector<QBrush> ReportDialog::brushes(const AbstractChartModel::ChartConfig &config)
|
||||
{
|
||||
switch (config.levelOfDetail)
|
||||
{
|
||||
case AbstractChartModel::ChartLevelOfDetail::LOW:
|
||||
return {QBrush(QRgb(0x43b0e0)),
|
||||
QBrush(QRgb(0x999999)),
|
||||
};
|
||||
case AbstractChartModel::ChartLevelOfDetail::HIGH:
|
||||
return {QBrush(QRgb(0x43B0E0)),
|
||||
QBrush(QRgb(0x53D7C8)),
|
||||
QBrush(QRgb(0x61CE95)),
|
||||
QBrush(QRgb(0x6EC574)),
|
||||
QBrush(QRgb(0x91BC7A)),
|
||||
QBrush(QRgb(0xA8B384)),
|
||||
QBrush(QRgb(0xAAA58C)),
|
||||
QBrush(QRgb(0xA19993)),
|
||||
QBrush(QRgb(0x999999)),
|
||||
};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
KDChart::Chart *ReportDialog::createNewChart(const AbstractChartModel::ChartConfig &config, const QPen &linePen, bool hasToCreateLegend, const QString &header)
|
||||
{
|
||||
using namespace KDChart;
|
||||
|
||||
Chart *result = new Chart(this); // with parent, we add it to layout and paint directly
|
||||
AbstractDiagram *diagram = nullptr;
|
||||
AbstractCoordinatePlane *coordinatePlane = nullptr;
|
||||
|
||||
switch (config.type)
|
||||
{
|
||||
case AbstractChartModel::ChartType::BAR:
|
||||
{
|
||||
BarDiagram *bar = new BarDiagram(result);
|
||||
ThreeDBarAttributes attr3d = bar->threeDBarAttributes();
|
||||
CartesianCoordinatePlane *cartesianCoordinatePlane = new CartesianCoordinatePlane(result);
|
||||
|
||||
attr3d.setEnabled(true);
|
||||
|
||||
bar->setThreeDBarAttributes(attr3d);
|
||||
|
||||
cartesianCoordinatePlane->setVerticalRange(QPair<qreal, qreal>(0, config.participantIds.size() + 1));
|
||||
|
||||
coordinatePlane = cartesianCoordinatePlane;
|
||||
diagram = bar;
|
||||
break;
|
||||
}
|
||||
case AbstractChartModel::ChartType::PIE:
|
||||
{
|
||||
PieDiagram *pie = new PieDiagram(result);
|
||||
ThreeDPieAttributes attr3d = pie->threeDPieAttributes();
|
||||
coordinatePlane = new PolarCoordinatePlane(result);
|
||||
|
||||
attr3d.setEnabled(true);
|
||||
|
||||
pie->setThreeDPieAttributes(attr3d);
|
||||
|
||||
diagram = pie;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!diagram)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Got unkown chart type. Aborting.";
|
||||
return result;
|
||||
}
|
||||
|
||||
result->replaceCoordinatePlane(coordinatePlane);
|
||||
|
||||
const QVector<QBrush> brushVec = brushes(config);
|
||||
for (int index = 0; index < brushVec.size(); ++index)
|
||||
diagram->setBrush(index, brushVec.at(index));
|
||||
|
||||
diagram->setPen(linePen);
|
||||
diagram->setModel(AbstractChartModel::create(config, diagram));
|
||||
|
||||
result->setGlobalLeading(5, 5, 5, 5);
|
||||
|
||||
if (!header.isEmpty())
|
||||
{
|
||||
HeaderFooter *headerFooter = new HeaderFooter(result);
|
||||
|
||||
headerFooter->setText(header);
|
||||
headerFooter->setType(HeaderFooter::Header);
|
||||
|
||||
result->addHeaderFooter(headerFooter);
|
||||
}
|
||||
|
||||
if (hasToCreateLegend)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
Legend *legend = new Legend(diagram, this);
|
||||
layout->addWidget(legend);
|
||||
layout->setAlignment(legend, Qt::AlignCenter);
|
||||
|
||||
m_ui->verticalLayout->addLayout(layout);
|
||||
}
|
||||
|
||||
FrameAttributes frameAttributes = result->frameAttributes();
|
||||
|
||||
frameAttributes.setVisible(true);
|
||||
|
||||
result->setFrameAttributes(frameAttributes);
|
||||
|
||||
diagram->setAntiAliasing(true);
|
||||
|
||||
KDChart::DataValueAttributes a(diagram->dataValueAttributes());
|
||||
KDChart::TextAttributes ta(a.textAttributes());
|
||||
ta.setRotation(0);
|
||||
ta.setPen(QPen(Qt::black));
|
||||
ta.setVisible(true);
|
||||
a.setTextAttributes(ta);
|
||||
a.setShowOverlappingDataLabels(true);
|
||||
a.setShowRepetitiveDataLabels(true);
|
||||
a.setVisible(true);
|
||||
diagram->setDataValueAttributes(a);
|
||||
|
||||
result->coordinatePlane()->replaceDiagram(diagram);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace OnlineReports
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Dialog which shows a single online report
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-28
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
#include "Charts/ore_abstract_chart_model.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ReportDialog;
|
||||
}
|
||||
|
||||
namespace KDChart
|
||||
{
|
||||
class Chart;
|
||||
class AbstractDiagram;
|
||||
class Legend;
|
||||
}
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
class ReportDialog : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReportDialog(const AbstractChartModel::ChartConfig &config, QWidget *parent = nullptr);
|
||||
~ReportDialog();
|
||||
|
||||
Q_SIGNALS:
|
||||
void removeName(const QString &name);
|
||||
|
||||
private: // methods
|
||||
void retranslate() override;
|
||||
static QVector<QBrush> brushes(const AbstractChartModel::ChartConfig &config);
|
||||
KDChart::Chart *createNewChart(const AbstractChartModel::ChartConfig &config, const QPen &linePen, bool hasToCreateLegend, const QString &header = QString());
|
||||
KDChart::Legend *createLegend(const KDChart::AbstractDiagram &diagram);
|
||||
|
||||
private: // attributes
|
||||
Ui::ReportDialog *m_ui;
|
||||
QString m_name;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace OnlineReports
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReportDialog</class>
|
||||
<widget class="QWidget" name="ReportDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>883</width>
|
||||
<height>716</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Messaging View</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Model to manage type related data from ParticipantManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-02
|
||||
*/
|
||||
|
||||
#include "ore_type_model.h"
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
TypeModel::TypeModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc, QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<ParticipantManagement::Type>({tr("Type Class"),
|
||||
tr("Name")},
|
||||
parent)
|
||||
, m_ppmDtc(ppmDtc)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("OnlineReportTypeModel"))
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
bool TypeModel::init()
|
||||
{
|
||||
m_ppmDtc->types([this](const ParticipantManagement::Type &type)
|
||||
{
|
||||
if (m_ppmDtc->isTypeInUse(type.id()))
|
||||
insertRow(type);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int TypeModel::getTypeId(const QModelIndex &index) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return -1;
|
||||
return m_vecData.at(index.row()).id();
|
||||
}
|
||||
|
||||
QVariant TypeModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const ParticipantManagement::Type &entry = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case 0:
|
||||
return ParticipantManagement::toString(entry.typeClass());
|
||||
case 1:
|
||||
return QString::fromStdString(entry.name());
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool TypeModel::isFiltered(const ParticipantManagement::Type &data, DataModification modType) const
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
return (data.typeClass() == ParticipantManagement::TypeClass::Unit ||
|
||||
data.typeClass() == ParticipantManagement::TypeClass::SupportUnit);
|
||||
}
|
||||
|
||||
} // namespace OnlineReports
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Model to manage type related data from ParticipantManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-03-02
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
class TypeModel final : public LtsWidgets::LtsAbstractTableModel<ParticipantManagement::Type>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TypeModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc, QObject *parent = nullptr);
|
||||
|
||||
bool init();
|
||||
int getTypeId(const QModelIndex &index) const;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
protected:
|
||||
bool isFiltered(const ParticipantManagement::Type &data, DataModification modType) const override;
|
||||
private:
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace OnlineReports
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui plugin for online reports
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2017-02-24
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace OnlineReports
|
||||
{
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
}; // class ForeignGuiInterface
|
||||
|
||||
} // namespace OnlineReports
|
||||
Reference in new issue
Block a user