/** *@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 #include namespace AreaEffectSimulation { std::shared_ptr GuiPlugin::createGuiInterface(LtsSession::LtsSession *session) { return std::make_shared(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(m_dtc)) return false; if (!m_session->getFtc(m_ftc)) return false; if (!m_session->getDtc(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 InterfaceImpl::getActions() { return {}; } // end of getActions() //----------------------------------------------------------------------------- void InterfaceImpl::showInfoWindow(const QVector &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 &dangerAreaIds, const QSet &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