diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index 55eed586d..59b00ac1d 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -465,8 +465,9 @@ const QDomDocument ElementScene::toXml(bool all_parts) root.appendChild(m_element_data.m_names_list.toXml(xml_document)); auto type_ = m_element_data.m_type; - if (type_ == ElementData::Slave || - type_ == ElementData::Master) + if (type_ == ElementData::Slave || + type_ == ElementData::Master || + type_ == ElementData::Terminale) { root.appendChild(m_element_data.kindInfoToXml(xml_document)); } diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index 2d8941b07..23db80ddf 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2006-2021 The QElectroTech Team This file is part of QElectroTech. @@ -98,6 +98,13 @@ void ElementPropertiesEditorWidget::upDateInterface() ui->m_master_type_cb->setCurrentIndex( ui->m_master_type_cb->findData ( m_data.m_master_type)); + } else if (m_data.m_type == ElementData::Terminale) { + ui->m_terminal_type_cb->setCurrentIndex( + ui->m_terminal_type_cb->findData( + m_data.m_terminal_type)); + ui->m_terminal_func_cb->setCurrentIndex( + ui->m_terminal_func_cb->findData( + m_data.m_terminal_function)); } on_m_base_type_cb_currentIndexChanged(ui->m_base_type_cb->currentIndex()); @@ -130,7 +137,18 @@ void ElementPropertiesEditorWidget::setUpInterface() ui->m_master_type_cb->addItem(tr("Bobine"), ElementData::Coil); ui->m_master_type_cb->addItem(tr("Organe de protection"), ElementData::Protection); ui->m_master_type_cb->addItem(tr("Commutateur / bouton"), ElementData::Commutator); - + + //Terminal option + ui->m_terminal_type_cb->addItem(tr("Générique"), ElementData::TTGeneric); + ui->m_terminal_type_cb->addItem(tr("Fusible"), ElementData::Fuse); + ui->m_terminal_type_cb->addItem(tr("Séctionnable"), ElementData::Sectional); + ui->m_terminal_type_cb->addItem(tr("Diode"), ElementData::Diode); + + ui->m_terminal_func_cb->addItem(tr("Générique"), ElementData::TFGeneric); + ui->m_terminal_func_cb->addItem(tr("Phase"), ElementData::Phase); + ui->m_terminal_func_cb->addItem(tr("Neutre"), ElementData::Neutral); + ui->m_terminal_func_cb->addItem(tr("Terre"), ElementData::PE); + //Disable the edition of the first column of the information tree //by this little workaround ui->m_tree->setItemDelegate(new EditorDelegate(this)); @@ -199,6 +217,11 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted() else if (m_data.m_type == ElementData::Master) { m_data.m_master_type = ui->m_master_type_cb->currentData().value(); } + else if (m_data.m_type == ElementData::Terminale) + { + m_data.m_terminal_type = ui->m_terminal_type_cb->currentData().value(); + m_data.m_terminal_function = ui->m_terminal_func_cb->currentData().value(); + } for (QTreeWidgetItem *qtwi : ui->m_tree->invisibleRootItem()->takeChildren()) { @@ -220,16 +243,19 @@ void ElementPropertiesEditorWidget::on_m_buttonBox_accepted() */ void ElementPropertiesEditorWidget::on_m_base_type_cb_currentIndexChanged(int index) { - bool slave = false , master = false; + bool slave = false , master = false, terminal = false; auto type_ = ui->m_base_type_cb->itemData(index).value(); if (type_ == ElementData::Slave) slave = true; else if (type_ == ElementData::Master) master = true; + else if (type_ == ElementData::Terminale) + terminal = true; ui->m_slave_gb->setVisible(slave); ui->m_master_gb->setVisible(master); + ui->m_terminal_gb->setVisible(terminal); updateTree(); } diff --git a/sources/editor/ui/elementpropertieseditorwidget.ui b/sources/editor/ui/elementpropertieseditorwidget.ui index d68cd3103..6c3b33344 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.ui +++ b/sources/editor/ui/elementpropertieseditorwidget.ui @@ -6,8 +6,8 @@ 0 0 - 450 - 321 + 527 + 442 @@ -107,6 +107,35 @@ + + + + Élément bornier + + + + + + Type + + + + + + + Fonction + + + + + + + + + + + + diff --git a/sources/properties/elementdata.cpp b/sources/properties/elementdata.cpp index 63a2d211c..9cab02db4 100644 --- a/sources/properties/elementdata.cpp +++ b/sources/properties/elementdata.cpp @@ -115,7 +115,7 @@ QDomElement ElementData::kindInfoToXml(QDomDocument &document) auto xml_func = document.createElement("kindInformation"); xml_func.setAttribute("name", "function"); auto func_txt = document.createTextNode(terminalFunctionToString(m_terminal_function)); - xml_type.appendChild(xml_func); + xml_func.appendChild(func_txt); returned_elmt.appendChild(xml_func); } @@ -313,7 +313,7 @@ QString ElementData::terminalTypeToString(ElementData::TerminalType type) case ElementData::Sectional: return QString("sectional"); case ElementData::Diode: - return QString("didoe"); + return QString("diode"); } }