/** * @RDE_HEADER@ * GUI Plugin for ParticipantManagement - Participant Edit * $Id$ * $HeadURL$ * $Author$ * Created by Patric Karwat, SLSE, 2016-10-17 */ #include "participant_show.h" #include "ui_participant_show.h" #include <../Common/participant_edit_model.h> #include <../Common/participant_edit_item.h> #include <../Common/participant_tree_edit_handler.h> #include #include namespace ParticipantManagement { ParticipantShow::ParticipantShow(LtsSession::LtsSession *session, bool asSupportService, QWidget *parent) : LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly) , m_asSupportService(asSupportService) , m_pTreehandler(nullptr) , m_dtc(nullptr) , m_ftc(nullptr) , m_session(session) , m_model(nullptr) , m_ui(new Ui::ParticipantShow) , m_logger(getLogger("ParticipantShow")) { m_ui->setupUi(this); m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ParticipantShow::onPrint); setOnlineHelpFilename(QStringLiteral("Situation-Operational_Planing")); } ParticipantShow::~ParticipantShow() { delete m_pTreehandler; delete m_ui; } void ParticipantShow::retranslate() { translate(m_ui, tr("Operational Planning - Party: %1").arg(m_nameParty)); } bool ParticipantShow::init(const std::shared_ptr &dtc, const std::shared_ptr &ftc, const std::shared_ptr &asbIfc, const int partyId, const QString &nameParty) { if (!dtc || !ftc) return false; m_dtc = dtc; m_ftc = ftc; m_partyId = partyId; m_nameParty = nameParty; m_model = new ParticipantPlanningModel(this, m_dtc, asbIfc); connect(m_model, &ParticipantPlanningModel::internalDataChanged, this, &ParticipantShow::slotChangesMade); m_ui->treeViewEdit->setModel(m_model); m_ui->treeViewEdit->expandAll(); m_ui->treeViewEdit->setContextMenuPolicy(Qt::CustomContextMenu); m_ui->treeViewEdit->moveSection(8, 1); m_pTreehandler = new ParticipantTreeEditHandler(m_ui->treeViewEdit, m_dtc, m_ftc, m_asSupportService); onPartyChanged(); return true; } void ParticipantShow::onPartyChanged() { if (hasUnsavedChanges()) { switch (askApplyDiscardCancel()) { case LtsWidgets::Button::Cancel: { return; } case LtsWidgets::Button::Discard: __unchange__(); // can't call resetChanges() by myself :( break; default: break; } } m_pTreehandler->partyHasChanged(m_partyId); } void ParticipantShow::onPrint() { LtsPrinting::printView(m_session, this, m_ui->treeViewEdit->treeView() ); } } //namespace ParticipantManagement