Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for ParticipantManagement - Name Unit Frameless Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-11-07
|
||||
*/
|
||||
|
||||
#include "participant_unit_namer.h"
|
||||
#include "ui_participant_unit_namer.h"
|
||||
|
||||
#include <LtsSession/lts_session_manager.h>
|
||||
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
ParticipantUnitNamer::ParticipantUnitNamer(const QString &designator, const QString &tactIdent, QWidget *parent)
|
||||
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal)
|
||||
, m_ui(new Ui::ParticipantUnitNamer)
|
||||
, m_validator(new QRegularExpressionValidator(QRegularExpression(QStringLiteral("[^,;\"'´`]*")), this))
|
||||
, m_logger(getLogger("ParticipantTemplateChooser"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->leDesignator->setValidator(m_validator);
|
||||
m_ui->leTactIdentifier->setValidator(m_validator);
|
||||
|
||||
m_ui->leDesignator->setText(designator);
|
||||
m_ui->leTactIdentifier->setText(tactIdent);
|
||||
|
||||
m_ui->ltsDialogButtonBox->getButton(LtsWidgets::DialogButton::Ok)->setVisible(false);
|
||||
m_ui->ltsDialogButtonBox->getButton(LtsWidgets::DialogButton::Apply)->setVisible(false);
|
||||
|
||||
m_ui->ltsDialogButtonBox->connectButton(LtsWidgets::DialogButton::Add, this, &ParticipantUnitNamer::onSetUnitName);
|
||||
m_ui->ltsDialogButtonBox->setText(LtsWidgets::DialogButton::Add, tr("OK")); // TODO: undo workaround !
|
||||
|
||||
// FIXME: HACK: as close is not allowed directly (for a FramelessDialog)
|
||||
connect(m_ui->ltsDialogButtonBox->getButton(LtsWidgets::DialogButton::Close), &QPushButton::clicked, this, &ParticipantUnitNamer::close);
|
||||
}
|
||||
|
||||
ParticipantUnitNamer::~ParticipantUnitNamer()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
//SLOTS
|
||||
|
||||
void ParticipantManagement::ParticipantUnitNamer::onSetUnitName()
|
||||
{
|
||||
if (m_ui->leDesignator->text().isEmpty() || m_ui->leTactIdentifier->text().isEmpty())
|
||||
return;
|
||||
|
||||
emit newUnitNames(m_ui->leDesignator->text(), m_ui->leTactIdentifier->text());
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
} //namespace ParticipantManagement
|
||||
Reference in new issue
Block a user