diff --git a/elements/03relayage/02esclaves/auxiliary_contacts/contnonc.elmt b/elements/03relayage/02esclaves/auxiliary_contacts/contnonc.elmt new file mode 100644 index 000000000..da664b8d3 --- /dev/null +++ b/elements/03relayage/02esclaves/auxiliary_contacts/contnonc.elmt @@ -0,0 +1,31 @@ + + + مُلامس NO-NC + Wechselkontakt (NO/NC) + Проктой контакт (НР) + Απλή μεταγωγική επαφή + Simple contact + Contatto semplice (NC/NO) + Contact NO - NC + Zestyk przełączny przerwowy + Contacto simple + enkel contact (NC/NO) + Jednoduchý kontakt + + + 1 + simple + SW + + Author: The QElectroTech team +License: see http://qelectrotech.org/wiki/doc/elements_license + + + + + + + + + + diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index 063c9d081..173c82018 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -79,6 +79,7 @@ void ElementPropertiesEditorWidget::setUpInterface() { // Slave option ui -> m_state_cb -> addItem(tr("Normalement ouvert"), QVariant("NO")); ui -> m_state_cb -> addItem(tr("Normalement ferm\351"), QVariant("NC")); + ui -> m_state_cb -> addItem(tr("Inverseur"), QVariant("SW")); ui -> m_type_cb -> addItem(tr("Simple"), QVariant("simple")); ui -> m_type_cb -> addItem(tr("Puissance"), QVariant("power")); ui -> m_type_cb -> addItem(tr("Temporis\351 travail"), QVariant("delayOn")); diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp index 5df154497..0eeb192be 100644 --- a/sources/properties/xrefproperties.cpp +++ b/sources/properties/xrefproperties.cpp @@ -26,6 +26,7 @@ XRefProperties::XRefProperties() m_show_power_ctc = true; m_display = Cross; m_snap_to = Bottom; + m_prefix_keys << "power" << "delay" << "switch"; } /** @@ -40,8 +41,9 @@ void XRefProperties::toSettings(QSettings &settings, const QString prefix) const settings.setValue(prefix + "displayhas", display); QString snap = m_snap_to == Bottom? "bottom" : "label"; settings.setValue(prefix + "snapto", snap); - settings.setValue(prefix + "powerprefix", m_prefix.value("power")); - settings.setValue(prefix + "delayprefix", m_prefix.value("delay")); + foreach (QString key, m_prefix.keys()) { + settings.setValue(prefix + key + "prefix", m_prefix.value(key)); + } } /** @@ -56,8 +58,9 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi display == "cross"? m_display = Cross : m_display = Contacts; QString snap = settings.value(prefix + "snapto", "label").toString(); snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label; - m_prefix.insert("power", settings.value(prefix + "powerprefix").toString()); - m_prefix.insert("delay", settings.value(prefix + "delayprefix").toString()); + foreach (QString key, m_prefix_keys) { + m_prefix.insert(key, settings.value(prefix + key + "prefix").toString()); + } } /** @@ -71,8 +74,9 @@ void XRefProperties::toXml(QDomElement &xml_element) const { xml_element.setAttribute("displayhas", display); QString snap = m_snap_to == Bottom? "bottom" : "label"; xml_element.setAttribute("snapto", snap); - xml_element.setAttribute("powerprefix", m_prefix.value("power")); - xml_element.setAttribute("delayprefix", m_prefix.value("delay")); + foreach (QString key, m_prefix.keys()) { + xml_element.setAttribute(key + "prefix", m_prefix.value(key)); + } } /** @@ -86,8 +90,9 @@ void XRefProperties::fromXml(const QDomElement &xml_element) { display == "cross"? m_display = Cross : m_display = Contacts; QString snap = xml_element.attribute("snapto", "label"); snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label; - m_prefix.insert("power", xml_element.attribute("powerprefix")); - m_prefix.insert("delay", xml_element.attribute("delayprefix")); + foreach (QString key, m_prefix_keys) { + m_prefix.insert(key, xml_element.attribute(key + "prefix")); + } } bool XRefProperties::operator ==(const XRefProperties &xrp) const{ diff --git a/sources/properties/xrefproperties.h b/sources/properties/xrefproperties.h index 05b0f8e1c..40d0945c3 100644 --- a/sources/properties/xrefproperties.h +++ b/sources/properties/xrefproperties.h @@ -19,6 +19,7 @@ #define XREFPROPERTIES_H #include "propertiesinterface.h" +#include /** * @brief The XRefProperties class @@ -64,6 +65,7 @@ class XRefProperties : public PropertiesInterface DisplayHas m_display; SnapTo m_snap_to; QHash m_prefix; + QStringList m_prefix_keys; }; #endif // XREFPROPERTIES_H diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index 67448a3d1..102946ca6 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -92,8 +92,9 @@ QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_p txt += "-"; txt += elmt->diagram()->convertPosition(elmt -> scenePos()).toString(); if (add_prefix) { - if (elmt->kindInformations()["type"].toString() == "power") txt.prepend(m_properties.prefix("power")); + if (elmt->kindInformations()["type"].toString() == "power") txt.prepend(m_properties.prefix("power")); else if (elmt->kindInformations()["type"].toString().contains("delay")) txt.prepend(m_properties.prefix("delay")); + else if (elmt->kindInformations()["state"].toString() == "SW") txt.prepend(m_properties.prefix("switch")); } return txt; } @@ -111,11 +112,23 @@ void CrossRefItem::allElementsPositionText(QString &no_str, QString &nc_str, con foreach (Element *elmt, m_element->linkedElements()) { QString state = elmt->kindInformations()["state"].toString(); - if (state == "NO") tmp_str = &no_str; - else if (state == "NC") tmp_str = &nc_str; + //NO and NC are displayed in single place in the cross + if (state == "NO" || state == "NC") { + if (state == "NO") tmp_str = &no_str; + else if (state == "NC") tmp_str = &nc_str; - if (!tmp_str->isEmpty()) *tmp_str += "\n"; - *tmp_str += elementPositionText(elmt, add_prefix); + if (!tmp_str->isEmpty()) *tmp_str += "\n"; + *tmp_str += elementPositionText(elmt, add_prefix); + } + + //SW are displayed in NC and NO column in the cross + else if (state == "SW") { + for (int i = 0; i < 2; i++) { + tmp_str = i==0? &no_str : &nc_str; + if (!tmp_str->isEmpty()) *tmp_str += "\n"; + *tmp_str += elementPositionText(elmt, add_prefix); + } + } } } @@ -350,7 +363,10 @@ void CrossRefItem::drawHasContacts(QPainter &painter) { for (int i=0; im_show_power_cb->isChecked()); - xrp.setPrefix("power", ui->m_power_prefix_le->text()); - xrp.setPrefix("delay", ui->m_delay_prefix_le->text()); + xrp.setPrefix("power", ui->m_power_prefix_le->text()); + xrp.setPrefix("delay", ui->m_delay_prefix_le->text()); + xrp.setPrefix("switch", ui->m_switch_prefix_le->text()); m_properties.insert(type, xrp); } @@ -136,8 +137,9 @@ void XRefPropertiesWidget::updateDisplay() { ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("bottom")); else ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("label")); ui->m_show_power_cb->setChecked(xrp.showPowerContact()); - ui->m_power_prefix_le->setText(xrp.prefix("power")); - ui->m_delay_prefix_le->setText(xrp.prefix("delay")); + ui->m_power_prefix_le-> setText(xrp.prefix("power")); + ui->m_delay_prefix_le-> setText(xrp.prefix("delay")); + ui->m_switch_prefix_le->setText(xrp.prefix("switch")); ui->m_cross_properties_gb->setDisabled(!ui->m_display_has_cross_rb->isChecked()); } diff --git a/sources/ui/xrefpropertieswidget.ui b/sources/ui/xrefpropertieswidget.ui index 09fefb571..08bb4c8b1 100644 --- a/sources/ui/xrefpropertieswidget.ui +++ b/sources/ui/xrefpropertieswidget.ui @@ -84,26 +84,36 @@ - - - - - - - Préfixe des contacts de puissance: + Préfixe des contacts de puissance : - Préfixe des contacts temporisés: + Préfixe des contacts temporisés : + + + + + + + + + + Préfixe des contacts inverseurs : + + + + + +