diff --git a/qelectrotech.pro b/qelectrotech.pro index b28366496..1972e200a 100644 --- a/qelectrotech.pro +++ b/qelectrotech.pro @@ -76,6 +76,7 @@ include(sources/QWidgetAnimation/QWidgetAnimation.pri) DEFINES += QAPPLICATION_CLASS=QApplication DEFINES += QT_MESSAGELOGCONTEXT DEFINES += GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\"" +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 TEMPLATE = app DEPENDPATH += . diff --git a/sources/ElementsCollection/elementscollectionmodel.h b/sources/ElementsCollection/elementscollectionmodel.h index ba3541084..beb86ab9a 100644 --- a/sources/ElementsCollection/elementscollectionmodel.h +++ b/sources/ElementsCollection/elementscollectionmodel.h @@ -19,6 +19,7 @@ #define ELEMENTSCOLLECTIONMODEL2_H #include +#include #include "elementslocation.h" class XmlProjectElementCollectionItem; diff --git a/sources/NameList/ui/namelistwidget.h b/sources/NameList/ui/namelistwidget.h index 2bd30f531..45074c980 100644 --- a/sources/NameList/ui/namelistwidget.h +++ b/sources/NameList/ui/namelistwidget.h @@ -1,25 +1,27 @@ /* Copyright 2006-2020 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 NAMELISTWIDGET_H #define NAMELISTWIDGET_H -#include "nameslist.h" #include +#include + +#include "nameslist.h" namespace Ui { class NameListWidget; @@ -32,27 +34,27 @@ namespace Ui { class NameListWidget : public QWidget { Q_OBJECT - + public: explicit NameListWidget(QWidget *parent = nullptr); ~NameListWidget(); - + void addLine(); void setNames (const NamesList &name_list); NamesList names() const; void setReadOnly(bool ro); bool isEmpty() const; void setClipboardValue (QHash value); - + private slots: void on_m_clipboard_cb_activated(int index); - + private: void clean(); - + private: Ui::NameListWidget *ui; - bool m_read_only = false; + bool m_read_only = false; }; #endif // NAMELISTWIDGET_H diff --git a/sources/configpages.cpp b/sources/configpages.cpp index 573c9c94d..caa5101e6 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -1,20 +1,26 @@ /* Copyright 2006-2020 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 +#include +#include +#include + #include "configpages.h" #include "borderpropertieswidget.h" #include "conductorpropertieswidget.h" @@ -27,10 +33,7 @@ #include "qetproject.h" #include "reportproperties.h" #include "qetapp.h" -#include -#include -#include -#include +#include "nameslist.h" /** @brief NewDiagramPage::NewDiagramPage @@ -249,13 +252,13 @@ void NewDiagramPage::loadSavedTbp() ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) { // epw contient les options d'export epw = new ExportPropertiesWidget(ExportProperties::defaultExportProperties()); - + // layout vertical contenant le titre, une ligne horizontale et epw QVBoxLayout *vlayout1 = new QVBoxLayout(); - + QLabel *title = new QLabel(this -> title()); vlayout1 -> addWidget(title); - + QFrame *horiz_line = new QFrame(); horiz_line -> setFrameShape(QFrame::HLine); vlayout1 -> addWidget(horiz_line); @@ -300,13 +303,13 @@ PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) { // epw contient les options d'export epw = new ExportPropertiesWidget(ExportProperties::defaultPrintProperties()); epw -> setPrintingMode(true); - + // layout vertical contenant le titre, une ligne horizontale et epw QVBoxLayout *vlayout1 = new QVBoxLayout(); - + QLabel *title = new QLabel(this -> title()); vlayout1 -> addWidget(title); - + QFrame *horiz_line = new QFrame(); horiz_line -> setFrameShape(QFrame::HLine); vlayout1 -> addWidget(horiz_line); @@ -329,10 +332,10 @@ PrintConfigPage::~PrintConfigPage() void PrintConfigPage::applyConf() { QString prefix = "print/default"; - + QSettings settings; epw -> exportProperties().toSettings(settings, prefix); - + // annule l'enregistrement de certaines proprietes non pertinentes settings.remove(prefix + "path"); settings.remove(prefix + "format"); diff --git a/sources/dataBase/ui/elementquerywidget.h b/sources/dataBase/ui/elementquerywidget.h index 8cf806058..0196b8d60 100644 --- a/sources/dataBase/ui/elementquerywidget.h +++ b/sources/dataBase/ui/elementquerywidget.h @@ -20,6 +20,7 @@ #include #include +#include class QListWidgetItem; diff --git a/sources/elementtextsmover.h b/sources/elementtextsmover.h index 9428b35fa..e53facd91 100644 --- a/sources/elementtextsmover.h +++ b/sources/elementtextsmover.h @@ -20,6 +20,7 @@ #include #include +#include class QGraphicsItem; class DiagramTextItem; @@ -37,16 +38,16 @@ class ElementTextsMover ElementTextsMover(); private: ElementTextsMover(const ElementTextsMover &); - + public: bool isReady() const; int beginMovement(Diagram *diagram, QGraphicsItem *driver_item = nullptr); void continueMovement(QGraphicsSceneMouseEvent *event); void endMovement(); - + private: QString undoText() const; - + private: bool m_movement_running = false; Diagram *m_diagram = nullptr; diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp index c89077ec8..dd864f5b0 100644 --- a/sources/properties/xrefproperties.cpp +++ b/sources/properties/xrefproperties.cpp @@ -15,9 +15,11 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ +#include +#include + #include "xrefproperties.h" #include "qetapp.h" -#include /** @brief XRefProperties::XRefProperties @@ -56,7 +58,7 @@ void XRefProperties::toSettings(QSettings &settings, QString slave_label = m_slave_label; settings.setValue(prefix + "slave_label", slave_label); - + QMetaEnum var = QMetaEnum::fromType(); settings.setValue(prefix + "xrefpos", var.valueToKey(m_xref_pos)); @@ -110,7 +112,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const xml_element.setAttribute("snapto", snap); QString xrefpos; - + QMetaEnum var = QMetaEnum::fromType(); xml_element.setAttribute("xrefpos", var.valueToKey(m_xref_pos)); diff --git a/sources/properties/xrefproperties.h b/sources/properties/xrefproperties.h index 39cf977af..446060f52 100644 --- a/sources/properties/xrefproperties.h +++ b/sources/properties/xrefproperties.h @@ -18,8 +18,10 @@ #ifndef XREFPROPERTIES_H #define XREFPROPERTIES_H -#include "propertiesinterface.h" #include +#include + +#include "propertiesinterface.h" /** @brief The XRefProperties class diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index 9de7db721..9e7ce75e2 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -1,23 +1,27 @@ /* Copyright 2006-2020 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 ELEMENT_H #define ELEMENT_H +#include +#include +#include + #include "qet.h" #include "qetgraphicsitem.h" #include "diagramcontext.h" @@ -25,9 +29,6 @@ #include "elementslocation.h" #include "nameslist.h" -#include -#include - class QETProject; class Terminal; class Conductor; @@ -40,7 +41,7 @@ class ElementTextItemGroup; class Element : public QetGraphicsItem { friend class DiagramEventAddElement; - + Q_OBJECT public: /** @@ -64,7 +65,7 @@ class Element : public QetGraphicsItem ~Element() override; private: Element(const Element &); - + // attributes public: /** @@ -74,7 +75,7 @@ class Element : public QetGraphicsItem */ enum { Type = UserType + 1000 }; int type() const override { return Type; } - + signals: void linkedElementChanged(); //This signal is emited when the linked elements with this element change void elementInfoChange( @@ -91,12 +92,12 @@ class Element : public QetGraphicsItem DynamicElementTextItem *text, ElementTextItemGroup *group); - + public: QList terminals() const; QList conductors() const; QList> AlignedFreeTerminals() const; - + //METHODS related to information DiagramContext elementInformations()const {return m_element_informations;} @@ -118,7 +119,7 @@ class Element : public QetGraphicsItem bool isFreezeLabel() const {return m_freeze_label;} void freezeNewAddedElement(); QString actualLabel(); - + QString name() const override; ElementsLocation location() const; virtual void setHighlighted(bool); @@ -140,7 +141,7 @@ class Element : public QetGraphicsItem int> &) const; QUuid uuid() const; int orientation() const; - + //METHODS related to texts void addDynamicTextItem(DynamicElementTextItem *deti = nullptr); void removeDynamicTextItem(DynamicElementTextItem *deti); @@ -156,7 +157,7 @@ class Element : public QetGraphicsItem bool removeTextFromGroup( DynamicElementTextItem *text, ElementTextItemGroup *group); - + //METHODS related to linked element bool isFree() const; virtual void linkToElement(Element *) {} @@ -171,7 +172,7 @@ class Element : public QetGraphicsItem protected: void drawAxes(QPainter *, const QStyleOptionGraphicsItem *); void setSize(int, int); - + private: void drawSelection( QPainter *, @@ -212,25 +213,25 @@ class Element : public QetGraphicsItem // to be use in the function element::fromXml QHash m_converted_text_from_xml_description; - + //ATTRIBUTES related to linked element QList connected_elements; QList tmp_uuids_link; QUuid m_uuid; kind m_link_type = Element::Simple; - + //ATTRIBUTES related to informations DiagramContext m_element_informations, m_kind_informations; autonum::sequentialNumbers m_autoNum_seq; bool m_freeze_label = false; QString m_F_str; - + ElementsLocation m_location; NamesList m_names; QList m_terminals; const QPicture m_picture; const QPicture m_low_zoom_picture; - + private: bool m_must_highlight = false; QSize dimensions; diff --git a/sources/qetinformation.cpp b/sources/qetinformation.cpp index 7af614854..4ff4a6de9 100644 --- a/sources/qetinformation.cpp +++ b/sources/qetinformation.cpp @@ -1,25 +1,26 @@ /* Copyright 2006-2020 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 "qetinformation.h" #include #include +#include "qetinformation.h" + /** @brief QETInformation::titleblockInfoKeys @return all available key for use with a titleblock @@ -47,7 +48,7 @@ QStringList QETInformation::titleblockInfoKeys() info_list << "savedtime"; info_list << "savedfilename"; info_list << "savedfilepath"; - + return info_list; } diff --git a/sources/qetinformation.h b/sources/qetinformation.h index ee8f25de0..b2dcebd12 100644 --- a/sources/qetinformation.h +++ b/sources/qetinformation.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 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 . */ @@ -19,6 +19,7 @@ #define QETINFORMATION_H #include +#include namespace QETInformation { diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index d38a17857..1894d8c6d 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -15,6 +15,13 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include +#include +#include +#include +#include + #include "qetproject.h" #include "diagram.h" #include "qetapp.h" @@ -30,11 +37,6 @@ #include "numerotationcontextcommands.h" #include "assignvariables.h" -#include -#include -#include -#include - static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min /** diff --git a/sources/qetproject.h b/sources/qetproject.h index 00e39ec58..49eb07974 100644 --- a/sources/qetproject.h +++ b/sources/qetproject.h @@ -1,23 +1,26 @@ /* Copyright 2006-2020 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 QET_PROJECT_H #define QET_PROJECT_H +#include +#include + #include "nameslist.h" #include "elementslocation.h" #include "borderproperties.h" @@ -28,8 +31,6 @@ #include "projectdatabase.h" #include "reportproperties.h" -#include - class Diagram; class ElementsLocation; class QETResult; @@ -62,7 +63,7 @@ class QETProject : public QObject }; Q_PROPERTY(bool autoConductor READ autoConductor WRITE setAutoConductor) - + // constructors, destructor public: QETProject (QObject *parent = nullptr); @@ -72,7 +73,7 @@ class QETProject : public QObject private: QETProject(const QETProject &); - + // methods public: projectDataBase *dataBase(); @@ -166,13 +167,13 @@ class QETProject : public QObject DiagramContext projectProperties(); void setProjectProperties(const DiagramContext &); QUndoStack* undoStack() {return m_undo_stack;} - + public slots: Diagram *addNewDiagram(int pos = -1); void removeDiagram(Diagram *); void diagramOrderChanged(int, int); void setModified(bool); - + signals: void projectFilePathChanged(QETProject *, const QString &); void projectTitleChanged(QETProject *, const QString &); @@ -195,14 +196,14 @@ class QETProject : public QObject void folioAutoNumChanged(QString); void defaultTitleBlockPropertiesChanged(); void conductorAutoNumChanged(); - + private slots: void updateDiagramsFolioData(); void updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *, const QString &); void removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *, const QString &); void usedTitleBlockTemplateChanged(const QString &); void undoStackChanged (bool a) {if (!a) setModified(true);} - + private: void readProjectXml(QDomDocument &xml_project); void readDiagramsXml(QDomDocument &xml_project); @@ -217,7 +218,7 @@ class QETProject : public QObject void writeBackup(); void init(); ProjectState openFile(QFile *file); - + // attributes private: /// File path this project is saved to diff --git a/sources/ui/dynamicelementtextmodel.h b/sources/ui/dynamicelementtextmodel.h index 4684c28fd..bceb1eff7 100644 --- a/sources/ui/dynamicelementtextmodel.h +++ b/sources/ui/dynamicelementtextmodel.h @@ -19,6 +19,8 @@ #define DYNAMICELEMENTTEXTMODEL_H #include +#include + #include #include "dynamicelementtextitem.h" @@ -35,7 +37,7 @@ class Element; class DynamicElementTextModel : public QStandardItemModel { Q_OBJECT - + public: enum ValueType { textFrom =1, @@ -58,10 +60,10 @@ class DynamicElementTextModel : public QStandardItemModel grpHoldBottom, grpFrame }; - + DynamicElementTextModel(Element *element, QObject *parent = nullptr); ~DynamicElementTextModel() override; - + bool indexIsInGroup(const QModelIndex &index) const; DynamicElementTextItem *textFromIndex(const QModelIndex &index) const; DynamicElementTextItem *textFromItem(QStandardItem *item) const; @@ -72,13 +74,13 @@ class DynamicElementTextModel : public QStandardItemModel QUndoCommand *undoForEditedGroup( ElementTextItemGroup *group, QUndoCommand *parent_undo = nullptr) const; - + ElementTextItemGroup *groupFromIndex(const QModelIndex &index) const; ElementTextItemGroup *groupFromItem(QStandardItem *item) const; QModelIndex indexFromGroup(ElementTextItemGroup *group) const; bool indexIsText(const QModelIndex &index) const; bool indexIsGroup(const QModelIndex &index) const; - + bool canDropMimeData( const QMimeData *data, Qt::DropAction action, @@ -93,10 +95,10 @@ class DynamicElementTextModel : public QStandardItemModel const QModelIndex &parent) override; QMimeData *mimeData(const QModelIndexList &indexes) const override; QStringList mimeTypes() const override; - + signals: void dataChanged(); - + private: QList itemsForText(DynamicElementTextItem *deti); void addText(DynamicElementTextItem *deti); @@ -119,7 +121,7 @@ class DynamicElementTextModel : public QStandardItemModel DynamicElementTextModel::ValueType type); void updateDataFromGroup(ElementTextItemGroup *group, DynamicElementTextModel::ValueType type); - + private: QPointer m_element; QHash m_texts_list; @@ -134,10 +136,10 @@ class DynamicElementTextModel : public QStandardItemModel class DynamicTextItemDelegate : public QStyledItemDelegate { Q_OBJECT - + public: DynamicTextItemDelegate(QObject *parent = Q_NULLPTR); - + QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, @@ -146,10 +148,10 @@ class DynamicTextItemDelegate : public QStyledItemDelegate QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; - + protected: bool eventFilter(QObject *object, QEvent *event) override; - + private: QStringList availableInfo(DynamicElementTextItem *deti) const; }; diff --git a/sources/ui/linksingleelementwidget.h b/sources/ui/linksingleelementwidget.h index 19b389fb3..cd436322e 100644 --- a/sources/ui/linksingleelementwidget.h +++ b/sources/ui/linksingleelementwidget.h @@ -18,6 +18,8 @@ #ifndef LINKSINGLEELEMENTWIDGET_H #define LINKSINGLEELEMENTWIDGET_H +#include + #include "element.h" #include "abstractelementpropertieseditorwidget.h" @@ -73,30 +75,30 @@ class LinkSingleElementWidget : public AbstractElementPropertiesEditorWidget void hideButtons(); void showButtons(); void headerCustomContextMenuRequested(const QPoint &pos); - + void on_m_unlink_pb_clicked(); void on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column); void on_m_tree_widget_customContextMenuRequested(const QPoint &pos); void on_m_show_linked_pb_clicked(); void on_m_show_this_pb_clicked(); - + void on_m_search_field_textEdited(const QString &arg1); - + private: Ui::LinkSingleElementWidget *ui; bool m_unlink = false; Element::kind m_filter; - + QHash m_qtwi_elmt_hash; QHash m_qtwi_strl_hash; - + QTreeWidgetItem *m_qtwi_at_context_menu = nullptr, *m_pending_qtwi = nullptr; - + Element *m_showed_element = nullptr, *m_element_to_link = nullptr; - + QMenu *m_context_menu; QAction *m_link_action, *m_show_qtwi, diff --git a/sources/ui/masterpropertieswidget.h b/sources/ui/masterpropertieswidget.h index 155019123..a75ed1311 100644 --- a/sources/ui/masterpropertieswidget.h +++ b/sources/ui/masterpropertieswidget.h @@ -20,6 +20,7 @@ #include #include + #include "abstractelementpropertieseditorwidget.h" class Element; diff --git a/sources/ui/multipastedialog.cpp b/sources/ui/multipastedialog.cpp index 9f66a0519..ea0bf2753 100644 --- a/sources/ui/multipastedialog.cpp +++ b/sources/ui/multipastedialog.cpp @@ -15,13 +15,16 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include +#include + #include "multipastedialog.h" #include "ui_multipastedialog.h" #include "diagram.h" #include "diagramcommands.h" #include "element.h" #include "conductorautonumerotation.h" -#include MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) : QDialog(parent), @@ -29,16 +32,16 @@ MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) : m_diagram(diagram) { ui->setupUi(this); - + connect(ui->m_x_sb, static_cast(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview); connect(ui->m_y_sb, static_cast(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview); connect(ui->m_copy_count, static_cast(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview); - + QRectF br; for (QGraphicsItem *item : m_diagram->selectedItems()) br = br.united(item->mapToScene(item->boundingRect()).boundingRect()); m_origin = br.topLeft(); - + m_document = m_diagram->toXml(false); updatePreview(); } @@ -56,7 +59,7 @@ MultiPasteDialog::~MultiPasteDialog() } } } - + delete ui; } @@ -73,20 +76,20 @@ void MultiPasteDialog::updatePreview() } m_pasted_content.clear(); m_pasted_content_list.clear(); - + QPointF offset(ui->m_x_sb->value(), ui->m_y_sb->value()); QPointF pos = m_origin+offset; - + for(int i=0 ; im_copy_count->value() ; i++) - { + { DiagramContent dc; m_diagram->fromXml(m_document, pos, false, &dc); - + m_pasted_content += dc; m_pasted_content_list << dc; pos += offset; } - + if(m_pasted_content.count()) m_diagram->adjustSceneRect(); } @@ -96,7 +99,7 @@ void MultiPasteDialog::on_m_button_box_accepted() if(m_pasted_content.count()) { m_diagram->undoStack().beginMacro(tr("Multi-collage")); - + QSettings settings; bool erase_label = settings.value("diagramcommands/erase-label-on-copy", true).toBool(); //Ensure when 'auto_num' is checked, the settings 'save_label' is to true. @@ -105,18 +108,18 @@ void MultiPasteDialog::on_m_button_box_accepted() //and so the auto_num below do nothing (there is not a formula to compare) if(ui->m_auto_num_cb->isChecked()) settings.setValue("diagramcommands/erase-label-on-copy", false); - - - + + + m_diagram->clearSelection(); m_diagram->undoStack().push(new PasteDiagramCommand(m_diagram, m_pasted_content)); - + for(DiagramContent dc : m_pasted_content_list) { QList pasted_elements = dc.m_elements; //Sort the list element by there pos (top -> bottom) std::sort(pasted_elements.begin(), pasted_elements.end(), [](Element *a, Element *b){return (a->pos().y() < b->pos().y());}); - + //Auto-connection if(ui->m_auto_connection_cb->isChecked()) { @@ -125,10 +128,10 @@ void MultiPasteDialog::on_m_button_box_accepted() while (!elmt->AlignedFreeTerminals().isEmpty()) { QPair pair = elmt->AlignedFreeTerminals().takeFirst(); - + Conductor *conductor = new Conductor(pair.first, pair.second); m_diagram->undoStack().push(new AddItemCommand(conductor, m_diagram, QPointF())); - + //Autonum the new conductor, the undo command associated for this, have for parent undo_object ConductorAutoNumerotation can (conductor, m_diagram); can.numerate(); @@ -138,7 +141,7 @@ void MultiPasteDialog::on_m_button_box_accepted() } } } - + //Set up the label of element //Instead of use the current autonum of project, //we try to fetch the same formula of the pasted element, in the several autonum of the project @@ -152,7 +155,7 @@ void MultiPasteDialog::on_m_button_box_accepted() { QHash autonums = m_diagram->project()->elementAutoNum(); QHashIterator hash_iterator(autonums); - + while(hash_iterator.hasNext()) { hash_iterator.next(); @@ -167,7 +170,7 @@ void MultiPasteDialog::on_m_button_box_accepted() } //Like elements, we compare formula of pasted conductor with the autonums available in the project. if(ui->m_auto_num_cond_cb->isChecked()) - { + { //This list is to ensure we not numerate twice the same conductor QList numerated; //Start with the element at top @@ -184,7 +187,7 @@ void MultiPasteDialog::on_m_button_box_accepted() { QHash autonums = m_diagram->project()->conductorAutoNum(); QHashIterator hash_iterator(autonums); - + while (hash_iterator.hasNext()) { hash_iterator.next(); @@ -205,7 +208,7 @@ void MultiPasteDialog::on_m_button_box_accepted() } } } - + m_diagram->adjustSceneRect(); m_accept = true; settings.setValue("diagramcommands/erase-label-on-copy", erase_label); diff --git a/sources/ui/potentialselectordialog.cpp b/sources/ui/potentialselectordialog.cpp index daa49b227..bfbededa4 100644 --- a/sources/ui/potentialselectordialog.cpp +++ b/sources/ui/potentialselectordialog.cpp @@ -15,11 +15,14 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include +#include + #include "potentialselectordialog.h" #include "ui_potentialselectordialog.h" #include "conductor.h" #include "terminal.h" -#include #include "QPropertyUndoCommand/qpropertyundocommand.h" #include "diagram.h" #include "element.h" @@ -191,14 +194,14 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QList H; for (ConductorProperties cp : list) { @@ -213,7 +216,7 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QListisChecked()) { return H.value(b); } } - + return ConductorProperties(); } @@ -290,7 +293,7 @@ void PotentialSelectorDialog::buildWidget() QString text1(tr("%n conducteurs composent le potentiel suivant :", "", m_potential_selector->m_conductor_number_1)); - + ConductorProperties cp1; if(!m_potential_selector->m_properties_list_1.isEmpty()) cp1 = m_potential_selector->m_properties_list_1.first();; @@ -308,14 +311,14 @@ void PotentialSelectorDialog::buildWidget() if(!cp1.m_wire_section.isEmpty()) text1.append(tr("\nSection du conducteur : %1") .arg(cp1.m_wire_section)); - + QString text2(tr("%n conducteurs composent le potentiel suivant :", "", m_potential_selector->m_conductor_number_2)); ConductorProperties cp2; if(!m_potential_selector->m_properties_list_2.isEmpty()) cp2 = m_potential_selector->m_properties_list_2.first(); - + if(!cp2.text.isEmpty()) text2.append(tr("\nNuméro : %1").arg(cp2.text)); if(!cp2.m_function.isEmpty()) @@ -329,7 +332,7 @@ void PotentialSelectorDialog::buildWidget() if(!cp2.m_wire_section.isEmpty()) text2.append(tr("\nSection du conducteur : %1") .arg(cp2.m_wire_section)); - + QRadioButton *rb1 = new QRadioButton(text1, this); QRadioButton *rb2 = new QRadioButton(text2, this); @@ -429,7 +432,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() new_value, undo); } - + //Check if formula of the new potential // have incompatible variable with folio report QRegularExpression rx ("%sequf_|%seqtf_|%seqhf_|%id|%F|%M|%LM"); @@ -445,7 +448,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() << "%F" << "%M" << "%LM"; - + QString text(tr("La formule du nouveau potentiel contient des variables incompatibles avec les reports de folio.\n" "Veuillez saisir une formule compatible pour ce potentiel.\n" "Les variables suivantes sont incompatibles :\n" @@ -455,7 +458,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() fag.setText(text); fag.setFormula(cp.m_formula); fag.exec(); - + QString new_formula = fag.formula(); QSet c_list = m_report->conductors().first()->relatedPotentialConductors(); c_list.insert(m_report->conductors().first()); @@ -471,7 +474,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted() new_value, undo); } - + break; } } diff --git a/sources/ui/shapegraphicsitempropertieswidget.cpp b/sources/ui/shapegraphicsitempropertieswidget.cpp index 6a0519f33..97c07e465 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.cpp +++ b/sources/ui/shapegraphicsitempropertieswidget.cpp @@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ + +#include + #include "shapegraphicsitempropertieswidget.h" #include "ui_shapegraphicsitempropertieswidget.h" #include "qetshapeitem.h" diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index c14b75a1c..b5f9ff002 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -15,12 +15,14 @@ You should have received a copy of the GNU General Public License along with QElectroTech. If not, see . */ -#include "xrefpropertieswidget.h" #include +#include +#include + +#include "xrefpropertieswidget.h" #include "ui_xrefpropertieswidget.h" #include "qdebug.h" -#include /** @brief XRefPropertiesWidget::XRefPropertiesWidget diff --git a/sources/ui/xrefpropertieswidget.h b/sources/ui/xrefpropertieswidget.h index 73d33a9e9..bd7471cd4 100644 --- a/sources/ui/xrefpropertieswidget.h +++ b/sources/ui/xrefpropertieswidget.h @@ -19,6 +19,8 @@ #define XREFPROPERTIESWIDGET_H #include +#include + #include "properties/xrefproperties.h" namespace Ui { diff --git a/sources/undocommand/addelementtextcommand.h b/sources/undocommand/addelementtextcommand.h index fc73f1d9b..5697db885 100644 --- a/sources/undocommand/addelementtextcommand.h +++ b/sources/undocommand/addelementtextcommand.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 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 . */ @@ -21,6 +21,7 @@ #include #include #include +#include class Element; class DynamicElementTextItem; @@ -37,10 +38,10 @@ class AddElementTextCommand : public QUndoCommand DynamicElementTextItem *deti, QUndoCommand *parent = nullptr); ~AddElementTextCommand() override; - + void undo() override; void redo() override; - + private: Element *m_element = nullptr; DynamicElementTextItem *m_text = nullptr; @@ -64,10 +65,10 @@ class AddTextsGroupCommand : public QUndoCommand QList texts_list, QUndoCommand *parent = nullptr); ~AddTextsGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_element; QPointer m_group; @@ -88,10 +89,10 @@ class RemoveTextsGroupCommand : public QUndoCommand ElementTextItemGroup *group, QUndoCommand *parent = nullptr); ~RemoveTextsGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_element; QPointer m_group; @@ -108,10 +109,10 @@ class AddTextToGroupCommand : public QUndoCommand ElementTextItemGroup *group, QUndoCommand *parent = nullptr); ~AddTextToGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_text; QPointer m_group; @@ -128,10 +129,10 @@ class RemoveTextFromGroupCommand : public QUndoCommand ElementTextItemGroup *group, QUndoCommand *parent = nullptr); ~RemoveTextFromGroupCommand() override; - + void undo() override; void redo() override; - + private: QPointer m_text; QPointer m_group; @@ -148,12 +149,12 @@ class AlignmentTextsGroupCommand : public QUndoCommand Qt::Alignment new_alignment, QUndoCommand *parent = nullptr); ~AlignmentTextsGroupCommand() override; - + int id() const override{return 6;} bool mergeWith(const QUndoCommand *other) override; void undo() override; void redo() override; - + private: QPointer m_group; Qt::Alignment m_previous_alignment, diff --git a/sources/undocommand/deleteqgraphicsitemcommand.h b/sources/undocommand/deleteqgraphicsitemcommand.h index 7466e2ac3..b2c3ba400 100644 --- a/sources/undocommand/deleteqgraphicsitemcommand.h +++ b/sources/undocommand/deleteqgraphicsitemcommand.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 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 . */ @@ -19,6 +19,8 @@ #define DELETEQGRAPHICSITEMCOMMAND_H #include +#include + #include "diagramcontent.h" class Diagram; @@ -32,17 +34,17 @@ class DeleteQGraphicsItemCommand : public QUndoCommand public: DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand * parent = nullptr); ~DeleteQGraphicsItemCommand() override; - + private: DeleteQGraphicsItemCommand(const DeleteQGraphicsItemCommand &); - + void setPotentialsOfRemovedElements(); Terminal *terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude); public: void undo() override; void redo() override; - + // attributes private: DiagramContent m_removed_contents; diff --git a/sources/undocommand/rotateselectioncommand.h b/sources/undocommand/rotateselectioncommand.h index bdf1d1b76..921bcac63 100644 --- a/sources/undocommand/rotateselectioncommand.h +++ b/sources/undocommand/rotateselectioncommand.h @@ -1,17 +1,17 @@ /* Copyright 2006-2020 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 . */ @@ -20,6 +20,7 @@ #include #include +#include class Diagram; class ConductorTextItem; @@ -35,16 +36,16 @@ class RotateSelectionCommand : public QUndoCommand RotateSelectionCommand(Diagram *diagram, qreal angle=90, QUndoCommand *parent=nullptr); void undo() override; void redo() override; - + bool isValid(); - + private: Diagram *m_diagram =nullptr; - + QList> m_cond_text; QHash m_rotate_by_user; QList m_undo; - + }; #endif // ROTATESELECTIONCOMMAND_H diff --git a/sources/undocommand/rotatetextscommand.h b/sources/undocommand/rotatetextscommand.h index 8ee37f3d3..2bbc80c24 100644 --- a/sources/undocommand/rotatetextscommand.h +++ b/sources/undocommand/rotatetextscommand.h @@ -20,6 +20,7 @@ #include #include +#include class ConductorTextItem; class Diagram; @@ -34,14 +35,14 @@ class RotateTextsCommand : public QUndoCommand { public: RotateTextsCommand(Diagram *diagram, QUndoCommand *parent=nullptr); - + void undo() override; void redo() override; - + private: void openDialog(); void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end); - + private: QPointer m_diagram; QHash m_cond_texts;