85 lines
2.3 KiB
C++
Executable File
85 lines
2.3 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* HMI Plugin for Messaging - Messaging Overview Dialog
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Chrsitian Roeskens, NLSE, 2018-05-03
|
|
*/
|
|
|
|
#include "taboc_sfm_messaging_dialog.h"
|
|
#include "ui_taboc_sfm_messaging_dialog.h"
|
|
|
|
#include <LtsNotification/lts_notification.h>
|
|
#include <LtsSession/lts_session_manager.h>
|
|
#include <LtsSession/lts_session_data.h>
|
|
|
|
#include <LtsPrinting/printing.h>
|
|
#include <QTreeView>
|
|
|
|
namespace TrainingAreaBaseOC
|
|
{
|
|
|
|
SfmMessagesDialog::SfmMessagesDialog(QWidget *parent)
|
|
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
|
, m_model(nullptr)
|
|
, m_dtc(nullptr)
|
|
, m_ui(new Ui::SfmMessagesDialog)
|
|
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
|
, m_logger(getLogger("MessagingDialog"))
|
|
{
|
|
m_ui->setupUi(this);
|
|
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &SfmMessagesDialog::onPrint);
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::No, this, &SfmMessagesDialog::onClear);
|
|
m_buttonBox->getButton(LtsWidgets::DialogButton::No)->setText(tr("Clear"));
|
|
|
|
setOnlineHelpFilename(QStringLiteral("OC-TNE_Messages"));
|
|
|
|
} // end of ctor()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
SfmMessagesDialog::~SfmMessagesDialog()
|
|
{
|
|
delete m_ui;
|
|
} // end of dtor()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void SfmMessagesDialog::retranslate()
|
|
{
|
|
translate(m_ui, tr("SFM Messages") );
|
|
}
|
|
|
|
bool SfmMessagesDialog::init(const std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> &dtc, LtsNotification::LtsNotification *notiSfmMsg, qint64 lastClearTime)
|
|
{
|
|
if (!dtc || !notiSfmMsg)
|
|
return false;
|
|
|
|
m_dtc = dtc;
|
|
m_notiSfmMsg = notiSfmMsg;
|
|
|
|
m_notiSfmMsg->setCount(0);
|
|
|
|
m_model = new MessagingModel(this);
|
|
m_model->initModel(m_dtc, lastClearTime);
|
|
m_ui->widget->setModel(m_model);
|
|
m_ui->widget->setSortIndicator(0, Qt::AscendingOrder);
|
|
return true;
|
|
} // end of init()
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void SfmMessagesDialog::onPrint()
|
|
{
|
|
LtsPrinting::printView(m_session, this, m_ui->widget->treeView() );
|
|
}
|
|
|
|
void SfmMessagesDialog::onClear()
|
|
{
|
|
m_model->clearModel();
|
|
emit clearedModel();
|
|
}
|
|
|
|
} // namespace TrainingAreaBaseOC
|