diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 5a65c3e85..5414c35bb 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -64,7 +64,6 @@ QColor Diagram::background_color = Qt::white; Diagram::Diagram(QETProject *project) : QGraphicsScene (project), m_project (project), - diagram_qet_version_ (-1), draw_grid_ (true), use_border_ (true), draw_terminals_ (true), @@ -733,9 +732,6 @@ QDomDocument Diagram::toXml(bool whole_content) { // racine de l'arbre XML auto dom_root = document.createElement("diagram"); - // add the application version number - dom_root.setAttribute("version", QET::version); - // schema properties // proprietes du schema if (whole_content) { @@ -1192,15 +1188,9 @@ bool Diagram::fromXml(QDomElement &document, // The first element must be a diagram if (root.tagName() != "diagram") return(false); - // Read attributes of this diagram - if (consider_informations) { - // Version of diagram - bool conv_ok; - qreal version_value = root.attribute("version").toDouble(&conv_ok); - if (conv_ok) { - diagram_qet_version_ = version_value; - } - + // Read attributes of this diagram + if (consider_informations) + { // Load border and titleblock border_and_titleblock.titleBlockFromXml(root); border_and_titleblock.borderFromXml(root); @@ -1262,19 +1252,6 @@ bool Diagram::fromXml(QDomElement &document, return(true); } - /* Backward compatibility: prior to version 0.3, we need to compensate, - * at diagram-opening time, the rotation of the element for each of its - * textfields having the "FollowParentRotation" option disabled. - * After 0.3, elements textfields get userx, - * usery and userrotation attributes that explicitly specify - * their position and orientation. - */ - qreal project_qet_version = declaredQElectroTechVersion(true); - bool handle_inputs_rotation = ( - project_qet_version != -1 && project_qet_version < 0.3 && - m_project -> state() == QETProject::ProjectParsingRunning - ); - //If paste from another project if (root.hasAttribute("projectId")) { QETProject *other_project = QETApp::project( @@ -1343,9 +1320,7 @@ bool Diagram::fromXml(QDomElement &document, addItem(nvel_elmt); //Loading fail, remove item from the diagram - if (!nvel_elmt->fromXml(element_xml, - table_adr_id, - handle_inputs_rotation)) + if (!nvel_elmt->fromXml(element_xml, table_adr_id)) { removeItem(nvel_elmt); delete nvel_elmt; @@ -2363,25 +2338,6 @@ int Diagram::folioIndex() const return(m_project -> folioIndex(this)); } -/** - @brief Diagram::declaredQElectroTechVersion - @param fallback_to_project : - When a diagram does not have a declared version, - this method will use the one declared by its parent project only if - fallback_to_project is true. - @return the declared QElectroTech version of this diagram -*/ -qreal Diagram::declaredQElectroTechVersion(bool fallback_to_project) const -{ - if (diagram_qet_version_ != -1) { - return diagram_qet_version_; - } - if (fallback_to_project && m_project) { - return(m_project -> declaredQElectroTechVersion()); - } - return(-1); -} - /** @brief Diagram::isReadOnly @return true if this diagram is read only. diff --git a/sources/diagram.h b/sources/diagram.h index 3b2c299de..48aab2bbb 100644 --- a/sources/diagram.h +++ b/sources/diagram.h @@ -157,7 +157,6 @@ class Diagram : public QGraphicsScene // methods related to parent project QETProject *project() const; int folioIndex() const; - qreal declaredQElectroTechVersion(bool = true) const; void showMe() {emit showDiagram(this);} bool isReadOnly() const; diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 312429af8..1c0f8197d 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -694,14 +694,12 @@ bool Element::valideXml(QDomElement &e) { @param e : the dom element where the parameter is stored @param table_id_adr : Reference to the mapping table between IDs of the XML file and the addresses in memory. If the import succeeds, it must be add the right couples (id, address). - @param handle_inputs_rotation : apply the rotation of this element to his child text @return */ bool Element::fromXml( QDomElement &e, QHash &table_id_adr, - bool handle_inputs_rotation) + Terminal *> &table_id_adr) { m_state = QET::GILoadingFromXml; /* @@ -797,12 +795,10 @@ bool Element::fromXml( // orientation bool conv_ok; int read_ori = e.attribute("orientation").toInt(&conv_ok); - if (!conv_ok || read_ori < 0 || read_ori > 3) read_ori = 0; - if (handle_inputs_rotation) { - setRotation(rotation() + (90*read_ori)); - } else { - setRotation(90*read_ori); + if (!conv_ok || read_ori < 0 || read_ori > 3) { + read_ori = 0; } + setRotation(90*read_ori); //Befor load the dynamic text field, //we remove the dynamic text field created from the description of this element, to avoid doublons. diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index 9e7ce75e2..be31e69db 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -133,8 +133,7 @@ class Element : public QetGraphicsItem virtual bool fromXml( QDomElement &, QHash &, - bool = false); + Terminal *> &); virtual QDomElement toXml( QDomDocument &, QHash