From fa68d545d06cc589da608ca0508a8d7642d0a9f9 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:14:40 +0200 Subject: [PATCH 1/3] correct more indentations / whitespace --- .../elementscollectionmodel.cpp | 78 ++--- .../elementscollectionmodel.h | 8 +- .../elementscollectionwidget.cpp | 60 ++-- .../ElementsCollection/elementslocation.cpp | 90 +++--- sources/ElementsCollection/elementslocation.h | 6 +- .../fileelementcollectionitem.cpp | 36 +-- .../fileelementcollectionitem.h | 6 +- .../qetgraphicshandlerutility.cpp | 8 +- .../GraphicsItem/demoterminalstrip.cpp | 274 +++++++++--------- .../GraphicsItem/demoterminalstrip.h | 68 ++--- .../terminalstriplayoutshandler.cpp | 36 +-- .../properties/terminalstriplayoutshandler.h | 42 +-- .../GraphicsItem/terminalstripdrawer.cpp | 30 +- .../GraphicsItem/terminalstripdrawer.h | 152 +++++----- .../GraphicsItem/terminalstripitem.cpp | 6 +- .../GraphicsItem/trueterminalstrip.cpp | 30 +- .../GraphicsItem/trueterminalstrip.h | 102 +++---- sources/autoNum/assignvariables.h | 2 +- .../diagramevent/diagrameventinterface.cpp | 4 +- sources/diagramevent/diagrameventinterface.h | 6 +- sources/editor/arceditor.cpp | 10 +- sources/editor/editorcommands.h | 14 +- sources/editor/elementscene.cpp | 2 +- sources/editor/graphicspart/partline.h | 2 +- sources/editor/graphicspart/partpolygon.h | 2 +- sources/editor/graphicspart/partrectangle.cpp | 4 +- sources/editor/graphicspart/partrectangle.h | 6 +- sources/editor/graphicspart/partterminal.h | 2 +- sources/editor/styleeditor.cpp | 2 +- sources/factory/elementpicturefactory.cpp | 22 +- sources/print/projectprintwindow.cpp | 14 +- sources/print/projectprintwindow.h | 2 +- sources/project/projectpropertieshandler.cpp | 28 +- sources/project/projectpropertieshandler.h | 36 +-- sources/properties/elementdata.cpp | 2 +- sources/qetgraphicsitem/conductor.cpp | 18 +- sources/qetgraphicsitem/conductor.h | 4 +- sources/qetgraphicsitem/element.cpp | 22 +- .../undocommand/addgraphicsobjectcommand.cpp | 80 ++--- .../undocommand/addgraphicsobjectcommand.h | 54 ++-- .../undocommand/changeelementdatacommand.cpp | 46 +-- .../undocommand/changeelementdatacommand.h | 42 +-- sources/undocommand/itemmodelcommand.h | 6 +- .../undocommand/movegraphicsitemcommand.cpp | 222 +++++++------- sources/xml/terminalstripitemxml.cpp | 146 +++++----- sources/xml/terminalstripitemxml.h | 40 +-- 46 files changed, 936 insertions(+), 936 deletions(-) diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 6c67ebd0c..679b5232a 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -111,10 +111,10 @@ QStringList ElementsCollectionModel::mimeTypes() const @return */ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, - Qt::DropAction action, - int row, - int column, - const QModelIndex &parent) const + Qt::DropAction action, + int row, + int column, + const QModelIndex &parent) const { if (!(QStandardItemModel::canDropMimeData(data, action, @@ -258,9 +258,9 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, @param projects : list of projects to load */ void ElementsCollectionModel::loadCollections(bool common_collection, - bool company_collection, - bool custom_collection, - QList projects) + bool company_collection, + bool custom_collection, + QList projects) { m_items_list_to_setUp.clear(); @@ -313,8 +313,8 @@ void ElementsCollectionModel::addCommonCollection(bool set_data) { FileElementCollectionItem *feci = new FileElementCollectionItem(); if (feci->setRootPath(QETApp::commonElementsDirN(), - set_data, - m_hide_element)) { + set_data, + m_hide_element)) { invisibleRootItem()->appendRow(feci); if (set_data) feci->setUpData(); @@ -324,41 +324,41 @@ void ElementsCollectionModel::addCommonCollection(bool set_data) } /** - @brief ElementsCollectionModel::addCompanyCollection - Add the company elements collection to this model - @param set_data + @brief ElementsCollectionModel::addCompanyCollection + Add the company elements collection to this model + @param set_data */ void ElementsCollectionModel::addCompanyCollection(bool set_data) { - FileElementCollectionItem *feci = new FileElementCollectionItem(); - if (feci->setRootPath(QETApp::companyElementsDirN(), - set_data, - m_hide_element)) { - invisibleRootItem()->appendRow(feci); - if (set_data) - feci->setUpData(); - } - else - delete feci; + FileElementCollectionItem *feci = new FileElementCollectionItem(); + if (feci->setRootPath(QETApp::companyElementsDirN(), + set_data, + m_hide_element)) { + invisibleRootItem()->appendRow(feci); + if (set_data) + feci->setUpData(); + } + else + delete feci; } /** - @brief ElementsCollectionModel::addCustomCollection - Add the custom elements collection to this model - @param set_data + @brief ElementsCollectionModel::addCustomCollection + Add the custom elements collection to this model + @param set_data */ void ElementsCollectionModel::addCustomCollection(bool set_data) { - FileElementCollectionItem *feci = new FileElementCollectionItem(); - if (feci->setRootPath(QETApp::customElementsDirN(), - set_data, - m_hide_element)) { - invisibleRootItem()->appendRow(feci); - if (set_data) - feci->setUpData(); - } - else - delete feci; + FileElementCollectionItem *feci = new FileElementCollectionItem(); + if (feci->setRootPath(QETApp::customElementsDirN(), + set_data, + m_hide_element)) { + invisibleRootItem()->appendRow(feci); + if (set_data) + feci->setUpData(); + } + else + delete feci; } /** @@ -579,9 +579,9 @@ QModelIndex ElementsCollectionModel::indexFromLocation( { QList child_list; - for (int i=0 ; i(item(i))); - } + } foreach(ElementCollectionItem *eci, child_list) { @@ -590,8 +590,8 @@ QModelIndex ElementsCollectionModel::indexFromLocation( if (eci->type() == FileElementCollectionItem::Type) { if (FileElementCollectionItem *feci = static_cast(eci)) { if ( (location.isCommonCollection() && feci->isCommonCollection()) || - (location.isCompanyCollection() && feci->isCompanyCollection()) || - (location.isCustomCollection() && !feci->isCommonCollection()) ) { + (location.isCompanyCollection() && feci->isCompanyCollection()) || + (location.isCustomCollection() && !feci->isCommonCollection()) ) { match_eci = feci->itemAtPath(location.collectionPath(false)); } } diff --git a/sources/ElementsCollection/elementscollectionmodel.h b/sources/ElementsCollection/elementscollectionmodel.h index 254a4cc5e..3acd998f3 100644 --- a/sources/ElementsCollection/elementscollectionmodel.h +++ b/sources/ElementsCollection/elementscollectionmodel.h @@ -42,11 +42,11 @@ class ElementsCollectionModel : public QStandardItemModel bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; - void loadCollections(bool common_collection, bool company_collection, bool custom_collection, QList projects); + void loadCollections(bool common_collection, bool company_collection, bool custom_collection, QList projects); - void addCommonCollection(bool set_data = true); - void addCompanyCollection(bool set_data = true); - void addCustomCollection(bool set_data = true); + void addCommonCollection(bool set_data = true); + void addCompanyCollection(bool set_data = true); + void addCustomCollection(bool set_data = true); void addLocation(const ElementsLocation& location); void addProject(QETProject *project, bool set_data = true); diff --git a/sources/ElementsCollection/elementscollectionwidget.cpp b/sources/ElementsCollection/elementscollectionwidget.cpp index 011805010..da7d4df70 100644 --- a/sources/ElementsCollection/elementscollectionwidget.cpp +++ b/sources/ElementsCollection/elementscollectionwidget.cpp @@ -96,7 +96,7 @@ void ElementsCollectionWidget::addProject(QETProject *project) m_progress_bar->show(); m_tree_view->setDisabled(true); QList prj; prj.append(project); - m_model->loadCollections(false, false, false, prj); + m_model->loadCollections(false, false, false, prj); } else { m_waiting_project.append(project); @@ -148,26 +148,26 @@ void ElementsCollectionWidget::setUpAction() m_open_dir = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier correspondant"), this); m_edit_element = new QAction(QET::Icons::ElementEdit, - tr("Éditer l'élément"), this); + tr("Éditer l'élément"), this); m_delete_element = new QAction(QET::Icons::ElementDelete, - tr("Supprimer l'élément"), this); + tr("Supprimer l'élément"), this); m_delete_dir = new QAction(QET::Icons::FolderDelete, tr("Supprimer le dossier"), this); m_reload = new QAction(QET::Icons::ViewRefresh, - tr("Recharger les collections"), this); + tr("Recharger les collections"), this); m_edit_dir = new QAction(QET::Icons::FolderEdit, tr("Éditer le dossier"), this); m_new_directory = new QAction(QET::Icons::FolderNew, - tr("Nouveau dossier"), this); + tr("Nouveau dossier"), this); m_new_element = new QAction(QET::Icons::ElementNew, - tr("Nouvel élément"), this); + tr("Nouvel élément"), this); m_show_this_dir = new QAction(QET::Icons::FolderOnlyThis, - tr("Afficher uniquement ce dossier"), - this); + tr("Afficher uniquement ce dossier"), + this); m_show_all_dir = new QAction(QET::Icons::FolderShowAll, - tr("Afficher tous les dossiers"), this); + tr("Afficher tous les dossiers"), this); m_dir_propertie = new QAction(QET::Icons::FolderProperties, - tr("Propriété du dossier"), this); + tr("Propriété du dossier"), this); } /** @@ -385,10 +385,10 @@ void ElementsCollectionWidget::deleteElement() ElementsLocation loc(eci->collectionPath()); if (! (loc.isElement() - && loc.exist() - && loc.isFileSystem() - && (loc.collectionPath().startsWith("company://") - || loc.collectionPath().startsWith("custom://"))) ) return; + && loc.exist() + && loc.isFileSystem() + && (loc.collectionPath().startsWith("company://") + || loc.collectionPath().startsWith("custom://"))) ) return; if (QET::QetMessageBox::question( this, @@ -401,8 +401,8 @@ void ElementsCollectionWidget::deleteElement() if (file.remove()) { m_model->removeRows(m_index_at_context_menu.row(), - 1, - m_index_at_context_menu.parent()); + 1, + m_index_at_context_menu.parent()); } else { @@ -429,10 +429,10 @@ void ElementsCollectionWidget::deleteDirectory() ElementsLocation loc (eci->collectionPath()); if (! (loc.isDirectory() - && loc.exist() - && loc.isFileSystem() - && (loc.collectionPath().startsWith("company://") - || loc.collectionPath().startsWith("custom://"))) ) return; + && loc.exist() + && loc.isFileSystem() + && (loc.collectionPath().startsWith("company://") + || loc.collectionPath().startsWith("custom://"))) ) return; if (QET::QetMessageBox::question( this, @@ -446,8 +446,8 @@ void ElementsCollectionWidget::deleteDirectory() if (dir.removeRecursively()) { m_model->removeRows(m_index_at_context_menu.row(), - 1, - m_index_at_context_menu.parent()); + 1, + m_index_at_context_menu.parent()); } else { @@ -666,7 +666,7 @@ void ElementsCollectionWidget::reload() this, &ElementsCollectionWidget::loadingFinished); - m_new_model->loadCollections(true, true, true, project_list); + m_new_model->loadCollections(true, true, true, project_list); } /** @@ -781,13 +781,13 @@ void ElementsCollectionWidget::search() QModelIndexList match_index; for (QString txt : text_list) { match_index << m_model->match(m_showed_index.isValid() - ? m_model->index(0,0,m_showed_index) - : m_model->index(0,0), - Qt::UserRole+1, - QVariant(txt), - -1, - Qt::MatchContains - | Qt::MatchRecursive); + ? m_model->index(0,0,m_showed_index) + : m_model->index(0,0), + Qt::UserRole+1, + QVariant(txt), + -1, + Qt::MatchContains + | Qt::MatchRecursive); } for(QModelIndex index : match_index) diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index f5d02464e..f0cbc9dff 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -293,17 +293,17 @@ void ElementsLocation::setPath(const QString &path) else if (path.startsWith("common://") || path.startsWith("company://") || path.startsWith("custom://")) { QString p; - if (path.startsWith("common://")) - { - tmp_path.remove("common://"); - p = QETApp::commonElementsDirN() + "/" + tmp_path; - } - else if (path.startsWith("company://")) - { - tmp_path.remove("company://"); - p = QETApp::companyElementsDirN() + "/" + tmp_path; - } - else + if (path.startsWith("common://")) + { + tmp_path.remove("common://"); + p = QETApp::commonElementsDirN() + "/" + tmp_path; + } + else if (path.startsWith("company://")) + { + tmp_path.remove("company://"); + p = QETApp::companyElementsDirN() + "/" + tmp_path; + } + else { tmp_path.remove("custom://"); p = QETApp::customElementsDirN() + "/" + tmp_path; @@ -319,19 +319,19 @@ void ElementsLocation::setPath(const QString &path) if(path_.endsWith(".elmt")) { m_file_system_path = path_; - if (path_.startsWith(QETApp::commonElementsDirN())) - { - path_.remove(QETApp::commonElementsDirN()+="/"); - path_.prepend("common://"); - m_collection_path = path_; - } - else if (path_.startsWith(QETApp::companyElementsDirN())) - { - path_.remove(QETApp::companyElementsDirN()+="/"); - path_.prepend("company://"); - m_collection_path = path_; - } - else if (path_.startsWith(QETApp::customElementsDirN())) + if (path_.startsWith(QETApp::commonElementsDirN())) + { + path_.remove(QETApp::commonElementsDirN()+="/"); + path_.prepend("common://"); + m_collection_path = path_; + } + else if (path_.startsWith(QETApp::companyElementsDirN())) + { + path_.remove(QETApp::companyElementsDirN()+="/"); + path_.prepend("company://"); + m_collection_path = path_; + } + else if (path_.startsWith(QETApp::customElementsDirN())) { path_.remove(QETApp::customElementsDirN()+="/"); path_.prepend("custom://"); @@ -341,19 +341,19 @@ void ElementsLocation::setPath(const QString &path) else { m_file_system_path = path_; - if (path_.startsWith(QETApp::commonElementsDirN())) - { - path_.remove(QETApp::commonElementsDirN()+="/"); - path_.prepend("common://"); - m_collection_path = path_; - } - else if (path_.startsWith(QETApp::companyElementsDirN())) - { - path_.remove(QETApp::companyElementsDirN()+="/"); - path_.prepend("company://"); - m_collection_path = path_; - } - else if (path_.startsWith(QETApp::customElementsDirN())) + if (path_.startsWith(QETApp::commonElementsDirN())) + { + path_.remove(QETApp::commonElementsDirN()+="/"); + path_.prepend("common://"); + m_collection_path = path_; + } + else if (path_.startsWith(QETApp::companyElementsDirN())) + { + path_.remove(QETApp::companyElementsDirN()+="/"); + path_.prepend("company://"); + m_collection_path = path_; + } + else if (path_.startsWith(QETApp::customElementsDirN())) { path_.remove(QETApp::customElementsDirN()+="/"); path_.prepend("custom://"); @@ -501,23 +501,23 @@ bool ElementsLocation::isFileSystem() const } /** - @brief ElementsLocation::isCommonCollection - @return - True if this location represent an item from the common collection + @brief ElementsLocation::isCommonCollection + @return + True if this location represent an item from the common collection */ bool ElementsLocation::isCommonCollection() const { - return fileSystemPath().startsWith(QETApp::commonElementsDirN()); + return fileSystemPath().startsWith(QETApp::commonElementsDirN()); } /** - @brief ElementsLocation::isCompanyCollection - @return - True if this location represent an item from the company collection + @brief ElementsLocation::isCompanyCollection + @return + True if this location represent an item from the company collection */ bool ElementsLocation::isCompanyCollection() const { - return fileSystemPath().startsWith(QETApp::companyElementsDirN()); + return fileSystemPath().startsWith(QETApp::companyElementsDirN()); } /** diff --git a/sources/ElementsCollection/elementslocation.h b/sources/ElementsCollection/elementslocation.h index 80e2b00a8..6238dc2e5 100644 --- a/sources/ElementsCollection/elementslocation.h +++ b/sources/ElementsCollection/elementslocation.h @@ -75,9 +75,9 @@ class ElementsLocation bool isElement() const; bool isDirectory() const; bool isFileSystem() const; - bool isCommonCollection() const; - bool isCompanyCollection() const; - bool isCustomCollection() const; + bool isCommonCollection() const; + bool isCompanyCollection() const; + bool isCustomCollection() const; bool isProject() const; bool exist() const; bool isWritable() const; diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index 45e720eec..9c84999fa 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -41,8 +41,8 @@ FileElementCollectionItem::FileElementCollectionItem() @return true if path exist. */ bool FileElementCollectionItem::setRootPath(const QString& path, - bool set_data, - bool hide_element) + bool set_data, + bool hide_element) { QDir dir(path); if (dir.exists()) @@ -120,11 +120,11 @@ QString FileElementCollectionItem::localName() else if (isDir()) { if (isCollectionRoot()) { - if (m_path == QETApp::commonElementsDirN()) - setText(QObject::tr("Collection QET")); - else if (m_path == QETApp::companyElementsDirN()) - setText(QObject::tr("Collection Company")); - else if (m_path == QETApp::customElementsDirN()) + if (m_path == QETApp::commonElementsDirN()) + setText(QObject::tr("Collection QET")); + else if (m_path == QETApp::companyElementsDirN()) + setText(QObject::tr("Collection Company")); + else if (m_path == QETApp::customElementsDirN()) setText(QObject::tr("Collection utilisateur")); else setText(QObject::tr("Collection inconnue")); @@ -221,29 +221,29 @@ QString FileElementCollectionItem::collectionPath() const bool FileElementCollectionItem::isCollectionRoot() const { if (m_path == QETApp::commonElementsDirN() - || m_path == QETApp::companyElementsDirN() - || m_path == QETApp::customElementsDirN()) - return true; + || m_path == QETApp::companyElementsDirN() + || m_path == QETApp::customElementsDirN()) + return true; else return false; } /** - @brief FileElementCollectionItem::isCommonCollection - @return True if this item represent the common collection + @brief FileElementCollectionItem::isCommonCollection + @return True if this item represent the common collection */ bool FileElementCollectionItem::isCommonCollection() const { - return fileSystemPath().startsWith(QETApp::commonElementsDirN()); + return fileSystemPath().startsWith(QETApp::commonElementsDirN()); } /** - @brief FileElementCollectionItem::isCompanyCollection - @return True if this item represent the company collection + @brief FileElementCollectionItem::isCompanyCollection + @return True if this item represent the company collection */ bool FileElementCollectionItem::isCompanyCollection() const { - return fileSystemPath().startsWith(QETApp::companyElementsDirN()); + return fileSystemPath().startsWith(QETApp::companyElementsDirN()); } /** @@ -347,8 +347,8 @@ void FileElementCollectionItem::setUpIcon() @param hide_element */ void FileElementCollectionItem::setPathName(const QString& path_name, - bool set_data, - bool hide_element) + bool set_data, + bool hide_element) { m_path = path_name; diff --git a/sources/ElementsCollection/fileelementcollectionitem.h b/sources/ElementsCollection/fileelementcollectionitem.h index acc142593..c70b1e58d 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.h +++ b/sources/ElementsCollection/fileelementcollectionitem.h @@ -47,9 +47,9 @@ class FileElementCollectionItem : public ElementCollectionItem QString name() const override; QString collectionPath() const override; bool isCollectionRoot() const override; - bool isCommonCollection() const; - bool isCompanyCollection() const; - bool isCustomCollection() const; + bool isCommonCollection() const; + bool isCompanyCollection() const; + bool isCustomCollection() const; void addChildAtPath(const QString &collection_name) override; void setUpData() override; diff --git a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp index 33da3debe..621b9e8a4 100644 --- a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp +++ b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp @@ -195,10 +195,10 @@ QRectF QetGraphicsHandlerUtility::mirrorRectForPosAtIndex( */ QRectF QetGraphicsHandlerUtility::rectForArc(const QRectF &rect, qreal start_angle, qreal span_angle) { - QPainterPath path; - path.arcMoveTo(rect, start_angle); - path.arcTo(rect, start_angle, span_angle); - return path.boundingRect(); + QPainterPath path; + path.arcMoveTo(rect, start_angle); + path.arcTo(rect, start_angle, span_angle); + return path.boundingRect(); } /** diff --git a/sources/TerminalStrip/GraphicsItem/demoterminalstrip.cpp b/sources/TerminalStrip/GraphicsItem/demoterminalstrip.cpp index 34a1c699c..bc407c94a 100644 --- a/sources/TerminalStrip/GraphicsItem/demoterminalstrip.cpp +++ b/sources/TerminalStrip/GraphicsItem/demoterminalstrip.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 "demoterminalstrip.h" @@ -21,132 +21,132 @@ namespace TerminalStripDrawer { /*========= DemoBridge =========*/ - class DemoBridge : public AbstractBridgeInterface - { - public: - DemoBridge(const QUuid &uuid) : - m_uuid { uuid } {} - - QUuid uuid() const override { - return m_uuid; - } - - private: - const QUuid m_uuid; - }; - - class DemoRealTerminal : public AbstractRealTerminalInterface - { - public: - DemoRealTerminal(const QString &label, const QUuid &bridge) : - m_label { label }, - m_bridge { bridge } - {} - - QString label() const override { - return m_label; - } - - bool isBridged() const override { - return true; - } - - DemoBridge *bridge() const override { - return new DemoBridge { m_bridge }; - } - - private: - QString m_label; - QUuid m_bridge; - }; - - class DemoPhysicalTerminal : public AbstractPhysicalTerminalInterface - { - public: - DemoPhysicalTerminal(QVector> real_terminals) : - m_real_terminals { real_terminals} - {} - - QVector> realTerminals() const override { - return m_real_terminals; - } - - private: - QVector> m_real_terminals; - }; + class DemoBridge : public AbstractBridgeInterface + { + public: + DemoBridge(const QUuid &uuid) : + m_uuid { uuid } {} + + QUuid uuid() const override { + return m_uuid; + } + + private: + const QUuid m_uuid; + }; + + class DemoRealTerminal : public AbstractRealTerminalInterface + { + public: + DemoRealTerminal(const QString &label, const QUuid &bridge) : + m_label { label }, + m_bridge { bridge } + {} + + QString label() const override { + return m_label; + } + + bool isBridged() const override { + return true; + } + + DemoBridge *bridge() const override { + return new DemoBridge { m_bridge }; + } + + private: + QString m_label; + QUuid m_bridge; + }; + + class DemoPhysicalTerminal : public AbstractPhysicalTerminalInterface + { + public: + DemoPhysicalTerminal(QVector> real_terminals) : + m_real_terminals { real_terminals} + {} + + QVector> realTerminals() const override { + return m_real_terminals; + } + + private: + QVector> m_real_terminals; + }; /*========= DemoTerminalStrip =========*/ - /** - * @brief DemoTerminalStrip::DemoTerminalStrip - */ - DemoTerminalStrip::DemoTerminalStrip() - { - build(); - } - - QVector > DemoTerminalStrip::physicalTerminal() const - { - return m_physical_terminal; - } - - void DemoTerminalStrip::build() - { - QUuid lvl_1 = QUuid::createUuid(); - QUuid lvl_2 = QUuid::createUuid(); - QUuid lvl_3 = QUuid::createUuid(); - QUuid lvl_4 = QUuid::createUuid(); - - QVector > real_terminals_vector; - - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("24vdc"), - lvl_1)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("0vdc"), - lvl_2)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("signal"), - lvl_3)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("teach"), - lvl_4)}; - m_physical_terminal << QSharedPointer { - new DemoPhysicalTerminal {real_terminals_vector}}; - - real_terminals_vector.clear(); - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("24vdc"), - lvl_1)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("0vdc"), - lvl_2)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("signal"), - lvl_3)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("teach"), - lvl_4)}; - m_physical_terminal << QSharedPointer { - new DemoPhysicalTerminal {real_terminals_vector}}; - - real_terminals_vector.clear(); - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("24vdc"), - lvl_1)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("0vdc"), - lvl_2)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("signal"), - lvl_3)}; - real_terminals_vector << QSharedPointer { - new DemoRealTerminal( QStringLiteral("teach"), - lvl_4)}; - m_physical_terminal << QSharedPointer { - new DemoPhysicalTerminal {real_terminals_vector}}; - } + /** + * @brief DemoTerminalStrip::DemoTerminalStrip + */ + DemoTerminalStrip::DemoTerminalStrip() + { + build(); + } + + QVector > DemoTerminalStrip::physicalTerminal() const + { + return m_physical_terminal; + } + + void DemoTerminalStrip::build() + { + QUuid lvl_1 = QUuid::createUuid(); + QUuid lvl_2 = QUuid::createUuid(); + QUuid lvl_3 = QUuid::createUuid(); + QUuid lvl_4 = QUuid::createUuid(); + + QVector > real_terminals_vector; + + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("24vdc"), + lvl_1)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("0vdc"), + lvl_2)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("signal"), + lvl_3)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("teach"), + lvl_4)}; + m_physical_terminal << QSharedPointer { + new DemoPhysicalTerminal {real_terminals_vector}}; + + real_terminals_vector.clear(); + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("24vdc"), + lvl_1)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("0vdc"), + lvl_2)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("signal"), + lvl_3)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("teach"), + lvl_4)}; + m_physical_terminal << QSharedPointer { + new DemoPhysicalTerminal {real_terminals_vector}}; + + real_terminals_vector.clear(); + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("24vdc"), + lvl_1)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("0vdc"), + lvl_2)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("signal"), + lvl_3)}; + real_terminals_vector << QSharedPointer { + new DemoRealTerminal( QStringLiteral("teach"), + lvl_4)}; + m_physical_terminal << QSharedPointer { + new DemoPhysicalTerminal {real_terminals_vector}}; + } } diff --git a/sources/TerminalStrip/GraphicsItem/demoterminalstrip.h b/sources/TerminalStrip/GraphicsItem/demoterminalstrip.h index eb148f248..dd28d96c8 100644 --- a/sources/TerminalStrip/GraphicsItem/demoterminalstrip.h +++ b/sources/TerminalStrip/GraphicsItem/demoterminalstrip.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 DEMOTERMINALSTRIP_H #define DEMOTERMINALSTRIP_H @@ -24,25 +24,25 @@ namespace TerminalStripDrawer { class DemoTerminalStrip : public AbstractTerminalStripInterface { - public: - DemoTerminalStrip(); - - QString installation() const override { - return QStringLiteral("=INST"); - } - QString location() const override { - return QStringLiteral("+LOC" ); - } - QString name() const override { - return QStringLiteral("X1"); - } - QVector> physicalTerminal() const override; - - private: - void build(); - - private: - QVector> m_physical_terminal; + public: + DemoTerminalStrip(); + + QString installation() const override { + return QStringLiteral("=INST"); + } + QString location() const override { + return QStringLiteral("+LOC" ); + } + QString name() const override { + return QStringLiteral("X1"); + } + QVector> physicalTerminal() const override; + + private: + void build(); + + private: + QVector> m_physical_terminal; }; } //End namespace TerminalStripDrawer diff --git a/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.cpp b/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.cpp index 0823702b0..f405c1033 100644 --- a/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.cpp +++ b/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 "terminalstriplayoutshandler.h" @@ -22,11 +22,11 @@ TerminalStripLayoutsHandler::TerminalStripLayoutsHandler() { - m_default_layout = QSharedPointer::create(); - m_default_layout->m_name = QObject::tr("Disposition par défaut"); + m_default_layout = QSharedPointer::create(); + m_default_layout->m_name = QObject::tr("Disposition par défaut"); } QSharedPointer TerminalStripLayoutsHandler::defaultLayout() { - return m_default_layout; + return m_default_layout; } diff --git a/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.h b/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.h index e20ae6066..e81b20f77 100644 --- a/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.h +++ b/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutshandler.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 TERMINALSTRIPLAYOUTSHANDLER_H #define TERMINALSTRIPLAYOUTSHANDLER_H @@ -29,13 +29,13 @@ */ class TerminalStripLayoutsHandler { - public: - TerminalStripLayoutsHandler(); - QSharedPointer defaultLayout(); + public: + TerminalStripLayoutsHandler(); + QSharedPointer defaultLayout(); - private: - QSet> m_layout_set; - QSharedPointer m_default_layout; + private: + QSet> m_layout_set; + QSharedPointer m_default_layout; }; #endif // TERMINALSTRIPLAYOUTSHANDLER_H diff --git a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp index 1b293dee6..dd9483432 100644 --- a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp +++ b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 "terminalstripdrawer.h" #include diff --git a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.h b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.h index 8b46ef2d6..0aa9e4858 100644 --- a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.h +++ b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 TERMINALSTRIPDRAWER_H #define TERMINALSTRIPDRAWER_H @@ -27,67 +27,67 @@ class TerminalStrip; namespace TerminalStripDrawer { - class AbstractBridgeInterface - { - public: - AbstractBridgeInterface() {} - virtual ~AbstractBridgeInterface() {} - virtual QUuid uuid() const = 0; - }; - - class AbstractRealTerminalInterface - { - public: - AbstractRealTerminalInterface() {} - virtual ~AbstractRealTerminalInterface() {} - virtual QString label() const = 0; - virtual bool isBridged() const = 0; - virtual AbstractBridgeInterface* bridge() const = 0; - }; - - class AbstractPhysicalTerminalInterface - { - public: - AbstractPhysicalTerminalInterface() {} - virtual ~AbstractPhysicalTerminalInterface() {} - virtual QVector> realTerminals() const = 0; - }; - - class AbstractTerminalStripInterface - { - public: - AbstractTerminalStripInterface() {} - virtual ~AbstractTerminalStripInterface() {} - virtual QString installation() const = 0; - virtual QString location() const = 0; - virtual QString name() const = 0; - virtual QVector> physicalTerminal() const = 0; - }; - - class TerminalStripDrawer - { - public: - TerminalStripDrawer(QSharedPointer strip = QSharedPointer { nullptr }, - QSharedPointer layout = QSharedPointer()); - - void setStrip(QSharedPointer strip); - void paint(QPainter *painter); - QRectF boundingRect() const; - - void setLayout(QSharedPointer layout); - bool haveLayout() const; - - void setPreviewDraw(bool draw = true); - - private: - int height() const; - int width() const; - - private: - QSharedPointer m_strip; - QSharedPointer m_pattern; - bool m_preview_draw { false }; - }; + class AbstractBridgeInterface + { + public: + AbstractBridgeInterface() {} + virtual ~AbstractBridgeInterface() {} + virtual QUuid uuid() const = 0; + }; + + class AbstractRealTerminalInterface + { + public: + AbstractRealTerminalInterface() {} + virtual ~AbstractRealTerminalInterface() {} + virtual QString label() const = 0; + virtual bool isBridged() const = 0; + virtual AbstractBridgeInterface* bridge() const = 0; + }; + + class AbstractPhysicalTerminalInterface + { + public: + AbstractPhysicalTerminalInterface() {} + virtual ~AbstractPhysicalTerminalInterface() {} + virtual QVector> realTerminals() const = 0; + }; + + class AbstractTerminalStripInterface + { + public: + AbstractTerminalStripInterface() {} + virtual ~AbstractTerminalStripInterface() {} + virtual QString installation() const = 0; + virtual QString location() const = 0; + virtual QString name() const = 0; + virtual QVector> physicalTerminal() const = 0; + }; + + class TerminalStripDrawer + { + public: + TerminalStripDrawer(QSharedPointer strip = QSharedPointer { nullptr }, + QSharedPointer layout = QSharedPointer()); + + void setStrip(QSharedPointer strip); + void paint(QPainter *painter); + QRectF boundingRect() const; + + void setLayout(QSharedPointer layout); + bool haveLayout() const; + + void setPreviewDraw(bool draw = true); + + private: + int height() const; + int width() const; + + private: + QSharedPointer m_strip; + QSharedPointer m_pattern; + bool m_preview_draw { false }; + }; } #endif // TERMINALSTRIPDRAWER_H diff --git a/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp b/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp index 77f28adee..9811cd2f2 100644 --- a/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp +++ b/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp @@ -1,17 +1,17 @@ /* Copyright 2006-2022 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 . */ diff --git a/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp b/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp index bfbf98bfb..be243a2af 100644 --- a/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp +++ b/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 "trueterminalstrip.h" #include "../physicalterminal.h" diff --git a/sources/TerminalStrip/GraphicsItem/trueterminalstrip.h b/sources/TerminalStrip/GraphicsItem/trueterminalstrip.h index 9b413ba59..034e75da2 100644 --- a/sources/TerminalStrip/GraphicsItem/trueterminalstrip.h +++ b/sources/TerminalStrip/GraphicsItem/trueterminalstrip.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 TRUETERMINALSTRIP_H #define TRUETERMINALSTRIP_H @@ -27,51 +27,51 @@ class TerminalStripBridge; namespace TerminalStripDrawer { - class TrueTerminalStrip : public AbstractTerminalStripInterface - { - public: - TrueTerminalStrip(TerminalStrip *strip); + class TrueTerminalStrip : public AbstractTerminalStripInterface + { + public: + TrueTerminalStrip(TerminalStrip *strip); - QString installation() const override; - QString location() const override; - QString name() const override; + QString installation() const override; + QString location() const override; + QString name() const override; QVector> physicalTerminal() const override; - private: - QPointer m_strip; - }; + private: + QPointer m_strip; + }; - class TruePhysicalTerminal : public AbstractPhysicalTerminalInterface - { - public: - TruePhysicalTerminal(QSharedPointer physical); - QVector> realTerminals() const override; + class TruePhysicalTerminal : public AbstractPhysicalTerminalInterface + { + public: + TruePhysicalTerminal(QSharedPointer physical); + QVector> realTerminals() const override; - private: - QSharedPointer m_physical; - }; + private: + QSharedPointer m_physical; + }; - class TrueRealTerminal : public AbstractRealTerminalInterface - { - public: - TrueRealTerminal(QSharedPointer real); - QString label() const override; - bool isBridged() const override; - AbstractBridgeInterface* bridge() const override; + class TrueRealTerminal : public AbstractRealTerminalInterface + { + public: + TrueRealTerminal(QSharedPointer real); + QString label() const override; + bool isBridged() const override; + AbstractBridgeInterface* bridge() const override; - private: - QSharedPointer m_real; - }; + private: + QSharedPointer m_real; + }; - class TrueBridge : public AbstractBridgeInterface - { - public: - TrueBridge(QSharedPointer bridge); - QUuid uuid() const override; + class TrueBridge : public AbstractBridgeInterface + { + public: + TrueBridge(QSharedPointer bridge); + QUuid uuid() const override; - private: - QSharedPointer m_bridge; - }; + private: + QSharedPointer m_bridge; + }; } #endif // TRUETERMINALSTRIP_H diff --git a/sources/autoNum/assignvariables.h b/sources/autoNum/assignvariables.h index c0e4dfc62..ee77d581a 100644 --- a/sources/autoNum/assignvariables.h +++ b/sources/autoNum/assignvariables.h @@ -63,7 +63,7 @@ namespace autonum public: static QString formulaToLabel (QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt = nullptr); static QString replaceVariable (const QString &formula, const DiagramContext &dc); - static QString genericXref (const Element *element); + static QString genericXref (const Element *element); private: AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr); diff --git a/sources/diagramevent/diagrameventinterface.cpp b/sources/diagramevent/diagrameventinterface.cpp index 959b5e27f..eb4329914 100644 --- a/sources/diagramevent/diagrameventinterface.cpp +++ b/sources/diagramevent/diagrameventinterface.cpp @@ -23,8 +23,8 @@ #include DiagramEventInterface::DiagramEventInterface(Diagram *diagram) : - QObject{diagram}, - m_diagram{diagram} + QObject{diagram}, + m_diagram{diagram} { m_diagram -> clearSelection(); } diff --git a/sources/diagramevent/diagrameventinterface.h b/sources/diagramevent/diagrameventinterface.h index f5a578259..41930a36c 100644 --- a/sources/diagramevent/diagrameventinterface.h +++ b/sources/diagramevent/diagrameventinterface.h @@ -64,9 +64,9 @@ class DiagramEventInterface : public QObject void finish(); //Emitted when the interface finishes its job. protected: - QPointer m_diagram; - bool m_running{false}; - bool m_abort{false}; + QPointer m_diagram; + bool m_running{false}; + bool m_abort{false}; }; #endif // DIAGRAMEVENTINTERFACE_H diff --git a/sources/editor/arceditor.cpp b/sources/editor/arceditor.cpp index 7dea37f7e..5d42a4914 100644 --- a/sources/editor/arceditor.cpp +++ b/sources/editor/arceditor.cpp @@ -87,16 +87,16 @@ void ArcEditor::setUpChangeConnections() #if TODO_LIST #pragma message("@TODO implement position changes!") #endif - // TODO: implement position changes! - //m_change_connections << connect(part, &PartArc::) + // TODO: implement position changes! + //m_change_connections << connect(part, &PartArc::) } void ArcEditor::disconnectChangeConnections() { - for (QMetaObject::Connection c : m_change_connections) { + for (QMetaObject::Connection c : m_change_connections) { disconnect(c); - } - m_change_connections.clear(); + } + m_change_connections.clear(); } /** diff --git a/sources/editor/editorcommands.h b/sources/editor/editorcommands.h index 024626b59..49d375287 100644 --- a/sources/editor/editorcommands.h +++ b/sources/editor/editorcommands.h @@ -247,21 +247,21 @@ class changeElementDataCommand : public ElementEditionCommand }; /** - @brief The RotateSelectionInESCommand class - Rotate the selected items in the element editor + @brief The RotateSelectionInESCommand class + Rotate the selected items in the element editor */ class RotateElementsCommand : public ElementEditionCommand { public: - RotateElementsCommand(ElementScene *scene, QUndoCommand *parent=nullptr); - void undo() override; - void redo() override; + RotateElementsCommand(ElementScene *scene, QUndoCommand *parent=nullptr); + void undo() override; + void redo() override; private: - ElementScene *m_scene =nullptr; - QList m_items; + ElementScene *m_scene =nullptr; + QList m_items; }; diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index ec963e0a8..a3a9c2e1b 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -449,7 +449,7 @@ const QDomDocument ElementScene::toXml(bool all_parts) root.setAttribute("hotspot_y", QString("%1").arg( -(qRound(size.y() - (ymargin/2))))); - QetVersion::toXmlAttribute(root); + QetVersion::toXmlAttribute(root); root.setAttribute("link_type", m_element_data.typeToString(m_element_data.m_type)); //Uuid used to compare two elements diff --git a/sources/editor/graphicspart/partline.h b/sources/editor/graphicspart/partline.h index 6df63bb5c..a4ae21326 100644 --- a/sources/editor/graphicspart/partline.h +++ b/sources/editor/graphicspart/partline.h @@ -125,6 +125,6 @@ class PartLine : public CustomElementGraphicPart int m_vector_index = -1; QPropertyUndoCommand *m_undo_command; QVector m_handler_vector; - qreal m_rot; + qreal m_rot; }; #endif diff --git a/sources/editor/graphicspart/partpolygon.h b/sources/editor/graphicspart/partpolygon.h index d8b7c6110..227105215 100644 --- a/sources/editor/graphicspart/partpolygon.h +++ b/sources/editor/graphicspart/partpolygon.h @@ -117,6 +117,6 @@ class PartPolygon : public CustomElementGraphicPart QAction *m_insert_point, *m_remove_point; QPointF m_context_menu_pos; - qreal m_rot; + qreal m_rot; }; #endif diff --git a/sources/editor/graphicspart/partrectangle.cpp b/sources/editor/graphicspart/partrectangle.cpp index 35be1de09..2927bcd3d 100644 --- a/sources/editor/graphicspart/partrectangle.cpp +++ b/sources/editor/graphicspart/partrectangle.cpp @@ -31,7 +31,7 @@ PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent) : CustomElementGraphicPart(editor, parent) { - m_rot=0; + m_rot=0; } /** @@ -201,7 +201,7 @@ QRectF PartRectangle::sceneGeometricRect() const */ QPointF PartRectangle::sceneTopLeft() const { - return(mapToScene(rect().topLeft())); + return(mapToScene(rect().topLeft())); } /** diff --git a/sources/editor/graphicspart/partrectangle.h b/sources/editor/graphicspart/partrectangle.h index 28017927a..9d9f23b2a 100644 --- a/sources/editor/graphicspart/partrectangle.h +++ b/sources/editor/graphicspart/partrectangle.h @@ -34,7 +34,7 @@ class PartRectangle : public CustomElementGraphicPart Q_PROPERTY(QRectF rect READ rect WRITE setRect) Q_PROPERTY(qreal xRadius READ XRadius WRITE setXRadius NOTIFY XRadiusChanged) Q_PROPERTY(qreal yRadius READ YRadius WRITE setYRadius NOTIFY YRadiusChanged) - Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) + Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) // constructors, destructor public: @@ -48,7 +48,7 @@ class PartRectangle : public CustomElementGraphicPart void rectChanged(); void XRadiusChanged(); void YRadiusChanged(); - void rotationChanged(); + void rotationChanged(); // methods public: @@ -112,6 +112,6 @@ class PartRectangle : public CustomElementGraphicPart m_old_xRadius, m_old_yRadius; bool m_modifie_radius_equaly = false; - qreal m_rot; + qreal m_rot; }; #endif diff --git a/sources/editor/graphicspart/partterminal.h b/sources/editor/graphicspart/partterminal.h index 570e34d08..0dc531f6c 100644 --- a/sources/editor/graphicspart/partterminal.h +++ b/sources/editor/graphicspart/partterminal.h @@ -72,7 +72,7 @@ class PartTerminal : public CustomElementGraphicPart void handleUserTransformation(const QRectF &, const QRectF &) override; Qet::Orientation orientation() const {return d -> m_orientation;} - void setOrientation(Qet::Orientation ori); + void setOrientation(Qet::Orientation ori); qreal rotation() const; void setRotation(qreal angle); diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 370f66c90..992a9569f 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -569,7 +569,7 @@ bool StyleEditor::isStyleEditable(QList cep_list) QStringList str; str << "arc" << "ellipse" << "line" << "polygon" << "rect"; - for (CustomElementPart *cep: cep_list) + for (CustomElementPart *cep: cep_list) if (!str.contains(cep -> xmlName())) return false; diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index b928ef65c..1d042d194 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -154,16 +154,16 @@ bool ElementPictureFactory::build(const ElementsLocation &location, QDomElement dom = location.xml(); //Check if the current version can read the xml description - const auto elmt_version = QetVersion::fromXmlAttribute(dom); - if (!elmt_version.isNull() - && QetVersion::currentVersion() < elmt_version) - { - std::cerr << qPrintable( - QObject::tr("Avertissement : l'élément " - " a été enregistré avec une version" - " ultérieure de QElectroTech.") - ) << std::endl; - } + const auto elmt_version = QetVersion::fromXmlAttribute(dom); + if (!elmt_version.isNull() + && QetVersion::currentVersion() < elmt_version) + { + std::cerr << qPrintable( + QObject::tr("Avertissement : l'élément " + " a été enregistré avec une version" + " ultérieure de QElectroTech.") + ) << std::endl; + } //This attributes must be present and valid int w, h, hot_x, hot_y; @@ -249,7 +249,7 @@ bool ElementPictureFactory::build(const ElementsLocation &location, void ElementPictureFactory::parseElement(const QDomElement &dom, QPainter &painter, primitives &prim) const { - if (dom.tagName() == "line") (parseLine (dom, painter, prim)); + if (dom.tagName() == "line") (parseLine (dom, painter, prim)); else if (dom.tagName() == "rect") (parseRect (dom, painter, prim)); else if (dom.tagName() == "ellipse") (parseEllipse(dom, painter, prim)); else if (dom.tagName() == "circle") (parseCircle (dom, painter, prim)); diff --git a/sources/print/projectprintwindow.cpp b/sources/print/projectprintwindow.cpp index c1622a7a2..326c10e0b 100644 --- a/sources/print/projectprintwindow.cpp +++ b/sources/print/projectprintwindow.cpp @@ -86,7 +86,7 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma if (!file_name.endsWith(".pdf")) { file_name.append(".pdf"); } - printer_->setCreator(QString("QElectroTech %1").arg(QetVersion::displayedVersion())); + printer_->setCreator(QString("QElectroTech %1").arg(QetVersion::displayedVersion())); printer_->setOutputFileName(file_name); printer_->setOutputFormat(QPrinter::PdfFormat); } @@ -98,11 +98,11 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma QString ProjectPrintWindow::docName(QETProject *project) { QString doc_name; - if (!project->filePath().isEmpty()) { - doc_name = QFileInfo(project->filePath()).baseName(); - } else if (!project->title().isEmpty()) { - doc_name = project->title(); - doc_name = QET::stringToFileName(doc_name); + if (!project->filePath().isEmpty()) { + doc_name = QFileInfo(project->filePath()).baseName(); + } else if (!project->title().isEmpty()) { + doc_name = project->title(); + doc_name = QET::stringToFileName(doc_name); } if (doc_name.isEmpty()) { @@ -669,7 +669,7 @@ QList ProjectPrintWindow::selectedDiagram() const void ProjectPrintWindow::exportToPDF() { - auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf)")); + auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf)")); if (file_name.isEmpty()) { return; } diff --git a/sources/print/projectprintwindow.h b/sources/print/projectprintwindow.h index 9a2ee25ad..25d83c857 100644 --- a/sources/print/projectprintwindow.h +++ b/sources/print/projectprintwindow.h @@ -40,7 +40,7 @@ class QCheckBox; */ class ProjectPrintWindow : public QMainWindow { - Q_OBJECT + Q_OBJECT public: static void launchDialog(QETProject *project, QPrinter::OutputFormat format = QPrinter::NativeFormat, QWidget *parent = nullptr); diff --git a/sources/project/projectpropertieshandler.cpp b/sources/project/projectpropertieshandler.cpp index 1e239e074..7fcbbd044 100644 --- a/sources/project/projectpropertieshandler.cpp +++ b/sources/project/projectpropertieshandler.cpp @@ -1,30 +1,30 @@ /* - Copyright 2006-2024 The QElectroTech Team - This file is part of QElectroTech. + Copyright 2006-2024 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 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. + 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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "projectpropertieshandler.h" #include "../qetproject.h" ProjectPropertiesHandler::ProjectPropertiesHandler(QETProject *project) : - m_project(project) + m_project(project) { } TerminalStripLayoutsHandler &ProjectPropertiesHandler::terminalStripLayoutHandler() { - return m_terminal_strip_layout_handler; + return m_terminal_strip_layout_handler; } diff --git a/sources/project/projectpropertieshandler.h b/sources/project/projectpropertieshandler.h index e77a216b3..71338bfae 100644 --- a/sources/project/projectpropertieshandler.h +++ b/sources/project/projectpropertieshandler.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 The QElectroTech Team - This file is part of QElectroTech. + Copyright 2006-2024 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 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. + 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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef PROJECTPROPERTIESHANDLER_H #define PROJECTPROPERTIESHANDLER_H @@ -39,15 +39,15 @@ class QETProject; */ class ProjectPropertiesHandler { - public: - ProjectPropertiesHandler(QETProject *project); + public: + ProjectPropertiesHandler(QETProject *project); - TerminalStripLayoutsHandler& terminalStripLayoutHandler(); + TerminalStripLayoutsHandler& terminalStripLayoutHandler(); - private: - QPointer m_project; + private: + QPointer m_project; - TerminalStripLayoutsHandler m_terminal_strip_layout_handler; + TerminalStripLayoutsHandler m_terminal_strip_layout_handler; }; #endif // PROJECTPROPERTIESHANDLER_H diff --git a/sources/properties/elementdata.cpp b/sources/properties/elementdata.cpp index 3e02c874f..daffd22b6 100644 --- a/sources/properties/elementdata.cpp +++ b/sources/properties/elementdata.cpp @@ -443,7 +443,7 @@ ElementData::SlaveState ElementData::slaveStateFromString(const QString &string) return ElementData::SW; } else if (string == QLatin1String("Other")){ return ElementData::Other; - } + } qDebug() << "ElementData::slaveStateFromString : string : " << string diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index dc9d23595..116491f9a 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -1765,29 +1765,29 @@ void Conductor::setSequenceNum(const autonum::sequentialNumbers& sn) */ void Conductor::setUpConnectionForFormula(QString old_formula, QString new_formula) { - Diagram *diagram_ {diagram()}; - if (!diagram_) { - diagram_ = terminal1->diagram(); - } - if (diagram_) + Diagram *diagram_ {diagram()}; + if (!diagram_) { + diagram_ = terminal1->diagram(); + } + if (diagram_) { //Because the variable %F is a reference to another text which can contain variables, //we must replace %F by the real text, to check if the real text contains the variable %id if (old_formula.contains("%F")) - old_formula.replace("%F", diagram_->border_and_titleblock.folio()); + old_formula.replace("%F", diagram_->border_and_titleblock.folio()); if (old_formula.contains("%id")) - disconnect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText); + disconnect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText); //Label is frozen, so we don't update it. if (m_freeze_label == true) return; if (new_formula.contains("%F")) - new_formula.replace("%F", diagram_->border_and_titleblock.folio()); + new_formula.replace("%F", diagram_->border_and_titleblock.folio()); if (new_formula.contains("%id")) - connect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText); + connect(diagram_->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText); } } diff --git a/sources/qetgraphicsitem/conductor.h b/sources/qetgraphicsitem/conductor.h index 63be5387f..d7b7d8e88 100644 --- a/sources/qetgraphicsitem/conductor.h +++ b/sources/qetgraphicsitem/conductor.h @@ -137,7 +137,7 @@ class Conductor : public QGraphicsObject {return m_autoNum_seq;} void setSequenceNum(const autonum::sequentialNumbers& sn); - QList junctions() const; + QList junctions() const; private: void setUpConnectionForFormula( @@ -227,7 +227,7 @@ class Conductor : public QGraphicsObject static int getCoeff(const qreal &, const qreal &); static int getSign(const qreal &); QHash shareOffsetBetweenSegments(const qreal &offset, const QList &, const qreal & = 0.01) const; - static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal = 10); + static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal = 10); static Qt::Corner movementType(const QPointF &, const QPointF &); static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &); }; diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 74c9fe580..7a0f48575 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -427,17 +427,17 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state) return(false); } - //Check if the current version can read the xml description - const auto elmt_version = QetVersion::fromXmlAttribute(xml_def_elmt); - if (!elmt_version.isNull() - && QetVersion::currentVersion() < elmt_version) - { - std::cerr << qPrintable( - QObject::tr("Avertissement : l'élément " - " a été enregistré avec une version" - " ultérieure de QElectroTech.") - ) << std::endl; - } + //Check if the current version can read the xml description + const auto elmt_version = QetVersion::fromXmlAttribute(xml_def_elmt); + if (!elmt_version.isNull() + && QetVersion::currentVersion() < elmt_version) + { + std::cerr << qPrintable( + QObject::tr("Avertissement : l'élément " + " a été enregistré avec une version" + " ultérieure de QElectroTech.") + ) << std::endl; + } //This attribute must be present and valid int w = 0, h = 0, hot_x = 0, hot_y = 0; diff --git a/sources/undocommand/addgraphicsobjectcommand.cpp b/sources/undocommand/addgraphicsobjectcommand.cpp index 7053c9e91..968b7eee0 100644 --- a/sources/undocommand/addgraphicsobjectcommand.cpp +++ b/sources/undocommand/addgraphicsobjectcommand.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 "addgraphicsobjectcommand.h" #include "../qetgraphicsitem/qetgraphicsitem.h" @@ -30,21 +30,21 @@ * @param parent : parent undo command of this class. */ AddGraphicsObjectCommand::AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram, - const QPointF &pos, QUndoCommand *parent) : - QUndoCommand(parent), - m_item(qgo), - m_diagram(diagram), - m_pos(pos) + const QPointF &pos, QUndoCommand *parent) : + QUndoCommand(parent), + m_item(qgo), + m_diagram(diagram), + m_pos(pos) { setText(QObject::tr("Ajouter ") + itemText()); - m_diagram->qgiManager().manage(m_item); + m_diagram->qgiManager().manage(m_item); } /** * @brief AddGraphicsObjectCommand::~AddGraphicsObjectCommand */ AddGraphicsObjectCommand::~AddGraphicsObjectCommand() { - m_diagram->qgiManager().release(m_item); + m_diagram->qgiManager().release(m_item); } /** @@ -53,12 +53,12 @@ AddGraphicsObjectCommand::~AddGraphicsObjectCommand() { */ void AddGraphicsObjectCommand::undo() { - if (m_item) - { - m_diagram->showMe(); - m_diagram->removeItem(m_item); - } - QUndoCommand::undo(); + if (m_item) + { + m_diagram->showMe(); + m_diagram->removeItem(m_item); + } + QUndoCommand::undo(); } /** @@ -67,13 +67,13 @@ void AddGraphicsObjectCommand::undo() */ void AddGraphicsObjectCommand::redo() { - if (m_item) - { - m_diagram->showMe(); - m_diagram->addItem(m_item); - m_item->setPos(m_pos); - } - QUndoCommand::redo(); + if (m_item) + { + m_diagram->showMe(); + m_diagram->addItem(m_item); + m_item->setPos(m_pos); + } + QUndoCommand::redo(); } /** @@ -83,12 +83,12 @@ void AddGraphicsObjectCommand::redo() QString AddGraphicsObjectCommand::itemText() const { if (auto qgi = dynamic_cast(m_item.data())) { - return qgi->name(); + return qgi->name(); } else if (dynamic_cast(m_item.data())) { return QObject::tr("un champ texte"); } else if (dynamic_cast(m_item.data())) { - return QObject::tr("un conducteur"); - } else { - return QObject::tr("un element graphique"); - } + return QObject::tr("un conducteur"); + } else { + return QObject::tr("un element graphique"); + } } diff --git a/sources/undocommand/addgraphicsobjectcommand.h b/sources/undocommand/addgraphicsobjectcommand.h index 96f3ebd91..005c895dc 100644 --- a/sources/undocommand/addgraphicsobjectcommand.h +++ b/sources/undocommand/addgraphicsobjectcommand.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 ADDGRAPHICSOBJECTCOMMAND_H #define ADDGRAPHICSOBJECTCOMMAND_H @@ -32,21 +32,21 @@ class Diagram; class AddGraphicsObjectCommand : public QUndoCommand { public: - AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram, - const QPointF &pos = QPointF(), - QUndoCommand *parent = nullptr); - ~AddGraphicsObjectCommand() override; + AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram, + const QPointF &pos = QPointF(), + QUndoCommand *parent = nullptr); + ~AddGraphicsObjectCommand() override; - void undo() override; - void redo() override; + void undo() override; + void redo() override; - private: - QString itemText() const; + private: + QString itemText() const; - private: - QPointer m_item; - Diagram *m_diagram = nullptr; - QPointF m_pos; + private: + QPointer m_item; + Diagram *m_diagram = nullptr; + QPointF m_pos; }; #endif // ADDGRAPHICSOBJECTCOMMAND_H diff --git a/sources/undocommand/changeelementdatacommand.cpp b/sources/undocommand/changeelementdatacommand.cpp index b4245cd96..b74f62635 100644 --- a/sources/undocommand/changeelementdatacommand.cpp +++ b/sources/undocommand/changeelementdatacommand.cpp @@ -1,40 +1,40 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 "changeelementdatacommand.h" #include "../qetgraphicsitem/element.h" ChangeElementDataCommand::ChangeElementDataCommand(Element *element, ElementData new_data, QUndoCommand *parent) : QUndoCommand(parent), - m_element(element), - m_old_data(element->elementData()), - m_new_data(new_data) + m_element(element), + m_old_data(element->elementData()), + m_new_data(new_data) { - setText(QObject::tr("Modifier les propriétés d'un élement")); + setText(QObject::tr("Modifier les propriétés d'un élement")); } void ChangeElementDataCommand::undo() { - if (m_element) { + if (m_element) { m_element.data()->setElementData(m_old_data); - } + } } void ChangeElementDataCommand::redo() { - if (m_element) { + if (m_element) { m_element.data()->setElementData(m_new_data); - } + } } diff --git a/sources/undocommand/changeelementdatacommand.h b/sources/undocommand/changeelementdatacommand.h index e760a3d69..21a278d89 100644 --- a/sources/undocommand/changeelementdatacommand.h +++ b/sources/undocommand/changeelementdatacommand.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 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 . + Copyright 2006-2024 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 CHANGEELEMENTDATACOMMAND_H #define CHANGEELEMENTDATACOMMAND_H @@ -25,14 +25,14 @@ class Element; class ChangeElementDataCommand : public QUndoCommand { - public: + public: ChangeElementDataCommand(Element *element, ElementData new_data, QUndoCommand *parent = nullptr); - void undo() override; - void redo() override; + void undo() override; + void redo() override; - private: - QPointer m_element; - ElementData m_old_data, m_new_data; + private: + QPointer m_element; + ElementData m_old_data, m_new_data; }; #endif // CHANGEELEMENTDATACOMMAND_H diff --git a/sources/undocommand/itemmodelcommand.h b/sources/undocommand/itemmodelcommand.h index 5274c7253..965c21950 100644 --- a/sources/undocommand/itemmodelcommand.h +++ b/sources/undocommand/itemmodelcommand.h @@ -30,15 +30,15 @@ class QAbstractItemModel; */ class ModelIndexCommand : public QUndoCommand { - public: + public: ModelIndexCommand(QAbstractItemModel *model, const QModelIndex &index, QUndoCommand *parent = nullptr); void setData(const QVariant &value, int role = Qt::DisplayRole); virtual void redo() override; virtual void undo() override; - private: - QPointer m_model; + private: + QPointer m_model; QModelIndex m_index; QVariant m_old_value, m_new_value; diff --git a/sources/undocommand/movegraphicsitemcommand.cpp b/sources/undocommand/movegraphicsitemcommand.cpp index 33dd89b7e..20037efcc 100644 --- a/sources/undocommand/movegraphicsitemcommand.cpp +++ b/sources/undocommand/movegraphicsitemcommand.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2022 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 . + Copyright 2006-2022 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 @@ -33,25 +33,25 @@ * @param parent : parent undo command */ MoveGraphicsItemCommand::MoveGraphicsItemCommand(Diagram *diagram, - const DiagramContent &content, - const QPointF &movement, - QUndoCommand *parent) : - QUndoCommand{parent}, - m_diagram{diagram}, - m_content{content}, - m_movement{movement} + const DiagramContent &content, + const QPointF &movement, + QUndoCommand *parent) : + QUndoCommand{parent}, + m_diagram{diagram}, + m_content{content}, + m_movement{movement} { - const auto moved_content_sentence = m_content.sentence(DiagramContent::Elements - | DiagramContent::TextFields - | DiagramContent::ConductorsToUpdate - | DiagramContent::ConductorsToMove - | DiagramContent::Images - | DiagramContent::Shapes - | DiagramContent::ElementTextFields - | DiagramContent::TerminalStrip); + const auto moved_content_sentence = m_content.sentence(DiagramContent::Elements + | DiagramContent::TextFields + | DiagramContent::ConductorsToUpdate + | DiagramContent::ConductorsToMove + | DiagramContent::Images + | DiagramContent::Shapes + | DiagramContent::ElementTextFields + | DiagramContent::TerminalStrip); - setText(QString(QObject::tr("déplacer %1", - "undo caption - %1 is a sentence listing the moved content").arg(moved_content_sentence))); + setText(QString(QObject::tr("déplacer %1", + "undo caption - %1 is a sentence listing the moved content").arg(moved_content_sentence))); } /** @@ -60,13 +60,13 @@ MoveGraphicsItemCommand::MoveGraphicsItemCommand(Diagram *diagram, */ void MoveGraphicsItemCommand::undo() { - if (m_diagram) - { - m_diagram->showMe(); - m_anim_group.setDirection(QAnimationGroup::Forward); - m_anim_group.start(); - } - QUndoCommand::undo(); + if (m_diagram) + { + m_diagram->showMe(); + m_anim_group.setDirection(QAnimationGroup::Forward); + m_anim_group.start(); + } + QUndoCommand::undo(); } /** @@ -75,21 +75,21 @@ void MoveGraphicsItemCommand::undo() */ void MoveGraphicsItemCommand::redo() { - if (m_diagram) - { - m_diagram->showMe(); - if (m_first_redo) - { - m_first_redo = false; - move(-m_movement); - } - else - { - m_anim_group.setDirection(QAnimationGroup::Backward); - m_anim_group.start(); - } - } - QUndoCommand::redo(); + if (m_diagram) + { + m_diagram->showMe(); + if (m_first_redo) + { + m_first_redo = false; + move(-m_movement); + } + else + { + m_anim_group.setDirection(QAnimationGroup::Backward); + m_anim_group.start(); + } + } + QUndoCommand::redo(); } /** @@ -99,57 +99,57 @@ void MoveGraphicsItemCommand::redo() */ void MoveGraphicsItemCommand::move(const QPointF &movement) { - for (auto &&qgi : m_content.items(DiagramContent::Elements - | DiagramContent::TextFields - | DiagramContent::Images - | DiagramContent::Shapes - | DiagramContent::TextGroup - | DiagramContent::ElementTextFields - | DiagramContent::Tables - | DiagramContent::TerminalStrip)) - { - //If item have a parent and the parent is in m_content, - //we don't apply movement because this item will be moved by his parent - if (const auto parent_ = qgi->parentItem()) { - if (m_content.items().contains(parent_)) { - continue; - } - } + for (auto &&qgi : m_content.items(DiagramContent::Elements + | DiagramContent::TextFields + | DiagramContent::Images + | DiagramContent::Shapes + | DiagramContent::TextGroup + | DiagramContent::ElementTextFields + | DiagramContent::Tables + | DiagramContent::TerminalStrip)) + { + //If item have a parent and the parent is in m_content, + //we don't apply movement because this item will be moved by his parent + if (const auto parent_ = qgi->parentItem()) { + if (m_content.items().contains(parent_)) { + continue; + } + } - if (const auto graphics_object = qgi->toGraphicsObject()) { - setupAnimation(graphics_object, - "pos", - graphics_object->pos(), - graphics_object->pos() + movement); - } - else if (qgi->type() == QGraphicsItemGroup::Type) - { - //ElementTextItemGroup is a QObject not a QGraphicsObject - if (ElementTextItemGroup *etig = dynamic_cast(qgi)) { - setupAnimation(etig, - "pos", - etig->pos(), - etig->pos() + movement); - } - } - else - { - qgi->setPos(qgi->pos() + movement); - } - } + if (const auto graphics_object = qgi->toGraphicsObject()) { + setupAnimation(graphics_object, + "pos", + graphics_object->pos(), + graphics_object->pos() + movement); + } + else if (qgi->type() == QGraphicsItemGroup::Type) + { + //ElementTextItemGroup is a QObject not a QGraphicsObject + if (ElementTextItemGroup *etig = dynamic_cast(qgi)) { + setupAnimation(etig, + "pos", + etig->pos(), + etig->pos() + movement); + } + } + else + { + qgi->setPos(qgi->pos() + movement); + } + } - //Move some conductors - for (const auto &conductor : qAsConst(m_content.m_conductors_to_move)) { - setupAnimation(conductor, - "pos", - conductor->pos(), - conductor->pos() + movement); - } + //Move some conductors + for (const auto &conductor : qAsConst(m_content.m_conductors_to_move)) { + setupAnimation(conductor, + "pos", + conductor->pos(), + conductor->pos() + movement); + } - //Recalcul the path of other conductors - for (const auto &conductor : qAsConst(m_content.m_conductors_to_update)) { - setupAnimation(conductor, "animPath", 1, 1); - } + //Recalcul the path of other conductors + for (const auto &conductor : qAsConst(m_content.m_conductors_to_update)) { + setupAnimation(conductor, "animPath", 1, 1); + } } /** @@ -162,14 +162,14 @@ void MoveGraphicsItemCommand::move(const QPointF &movement) * @param end */ void MoveGraphicsItemCommand::setupAnimation(QObject *target, - const QByteArray &property_name, - const QVariant &start, - const QVariant &end) + const QByteArray &property_name, + const QVariant &start, + const QVariant &end) { - QPropertyAnimation *animation{new QPropertyAnimation(target, property_name)}; - animation->setDuration(300); - animation->setStartValue(start); - animation->setEndValue(end); - animation->setEasingCurve(QEasingCurve::OutQuad); - m_anim_group.addAnimation(animation); + QPropertyAnimation *animation{new QPropertyAnimation(target, property_name)}; + animation->setDuration(300); + animation->setStartValue(start); + animation->setEndValue(end); + animation->setEasingCurve(QEasingCurve::OutQuad); + m_anim_group.addAnimation(animation); } diff --git a/sources/xml/terminalstripitemxml.cpp b/sources/xml/terminalstripitemxml.cpp index 954dece8e..d10e946da 100644 --- a/sources/xml/terminalstripitemxml.cpp +++ b/sources/xml/terminalstripitemxml.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2022 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 . + Copyright 2006-2022 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 "terminalstripitemxml.h" @@ -37,16 +37,16 @@ const QString STRIP_ITEMS_TAG_NAME { QStringLiteral("terminal_strip_items") }; */ QDomElement TerminalStripItemXml::toXml(const QVector &items, QDomDocument &document) { - auto dom_element = document.createElement(STRIP_ITEMS_TAG_NAME); - for (const auto &item : items) - { - const auto child_ = toXml(item, document); - if (!child_.isNull()) { - dom_element.appendChild(child_); - } - } - - return dom_element; + auto dom_element = document.createElement(STRIP_ITEMS_TAG_NAME); + for (const auto &item : items) + { + const auto child_ = toXml(item, document); + if (!child_.isNull()) { + dom_element.appendChild(child_); + } + } + + return dom_element; } /** @@ -59,20 +59,20 @@ QDomElement TerminalStripItemXml::toXml(const QVector &item */ QVector TerminalStripItemXml::fromXml(Diagram *diagram, const QDomElement &xml_elmt) { - QVector returned_vector; + QVector returned_vector; - for (const auto &dom_elmt : QETXML::subChild(xml_elmt, - STRIP_ITEMS_TAG_NAME, - STRIP_ITEM_TAG_NAME)) - { - auto strip_item = new TerminalStripItem(); - diagram->addItem(strip_item); - returned_vector << strip_item; + for (const auto &dom_elmt : QETXML::subChild(xml_elmt, + STRIP_ITEMS_TAG_NAME, + STRIP_ITEM_TAG_NAME)) + { + auto strip_item = new TerminalStripItem(); + diagram->addItem(strip_item); + returned_vector << strip_item; - TerminalStripItemXml::fromXml(strip_item, diagram->project(), dom_elmt); - } + TerminalStripItemXml::fromXml(strip_item, diagram->project(), dom_elmt); + } - return returned_vector; + return returned_vector; } /** @@ -84,21 +84,21 @@ QVector TerminalStripItemXml::fromXml(Diagram *diagram, con */ QDomElement TerminalStripItemXml::toXml(TerminalStripItem *item, QDomDocument &document) { - if (item->terminalStrip()) - { - //Terminal strip item dom element - auto dom_element = document.createElement(STRIP_ITEM_TAG_NAME); + if (item->terminalStrip()) + { + //Terminal strip item dom element + auto dom_element = document.createElement(STRIP_ITEM_TAG_NAME); - auto dom_strip = document.createElement(QStringLiteral("terminal_strip")); - dom_strip.setAttribute(QStringLiteral("uuid"), item->terminalStrip()->uuid().toString()); - dom_element.appendChild(dom_strip); + auto dom_strip = document.createElement(QStringLiteral("terminal_strip")); + dom_strip.setAttribute(QStringLiteral("uuid"), item->terminalStrip()->uuid().toString()); + dom_element.appendChild(dom_strip); - dom_element.appendChild(QETXML::qGraphicsItemPosToXml(item, document)); + dom_element.appendChild(QETXML::qGraphicsItemPosToXml(item, document)); - return dom_element; - } else { - return QDomElement(); - } + return dom_element; + } else { + return QDomElement(); + } } /** @@ -112,29 +112,29 @@ QDomElement TerminalStripItemXml::toXml(TerminalStripItem *item, QDomDocument &d */ bool TerminalStripItemXml::fromXml(TerminalStripItem *item, QETProject *project, const QDomElement &xml_elmt) { - if (xml_elmt.tagName() == STRIP_ITEM_TAG_NAME) - { - bool a{false}; - - const auto ts = xml_elmt.firstChildElement(QStringLiteral("terminal_strip")); - if (!ts.isNull()) - { - const QUuid uuid_(ts.attribute(QStringLiteral("uuid"))); - item->m_pending_strip_uuid = uuid_; - - for (const auto &ts : project->terminalStrip()) { - if (ts->uuid() == uuid_) { - item->setTerminalStrip(ts); - a = true; - break; - } - } - } - - bool b{QETXML::qGraphicsItemPosFromXml(item, - xml_elmt.firstChildElement(QStringLiteral("pos")))}; - - return (a && b); - } - return false; + if (xml_elmt.tagName() == STRIP_ITEM_TAG_NAME) + { + bool a{false}; + + const auto ts = xml_elmt.firstChildElement(QStringLiteral("terminal_strip")); + if (!ts.isNull()) + { + const QUuid uuid_(ts.attribute(QStringLiteral("uuid"))); + item->m_pending_strip_uuid = uuid_; + + for (const auto &ts : project->terminalStrip()) { + if (ts->uuid() == uuid_) { + item->setTerminalStrip(ts); + a = true; + break; + } + } + } + + bool b{QETXML::qGraphicsItemPosFromXml(item, + xml_elmt.firstChildElement(QStringLiteral("pos")))}; + + return (a && b); + } + return false; } diff --git a/sources/xml/terminalstripitemxml.h b/sources/xml/terminalstripitemxml.h index c0e738f13..a59d855d6 100644 --- a/sources/xml/terminalstripitemxml.h +++ b/sources/xml/terminalstripitemxml.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2022 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 . + Copyright 2006-2022 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 TERMINALSTRIPITEMXML_H #define TERMINALSTRIPITEMXML_H @@ -26,12 +26,12 @@ class Diagram; class TerminalStripItemXml { - public: - static QDomElement toXml(const QVector &items, QDomDocument &document); - static QVector fromXml(Diagram *diagram, const QDomElement &xml_elmt); + public: + static QDomElement toXml(const QVector &items, QDomDocument &document); + static QVector fromXml(Diagram *diagram, const QDomElement &xml_elmt); - static QDomElement toXml(TerminalStripItem *item, QDomDocument &document); - static bool fromXml(TerminalStripItem *item, QETProject *project, const QDomElement &xml_elmt); + static QDomElement toXml(TerminalStripItem *item, QDomDocument &document); + static bool fromXml(TerminalStripItem *item, QETProject *project, const QDomElement &xml_elmt); }; #endif // TERMINALSTRIPITEMXML_H From 0d44933432b9a323658247c34aeb793236fef952 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Wed, 24 Apr 2024 18:02:00 +0200 Subject: [PATCH 2/3] correct more indentations / whitespace --- sources/ElementsCollection/ui/renamedialog.h | 2 +- .../ui/replaceconductordialog.cpp | 4 +- sources/editor/ui/ellipseeditor.cpp | 2 +- sources/editor/ui/ellipseeditor.h | 2 +- sources/editor/ui/lineeditor.h | 10 +- sources/editor/ui/qetelementeditor.cpp | 6 +- sources/editor/ui/terminaleditor.cpp | 30 ++--- sources/editor/ui/terminaleditor.h | 36 +++--- sources/editor/ui/texteditor.cpp | 106 +++++++++--------- sources/ui/aboutqetdialog.cpp | 22 ++-- .../configpage/generalconfigurationpage.cpp | 30 ++--- .../ui/configpage/generalconfigurationpage.h | 4 +- sources/ui/linksingleelementwidget.cpp | 4 +- sources/ui/projectpropertiesdialog.cpp | 6 +- sources/ui/projectpropertiesdialog.h | 4 +- .../ui/shapegraphicsitempropertieswidget.cpp | 64 +++++------ .../ui/shapegraphicsitempropertieswidget.h | 4 +- 17 files changed, 168 insertions(+), 168 deletions(-) diff --git a/sources/ElementsCollection/ui/renamedialog.h b/sources/ElementsCollection/ui/renamedialog.h index c43a42d10..f6bef1901 100644 --- a/sources/ElementsCollection/ui/renamedialog.h +++ b/sources/ElementsCollection/ui/renamedialog.h @@ -23,7 +23,7 @@ #include namespace Ui { - class RenameDialog; + class RenameDialog; } class RenameDialog : public QDialog diff --git a/sources/SearchAndReplace/ui/replaceconductordialog.cpp b/sources/SearchAndReplace/ui/replaceconductordialog.cpp index 387c92d2f..00ea72b55 100644 --- a/sources/SearchAndReplace/ui/replaceconductordialog.cpp +++ b/sources/SearchAndReplace/ui/replaceconductordialog.cpp @@ -124,7 +124,7 @@ void ReplaceConductorDialog::setProperties(const ConductorProperties &properties ui->m_pen_cb ->setChecked (m_properties.singleLineProperties.isPen()); ui->m_phase_cb ->setChecked (m_properties.singleLineProperties.phasesCount()); ui->m_phase_slider->setValue (m_properties.singleLineProperties.phasesCount()); - + updatePreview(false); } @@ -252,7 +252,7 @@ void ReplaceConductorDialog::setColorButton2(const QColor &color) void ReplaceConductorDialog::on_m_erase_formula_cb_clicked() { - ui->m_formula_le->setText(ui->m_erase_formula_cb->isChecked() + ui->m_formula_le->setText(ui->m_erase_formula_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); ui->m_formula_le->setDisabled(ui->m_erase_formula_cb->isChecked()); diff --git a/sources/editor/ui/ellipseeditor.cpp b/sources/editor/ui/ellipseeditor.cpp index 308264e33..393de0ba4 100644 --- a/sources/editor/ui/ellipseeditor.cpp +++ b/sources/editor/ui/ellipseeditor.cpp @@ -34,7 +34,7 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *part, QWidge ui(new Ui::EllipseEditor), m_part(part) { - ui->setupUi(this); + ui->setupUi(this); m_style = new StyleEditor(editor); ui->m_main_layout->insertWidget(0, m_style); updateForm(); diff --git a/sources/editor/ui/ellipseeditor.h b/sources/editor/ui/ellipseeditor.h index 2567ad4c8..36cf50328 100644 --- a/sources/editor/ui/ellipseeditor.h +++ b/sources/editor/ui/ellipseeditor.h @@ -33,7 +33,7 @@ class StyleEditor; */ class EllipseEditor : public ElementItemEditor { - Q_OBJECT + Q_OBJECT public: explicit EllipseEditor (QETElementEditor *editor, PartEllipse *part = nullptr, QWidget *parent = nullptr); diff --git a/sources/editor/ui/lineeditor.h b/sources/editor/ui/lineeditor.h index 9e386adeb..0c6a8b104 100644 --- a/sources/editor/ui/lineeditor.h +++ b/sources/editor/ui/lineeditor.h @@ -21,7 +21,7 @@ #include "../elementitemeditor.h" namespace Ui { - class LineEditor; + class LineEditor; } class PartLine; @@ -33,11 +33,11 @@ class StyleEditor; */ class LineEditor : public ElementItemEditor { - Q_OBJECT + Q_OBJECT - public: - explicit LineEditor(QETElementEditor *editor, PartLine *part = nullptr, QWidget *parent = nullptr); - ~LineEditor() override; + public: + explicit LineEditor(QETElementEditor *editor, PartLine *part = nullptr, QWidget *parent = nullptr); + ~LineEditor() override; bool setPart(CustomElementPart *part) override; bool setParts(QList parts) override; diff --git a/sources/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index 79b9e27c2..684a5ca48 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -106,7 +106,7 @@ void QETElementEditor::contextMenu(QPoint p, QList actions) menu.addAction(ui->m_delete_action); menu.addAction(ui->m_cut_action); menu.addAction(ui->m_copy_action); - menu.addAction((ui->m_rotate_action)); + menu.addAction((ui->m_rotate_action)); menu.addSeparator(); menu.addAction(ui->m_paste_action); menu.addAction(ui->m_paste_in_area_action); @@ -1026,10 +1026,10 @@ void QETElementEditor::setupActions() depth_toolbar -> addActions(m_depth_action_group -> actions()); addToolBar(Qt::TopToolBarArea, depth_toolbar); - //Rotate action + //Rotate action connect(ui->m_rotate_action, &QAction::triggered, [this]() {this -> elementScene() -> undoStack().push(new RotateElementsCommand(this->elementScene()));}); - //Zoom action + //Zoom action ui->m_zoom_in_action -> setShortcut(QKeySequence::ZoomIn); ui->m_zoom_out_action -> setShortcut(QKeySequence::ZoomOut); ui->m_zoom_fit_best_action -> setShortcut(QKeySequence(tr("Ctrl+9"))); diff --git a/sources/editor/ui/terminaleditor.cpp b/sources/editor/ui/terminaleditor.cpp index 685aa5174..c84ae5ecf 100644 --- a/sources/editor/ui/terminaleditor.cpp +++ b/sources/editor/ui/terminaleditor.cpp @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 The QElectroTech Team - This file is part of QElectroTech. + Copyright 2006-2024 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 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. + 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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "terminaleditor.h" #include "ui_terminaleditor.h" @@ -114,9 +114,9 @@ CustomElementPart *TerminalEditor::currentPart() const */ void TerminalEditor::init() { - ui->m_orientation_cb->addItem(QET::Icons::North, tr("Nord"), Qet::North); - ui->m_orientation_cb->addItem(QET::Icons::East, tr("Est"), Qet::East); - ui->m_orientation_cb->addItem(QET::Icons::South, tr("Sud"), Qet::South); + ui->m_orientation_cb->addItem(QET::Icons::North, tr("Nord"), Qet::North); + ui->m_orientation_cb->addItem(QET::Icons::East, tr("Est"), Qet::East); + ui->m_orientation_cb->addItem(QET::Icons::South, tr("Sud"), Qet::South); ui->m_orientation_cb->addItem(QET::Icons::West, tr("Ouest"), Qet::West); ui->m_type_cb->addItem(tr("Générique"), TerminalData::Generic); diff --git a/sources/editor/ui/terminaleditor.h b/sources/editor/ui/terminaleditor.h index 9d1a6929a..83013fb74 100644 --- a/sources/editor/ui/terminaleditor.h +++ b/sources/editor/ui/terminaleditor.h @@ -1,19 +1,19 @@ /* - Copyright 2006-2024 The QElectroTech Team - This file is part of QElectroTech. + Copyright 2006-2024 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 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. + 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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef TERMINALEDITOR_H #define TERMINALEDITOR_H @@ -33,18 +33,18 @@ class PartTerminal; */ class TerminalEditor : public ElementItemEditor { - Q_OBJECT + Q_OBJECT - public: + public: TerminalEditor(QETElementEditor *editor, QWidget *parent = nullptr); ~TerminalEditor() override; - void updateForm() override; + void updateForm() override; bool setPart(CustomElementPart *new_part) override; CustomElementPart *currentPart() const override; QList currentParts() const override {return QList();} - private: + private: void init(); void posEdited(); void orientationEdited(); @@ -53,8 +53,8 @@ class TerminalEditor : public ElementItemEditor void activeConnections(bool active); void activeChangeConnections(bool active); - private: - Ui::TerminalEditor *ui; + private: + Ui::TerminalEditor *ui; QVector m_editor_connections, m_change_connections; PartTerminal *m_part = nullptr; diff --git a/sources/editor/ui/texteditor.cpp b/sources/editor/ui/texteditor.cpp index 2ed2e3960..feb34df51 100644 --- a/sources/editor/ui/texteditor.cpp +++ b/sources/editor/ui/texteditor.cpp @@ -295,83 +295,83 @@ void TextEditor::setUpWidget(QWidget *parent) setWindowTitle(tr("Form")); resize(378, 133); QGridLayout *gridLayout = new QGridLayout(parent); - gridLayout->setObjectName(QString::fromUtf8("gridLayout")); - m_y_sb = new QSpinBox(parent); - m_y_sb->setObjectName(QString::fromUtf8("m_y_sb")); - m_y_sb->setMinimum(-10000); - m_y_sb->setMaximum(10000); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + m_y_sb = new QSpinBox(parent); + m_y_sb->setObjectName(QString::fromUtf8("m_y_sb")); + m_y_sb->setMinimum(-10000); + m_y_sb->setMaximum(10000); - gridLayout->addWidget(m_y_sb, 1, 3, 1, 1); + gridLayout->addWidget(m_y_sb, 1, 3, 1, 1); - QLabel*label_2 = new QLabel(tr("Y :"),parent); + QLabel*label_2 = new QLabel(tr("Y :"),parent); - gridLayout->addWidget(label_2, 1, 2, 1, 1); + gridLayout->addWidget(label_2, 1, 2, 1, 1); - QLabel*label_4 = new QLabel(tr("Police :"),parent); + QLabel*label_4 = new QLabel(tr("Police :"),parent); - gridLayout->addWidget(label_4, 2, 0, 1, 1); + gridLayout->addWidget(label_4, 2, 0, 1, 1); - m_rotation_sb = new QSpinBox(parent); - m_rotation_sb->setSuffix(tr("\302\260")); - m_rotation_sb->setWrapping(true); - m_rotation_sb->setMaximum(360); + m_rotation_sb = new QSpinBox(parent); + m_rotation_sb->setSuffix(tr("\302\260")); + m_rotation_sb->setWrapping(true); + m_rotation_sb->setMaximum(360); - gridLayout->addWidget(m_rotation_sb, 1, 5, 1, 1); + gridLayout->addWidget(m_rotation_sb, 1, 5, 1, 1); - QLabel *label_3 = new QLabel(tr("Rotation :"),parent); + QLabel *label_3 = new QLabel(tr("Rotation :"),parent); - gridLayout->addWidget(label_3, 1, 4, 1, 1); + gridLayout->addWidget(label_3, 1, 4, 1, 1); - m_x_sb = new QSpinBox(parent); - m_x_sb->setObjectName(QString::fromUtf8("m_x_sb")); - m_x_sb->setMinimum(-10000); - m_x_sb->setMaximum(10000); + m_x_sb = new QSpinBox(parent); + m_x_sb->setObjectName(QString::fromUtf8("m_x_sb")); + m_x_sb->setMinimum(-10000); + m_x_sb->setMaximum(10000); - gridLayout->addWidget(m_x_sb, 1, 1, 1, 1); + gridLayout->addWidget(m_x_sb, 1, 1, 1, 1); - QLabel *label = new QLabel(tr("X :"),parent); + QLabel *label = new QLabel(tr("X :"),parent); - gridLayout->addWidget(label, 1, 0, 1, 1); + gridLayout->addWidget(label, 1, 0, 1, 1); - m_size_sb = new QSpinBox(parent); - m_size_sb->setObjectName(QString::fromUtf8("m_size_sb")); + m_size_sb = new QSpinBox(parent); + m_size_sb->setObjectName(QString::fromUtf8("m_size_sb")); - gridLayout->addWidget(m_size_sb, 2, 1, 1, 1); + gridLayout->addWidget(m_size_sb, 2, 1, 1, 1); - m_line_edit = new QLineEdit(parent); - m_line_edit->setObjectName(QString::fromUtf8("m_line_edit")); - m_line_edit->setClearButtonEnabled(true); - m_line_edit->setPlaceholderText(tr("Entrer votre texte ici")); + m_line_edit = new QLineEdit(parent); + m_line_edit->setObjectName(QString::fromUtf8("m_line_edit")); + m_line_edit->setClearButtonEnabled(true); + m_line_edit->setPlaceholderText(tr("Entrer votre texte ici")); - gridLayout->addWidget(m_line_edit, 0, 0, 1, 6); + gridLayout->addWidget(m_line_edit, 0, 0, 1, 6); #ifdef BUILD_WITHOUT_KF5 #else - m_color_pb = new KColorButton(parent); - m_color_pb->setObjectName(QString::fromUtf8("m_color_pb")); + m_color_pb = new KColorButton(parent); + m_color_pb->setObjectName(QString::fromUtf8("m_color_pb")); - connect( - m_color_pb, - &KColorButton::changed, - this, - &TextEditor::on_m_color_pb_changed); + connect( + m_color_pb, + &KColorButton::changed, + this, + &TextEditor::on_m_color_pb_changed); - gridLayout->addWidget(m_color_pb, 2, 5, 1, 1); - #endif - QLabel *label_5 = new QLabel(parent); - label_5->setObjectName(QString::fromUtf8("label_5")); + gridLayout->addWidget(m_color_pb, 2, 5, 1, 1); +#endif + QLabel *label_5 = new QLabel(parent); + label_5->setObjectName(QString::fromUtf8("label_5")); - gridLayout->addWidget(label_5, 2, 4, 1, 1); + gridLayout->addWidget(label_5, 2, 4, 1, 1); - m_font_pb = new QPushButton(tr("Couleur :"),parent); - connect(m_font_pb, - &QPushButton::pressed, - this, - &TextEditor::on_m_font_pb_clicked); + m_font_pb = new QPushButton(tr("Couleur :"),parent); + connect(m_font_pb, + &QPushButton::pressed, + this, + &TextEditor::on_m_font_pb_clicked); - gridLayout->addWidget(m_font_pb, 2, 2, 1, 2); + gridLayout->addWidget(m_font_pb, 2, 2, 1, 2); - QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + QSpacerItem *verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); - gridLayout->addItem(verticalSpacer, 3, 2, 1, 1); - setLayout(gridLayout); + gridLayout->addItem(verticalSpacer, 3, 2, 1, 1); + setLayout(gridLayout); } diff --git a/sources/ui/aboutqetdialog.cpp b/sources/ui/aboutqetdialog.cpp index 336122263..b45b10ff7 100644 --- a/sources/ui/aboutqetdialog.cpp +++ b/sources/ui/aboutqetdialog.cpp @@ -64,17 +64,17 @@ void AboutQETDialog::setAbout() tr(" Les développeurs de QElectroTech", "about tab, developers line") + "

