Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2018-01-17
|
||||
#
|
||||
|
||||
SET(osc_system_gui_SRCS
|
||||
osc_system_gui_plugin.cpp
|
||||
osc_system_gui_plugin.h
|
||||
osc_selftest.cpp
|
||||
osc_selftest.h
|
||||
osc_settings.cpp
|
||||
osc_settings.h
|
||||
osc_close_aes_list.cpp
|
||||
osc_close_aes_list.h
|
||||
osc_close_aes_list_model.cpp
|
||||
osc_close_aes_list_model.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(osc_system_gui_SRCS
|
||||
osc_selftest.ui
|
||||
osc_settings.ui
|
||||
osc_close_aes_list.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS OscSystemGuiPlugin MODULE ${osc_system_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(OscSystemGuiPlugin
|
||||
LtsPrinting
|
||||
NGLLogger
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
LtsCoordTrans
|
||||
LtsDataView
|
||||
LtsNotification
|
||||
OscGuiPluginInterface
|
||||
svcOscClient
|
||||
TabocDataPluginInterface
|
||||
EscDataPluginInterface
|
||||
AesDataPluginInterface
|
||||
PdmDataPluginInterface
|
||||
PpmDataPluginInterface
|
||||
LtsWidgets
|
||||
LtsUtilsSettings
|
||||
LtsUtilsGuiDds
|
||||
Qt5::Widgets
|
||||
Qt5::Multimedia
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(OscSystemGuiPlugin)
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Observer Controller - CloseAesList Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2018-01-17
|
||||
*/
|
||||
|
||||
#include "osc_close_aes_list.h"
|
||||
#include "ui_osc_close_aes_list.h"
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
CloseAesList::CloseAesList(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_model(new AesListModel(session, this))
|
||||
, m_ui(new Ui::CloseAesList)
|
||||
, m_logger(getLogger("CloseAesList"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->aesList->setModel(m_model);
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->aesList->hideColumn(AesListModel::Columns::Id);
|
||||
#endif
|
||||
connect(this, &CloseAesList::updateAesList, m_model, &AesListModel::initModel);
|
||||
setOnlineHelpFilename(QStringLiteral("OC-AesList"));
|
||||
}
|
||||
|
||||
CloseAesList::~CloseAesList()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CloseAesList::setCloseAes(const QSet<int> &aesList)
|
||||
{
|
||||
m_model->initModel(aesList);
|
||||
}
|
||||
|
||||
|
||||
void CloseAesList::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("AES List") );
|
||||
}
|
||||
|
||||
} // namespace OcSituationClient
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Observer Controller - CloseAesList Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2018-01-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <OcSituationClient/logger.h>
|
||||
|
||||
#include <osc_close_aes_list_model.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CloseAesList;
|
||||
}
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
class CloseAesList : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CloseAesList(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~CloseAesList();
|
||||
void setCloseAes(const QSet<int> &aesList);
|
||||
|
||||
Q_SIGNALS:
|
||||
void updateAesList(const QSet<int> &newList);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
private:
|
||||
AesListModel *m_model;
|
||||
|
||||
Ui::CloseAesList *m_ui;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace OcSituationClient
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CloseAesList</class>
|
||||
<widget class="QWidget" name="CloseAesList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>517</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">MessagingView</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="LtsDataView::LtsDataView" name="aesList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsDataView::LtsDataView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsDataView/lts_data_view.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../Styles/Dark/resources/rme_dark_style.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "osc_close_aes_list_model.h"
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
|
||||
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
AesListModel::AesListModel(LtsSession::LtsSession *session, QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<int>(
|
||||
{ tr("Id"),
|
||||
tr("Name"),
|
||||
tr("Type"),
|
||||
tr("Party")
|
||||
}
|
||||
, parent)
|
||||
, m_session(session)
|
||||
, m_logger(getLogger("AesListModel"))
|
||||
{
|
||||
|
||||
m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc);
|
||||
m_session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc);
|
||||
m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc);
|
||||
|
||||
}
|
||||
|
||||
bool AesListModel::initModel(const QSet<int> &viewList)
|
||||
{
|
||||
beginResetModel();
|
||||
m_vecData.clear();
|
||||
endResetModel();
|
||||
|
||||
if (viewList.isEmpty())
|
||||
return true;
|
||||
|
||||
beginInsertRows(QModelIndex(), 0, viewList.size() - 1);
|
||||
for (int i : viewList)
|
||||
m_vecData.push_back(i);
|
||||
endInsertRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant AesListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index) || role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
// Display Role only!
|
||||
|
||||
const AreaEffectSimulation::AesItemView &view = m_aesDtc.get()->aesItemView(m_vecData.at(index.row()));
|
||||
if (view.id() == 0)
|
||||
return QVariant();
|
||||
|
||||
AreaEffectSimulation::AesItem aesItem;
|
||||
m_aesDtc->aesItemFromId(view.aesItemId(), aesItem);
|
||||
if (aesItem.id() < 0)
|
||||
return QVariant();
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Columns::Id:
|
||||
return aesItem.id();
|
||||
case Columns::Name:
|
||||
return QString::fromStdString(aesItem.name());
|
||||
case Columns::AesType:
|
||||
return m_pdmDtc->trChargeTypeShortName(aesItem.chargeStruct().chargeTypeId(), true);
|
||||
case Columns::Party:
|
||||
return aesItem.partyId().is_set() ? ParticipantManagement::trPartyName(m_ppmDtc->party(aesItem.partyId().get()).name()) : QObject::tr("---");
|
||||
default:
|
||||
return QVariant();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace OcSituationClient
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
|
||||
#include <OcSituationClient/logger.h>
|
||||
|
||||
#include <QSet>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
namespace OcSituationClient
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// AesListModel
|
||||
// --------------------------------------------------------
|
||||
class AesListModel final : public LtsWidgets::LtsAbstractTableModel<int>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
Name,
|
||||
AesType,
|
||||
Party
|
||||
};
|
||||
|
||||
explicit AesListModel(LtsSession::LtsSession *session, QObject *parent = nullptr);
|
||||
|
||||
bool initModel(const QSet<int> &viewList);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override;
|
||||
|
||||
private:
|
||||
LtsSession::LtsSession *m_session;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} //namespace OcSituationClient
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Observer Controller - SelfTest Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2018-01-17
|
||||
*/
|
||||
|
||||
#include "osc_selftest.h"
|
||||
#include "ui_osc_selftest.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QStorageInfo>
|
||||
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
SelfTest::SelfTest(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_timer(nullptr)
|
||||
, m_lastStatesTime(0)
|
||||
, m_session(session)
|
||||
, m_tabocDtc(nullptr)
|
||||
, m_escDtc(nullptr)
|
||||
, m_ui(new Ui::SelfTest)
|
||||
, m_logger(getLogger("SelfTestDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
if ( m_session->getDtc<TrainingAreaBaseOC::DataInterface>(m_tabocDtc))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "load tab settings";
|
||||
connect(m_tabocDtc.get(), &TrainingAreaBaseOC::Interface::Dtc::technicalStateSfmChanged,
|
||||
this, &SelfTest::onSfmStatusChanged);
|
||||
|
||||
onSfmStatusChanged(m_tabocDtc->technicalStateSfm(1), DataModification());
|
||||
}
|
||||
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
const bool enableEffectShowManagement = ps->value(QStringLiteral("esm"), QStringLiteral("enableEffectShowManagement")).toBool();
|
||||
if (!enableEffectShowManagement)
|
||||
{
|
||||
m_ui->lblEsc->hide();
|
||||
m_ui->leEsc->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer = new QTimer(this);
|
||||
if ( m_escDtc.get() != nullptr) {
|
||||
connect(m_escDtc.get(), &EffectShowClient::Interface::Dtc::operatingConditionEntityChanged, this, &SelfTest::onEscOperationConditionChanged);
|
||||
onEscOperationConditionChanged(m_escDtc->operatingConditionEntity(), DataModification());
|
||||
connect(m_timer, &QTimer::timeout, this, &SelfTest::onCheckLastCondition);
|
||||
m_timer->start(3000);
|
||||
}
|
||||
}
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("OC-Self_Test"));
|
||||
|
||||
} // end of ctor()
|
||||
|
||||
void SelfTest::onCheckLastCondition()
|
||||
{
|
||||
if ((m_session->partitionTime() - 10*1000) > m_lastStatesTime )
|
||||
{
|
||||
m_ui->leEsc->setText(tr("No Effect Show Connected"));
|
||||
}
|
||||
}
|
||||
|
||||
SelfTest::~SelfTest()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void SelfTest::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Self Test") );
|
||||
}
|
||||
|
||||
QString SelfTest::getTechStatError(u_char errorID) const
|
||||
{
|
||||
switch (errorID)
|
||||
{
|
||||
case 1:
|
||||
return tr("Error ROM");
|
||||
case 2:
|
||||
return tr("Error RAM");
|
||||
case 3:
|
||||
return tr("Error SCC1");
|
||||
case 4:
|
||||
return tr("Error SCC2");
|
||||
case 5:
|
||||
return tr("Error SCP");
|
||||
case 10:
|
||||
return tr("Error EEPROM");
|
||||
case 11:
|
||||
return tr("Error A/D-Converter");
|
||||
case 12:
|
||||
return tr("Error CAN");
|
||||
case 13:
|
||||
return tr("Error DUART A");
|
||||
case 14:
|
||||
return tr("Error DUART B");
|
||||
case 20:
|
||||
return tr("Error GPS");
|
||||
case 21:
|
||||
return tr("Error PUMA/T");
|
||||
case 30:
|
||||
return tr("Error Equipment Configuration");
|
||||
case 31:
|
||||
return tr("Error Exercise Configuration");
|
||||
case 40:
|
||||
return tr("Error Login");
|
||||
case 41:
|
||||
return tr("Error TETRA Registration");
|
||||
case 42:
|
||||
return tr("Error Transparent Channel O/C");
|
||||
case 43:
|
||||
return tr("Error Transparent Channel DMF");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tr("Unknown Error (%1)").arg(errorID);
|
||||
}
|
||||
|
||||
void SelfTest::onStatusHDD()
|
||||
{
|
||||
QStorageInfo storage(QCoreApplication::applicationFilePath());
|
||||
if (storage.isValid() && storage.isReady())
|
||||
{
|
||||
quint64 freeBytesAvailable = storage.bytesAvailable();
|
||||
quint64 bytesAvailable = storage.bytesTotal();
|
||||
|
||||
double percent = bytesAvailable ? 100.0 * freeBytesAvailable / bytesAvailable : 0;
|
||||
|
||||
m_ui->leDisk->setText(tr("%1% available (%2)").arg(QString::number(percent, 'f', 2), readableSize(freeBytesAvailable)));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->leDisk->setText(tr("Error reading available disk space"));
|
||||
}
|
||||
}
|
||||
|
||||
void SelfTest::onSfmStatusChanged(const TrainingAreaBaseOC::TechnicalStateSfm &data, DataModification modType)
|
||||
{
|
||||
|
||||
Q_UNUSED(modType)
|
||||
m_ui->leRadio->setText(data.radioAvailable() ? tr("Available") : tr("Not Available"));
|
||||
m_ui->leLicense->setText(data.licensed() ? tr("Yes") : tr("No"));
|
||||
m_ui->leSfm->setText(data.sfmConnected() ? tr("Connected") : tr("Not Connected"));
|
||||
m_ui->leSfmMani->setText(data.manipulationSfm() ? tr("Yes") : tr("No"));
|
||||
m_ui->leEquipmentMani->setText(data.manipulationEquipment() ? tr("Yes") : tr("No"));
|
||||
m_ui->lblErrorCodes->setText(data.errorCode() > 0 ? getTechStatError(data.errorCode()) : QLatin1String(""));
|
||||
onStatusHDD();
|
||||
|
||||
}
|
||||
|
||||
void SelfTest::onEscOperationConditionChanged(const EffectShowClient::OperatingConditionEntity &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType)
|
||||
|
||||
QString feature = tr("Effect Show Connected: ");
|
||||
switch (data.vehicleFeature().underlying())
|
||||
{
|
||||
case EffectShowManagement::Feature_e::Smoke:
|
||||
feature += tr("Smoke");
|
||||
break;
|
||||
case EffectShowManagement::Feature_e::Explosion24:
|
||||
feature += tr("Explosion (24)");
|
||||
break;
|
||||
case EffectShowManagement::Feature_e::Explosion48:
|
||||
feature += tr("Explosion (48)");
|
||||
break;
|
||||
case EffectShowManagement::Feature_e::NotSpecified:
|
||||
feature.clear();
|
||||
break;
|
||||
}
|
||||
|
||||
if (feature.isEmpty())
|
||||
m_ui->leEsc->setText(tr("No Effect Show Connected"));
|
||||
else
|
||||
m_ui->leEsc->setText(feature);
|
||||
|
||||
m_lastStatesTime = m_session->partitionTime();
|
||||
}
|
||||
|
||||
|
||||
QString SelfTest::readableSize(quint64 bytes) const
|
||||
{
|
||||
if (bytes > TB)
|
||||
return tr("%1 TB").arg((double) bytes / TB, 0, 'f', 2);
|
||||
else if (bytes > GB)
|
||||
return tr("%1 GB").arg((double) bytes / GB, 0, 'f', 2);
|
||||
else if (bytes > MB)
|
||||
return tr("%1 MB").arg((double) bytes / MB, 0, 'f', 2);
|
||||
else if (bytes > KB)
|
||||
return tr("%1 KB").arg((double) bytes / KB, 0, 'f', 2);
|
||||
else
|
||||
return tr("%1 Bytes").arg(bytes);
|
||||
}
|
||||
|
||||
|
||||
} // namespace OcSituationClient
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Observer Controller - Selfcheck Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2018-01-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <OcSituationClient/logger.h>
|
||||
#include <TrainingAreaBaseOC/taboc_data_plugin_interface.h>
|
||||
#include <EffectShowClient/esc_data_plugin_interface.h>
|
||||
|
||||
|
||||
class QTimer;
|
||||
namespace Ui
|
||||
{
|
||||
class SelfTest;
|
||||
}
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
class SelfTest : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SelfTest(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~SelfTest();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onStatusHDD();
|
||||
void onSfmStatusChanged(const TrainingAreaBaseOC::TechnicalStateSfm &data, DataModification modType);
|
||||
void onEscOperationConditionChanged(const EffectShowClient::OperatingConditionEntity &data, DataModification modType);
|
||||
void onCheckLastCondition();
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
QString getTechStatError(u_char errorID) const;
|
||||
QString readableSize(const quint64 bytes) const;
|
||||
|
||||
private:
|
||||
|
||||
static const quint64 BYTE = 1;
|
||||
static const quint64 KB = 1024 * BYTE;
|
||||
static const quint64 MB = 1024 * KB;
|
||||
static const quint64 GB = 1024 * MB;
|
||||
static const quint64 TB = 1024 * GB;
|
||||
|
||||
QTimer *m_timer;
|
||||
qint64 m_lastStatesTime;
|
||||
LtsSession::LtsSession *m_session;
|
||||
|
||||
std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> m_tabocDtc;
|
||||
std::shared_ptr<EffectShowClient::Interface::Dtc> m_escDtc;
|
||||
|
||||
Ui::SelfTest *m_ui;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace OcSituationClient
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SelfTest</class>
|
||||
<widget class="QWidget" name="SelfTest">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">MessagingView</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="leSfmMani">
|
||||
<property name="toolTip">
|
||||
<string>Manipulation Sfm</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="leLicense">
|
||||
<property name="toolTip">
|
||||
<string>Radio License</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Manipulation Equipment:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Sfm Connection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Disk Space:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leSfm">
|
||||
<property name="toolTip">
|
||||
<string>Sfm Connection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Radio Connection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="leRadio">
|
||||
<property name="toolTip">
|
||||
<string>Radio Connection</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="leEquipmentMani">
|
||||
<property name="toolTip">
|
||||
<string>Manipulation Equipment</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lblErrorCodes">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Manipulation Sfm:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Radio License:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="leDisk">
|
||||
<property name="toolTip">
|
||||
<string>Disk Space</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblEsc">
|
||||
<property name="text">
|
||||
<string>Effect Show Connection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leEsc">
|
||||
<property name="toolTip">
|
||||
<string>Effect Show Connection</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Observer Controller - Settings Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2018-01-17
|
||||
*/
|
||||
|
||||
#include "osc_settings.h"
|
||||
#include "ui_osc_settings.h"
|
||||
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <QDebug>
|
||||
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
Settings::Settings(LtsSession::LtsSession *session, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_mediaplayer(new QMediaPlayer(this))
|
||||
, m_ocGroupString(QStringLiteral("ObserverController"))
|
||||
, m_opSettings(LtsUtils::OperatorSettings::getInstance())
|
||||
, m_ui(new Ui::Settings)
|
||||
// , m_logger(getLogger("SettingsDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
//optional
|
||||
session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc);
|
||||
|
||||
//connects
|
||||
connect(m_ui->pbSoundCheck, &LtsWidgets::LtsDragIcon::clicked, this, &Settings::onSoundCheck);
|
||||
connect(m_ui->pbResetRange, &LtsWidgets::LtsDragIcon::clicked, this, &Settings::onResetRange);
|
||||
connect(m_ui->slWarningRange, &QSlider::valueChanged, this, [this](int range)
|
||||
{
|
||||
m_ui->lblRange->setText(QString::number(range));
|
||||
});
|
||||
|
||||
#ifdef WIN32
|
||||
m_handler = CreateFile(L"\\\\.\\LCD",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0, NULL);
|
||||
m_monitorLightBrightness = getMonitorCurrentLightBrightness();
|
||||
connect(m_ui->slMonitorBrightness, &QSlider::valueChanged, this, [this](int range)
|
||||
{
|
||||
m_ui->lblMonitorBrightness->setText(QString::number(range));
|
||||
setMonitorLightBrightness(range);
|
||||
});
|
||||
if(m_monitorLightBrightness >= 0)
|
||||
{
|
||||
m_ui->slMonitorBrightness->setValue(m_monitorLightBrightness);
|
||||
}
|
||||
m_ui->lblMonitorBrightness->setText(QString::number(m_ui->slMonitorBrightness->value()));
|
||||
|
||||
connect(m_buttonBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
//reset to old Value
|
||||
setMonitorLightBrightness(m_monitorLightBrightness);
|
||||
});
|
||||
#else
|
||||
m_ui->slMonitorBrightness->hide();
|
||||
m_ui->lblMonitorBrightness->hide();
|
||||
m_ui->LblMonitorBrightness->hide();
|
||||
#endif
|
||||
|
||||
connect(m_ui->cbxAcusticWarning, &LtsWidgets::LtsDragIcon::clicked, this, &Settings::slotChangesMade);
|
||||
connect(m_ui->cbxVisualWarning, &LtsWidgets::LtsDragIcon::clicked, this, &Settings::slotChangesMade);
|
||||
connect(m_ui->cbxOcSituationBorder, &LtsWidgets::LtsDragIcon::clicked, this, &Settings::slotChangesMade);
|
||||
connect(m_ui->cbxMovingMapToSelf, &LtsWidgets::LtsDragIcon::clicked, this, &Settings::slotChangesMade);
|
||||
//load OperatorSettings and set Ui Values
|
||||
loadOperatorSettings();
|
||||
|
||||
//set audio file
|
||||
m_mediaplayer->setMedia(QUrl(QLatin1String("qrc:/beep.wav")));
|
||||
m_mediaplayer->setVolume(100);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("OC-Settings"));
|
||||
}
|
||||
|
||||
Settings::~Settings()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
/*!
|
||||
* \brief Settings::setMonitorLightBrightness
|
||||
* this method set the light brightness of an windows os monitor
|
||||
* \warning this funcion work only for windows os
|
||||
* \param value
|
||||
*/
|
||||
void Settings::setMonitorLightBrightness(const int value)
|
||||
{
|
||||
#ifdef WIN32
|
||||
m_displayBrightness.ucDisplayPolicy = 0;
|
||||
m_displayBrightness.ucACBrightness = 0;
|
||||
m_displayBrightness.ucDCBrightness = value;
|
||||
DWORD ret = 0;
|
||||
DWORD nOutBufferSize = sizeof(m_displayBrightness);
|
||||
if(m_handler == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
m_handler = CreateFile(L"\\\\.\\LCD",
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
NULL);
|
||||
if(m_handler == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
qCritical()<<" couldn't CreateFile for setting monitor light brightness. Error: "<<GetLastError();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!DeviceIoControl(m_handler,
|
||||
IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS,
|
||||
(DISPLAY_BRIGHTNESS*)&m_displayBrightness,
|
||||
nOutBufferSize,
|
||||
NULL,
|
||||
0,
|
||||
&ret,
|
||||
NULL))
|
||||
{
|
||||
qCritical()<<" couldn't set monitor light brightness. Error: "<<GetLastError();
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(value)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Settings::getMonitorCurrentLightBrightness
|
||||
* get on win os monitor light brightness
|
||||
* \warning this funcion work only for windows os
|
||||
* \return
|
||||
*/
|
||||
int Settings::getMonitorCurrentLightBrightness()
|
||||
{
|
||||
#ifdef WIN32
|
||||
DWORD ret;
|
||||
int nRes = DeviceIoControl(
|
||||
m_handler, // handle to device
|
||||
IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS , // dwIoControlCode
|
||||
NULL, // lpInBuffer
|
||||
0, // nInBufferSize
|
||||
(DISPLAY_BRIGHTNESS*)&m_displayBrightness, // output buffer
|
||||
sizeof(m_displayBrightness), // size of output buffer
|
||||
(LPDWORD) &ret, // bytes returned
|
||||
NULL // OVERLAPPED
|
||||
);
|
||||
if(nRes !=0)
|
||||
{
|
||||
const int l = m_displayBrightness.ucDCBrightness;
|
||||
return l;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Settings::onResetRange()
|
||||
{
|
||||
m_ui->slWarningRange->setValue(WARNINGRANGEDEFAULT);
|
||||
}
|
||||
|
||||
void Settings::onSoundCheck()
|
||||
{
|
||||
m_mediaplayer->play();
|
||||
}
|
||||
|
||||
void Settings::loadOperatorSettings()
|
||||
{
|
||||
// now set values
|
||||
m_ui->slWarningRange->setValue(m_opSettings->value(m_ocGroupString, QStringLiteral("WarningRange"), WARNINGRANGEDEFAULT).toInt());
|
||||
m_ui->cbxAcusticWarning->setChecked(m_opSettings->value(m_ocGroupString, QStringLiteral("AcousticWarning"), false).toBool());
|
||||
m_ui->cbxVisualWarning->setChecked(m_opSettings->value(m_ocGroupString, QStringLiteral("VisualWarning"), false).toBool());
|
||||
m_ui->cbxOcSituationBorder->setChecked(m_opSettings->value(m_ocGroupString, QStringLiteral("OcSituationBorder"), false).toBool());
|
||||
m_ui->cbxMovingMapToSelf->setChecked(m_opSettings->value(m_ocGroupString, QStringLiteral("MovingMapToSelf"), false).toBool());
|
||||
}
|
||||
|
||||
void Settings::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Settings") );
|
||||
}
|
||||
|
||||
bool Settings::apply()
|
||||
{
|
||||
//write qsettings
|
||||
m_opSettings->setValue(m_ocGroupString, QStringLiteral("WarningRange"), m_ui->slWarningRange->value());
|
||||
m_opSettings->setValue(m_ocGroupString, QStringLiteral("AcousticWarning"), m_ui->cbxAcusticWarning->isChecked());
|
||||
m_opSettings->setValue(m_ocGroupString, QStringLiteral("VisualWarning"), m_ui->cbxVisualWarning->isChecked());
|
||||
m_opSettings->setValue(m_ocGroupString, QStringLiteral("OcSituationBorder"), m_ui->cbxOcSituationBorder->isChecked());
|
||||
m_opSettings->setValue(m_ocGroupString, QStringLiteral("MovingMapToSelf"), m_ui->cbxMovingMapToSelf->isChecked());
|
||||
|
||||
m_sitMapGuiIfc->ocSituationRange_show(m_ui->cbxOcSituationBorder->isChecked());
|
||||
|
||||
#ifdef WIN32
|
||||
m_monitorLightBrightness = getMonitorCurrentLightBrightness();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace OcSituationClient
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Observer Controller - Settings Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2018-01-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMediaPlayer>
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <ntddvdeo.h>
|
||||
#endif
|
||||
namespace SituationMap
|
||||
{
|
||||
class ForeignGuiInterface;
|
||||
}
|
||||
|
||||
namespace LtsUtils
|
||||
{
|
||||
class OperatorSettings;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class Settings;
|
||||
}
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
class Settings : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Settings(LtsSession::LtsSession *session, QWidget *parent = nullptr);
|
||||
~Settings();
|
||||
void setMonitorLightBrightness(const int value);
|
||||
int getMonitorCurrentLightBrightness();
|
||||
|
||||
#ifdef WIN32
|
||||
typedef struct _DISPLAY_BRIGHTNESS {
|
||||
UCHAR ucDisplayPolicy;
|
||||
UCHAR ucACBrightness;
|
||||
UCHAR ucDCBrightness;
|
||||
} DISPLAY_BRIGHTNESS, *PDISPLAY_BRIGHTNESS;
|
||||
#endif
|
||||
|
||||
private Q_SLOTS:
|
||||
void onResetRange();
|
||||
void onSoundCheck();
|
||||
private:
|
||||
void loadOperatorSettings();
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
|
||||
private:
|
||||
static const int WARNINGRANGEDEFAULT = 100;
|
||||
QMediaPlayer *m_mediaplayer;
|
||||
QString m_ocGroupString;
|
||||
LtsUtils::OperatorSettings *m_opSettings;
|
||||
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
|
||||
Ui::Settings *m_ui;
|
||||
int m_monitorLightBrightness;
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
DISPLAY_BRIGHTNESS m_displayBrightness;
|
||||
HANDLE m_handler;
|
||||
#endif
|
||||
//LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace OcSituationClient
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Settings</class>
|
||||
<widget class="QWidget" name="Settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>584</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">MessagingView</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="LtsWidgets::LtsDragIcon" name="cbxAcusticWarning" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" stdset="0">
|
||||
<string>Acoustical Warning</string>
|
||||
</property>
|
||||
<property name="isCheckable" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LtsWidgets::LtsDragIcon" name="cbxOcSituationBorder" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" stdset="0">
|
||||
<string>OC-Situation Borderline</string>
|
||||
</property>
|
||||
<property name="isCheckable" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="LtsWidgets::LtsDragIcon" name="pbSoundCheck" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" stdset="0">
|
||||
<string>Sound Check</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="LtsWidgets::LtsDragIcon" name="cbxVisualWarning" native="true">
|
||||
<property name="text" stdset="0">
|
||||
<string>Visual Warning</string>
|
||||
</property>
|
||||
<property name="isCheckable" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="LtsWidgets::LtsDragIcon" name="cbxMovingMapToSelf" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" stdset="0">
|
||||
<string>Moving Map To Self</string>
|
||||
</property>
|
||||
<property name="isCheckable" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Warning Range [m]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblRange">
|
||||
<property name="text">
|
||||
<string notr="true"><RANGE></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>121</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LtsWidgets::LtsDragIcon" name="pbResetRange" native="true">
|
||||
<property name="toolTip">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
<property name="icon" stdset="0">
|
||||
<iconset>
|
||||
<normaloff>:/style/restart.svg</normaloff>:/style/restart.svg</iconset>
|
||||
</property>
|
||||
<property name="eForceFixedSize" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QSlider" name="slWarningRange">
|
||||
<property name="minimum">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="LblMonitorBrightness">
|
||||
<property name="text">
|
||||
<string>Monitor Brightness:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblMonitorBrightness">
|
||||
<property name="text">
|
||||
<string notr="true"><RANGE></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QSlider" name="slMonitorBrightness">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsDragIcon</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>LtsWidgets/lts_drag_icon.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,323 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for ObserverController
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2017-01-14
|
||||
*/
|
||||
|
||||
#include "osc_system_gui_plugin.h"
|
||||
#include "osc_selftest.h"
|
||||
#include "osc_settings.h"
|
||||
#include "osc_close_aes_list.h"
|
||||
|
||||
#include <OcSituationClient/logger.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsNotification/lts_notification.h>
|
||||
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
#include <QNetworkSession>
|
||||
#include <QNetworkConfigurationManager>
|
||||
#include <QNetworkConfiguration>
|
||||
#include <QTimer>
|
||||
#include <QPolygonF>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("System.InterfaceImpl"))
|
||||
, m_closeAreaIdentifier(QStringLiteral("ocrCloseAesList"))
|
||||
{
|
||||
m_enterSound.setVolume(90);
|
||||
m_enterSound.setSource(QUrl(QStringLiteral("qrc:/effectarea-enter.wav")));
|
||||
m_leaveSound.setVolume(90);
|
||||
m_leaveSound.setSource(QUrl(QStringLiteral("qrc:/effectarea-leave.wav")));
|
||||
|
||||
m_nearInSound.setVolume(90);
|
||||
m_nearInSound.setSource(QUrl(QStringLiteral("qrc:/entryNew.wav")));
|
||||
m_nearOutSound.setVolume(90);
|
||||
m_nearOutSound.setSource(QUrl(QStringLiteral("qrc:/leaveNew.wav")));
|
||||
}
|
||||
|
||||
|
||||
InterfaceImpl::~InterfaceImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc;
|
||||
if (!m_session->getDtc<ParticipantManagement::DataInterface>(ppmDtc))
|
||||
return false;
|
||||
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> pdmDtc;
|
||||
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(pdmDtc))
|
||||
return false;
|
||||
|
||||
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_aesDtc))
|
||||
return false;
|
||||
if (!m_session->getDtc<TrainingAreaBaseOC::DataInterface>(m_tabocDtc))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_aesDtc = nullptr;
|
||||
m_tabocDtc = nullptr;
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("System");
|
||||
}
|
||||
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
|
||||
// Action 'SelfTest'
|
||||
plData.menuText = tr("Self Test");
|
||||
plData.identifier = QStringLiteral("ocrSelftest");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:pi_show_bite.svg"));
|
||||
plData.operatorRight = 0;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowSelfTest(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
// Action 'Settings'
|
||||
plData.menuText = tr("Settings");
|
||||
plData.identifier = QStringLiteral("ocrSettings");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:presets.svg"));
|
||||
plData.operatorRight = 0;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowSettings(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
|
||||
// Action 'AES List'
|
||||
plData.menuText = tr("AES List");
|
||||
plData.identifier = m_closeAreaIdentifier;
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:aes_list.svg"));
|
||||
plData.operatorRight = 0;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowCloseAes(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
|
||||
if (m_tabocDtc)
|
||||
{
|
||||
m_tabocDtc->enableAll();
|
||||
|
||||
connect(m_tabocDtc.get(), &TrainingAreaBaseOC::Interface::Dtc::enterLeaveAesChanged, this, &InterfaceImpl::onEnterLeaveAesChanged);
|
||||
if (m_aesDtc)
|
||||
connect(m_tabocDtc.get(), &TrainingAreaBaseOC::Interface::Dtc::ownPositionChanged, this, &InterfaceImpl::onCheckAllEffectAreas);
|
||||
// connect(m_tabocDtc.get(), &TrainingAreaBaseOC::Interface::Dtc::technicalStateSfmChanged,
|
||||
// this, &InterfaceImpl::onEnterLeaveAesChanged);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void InterfaceImpl::onEnterLeaveAesChanged(const TrainingAreaBaseOC::EnterLeaveAes &data, DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
if (LtsUtils::OperatorSettings::getInstance())
|
||||
{
|
||||
bool playSound = LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("ObserverController"), QStringLiteral("AcousticWarning"), false).toBool();
|
||||
if (playSound)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Got new ENterLeave event and play sound";
|
||||
if (data.cAreaType()) //entered/leaved directly
|
||||
{
|
||||
if(data.aesEntered())
|
||||
{
|
||||
m_enterSound.play();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_leaveSound.play();
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "enter leave direvly " << data.aesEntered();
|
||||
}
|
||||
else //not entered but warning range
|
||||
{
|
||||
if (data.aesEntered())
|
||||
{
|
||||
m_nearInSound.play();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nearOutSound.play();
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "enter leave near " << data.aesEntered();
|
||||
}
|
||||
}
|
||||
|
||||
if (data.aesEntered() && LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("ObserverController"), QStringLiteral("VisualWarning"), false).toBool() ) //new one
|
||||
{
|
||||
bool bWidgetExists = m_session->widgetExists(menuGroup(), m_closeAreaIdentifier, LtsWidgets::LayoutArea::eDialogTab);
|
||||
if (!bWidgetExists)
|
||||
m_session->addWidget(onShowCloseAes(), menuGroup(), m_closeAreaIdentifier, LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceImpl::onCheckAllEffectAreas()
|
||||
{
|
||||
if (!m_tabocDtc || !m_aesDtc)
|
||||
return;
|
||||
TrainingAreaBaseOC::OwnPosition pos = m_tabocDtc.get()->ownPosition(1);
|
||||
TrainingAreaBaseOC::EnterLeaveAes elAes;
|
||||
//create radios
|
||||
QPolygonF circle; //5deg steps +1
|
||||
circle.reserve(73);
|
||||
int radius = LtsUtils::OperatorSettings::getInstance()->value(QStringLiteral("ObserverController"), QStringLiteral("WarningRange"), 1).toInt();
|
||||
DEBUG_LOG(m_logger) << "My warning range is:" << radius;
|
||||
for (int i=0; i<360; i+=5)
|
||||
{
|
||||
double angle = i * M_PI / 180.0;
|
||||
circle << QPointF(cos(angle) * radius, sin(angle) * radius);
|
||||
}
|
||||
|
||||
LtsCoordTrans::UtmCoordinate posUtm = LtsCoordTrans::UtmCoordinate::fromGeographic(pos.position().lon(), pos.position().lat());
|
||||
int zone = posUtm.zone;
|
||||
circle << circle.value(0);
|
||||
circle.translate(posUtm.x, posUtm.y);
|
||||
QPolygonF circleLonLat;
|
||||
circleLonLat.reserve(circle.size());
|
||||
for (int i=0; i < circle.size(); i++)
|
||||
{
|
||||
LtsCoordTrans::UtmCoordinate posUtmC(zone, circle.at(i).x(), circle.at(i).y());
|
||||
circleLonLat << posUtmC.geographic();
|
||||
}
|
||||
//now check all areas
|
||||
const QMap<qint32, AreaEffectSimulation::AesItemView> views = m_aesDtc.get()->aesItemViews();
|
||||
DEBUG_LOG(m_logger) << "new position " << posUtm.mgrs();
|
||||
|
||||
for(const AreaEffectSimulation::AesItemView &view: qAsConst(views))
|
||||
{
|
||||
if (view.aesTypeId() == AreaEffectSimulation::AesType::AtExplosionAreaSingleExplosions
|
||||
|| view.aesTypeId() == AreaEffectSimulation::AesType::AtMineAreaSingleMines
|
||||
|| view.aesTypeId() == AreaEffectSimulation::AesType::AtTechnicalArea )
|
||||
continue;
|
||||
bool contains = m_closeAes.contains(view.id());
|
||||
|
||||
if (m_closeAes.contains(view.id()) && view.effectStateId() != AreaEffectSimulation::AesEffectState::EsActivated)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "outdatet " ;
|
||||
|
||||
m_closeAes.remove(view.id());
|
||||
elAes.aesEntered(false);
|
||||
}
|
||||
else if (view.effectStateId() == AreaEffectSimulation::AesEffectState::EsActivated)
|
||||
{
|
||||
//not inside and is active
|
||||
QPolygonF poly(view.form().size());
|
||||
int i=0;
|
||||
for(const auto &point : view.form())
|
||||
{
|
||||
poly[i++] = QPointF(point.lon(), point.lat());
|
||||
}
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
|
||||
bool inters = poly.intersected(circleLonLat).size() > 0;
|
||||
#else
|
||||
bool inters = poly.intersects(circleLonLat);
|
||||
#endif
|
||||
DEBUG_LOG(m_logger) << "active " << view.id() << " intersect=" << inters << " inside map=" << contains ;
|
||||
|
||||
if (inters && contains)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "already inside" ;
|
||||
continue; //already inside
|
||||
}
|
||||
else if (inters && !contains)
|
||||
{
|
||||
// is new
|
||||
DEBUG_LOG(m_logger) << "is new inside" ;
|
||||
|
||||
m_closeAes.insert(view.id());
|
||||
elAes.aesEntered(true);
|
||||
}
|
||||
else if (!inters && contains)
|
||||
{
|
||||
//not inside anymore
|
||||
DEBUG_LOG(m_logger) << "now outside" ;
|
||||
|
||||
m_closeAes.remove(view.id());
|
||||
elAes.aesEntered(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "missed " << view.id() << " ";
|
||||
continue;
|
||||
}
|
||||
|
||||
elAes.aesId(view.aesItemId());
|
||||
elAes.chargeTypeId(view.chargeStruct().chargeTypeId());
|
||||
//now send event
|
||||
|
||||
onEnterLeaveAesChanged(elAes,DataModification::eModified);
|
||||
emit updateAesList(m_closeAes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowSelfTest(QWidget *parent)
|
||||
{
|
||||
SelfTest *dialog = new SelfTest(m_session, parent);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowSettings(QWidget *parent)
|
||||
{
|
||||
Settings *dialog = new Settings(m_session, parent);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowCloseAes(QWidget *parent)
|
||||
{
|
||||
CloseAesList *dialog = new CloseAesList(m_session, parent);
|
||||
connect (this, &InterfaceImpl::updateAesList, dialog, &CloseAesList::updateAesList);
|
||||
emit updateAesList(m_closeAes);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
} // namespace OcSituationClient
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for ObserverController
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2018-01-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
#include <Plugins/OcSituationClient/osc_gui_plugin_interface.h>
|
||||
#include <TrainingAreaBaseOC/taboc_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
|
||||
#include <QSoundEffect>
|
||||
|
||||
class QNetworkSession;
|
||||
namespace LtsNotification
|
||||
{
|
||||
class LtsNotification;
|
||||
}
|
||||
|
||||
namespace OcSituationClient
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:osc.system")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("ObserverController.System"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Global ||
|
||||
partition == IDL::PartitionType::Exercise ||
|
||||
partition == IDL::PartitionType::Replay);
|
||||
}
|
||||
};
|
||||
|
||||
class InterfaceImpl final : public QObject, public ForeignGuiInterface, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
~InterfaceImpl();
|
||||
|
||||
bool fetchInterfaces() override;
|
||||
void clearInterfaces() override;
|
||||
QString menuGroup() const override;
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Global || partition == IDL::PartitionType::Exercise;
|
||||
}
|
||||
|
||||
private slots:
|
||||
//void slotConnectionChanged(const OcSituationClient:: &data, DataModification modType);
|
||||
void onEnterLeaveAesChanged(const TrainingAreaBaseOC::EnterLeaveAes &data, DataModification modType);
|
||||
void onCheckAllEffectAreas();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void updateAesList(const QSet<int> &newList);
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowSelfTest(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowSettings(QWidget *parent);
|
||||
LtsWidgets::LtsDialog *onShowCloseAes(QWidget *parent = nullptr);
|
||||
|
||||
std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> m_tabocDtc;
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
QString m_closeAreaIdentifier;
|
||||
QSet<int> m_closeAes;
|
||||
QSoundEffect m_enterSound;
|
||||
QSoundEffect m_leaveSound;
|
||||
QSoundEffect m_nearInSound;
|
||||
QSoundEffect m_nearOutSound;
|
||||
|
||||
};
|
||||
|
||||
} // namespace OcSituationClient
|
||||
Reference in new issue
Block a user