110 lines
3.4 KiB
C++
Executable File
110 lines
3.4 KiB
C++
Executable File
/**
|
|
*@RDE_HEADER@
|
|
* Gui Plugin for AreaEffectSimulation - Info
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by hjl, SLSE, 2017-03-22
|
|
*/
|
|
|
|
#include "aes_info_gui_plugin.h"
|
|
#include "aes_info_dialog.h"
|
|
#include "aes_danger_area_aes_item_info.h"
|
|
#include "aes_charge_effect_item_info.h"
|
|
|
|
#include <LtsSession/lts_session.h>
|
|
|
|
#include <AreaEffectSimulation/logger.h>
|
|
|
|
namespace AreaEffectSimulation
|
|
{
|
|
|
|
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
|
{
|
|
return std::make_shared<InterfaceImpl>(session);
|
|
} // end of createGuiInterface()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
|
: GuiPluginBase::Interface(session, getLogger("AESInfo"))
|
|
, m_dtc(nullptr)
|
|
, m_pdmDtc(nullptr)
|
|
{} // end of ctor()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
bool InterfaceImpl::fetchInterfaces()
|
|
{
|
|
if (!m_session->getDtc<AreaEffectSimulation::DataInterface>(m_dtc))
|
|
return false;
|
|
if (!m_session->getFtc<AreaEffectSimulation::DataInterface>(m_ftc))
|
|
return false;
|
|
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(m_pdmDtc))
|
|
return false;
|
|
return true;
|
|
} // end of fetchInterfaces()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void InterfaceImpl::clearInterfaces()
|
|
{
|
|
m_pdmDtc = nullptr;
|
|
m_dtc = nullptr;
|
|
m_ftc = nullptr;
|
|
} // end of clearInterfaces()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QString InterfaceImpl::menuGroup() const
|
|
{
|
|
return QStringLiteral("AES Info");
|
|
} // end of menuGroup()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
|
{
|
|
return {};
|
|
} // end of getActions()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void InterfaceImpl::showInfoWindow(const QVector<int> &aesEntityIds, AreaEffectSimulation::AesType aesType)
|
|
{
|
|
for (auto id : aesEntityIds)
|
|
this->showInfoWindow(id, aesType);
|
|
}
|
|
|
|
void InterfaceImpl::showInfoWindow(int aesEntityId, AesType aesType)
|
|
{
|
|
DEBUG_LOG(m_logger) << "ShowInfoWindow() "
|
|
<< " aesEntityId: " << aesEntityId;
|
|
|
|
AesInfoDialog *dialog = new AesInfoDialog(aesEntityId, aesType);
|
|
if (!dialog->init(m_session, m_dtc, m_ftc, m_pdmDtc))
|
|
{
|
|
delete dialog;
|
|
return;
|
|
}
|
|
|
|
m_session->addWidget(dialog, menuGroup(), QStringLiteral("AesInfo%1").arg(aesEntityId), LtsWidgets::LayoutArea::eInfoTab);
|
|
} // end of showInfoWindow()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
LtsWidgets::LtsDialog* InterfaceImpl::showDangerAreaAesItemInfo(const QSet<int> &dangerAreaIds, const QSet<int> &aesItemIds)
|
|
{
|
|
return LtsWidgets::initDialog(new DangerAreaAesItemInfo,
|
|
dangerAreaIds, aesItemIds, m_session);
|
|
}// end of showDangerAreaAesItemInfo()
|
|
|
|
void InterfaceImpl::showChargeEffectInfoWindow(int chargeEffectId)
|
|
{
|
|
AesChargeEffectItemInfo *dialog = new AesChargeEffectItemInfo(chargeEffectId);
|
|
if (!dialog->init(m_session))
|
|
{
|
|
delete dialog;
|
|
return;
|
|
}
|
|
m_session->addWidget(dialog, menuGroup(), QStringLiteral("AesInfo%1").arg(chargeEffectId), LtsWidgets::LayoutArea::eInfoTab);
|
|
|
|
} // end of showChargeEffectInfoWindow
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
} // namespace AreaEffectSimulation
|