" "https://qelectrotech.org/" - "

" + - "The program is provided AS IS with NO WARRANTY OF ANY KIND," - "
" - " INCLUDING THE WARRANTY OF DESIGN, " - "
" - "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE."; - "
" + "

" + + "The program is provided AS IS with NO WARRANTY OF ANY KIND," + "
" + " INCLUDING THE WARRANTY OF DESIGN, " + "
" + "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE."; + "
" "

" + tr("Contact : qet@lists.tuxfamily.org", "about tab, contact line"); - - + + ui->m_about_label->setText(str); } @@ -91,7 +91,7 @@ void AboutQETDialog::setAuthors() addAuthor(ui->m_author_label, "Ronny Desmedt", "r.desmedt@live.be", tr("Convertisseur DXF")); addAuthor(ui->m_author_label, "Raul Roda", "raulroda8@gmail.com", tr("Plugin Bornier")); addAuthor(ui->m_author_label, "Abhishek Bansal", "abhishek@qelectrotech.org", tr("Développement")); - addAuthor(ui->m_author_label, "Simon De Backer", "debacker@qelectrotech.org", tr("Développement")); + addAuthor(ui->m_author_label, "Simon De Backer", "debacker@qelectrotech.org", tr("Développement")); addAuthor(ui->m_author_label, "David Varley", "David.Varley@cborn.com", tr("Développement")); addAuthor(ui->m_author_label, "Damian Caceres", "damiancaceresmoreno@yahoo.es", tr("Développement")); addAuthor(ui->m_author_label, "Martin Marmsoler", "martin.marmsoler@gmail.com", tr("Développement")); @@ -166,7 +166,7 @@ void AboutQETDialog::setContributors() void AboutQETDialog::setVersion() { QString str = "QElectroTech V " - + QetVersion::displayedVersion() + + QetVersion::displayedVersion() + ""; ui->m_version_label->setText(str + MachineInfo::instance()->compilation_info()); } diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp index bddc89b65..79adbd550 100644 --- a/sources/ui/configpage/generalconfigurationpage.cpp +++ b/sources/ui/configpage/generalconfigurationpage.cpp @@ -122,12 +122,12 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool()); ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString()); - /* - Nombre maximum de primitives affichees par la "liste des parties" - Au-dela, un petit message est affiche, indiquant que ce nombre a ete depasse - et que la liste ne sera donc pas mise a jour. - */ - ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt()); + /* + Nombre maximum de primitives affichees par la "liste des parties" + Au-dela, un petit message est affiche, indiquant que ce nombre a ete depasse + et que la liste ne sera donc pas mise a jour. + */ + ui->MaxPartsElementEditorList_sb->setValue(settings.value("elementeditor/max-parts-element-editor-list", 200).toInt()); QString path = settings.value("elements-collections/common-collection-path", "default").toString(); if (path != "default") @@ -209,7 +209,7 @@ void GeneralConfigurationPage::applyConf() //ELEMENT EDITOR settings.setValue("elementeditor/default-informations", ui->m_default_elements_info->toPlainText()); - settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value()); + settings.setValue("elementeditor/max-parts-element-editor-list", ui->MaxPartsElementEditorList_sb->value()); //DIAGRAM VIEW settings.setValue("diagramview/gestures", ui->m_use_gesture_trackpad->isChecked()); @@ -223,7 +223,7 @@ void GeneralConfigurationPage::applyConf() //NOMENCLATURE settings.setValue("nomenclature/terminal-exportlist",ui->m_export_terminal->isChecked()); - + //DIAGRAM EDITOR QString view_mode = ui->m_use_tab_mode_rb->isChecked() ? "tabbed" : "windowed"; settings.setValue("diagrameditor/viewmode", view_mode) ; @@ -520,11 +520,11 @@ void GeneralConfigurationPage::on_m_indi_text_font_pb_clicked() void GeneralConfigurationPage::on_MaxPartsElementEditorList_sb_valueChanged(int value) { - if (value > 500) { - ui->MaxPartsElementEditorList_sb->setToolTip(tr("To high values might lead to crashes of the application.")); - ui->MaxPartsElementEditorList_sb->setStyleSheet("background-color: orange"); - } else { - ui->MaxPartsElementEditorList_sb->setToolTip(""); - ui->MaxPartsElementEditorList_sb->setStyleSheet(""); - } + if (value > 500) { + ui->MaxPartsElementEditorList_sb->setToolTip(tr("To high values might lead to crashes of the application.")); + ui->MaxPartsElementEditorList_sb->setStyleSheet("background-color: orange"); + } else { + ui->MaxPartsElementEditorList_sb->setToolTip(""); + ui->MaxPartsElementEditorList_sb->setStyleSheet(""); + } } diff --git a/sources/ui/configpage/generalconfigurationpage.h b/sources/ui/configpage/generalconfigurationpage.h index ae6bda52f..48877a8f0 100644 --- a/sources/ui/configpage/generalconfigurationpage.h +++ b/sources/ui/configpage/generalconfigurationpage.h @@ -1,4 +1,4 @@ -/* +/* Copyright 2006-2024 The QElectroTech Team This file is part of QElectroTech. @@ -47,7 +47,7 @@ class GeneralConfigurationPage : public ConfigPage void on_m_company_tbt_path_cb_currentIndexChanged(int index); void on_m_custom_tbt_path_cb_currentIndexChanged(int index); void on_m_indi_text_font_pb_clicked(); - void on_MaxPartsElementEditorList_sb_valueChanged(int value); + void on_MaxPartsElementEditorList_sb_valueChanged(int value); private: void fillLang(); diff --git a/sources/ui/linksingleelementwidget.cpp b/sources/ui/linksingleelementwidget.cpp index 20802064f..367f2a5c6 100644 --- a/sources/ui/linksingleelementwidget.cpp +++ b/sources/ui/linksingleelementwidget.cpp @@ -296,7 +296,7 @@ void LinkSingleElementWidget::buildTree() QStringList search_list; QStringList str_list; - if (!elmt->conductors().isEmpty()) + if (!elmt->conductors().isEmpty()) { ConductorProperties cp = elmt->conductors().first()->properties(); str_list << cp.text; @@ -316,7 +316,7 @@ void LinkSingleElementWidget::buildTree() search_list << str_list.last(); } else - str_list << "" << "" << "" << "" << ""; + str_list << "" << "" << "" << "" << ""; if (Diagram *diag = elmt->diagram()) { diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index 6d4bf0e6c..da15eba97 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -36,13 +36,13 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *p m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title")); m_properties_dialog -> addPage(new ProjectMainConfigPage(project)); - NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this); + NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this); m_properties_dialog -> addPage(newDiagramPage); - ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project); + ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project); m_properties_dialog -> addPage(projectAutoNumConfigPage); - m_properties_dialog->addPage(new TerminalStripProjectConfigPage { project, parent }); + m_properties_dialog->addPage(new TerminalStripProjectConfigPage { project, parent }); connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString))); connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp())); diff --git a/sources/ui/projectpropertiesdialog.h b/sources/ui/projectpropertiesdialog.h index a4bd45e95..3f9bfaad3 100644 --- a/sources/ui/projectpropertiesdialog.h +++ b/sources/ui/projectpropertiesdialog.h @@ -32,8 +32,8 @@ class ProjectPropertiesDialog : public QObject { enum Page { Main = 0, Diagram = 1, - Autonum = 2, - TerminalStrip = 3 + Autonum = 2, + TerminalStrip = 3 }; ProjectPropertiesDialog(QETProject *project, QWidget *parent = nullptr); diff --git a/sources/ui/shapegraphicsitempropertieswidget.cpp b/sources/ui/shapegraphicsitempropertieswidget.cpp index df6282344..1f8a19634 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.cpp +++ b/sources/ui/shapegraphicsitempropertieswidget.cpp @@ -64,8 +64,8 @@ ShapeGraphicsItemPropertiesWidget::~ShapeGraphicsItemPropertiesWidget() */ void ShapeGraphicsItemPropertiesWidget::setItem(QetShapeItem *shape) { - if (m_shape != shape) { - clearEditConnection(); + if (m_shape != shape) { + clearEditConnection(); } if (!shape) { return; @@ -75,7 +75,7 @@ void ShapeGraphicsItemPropertiesWidget::setItem(QetShapeItem *shape) ui->m_close_polygon->setVisible(m_shape->shapeType() == QetShapeItem::Polygon); ui->m_filling_gb->setHidden(m_shape->shapeType() == QetShapeItem::Line); - updateUi(); + updateUi(); setUpEditConnection(); } @@ -86,11 +86,11 @@ void ShapeGraphicsItemPropertiesWidget::setItem(QetShapeItem *shape) */ void ShapeGraphicsItemPropertiesWidget::setItems(QList shapes_list) { - clearEditConnection(); + clearEditConnection(); m_shapes_list.clear(); m_shape = nullptr; - if (shapes_list.isEmpty()) { + if (shapes_list.isEmpty()) { updateUi(); } else if (shapes_list.size() == 1) @@ -357,7 +357,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi() //Disconnect every connections of editor widgets //to avoid an unwanted edition (QSpinBox emit valueChanged no matter if changer by user or by program) - clearEditConnection(); + clearEditConnection(); if (m_shape) { @@ -455,8 +455,8 @@ bool ShapeGraphicsItemPropertiesWidget::setLiveEdit(bool live_edit) if (m_live_edit) { setUpEditConnection(); - } else { - clearEditConnection(); + } else { + clearEditConnection(); } return true; } @@ -468,46 +468,46 @@ bool ShapeGraphicsItemPropertiesWidget::setLiveEdit(bool live_edit) */ void ShapeGraphicsItemPropertiesWidget::setUpEditConnection() { - clearEditConnection(); + clearEditConnection(); if (m_shape || !m_shapes_list.isEmpty()) { - m_edit_connection << connect (ui->m_style_cb, QOverload::of(&QComboBox::activated), - this, &ShapeGraphicsItemPropertiesWidget::apply); + m_edit_connection << connect (ui->m_style_cb, QOverload::of(&QComboBox::activated), + this, &ShapeGraphicsItemPropertiesWidget::apply); - m_edit_connection << connect (ui->m_size_dsb, QOverload::of(&QDoubleSpinBox::valueChanged), - this, &ShapeGraphicsItemPropertiesWidget::apply); + m_edit_connection << connect (ui->m_size_dsb, QOverload::of(&QDoubleSpinBox::valueChanged), + this, &ShapeGraphicsItemPropertiesWidget::apply); - m_edit_connection << connect (ui->m_color_kpb, &KColorButton::changed, - this, &ShapeGraphicsItemPropertiesWidget::apply); + m_edit_connection << connect (ui->m_color_kpb, &KColorButton::changed, + this, &ShapeGraphicsItemPropertiesWidget::apply); - m_edit_connection << connect (ui->m_brush_style_cb, QOverload::of(&QComboBox::activated), - this, &ShapeGraphicsItemPropertiesWidget::apply); + m_edit_connection << connect (ui->m_brush_style_cb, QOverload::of(&QComboBox::activated), + this, &ShapeGraphicsItemPropertiesWidget::apply); - m_edit_connection << connect (ui->m_brush_color_kpb, &KColorButton::changed, - this, &ShapeGraphicsItemPropertiesWidget::apply); + m_edit_connection << connect (ui->m_brush_color_kpb, &KColorButton::changed, + this, &ShapeGraphicsItemPropertiesWidget::apply); - m_edit_connection << connect (ui->m_close_polygon, &QCheckBox::clicked, - this, &ShapeGraphicsItemPropertiesWidget::apply); + m_edit_connection << connect (ui->m_close_polygon, &QCheckBox::clicked, + this, &ShapeGraphicsItemPropertiesWidget::apply); - m_edit_connection << connect (m_shape, &QetShapeItem::penChanged, - this, &ShapeGraphicsItemPropertiesWidget::updateUi); + m_edit_connection << connect (m_shape, &QetShapeItem::penChanged, + this, &ShapeGraphicsItemPropertiesWidget::updateUi); - m_edit_connection << connect (m_shape, &QetShapeItem::closeChanged, - this, &ShapeGraphicsItemPropertiesWidget::updateUi); + m_edit_connection << connect (m_shape, &QetShapeItem::closeChanged, + this, &ShapeGraphicsItemPropertiesWidget::updateUi); - m_edit_connection << connect (m_shape, &QetShapeItem::brushChanged, - this, &ShapeGraphicsItemPropertiesWidget::updateUi); + m_edit_connection << connect (m_shape, &QetShapeItem::brushChanged, + this, &ShapeGraphicsItemPropertiesWidget::updateUi); - } + } } void ShapeGraphicsItemPropertiesWidget::clearEditConnection() { - for (const auto &c : qAsConst(m_edit_connection)) { - disconnect(c); - } - m_edit_connection.clear(); + for (const auto &c : qAsConst(m_edit_connection)) { + disconnect(c); + } + m_edit_connection.clear(); } void ShapeGraphicsItemPropertiesWidget::on_m_lock_pos_cb_clicked() diff --git a/sources/ui/shapegraphicsitempropertieswidget.h b/sources/ui/shapegraphicsitempropertieswidget.h index 6853262d7..9094f20d1 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.h +++ b/sources/ui/shapegraphicsitempropertieswidget.h @@ -53,12 +53,12 @@ class ShapeGraphicsItemPropertiesWidget : public PropertiesEditorWidget private: void setUpEditConnection(); - void clearEditConnection(); + void clearEditConnection(); private slots: void on_m_lock_pos_cb_clicked(); - private: + private: Ui::ShapeGraphicsItemPropertiesWidget *ui; QetShapeItem *m_shape; QList > m_shapes_list; From f33ea64b99eb96d50611d45a11cb21571279fccf Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Wed, 24 Apr 2024 18:21:12 +0200 Subject: [PATCH 3/3] correct more indentations / whitespace (too many tabs) --- sources/ElementsCollection/elementscollectionmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 679b5232a..bd66717e8 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -590,7 +590,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation( if (eci->type() == FileElementCollectionItem::Type) { if (FileElementCollectionItem *feci = static_cast(eci)) { if ( (location.isCommonCollection() && feci->isCommonCollection()) || - (location.isCompanyCollection() && feci->isCompanyCollection()) || + (location.isCompanyCollection() && feci->isCompanyCollection()) || (location.isCustomCollection() && !feci->isCommonCollection()) ) { match_eci = feci->itemAtPath(location.collectionPath(false)); }