diff --git a/elements/10_electric/qet_labels.xml b/elements/10_electric/qet_labels.xml new file mode 100644 index 000000000..7d90d76d1 --- /dev/null +++ b/elements/10_electric/qet_labels.xml @@ -0,0 +1,576 @@ + + + + + + + + + + + X + + + + + + + + X + + + + F + + + F + + + Q + + + Q + + + F + + + Q + + + F + + + + + K + + + + + + + S + + + S + + + + + T + + + G + + + RB + + + + + T + + + + L + + + KF + + + + + + H + + + H + + + S + + + S + + + S + + + + + + + + + + + + + + + S + + + H + + + P + + + + M + + + Y + + + YB + + + R + + + EH + + + + + B + + + + + B + + + + + R + + + C + + + L + + + + V + + + + + + + + + + + + + X + + + + F + + + F + + + Q + + + Q + + + F + + + Q + + + + + T + + + L + + + + + T + + + + + + + + R + + + C + + + L + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 361 + + diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index dfe213cce..18a7b673c 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -124,6 +124,16 @@ QString ElementsLocation::baseName() const { return(QString()); } +/** + * @brief ElementsLocation::projectId + * This method is used to know if an element belongs to + * a project or not. + * @return Element Project Id + */ +int ElementsLocation::projectId() const { + return QETApp::projectId(m_project); +} + /** * @brief ElementsLocation::collectionPath * Return the path of the represented element relative to collection diff --git a/sources/ElementsCollection/elementslocation.h b/sources/ElementsCollection/elementslocation.h index 7209e2664..49e5b0334 100644 --- a/sources/ElementsCollection/elementslocation.h +++ b/sources/ElementsCollection/elementslocation.h @@ -44,6 +44,7 @@ class ElementsLocation public: QString baseName() const; + int projectId() const; QString collectionPath(bool protocol = true) const; QString projectCollectionPath() const; diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h index 7d41cb1a5..4cc809d23 100644 --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -101,7 +101,9 @@ class BorderTitleBlock : public QObject DiagramContext additionalFields() const { return (additional_fields_); } /// @return the value of the title block QString autoPageNum() const { return(btb_auto_page_num_); } - + /// @return the value of the total number of folios + int folioTotal() const { return(folio_total_);} + // methods to get display options /// @return true si le cartouche est affiche, false sinon bool titleBlockIsDisplayed() const { return(display_titleblock_); } diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 2e9ee7100..cc4aab1de 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -855,9 +855,19 @@ void Diagram::addItem(QGraphicsItem *item) { case Element::Type: { - const Element *elmt = static_cast(item); + Element *elmt = static_cast(item); foreach(ElementTextItem *eti, elmt->texts()) connect (eti, &ElementTextItem::diagramTextChanged, this, &Diagram::diagramTextChanged); + Element::kind linkType = elmt->linkType(); + if ((linkType == Element::Simple) || + (linkType == Element::Master) || + (linkType == Element::Slave) || + (linkType == Element::Terminale)) { + CustomElement *celmt = static_cast(item); + celmt->parseLabels(); + } + + elmt->updateLabel(); } break; diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index d782a56cf..ad8ce8aa5 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -190,7 +190,7 @@ void PasteDiagramCommand::redo() //Reset the text field tagged "label if (ElementTextItem *eti = e ->taggedText("label")) - eti -> setPlainText("_"); + eti -> setPlainText("_"); } } diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 80555075d..73a384da9 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -28,6 +28,7 @@ #include "selectautonumw.h" #include "numerotationcontext.h" #include "folioautonumbering.h" +#include "elementautonumberingw.h" /** Constructor @param project Project this page is editing. @@ -269,6 +270,10 @@ void ProjectAutoNumConfigPage::initWidgets() { m_saw = new SelectAutonumW(conductor_tab_widget); + //Element Tab + element_tab_widget = new QWidget(this); + m_eaw = new ElementAutonumberingW(element_tab_widget); + //Folio Tab folio_tab_widget = new QWidget(this); folio_tab_widget->setObjectName("FolioTab"); @@ -296,7 +301,7 @@ void ProjectAutoNumConfigPage::initWidgets() { */ void ProjectAutoNumConfigPage::initLayout() { - //Conductor tab + //Conductor Tab tab_widget->addTab(conductor_tab_widget, tr("Conductor")); QHBoxLayout *context_layout = new QHBoxLayout(); @@ -312,6 +317,9 @@ void ProjectAutoNumConfigPage::initLayout() { main_layout->addLayout(aux_layout); conductor_tab_widget -> setLayout (main_layout); + //Element Tab + tab_widget->addTab(element_tab_widget,tr ("Element")); + // Folio Tab tab_widget->addTab(folio_tab_widget, tr("Folio")); @@ -345,6 +353,10 @@ void ProjectAutoNumConfigPage::readValuesFromProject() { foreach (QString str, keys) { m_context_cb -> addItem(str); } } + //Element Tab + if (!project_->elementAutoNum().isEmpty()) + m_eaw->setContext(project_->elementAutoNum()); + //Folio Tab QList keys_2 = project_->folioAutoNum().keys(); if (!keys_2.isEmpty()){ @@ -375,6 +387,9 @@ void ProjectAutoNumConfigPage::buildConnections() { connect (m_saw, SIGNAL (applyPressed()), this, SLOT (saveContext())); connect (m_remove_pb, SIGNAL (clicked()), this, SLOT(removeContext())); + //Element Tab + connect (m_eaw, SIGNAL (applyPressed()), this, SLOT (saveContext_3())); + //Folio Tab connect (m_context_cb_2, SIGNAL (currentIndexChanged(QString)), this, SLOT (updateContext_2(QString))); connect (m_saw_2, SIGNAL (applyPressed()), this, SLOT (saveContext_2())); @@ -448,6 +463,14 @@ void ProjectAutoNumConfigPage::saveContext_2() { } } +/** + * @brief ProjectAutoNumConfigPage::saveContext_3 + * Save the current displayed Element formula in project + */ +void ProjectAutoNumConfigPage::saveContext_3() { + project()->addElementAutoNum (m_eaw->formula()); +} + /** * @brief ProjectAutoNumConfigPage::applyAutoNum * Apply auto folio numbering, New Folios or Selected Folios @@ -508,7 +531,7 @@ void ProjectAutoNumConfigPage::changeToTab(int i){ */ void ProjectAutoNumConfigPage::tabChanged(int i){ if (i>0){ - if (tab_widget->currentIndex()==2){ + if (tab_widget->currentIndex()==3){ tab_widget->resize(470,tab_widget->height()); } else { diff --git a/sources/projectconfigpages.h b/sources/projectconfigpages.h index 9bdd49508..6b167cea1 100644 --- a/sources/projectconfigpages.h +++ b/sources/projectconfigpages.h @@ -35,6 +35,7 @@ class SelectAutonumW; class QComboBox; class QPushButton; class FolioAutonumberingW; +class ElementAutonumberingW; /** This class, derived from ConfigPage, aims at providing the basic skeleton @@ -142,10 +143,11 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage { private slots: void updateContext(QString); void saveContext(); - void removeContext(); + void removeContext(); //conductor void updateContext_2(QString); - void saveContext_2(); + void saveContext_2(); //folio void removeContext_2(); + void saveContext_3(); //element void applyAutoNum(); @@ -159,21 +161,22 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage { //Attributes private: - QTabWidget *tab_widget; - QWidget *element_widget; - QWidget *conductor_tab_widget; - QWidget *folio_tab_widget; - QWidget *autoNumbering_tab_widget; - QScrollArea *scrollArea; - QLabel *m_label; - QLabel *m_label_2; - QComboBox *m_context_cb; - QComboBox *m_context_cb_2; - QPushButton *m_remove_pb; - QPushButton *m_remove_pb_2; - SelectAutonumW *m_saw; - SelectAutonumW *m_saw_2; - FolioAutonumberingW *m_faw; + QTabWidget *tab_widget; + QWidget *conductor_tab_widget; + QWidget *element_tab_widget; + QWidget *folio_tab_widget; + QWidget *autoNumbering_tab_widget; + QScrollArea *scrollArea; + QLabel *m_label; + QLabel *m_label_2; + QComboBox *m_context_cb; + QComboBox *m_context_cb_2; + QPushButton *m_remove_pb; + QPushButton *m_remove_pb_2; + SelectAutonumW *m_saw; + SelectAutonumW *m_saw_2; + FolioAutonumberingW *m_faw; + ElementAutonumberingW *m_eaw; }; diff --git a/sources/qetgraphicsitem/customelement.cpp b/sources/qetgraphicsitem/customelement.cpp index 2ca6047cd..b00f8107c 100644 --- a/sources/qetgraphicsitem/customelement.cpp +++ b/sources/qetgraphicsitem/customelement.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2016 The QElectroTech Team This file is part of QElectroTech. - + QElectroTech is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - + QElectroTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ @@ -23,6 +23,7 @@ #include #include "terminal.h" #include "diagramposition.h" +#include "diagramcontent.h" /** Constructeur de la classe CustomElement. Permet d'instancier un element @@ -67,7 +68,7 @@ CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qg buildFromXml(location.xml(), &elmt_state); if (state) *state = elmt_state; if (elmt_state) return; - + if (state) *state = 0; } @@ -86,13 +87,13 @@ CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qg @return true si le chargement a reussi, false sinon */ bool CustomElement::buildFromXml(const QDomElement &xml_def_elmt, int *state) { - + if (xml_def_elmt.tagName() != "definition" || xml_def_elmt.attribute("type") != "element") { if (state) *state = 4; return(false); } - + // verifie basiquement que la version actuelle est capable de lire ce fichier if (xml_def_elmt.hasAttribute("version")) { bool conv_ok; @@ -105,7 +106,7 @@ bool CustomElement::buildFromXml(const QDomElement &xml_def_elmt, int *state) { ) << std::endl; } } - + // ces attributs doivent etre presents et valides int w, h, hot_x, hot_y; if ( @@ -118,35 +119,35 @@ bool CustomElement::buildFromXml(const QDomElement &xml_def_elmt, int *state) { if (state) *state = 5; return(false); } - + setSize(w, h); setHotspot(QPoint(hot_x, hot_y)); - + //the definition must have childs if (xml_def_elmt.firstChild().isNull()) { if (state) *state = 6; return(false); } - + // initialisation du QPainter (pour dessiner l'element) QPainter qp; qp.begin(&drawing); - + QPainter low_zoom_qp; low_zoom_qp.begin(&low_zoom_drawing); QPen tmp; tmp.setWidthF(1.0); // ligne vaudou pour prise en compte du setCosmetic - ne pas enlever tmp.setCosmetic(true); low_zoom_qp.setPen(tmp); - + // extrait les noms de la definition XML names.fromXml(xml_def_elmt); setToolTip(name()); //load kind informations kind_informations_.fromXml(xml_def_elmt.firstChildElement("kindInformations"), "kindInformation"); - + // parcours des enfants de la definition : parties du dessin int parsed_elements_count = 0; for (QDomNode node = xml_def_elmt.firstChild() ; !node.isNull() ; node = node.nextSibling()) { @@ -173,11 +174,11 @@ bool CustomElement::buildFromXml(const QDomElement &xml_def_elmt, int *state) { } } } - + // fin du dessin qp.end(); low_zoom_qp.end(); - + // il doit y avoir au moins un element charge if (!parsed_elements_count) { if (state) *state = 8; @@ -263,6 +264,89 @@ void CustomElement::paint(QPainter *qp, const QStyleOptionGraphicsItem *options) } } +/** + Retrieves the element label stored in file ./elements/ * /qet_labels.xml + The labels are applied to all elements inside a folder. If an element + has a specific label, it will be applied. See qet_labels.xml for more + instructions. +*/ +void CustomElement::parseLabels() { + if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) && (this->taggedText("label")->toPlainText()=="_")) { //element is being added + QXmlStreamReader rxml; + QString path[10]; + QString prefix; + int i = -1; + ElementsLocation current_location = location(); + int dirLevel = -1; + + //Add location name to path array + while(current_location.parent().name()!="Imported elements" ) { + i++; + path[i]=current_location.fileName(); + current_location = current_location.parent(); + dirLevel++; + } + + // Only Electric labels created so far + if (current_location.name()!= "Electric") return; + QString qet_labels = "10_electric/qet_labels.xml"; + QString filepath = QETApp::commonElementsDir().append(qet_labels); + QFile file(filepath); + file.isReadable(); + if (!file.open(QFile::ReadOnly | QFile::Text)) return; + rxml.setDevice(&file); + rxml.readNext(); + + while(!rxml.atEnd()) { + if (rxml.attributes().value("name").toString() == path[i]) { + rxml.readNext(); + i=i-1; + //reached element directory + if (i==0) { + for (int j=i; j<= dirLevel; j = j +1){ + //if there is a prefix available apply prefix + if(rxml.name()=="prefix") { + prefix = rxml.readElementText(); + DiagramContext &dc = this->rElementInformations(); + //if there is a formula to assign, assign it + if (!location().project()->elementAutoNum().isEmpty() && this->linkType()!=Element::Slave) { + QString formula = location().project()->elementAutoNum(); + formula.replace("%prefix", prefix); + dc.addValue("label", formula); + this->setTaggedText("label",formula); + } else { //assign only prefix + dc.addValue("label", prefix); + this->setTaggedText("label", prefix); + } + this->setElementInformations(dc); + return; + } + //if there isn't a prefix available, find parent prefix in parent folder + else { + while (rxml.readNextStartElement() && rxml.name()!="prefix") { + rxml.skipCurrentElement(); + rxml.readNext(); + } + } + } + } + } + rxml.readNext(); + } + } + //apply formula to specific label + else if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) && + (!location().project()->elementAutoNum().isEmpty()) && (this->linkType()!=Element::Slave)) { + QString formula = location().project()->elementAutoNum(); + DiagramContext &dc = this->rElementInformations(); + QString prefix = this->taggedText("label")->toPlainText(); + formula.replace("%prefix", prefix); + dc.addValue("label", formula); + this->setTaggedText("label",formula); + this->setElementInformations(dc); + } +} + /** Analyse et prend en compte un element XML decrivant une partie du dessin de l'element perso. Si l'analyse reussit, la partie est ajoutee au dessin. @@ -294,7 +378,7 @@ bool CustomElement::parseElement(QDomElement &e, QPainter &qp) { La ligne est definie par les attributs suivants : - x1, y1 : reels, coordonnees d'une extremite de la ligne - x2, y2 : reels, coordonnees de l'autre extremite de la ligne - + @param e L'element XML a analyser @param qp Le QPainter a utiliser pour dessiner l'element perso @return true si l'analyse reussit, false sinon @@ -306,19 +390,19 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { if (!QET::attributeIsAReal(e, QString("y1"), &y1)) return(false); if (!QET::attributeIsAReal(e, QString("x2"), &x2)) return(false); if (!QET::attributeIsAReal(e, QString("y2"), &y2)) return(false); - + Qet::EndType first_end = Qet::endTypeFromString(e.attribute("end1")); Qet::EndType second_end = Qet::endTypeFromString(e.attribute("end2")); qreal length1, length2; if (!QET::attributeIsAReal(e, QString("length1"), &length1)) length1 = 1.5; if (!QET::attributeIsAReal(e, QString("length2"), &length2)) length2 = 1.5; - + qp.save(); setPainterStyle(e, qp); QPen t = qp.pen(); t.setJoinStyle(Qt::MiterJoin); qp.setPen(t); - + QLineF line(x1, y1, x2, y2); //Add line to the list @@ -327,10 +411,10 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { QPointF point1(line.p1()); QPointF point2(line.p2()); - + qreal line_length(line.length()); qreal pen_width = qp.pen().widthF(); - + // determine s'il faut dessiner les extremites bool draw_1st_end, draw_2nd_end; qreal reduced_line_length = line_length - (length1 * PartLine::requiredLengthForEndType(first_end)); @@ -341,7 +425,7 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { reduced_line_length = line_length - (length2 * PartLine::requiredLengthForEndType(second_end)); } draw_2nd_end = second_end && reduced_line_length >= 0; - + // dessine la premiere extremite QPointF start_point, stop_point; if (draw_1st_end) { @@ -355,12 +439,12 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { } else if (first_end == Qet::Simple) { qp.drawPolyline(QPolygonF() << four_points1[3] << point1 << four_points1[2]); start_point = point1; - + } else if (first_end == Qet::Triangle) { qp.drawPolygon(QPolygonF() << four_points1[0] << four_points1[2] << point1 << four_points1[3]); start_point = four_points1[0]; } - + // ajuste le depart selon l'epaisseur du trait if (pen_width && (first_end == Qet::Simple || first_end == Qet::Circle)) { start_point = QLineF(start_point, point2).pointAt(pen_width / 2.0 / line_length); @@ -368,7 +452,7 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { } else { start_point = point1; } - + // dessine la seconde extremite if (draw_2nd_end) { QList four_points2(PartLine::fourEndPoints(point2, point1, length2)); @@ -385,7 +469,7 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { qp.drawPolygon(QPolygonF() << four_points2[0] << four_points2[2] << point2 << four_points2[3] << four_points2[0]); stop_point = four_points2[0]; } - + // ajuste l'arrivee selon l'epaisseur du trait if (pen_width && (second_end == Qet::Simple || second_end == Qet::Circle)) { stop_point = QLineF(point1, stop_point).pointAt((line_length - (pen_width / 2.0)) / line_length); @@ -393,9 +477,9 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { } else { stop_point = point2; } - + qp.drawLine(start_point, stop_point); - + qp.restore(); return(true); } @@ -408,7 +492,7 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp) { - y : ordonnee du coin superieur gauche du rectangle - width : largeur du rectangle - height : hauteur du rectangle - + @param e L'element XML a analyser @param qp Le QPainter a utiliser pour dessiner l'element perso @return true si l'analyse reussit, false sinon @@ -427,12 +511,12 @@ bool CustomElement::parseRect(QDomElement &e, QPainter &qp) { qp.save(); setPainterStyle(e, qp); - + // force le type de jointures pour les rectangles QPen p = qp.pen(); p.setJoinStyle(Qt::MiterJoin); qp.setPen(p); - + qp.drawRect(QRectF(rect_x, rect_y, rect_w, rect_h)); qp.restore(); return(true); @@ -445,7 +529,7 @@ bool CustomElement::parseRect(QDomElement &e, QPainter &qp) { - x : abscisse du coin superieur gauche de la quadrature du cercle - y : ordonnee du coin superieur gauche de la quadrature du cercle - diameter : diametre du cercle - + @param e L'element XML a analyser @param qp Le QPainter a utiliser pour dessiner l'element perso @return true si l'analyse reussit, false sinon @@ -477,7 +561,7 @@ bool CustomElement::parseCircle(QDomElement &e, QPainter &qp) { - y : ordonnee du coin superieur gauche du rectangle dans lequel s'inscrit l'ellipse - width : dimension de la diagonale horizontale de l'ellipse - height : dimension de la diagonale verticale de l'ellipse - + @param e L'element XML a analyser @param qp Le QPainter a utiliser pour dessiner l'element perso @return true si l'analyse reussit, false sinon @@ -515,7 +599,7 @@ bool CustomElement::parseEllipse(QDomElement &e, QPainter &qp) { - start : angle de depart : l'angle "0 degre" est a trois heures - angle : etendue (en degres) de l'arc de cercle ; une valeur positive va dans le sens contraire des aiguilles d'une montre - + @param e L'element XML a analyser @param qp Le QPainter a utiliser pour dessiner l'element perso @return true si l'analyse reussit, false sinon @@ -529,7 +613,7 @@ bool CustomElement::parseArc(QDomElement &e, QPainter &qp) { if (!QET::attributeIsAReal(e, QString("height"), &arc_h)) return(false); if (!QET::attributeIsAReal(e, QString("start"), &arc_s)) return(false); if (!QET::attributeIsAReal(e, QString("angle"), &arc_a)) return(false); - + qp.save(); setPainterStyle(e, qp); @@ -612,15 +696,15 @@ bool CustomElement::parseText(QDomElement &e, QPainter &qp) { !QET::attributeIsAnInteger(e, "size", &size) ||\ !e.hasAttribute("text") ) return(false); - + qp.save(); setPainterStyle(e, qp); - + // determine la police a utiliser et en recupere les metriques associees QFont used_font = QETApp::diagramTextsFont(size); QFontMetrics qfm(used_font); QColor text_color = (e.attribute("color") != "white"? Qt::black : Qt::white); - + // instancie un QTextDocument (comme la classe QGraphicsTextItem) pour // generer le rendu graphique du texte QTextDocument text_document; @@ -638,18 +722,18 @@ bool CustomElement::parseText(QDomElement &e, QPainter &qp) { eti -> setRotationAngle(original_rotation_angle); eti -> setFollowParentRotations(e.attribute("rotate") == "true"); list_texts_ << eti; - - // Se positionne aux coordonnees indiquees dans la description du texte + + // Se positionne aux coordonnees indiquees dans la description du texte qp.setTransform(QTransform(), false); qp.translate(pos_x, pos_y); - + // Pivote le systeme de coordonnees du QPainter pour effectuer le rendu // dans le bon sens qreal default_rotation_angle = 0.0; if (QET::attributeIsAReal(e, "rotation", &default_rotation_angle)) { qp.rotate(default_rotation_angle); } - + /* Deplace le systeme de coordonnees du QPainter pour effectuer le rendu au bon endroit ; note : on soustrait l'ascent() de la police pour @@ -657,12 +741,12 @@ bool CustomElement::parseText(QDomElement &e, QPainter &qp) { indiquee correspond a la baseline. */ QPointF qpainter_offset(0.0, -qfm.ascent()); - + //adjusts the offset by the margin of the text document text_document.setDocumentMargin(0.0); - + qp.translate(qpainter_offset); - + // force the palette used to render the QTextDocument QAbstractTextDocumentLayout::PaintContext ctx; ctx.palette.setColor(QPalette::Text, text_color); @@ -691,26 +775,38 @@ ElementTextItem *CustomElement::parseInput(QDomElement &e) { !QET::attributeIsAReal(e, "y", &pos_y) ||\ !QET::attributeIsAnInteger(e, "size", &size) ) return(0); - + ElementTextItem *eti = new ElementTextItem(e.attribute("text"), this); eti -> setFont(QETApp::diagramTextsFont(size)); eti -> setTagg(e.attribute("tagg", "other")); - + + if (e.attribute("tagg")=="label") { + DiagramContext &dc = this->rElementInformations(); + dc.addValue("label", e.attribute("text")); + this->setElementInformations(dc); + this->setTaggedText("label", e.attribute("text")); + } + else if (e.attribute("tagg")=="function") { + DiagramContext &dc = this->rElementInformations(); + dc.addValue("function", e.attribute("text")); + this->setElementInformations(dc); + } + // position the text field eti -> setOriginalPos(QPointF(pos_x, pos_y)); eti -> setPos(pos_x, pos_y); - + // rotation of the text field qreal original_rotation_angle = 0.0; QET::attributeIsAReal(e, "rotation", &original_rotation_angle); eti -> setOriginalRotationAngle(original_rotation_angle); eti -> setRotationAngle(original_rotation_angle); - + // behavior when the parent element is rotated eti -> setFollowParentRotations(e.attribute("rotate") == "true"); - + list_texts_ << eti; - + return(eti); } @@ -720,7 +816,7 @@ ElementTextItem *CustomElement::parseInput(QDomElement &e) { Une borne est definie par les attributs suivants : - x, y : coordonnees de la borne - orientation : orientation de la borne = Nord (n), Sud (s), Est (e) ou Ouest (w) - + @param e L'element XML a analyser @return Un pointeur vers l'objet Terminal ainsi cree, 0 sinon */ @@ -762,12 +858,12 @@ void CustomElement::setQPainterAntiAliasing(QPainter &qp, bool aa) { - une pour l'Est - une pour le Sud - une pour l'Ouest - + Pour chaque orientation, on indique si elle est : - l'orientation par defaut : d - une orientation autorisee : y - une orientation interdire : n - + Exemple : "dnny" represente un element par defaut oriente vers le nord et qui peut etre oriente vers l'ouest mais pas vers le sud ou vers l'est. @param e Element XML @@ -826,7 +922,7 @@ bool CustomElement::validOrientationAttribute(const QDomElement &e) { - hachures gauche - hachures droite - none : pas de contour - + Les autres valeurs ne sont pas prises en compte. @param e L'element XML a parser @param qp Le QPainter a modifier en fonction des styles @@ -835,14 +931,14 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) { // recupere le QPen et la QBrush du QPainter QPen pen = qp.pen(); QBrush brush = qp.brush(); - + // attributs par defaut pen.setJoinStyle(Qt::BevelJoin); pen.setCapStyle(Qt::SquareCap); - + // recupere la liste des couples style / valeur QStringList styles = e.attribute("style").split(";", QString::SkipEmptyParts); - + // agit sur le QPen et la QBrush en fonction des valeurs rencontrees QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$"); foreach (QString style, styles) { @@ -949,11 +1045,11 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) { } } } - - // affectation du QPen et de la QBrush modifies au QPainter + + // affectation du QPen et de la QBrush modifies au QPainter qp.setPen(pen); qp.setBrush(brush); - + // mise en place (ou non) de l'antialiasing setQPainterAntiAliasing(qp, e.attribute("antialias") == "true"); } diff --git a/sources/qetgraphicsitem/customelement.h b/sources/qetgraphicsitem/customelement.h index 53305de33..74dfbf365 100644 --- a/sources/qetgraphicsitem/customelement.h +++ b/sources/qetgraphicsitem/customelement.h @@ -72,6 +72,7 @@ class CustomElement : public FixedElement virtual QList *> arcs() const; virtual int terminalsCount() const; virtual void paint(QPainter *, const QStyleOptionGraphicsItem *); + virtual void parseLabels(); QString typeId() const; ElementsLocation location() const; QString name() const; @@ -93,6 +94,7 @@ class CustomElement : public FixedElement virtual bool validOrientationAttribute(const QDomElement &); virtual void setPainterStyle(QDomElement &, QPainter &); ElementTextItem* setTaggedText(const QString &tagg, const QString &newstr, const bool noeditable=false); + }; /** diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 346972484..8893d6145 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -659,5 +659,7 @@ QString Element::assignVariables(QString label, Element *elmt){ label.replace("%F", elmt->diagram() -> border_and_titleblock.folio()); label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number())); label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter()); + label.replace("%id", QString::number(elmt->diagram()->folioIndex()+1)); + label.replace("%total", QString::number(elmt->diagram()->border_and_titleblock.folioTotal())); return label; } diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index a6a773743..7e60abf1e 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -120,8 +120,9 @@ class Element : public QetGraphicsItem { kind link_type_; signals: - void linkedElementChanged(); //This signal is emtied when the linked elements with this element change + void linkedElementChanged(); //This signal is emited when the linked elements with this element change void elementInfoChange(DiagramContext old_info, DiagramContext new_info); + void updateLabel(); //This signal is emited to update element's label //METHODS related to information public: @@ -162,7 +163,7 @@ class Element : public QetGraphicsItem { // selection-related methods void select(); - void deselect(); + void deselect(); virtual void rotateBy(const qreal &); virtual void editProperty(); diff --git a/sources/qetgraphicsitem/elementtextitem.cpp b/sources/qetgraphicsitem/elementtextitem.cpp index 9fca337b3..590ac08e1 100644 --- a/sources/qetgraphicsitem/elementtextitem.cpp +++ b/sources/qetgraphicsitem/elementtextitem.cpp @@ -254,6 +254,7 @@ void ElementTextItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if (m_first_move) { //We signal the beginning of movement to the parent diagram int moved_texts_count = diagram_ptr -> beginMoveElementTexts(this); + parent_element_ -> setHighlighted(true); //If there is one texte to move, we highlight the parent element. if (moved_texts_count == 1 && parent_element_) { diff --git a/sources/qetgraphicsitem/masterelement.cpp b/sources/qetgraphicsitem/masterelement.cpp index b2b461278..8431ea400 100644 --- a/sources/qetgraphicsitem/masterelement.cpp +++ b/sources/qetgraphicsitem/masterelement.cpp @@ -33,8 +33,9 @@ MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qg { link_type_ = Master; connect(this, SIGNAL(elementInfoChange(DiagramContext, DiagramContext)), this, SLOT(updateLabel(DiagramContext, DiagramContext))); - connect(this, SIGNAL(xChanged()),this, SLOT(changeElementInfo())); - connect(this, SIGNAL(yChanged()),this, SLOT(changeElementInfo())); + connect(this, SIGNAL(xChanged()), this, SLOT(changeElementInfo())); + connect(this, SIGNAL(yChanged()), this, SLOT(changeElementInfo())); + connect(this, SIGNAL(updateLabel()), this, SLOT(changeElementInfo())); } /** @@ -61,8 +62,9 @@ void MasterElement::linkToElement(Element *elmt) if (!cri_) cri_ = new CrossRefItem(this); //create cross ref item if not yet - connect(elmt, SIGNAL(xChanged()), cri_, SLOT(updateLabel())); - connect(elmt, SIGNAL(yChanged()), cri_, SLOT(updateLabel())); + connect(elmt, SIGNAL(xChanged()), cri_, SLOT(updateLabel())); + connect(elmt, SIGNAL(yChanged()), cri_, SLOT(updateLabel())); + connect(elmt, SIGNAL(updateLabel()), cri_, SLOT(updateLabel())); cri_ -> updateLabel(); emit linkedElementChanged(); } @@ -98,8 +100,9 @@ void MasterElement::unlinkElement(Element *elmt) elmt -> setHighlighted (false); //update the graphics cross ref - disconnect(elmt, SIGNAL(xChanged()), cri_, SLOT(updateLabel())); - disconnect(elmt, SIGNAL(yChanged()), cri_, SLOT(updateLabel())); + disconnect(elmt, SIGNAL(xChanged()), cri_, SLOT(updateLabel())); + disconnect(elmt, SIGNAL(yChanged()), cri_, SLOT(updateLabel())); + disconnect(elmt, SIGNAL(updateLabel()), cri_, SLOT(updateLabel())); cri_ -> updateLabel(); aboutDeleteXref(); diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp index 6a235c26d..903d3f482 100644 --- a/sources/qetgraphicsitem/reportelement.cpp +++ b/sources/qetgraphicsitem/reportelement.cpp @@ -219,10 +219,7 @@ void ReportElement::updateLabel() { Element *elmt = connected_elements.at(0); QString label = label_; - label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1)); - label.replace("%F", elmt->diagram() -> border_and_titleblock.folio()); - label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number())); - label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter()); + label = assignVariables(label,elmt); m_text_field -> setPlainText(label); } else diff --git a/sources/qetgraphicsitem/simpleelement.cpp b/sources/qetgraphicsitem/simpleelement.cpp index fcd9519ed..c80cf8539 100644 --- a/sources/qetgraphicsitem/simpleelement.cpp +++ b/sources/qetgraphicsitem/simpleelement.cpp @@ -35,6 +35,7 @@ SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qg connect(this, SIGNAL(elementInfoChange(DiagramContext, DiagramContext)), this, SLOT(updateLabel(DiagramContext, DiagramContext))); connect(this, SIGNAL(xChanged()),this, SLOT(changeElementInfo())); connect(this, SIGNAL(yChanged()),this, SLOT(changeElementInfo())); + connect(this, SIGNAL(updateLabel()),this,SLOT(changeElementInfo())); } /** diff --git a/sources/qetgraphicsitem/slaveelement.cpp b/sources/qetgraphicsitem/slaveelement.cpp index 0324dda5e..6b15d18d7 100644 --- a/sources/qetgraphicsitem/slaveelement.cpp +++ b/sources/qetgraphicsitem/slaveelement.cpp @@ -64,6 +64,7 @@ void SlaveElement::linkToElement(Element *elmt) connect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel())); connect(diagram()->project(), SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel())); connect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel())); + connect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel())); updateLabel(); elmt -> linkToElement(this); @@ -104,6 +105,7 @@ void SlaveElement::unlinkElement(Element *elmt) disconnect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel())); disconnect(diagram()->project(), SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel())); disconnect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel())); + disconnect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel())); delete Xref_item; Xref_item = NULL; diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 0a799ee94..e5e77cfb2 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -408,6 +408,14 @@ QHash QETProject::conductorAutoNum() const { return m_conductor_autonum; } +/** + * @brief QETProject::elementAutoNum + * @return Formula of element autonum stored in project + */ +QString QETProject::elementAutoNum() const { + return m_element_autonum; +} + /** * @brief QETProject::folioAutoNum * @return All value of conductor autonum stored in project @@ -427,6 +435,15 @@ void QETProject::addConductorAutoNum(QString key, NumerotationContext context) { m_conductor_autonum.insert(key, context); } +/** + * @brief QETProject::addElementAutoNum + * Add the new formula + * @param formula + */ +void QETProject::addElementAutoNum(QString formula) { + m_element_autonum = formula; +} + /** * @brief QETProject::addFolioAutoNum * Add a new folio numerotation context. If key already exist, @@ -1176,7 +1193,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project) m_default_xref_properties = XRefProperties:: defaultProperties(); //Read values indicate in project - QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums, folio_autonums; + QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums, folio_autonums, element_autonums; for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling()) { @@ -1197,9 +1214,11 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project) conds_autonums = child_elmt; else if (child_elmt.tagName()== "folio_autonums") folio_autonums = child_elmt; + else if (child_elmt.tagName()== "element_autonums") + element_autonums = child_elmt; } - // size, titleblock, conductor, report, conductor autonum + // size, titleblock, conductor, report, conductor autonum, folio autonum, element autonum if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt); if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt); if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt); @@ -1231,6 +1250,10 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project) m_folio_autonum.insert(elmt.attribute("title"), nc); } } + if (!element_autonums.isNull()) + { + m_element_autonum = element_autonums.attribute("formula"); + } } /** @@ -1300,6 +1323,11 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) { folio_autonums.appendChild(folio_autonum); } xml_element.appendChild(folio_autonums); + + //Export Element Autonums + QDomElement element_autonums = xml_document.createElement("element_autonums"); + element_autonums.setAttribute("formula", m_element_autonum); + xml_element.appendChild(element_autonums); } /** diff --git a/sources/qetproject.h b/sources/qetproject.h index fe38fc4a8..dc394b863 100644 --- a/sources/qetproject.h +++ b/sources/qetproject.h @@ -109,11 +109,13 @@ class QETProject : public QObject QHash conductorAutoNum() const; QHash folioAutoNum() const; void addConductorAutoNum (QString key, NumerotationContext context); - void addFolioAutoNum (QString key, NumerotationContext context); + void addElementAutoNum (QString formula); + void addFolioAutoNum (QString key, NumerotationContext context); void removeConductorAutonum (QString key); void removeFolioAutoNum (QString key); NumerotationContext conductorAutoNum(const QString &key) const; NumerotationContext folioAutoNum(const QString &key) const; + QString elementAutoNum() const; bool autoConductor () const; bool autoFolio () const; @@ -218,7 +220,10 @@ class QETProject : public QObject QUndoStack *undo_stack_; /// Conductor auto numerotation QHash m_conductor_autonum; + /// Folio auto numbering QHash m_folio_autonum; + /// Element Auto Numbering + QString m_element_autonum; /// Folio List Sheets quantity for this project. int folioSheetsQuantity; bool m_auto_conductor; diff --git a/sources/ui/elementautonumberingw.cpp b/sources/ui/elementautonumberingw.cpp new file mode 100644 index 000000000..4a9200e47 --- /dev/null +++ b/sources/ui/elementautonumberingw.cpp @@ -0,0 +1,92 @@ +/* + Copyright 2006-2016 The QElectroTech Team + This file is part of QElectroTech. + + QElectroTech is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + QElectroTech is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . +*/ +#include "elementautonumberingw.h" +#include "ui_elementautonumberingw.h" +#include +#include +#include + +/** + * Constructor + */ +ElementAutonumberingW::ElementAutonumberingW(QWidget *parent) : + QWidget(parent), + ui(new Ui::ElementAutonumberingW) + +{ + ui->setupUi(this); + applyEnable(false); +} + +/** + * Destructor + */ +ElementAutonumberingW::~ElementAutonumberingW() +{ + delete ui; +} + +/** + * @brief ElementAutonumberingW::setContext + * @param formula to be inserted into context + */ +void ElementAutonumberingW::setContext(QString formula) { + ui->m_formula_le->insert(formula); +} + +/** + * @brief ElementAutonumberingW::formula + * @return formula to be stored into project + */ +QString ElementAutonumberingW::formula() { + return ui->m_formula_le->text(); +} + +/** + * @brief ElementAutonumberingW::on_m_formula_le_textChanged + * Update Apply Button + */ +void ElementAutonumberingW::on_m_formula_le_textChanged() { + if (!ui->m_formula_le->text().isEmpty()) + applyEnable(true); + else applyEnable(false); +} + +/** + * @brief ElementAutonumberingW::on_buttonBox_clicked + * Action on @buttonBox clicked + */ +void ElementAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) { + //transform button to int + int answer = ui -> buttonBox -> buttonRole(button); + + switch (answer) { + case QDialogButtonBox::ApplyRole: + applyEnable(true); + emit applyPressed(); + break; + } +} + +/** + * @brief ElementAutonumberingW::applyEnable + * enable/disable the apply button + */ +void ElementAutonumberingW::applyEnable(bool b) { + ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b); +} diff --git a/sources/ui/elementautonumberingw.h b/sources/ui/elementautonumberingw.h new file mode 100644 index 000000000..163e044d9 --- /dev/null +++ b/sources/ui/elementautonumberingw.h @@ -0,0 +1,64 @@ +/* + Copyright 2006-2016 The QElectroTech Team + This file is part of QElectroTech. + + QElectroTech is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + QElectroTech is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . +*/ +#ifndef ELEMENTAUTONUMBERINGW_H +#define ELEMENTAUTONUMBERINGW_H + +#include + +class QAbstractButton; + +namespace Ui { + class ElementAutonumberingW; +} + +/** + This class implements the element autonumbering widget. + It loads the current formula applied to new elements and allows + the user to overwrite it with a new formula. Formula is added + while parsing label in customelement.cpp +*/ +class ElementAutonumberingW : public QWidget +{ + Q_OBJECT + + //METHODS + public: + explicit ElementAutonumberingW(QWidget *parent = 0); + ~ElementAutonumberingW(); + QString formula(); + void setContext(QString); + + + private: + + // SIGNALS + signals: + void applyPressed(); + + //SLOTS + private slots: + void on_m_formula_le_textChanged(); + void on_buttonBox_clicked(QAbstractButton *); + void applyEnable (bool = true); + + //ATTRIBUTES + private: + Ui::ElementAutonumberingW *ui; +}; + +#endif // ELEMENTAUTONUMBERINGW_H diff --git a/sources/ui/elementautonumberingw.ui b/sources/ui/elementautonumberingw.ui new file mode 100644 index 000000000..6f49cb0df --- /dev/null +++ b/sources/ui/elementautonumberingw.ui @@ -0,0 +1,176 @@ + + + ElementAutonumberingW + + + + 0 + 0 + 460 + 550 + + + + + 0 + 0 + + + + + 460 + 0 + + + + Form + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 50 + + + + + 0 + 0 + + + + + 0 + 50 + + + + false + + + Qt::LeftToRight + + + Qt::ScrollBarAsNeeded + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + true + + + Qt::AlignHCenter|Qt::AlignTop + + + + + 0 + 0 + 440 + 495 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + QLayout::SetFixedSize + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Auto Naming Pattern: + + + + + + + + + + + + Insert Formula Here e.g.: %prefix%l%c + + + + + + + Formula: + + + + + + + You can use the following variables to your formula: + -%prefix: Default Element Prefix + -%l: Element Line + -%c: Element Column + -%F: Folio Name + -%f or %id: Folio ID + -%total: Total of folios +You can also assign any other titleblock variable +that you create. Text and number inputs are also available + + + + + + + + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Apply + + + + + + + + diff --git a/sources/ui/folioautonumbering.cpp b/sources/ui/folioautonumbering.cpp index c523c8e34..b9ec39eca 100644 --- a/sources/ui/folioautonumbering.cpp +++ b/sources/ui/folioautonumbering.cpp @@ -135,7 +135,7 @@ void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() { * @brief FolioAutonumberingW::on_m_new_tabs_sb_valueChanged * Enable Apply if any new folio is to be created */ -void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(){ +void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(int){ if (ui->m_new_tabs_sb->value()>0) applyEnable(true); else applyEnable(false); } @@ -144,7 +144,7 @@ void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(){ * @brief FolioAutonumberingW::on_m_from_cb_currentIndexChanged * Enable To ComboBox */ -void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(){ +void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(int){ int index = ui->m_from_cb->currentIndex(); ui->m_to_cb->clear(); if (index > 0){ diff --git a/sources/ui/folioautonumbering.h b/sources/ui/folioautonumbering.h index 10b436802..5bb1c858d 100644 --- a/sources/ui/folioautonumbering.h +++ b/sources/ui/folioautonumbering.h @@ -26,7 +26,7 @@ class QAbstractButton; class QETProject; namespace Ui { - class FolioAutonumberingW; + class FolioAutonumberingW; } class FolioAutonumberingW : public QWidget @@ -35,16 +35,16 @@ class FolioAutonumberingW : public QWidget //METHODS public: - explicit FolioAutonumberingW(QETProject *project, QWidget *parent = 0); - ~FolioAutonumberingW(); + explicit FolioAutonumberingW(QETProject *project, QWidget *parent = 0); + ~FolioAutonumberingW(); - void setContext (QList autonums); + void setContext (QList autonums); NumerotationContext toNumContext() const; - QString autoNumSelected(); - int newFoliosNumber(); - bool newFolios; - int fromFolio(); - int toFolio(); + QString autoNumSelected(); + int newFoliosNumber(); + bool newFolios; + int fromFolio(); + int toFolio(); // SIGNALS signals: @@ -53,20 +53,20 @@ class FolioAutonumberingW : public QWidget //SLOTS private slots: - void on_m_create_new_tabs_rb_clicked(); - void on_m_autonumber_tabs_rb_clicked(); - void on_m_new_tabs_sb_valueChanged(); + void on_m_create_new_tabs_rb_clicked(); + void on_m_autonumber_tabs_rb_clicked(); + void on_m_new_tabs_sb_valueChanged(int); void on_buttonBox_clicked(QAbstractButton *); - void on_m_from_cb_currentIndexChanged(); + void on_m_from_cb_currentIndexChanged(int); void applyEnable (bool = true); //ATTRIBUTES private: - QETProject *project_; - Ui::FolioAutonumberingW *ui; + QETProject *project_; + Ui::FolioAutonumberingW *ui; QList num_part_list_; NumerotationContext m_context; - void updateFolioList(); + void updateFolioList(); }; #endif // FOLIOAUTONUMBERING_H diff --git a/sources/ui/numparteditorw.cpp b/sources/ui/numparteditorw.cpp index 3cb06a431..b1ad10a8e 100644 --- a/sources/ui/numparteditorw.cpp +++ b/sources/ui/numparteditorw.cpp @@ -149,7 +149,7 @@ void NumPartEditorW::on_value_field_textEdited() { * @brief NumPartEditorW::on_increase_spinBox_valueChanged * emit changed when @increase_spinBox value changed */ -void NumPartEditorW::on_increase_spinBox_valueChanged() { +void NumPartEditorW::on_increase_spinBox_valueChanged(int) { if (!ui -> value_field -> text().isEmpty()) emit changed(); } diff --git a/sources/ui/numparteditorw.h b/sources/ui/numparteditorw.h index 7ca0c25f7..90fdf9060 100644 --- a/sources/ui/numparteditorw.h +++ b/sources/ui/numparteditorw.h @@ -49,7 +49,7 @@ class NumPartEditorW : public QWidget private slots: void on_type_combo_activated(int); void on_value_field_textEdited(); - void on_increase_spinBox_valueChanged(); + void on_increase_spinBox_valueChanged(int); void setType (NumPartEditorW::type t, bool=false); signals: diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index 598ed3d64..43855f126 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -72,5 +72,5 @@ void ProjectPropertiesDialog::setCurrentPage(ProjectPropertiesDialog::Page p) { */ void ProjectPropertiesDialog::changeToFolio() { ProjectAutoNumConfigPage *autoNumPage = static_cast (m_properties_dialog->pages.at(2)); - autoNumPage->changeToTab(1); + autoNumPage->changeToTab(2); }