diff --git a/sources/ElementsCollection/elementslocation.cpp b/sources/ElementsCollection/elementslocation.cpp index 826398b8b..cd09896e4 100644 --- a/sources/ElementsCollection/elementslocation.cpp +++ b/sources/ElementsCollection/elementslocation.cpp @@ -53,7 +53,8 @@ ElementsLocation::ElementsLocation(const QString &path, QETProject *project) : @brief ElementsLocation::~ElementsLocation Destructeur */ -ElementsLocation::~ElementsLocation() { +ElementsLocation::~ElementsLocation() +{ } /** @@ -110,7 +111,8 @@ ElementsLocation &ElementsLocation::operator=(const ElementsLocation &other) { \~French true si other et cet ElementsLocation sont identiques, false sinon */ -bool ElementsLocation::operator==(const ElementsLocation &other) const { +bool ElementsLocation::operator==(const ElementsLocation &other) const +{ return( m_collection_path == other.m_collection_path &&\ m_project == other.m_project @@ -124,7 +126,8 @@ bool ElementsLocation::operator==(const ElementsLocation &other) const { @return true si other et cet ElementsLocation sont differents, false sinon */ -bool ElementsLocation::operator!=(const ElementsLocation &other) const { +bool ElementsLocation::operator!=(const ElementsLocation &other) const +{ return( m_collection_path != other.m_collection_path ||\ m_project != other.m_project @@ -139,7 +142,8 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const { For exemple if this location represent an element they return myElement. @see fileName() */ -QString ElementsLocation::baseName() const { +QString ElementsLocation::baseName() const +{ QRegExp regexp("^.*([^/]+)\\.elmt$"); if (regexp.exactMatch(m_collection_path)) { return(regexp.capturedTexts().at(1)); @@ -203,7 +207,8 @@ QString ElementsLocation::fileSystemPath() const @return The path of this location. @deprecated use instead collectionPath(true) */ -QString ElementsLocation::path() const { +QString ElementsLocation::path() const +{ return(m_collection_path); } @@ -343,7 +348,8 @@ bool ElementsLocation::addToPath(const QString &string) @return the location of the parent category, or a copy of this location when it represents a root category. */ -ElementsLocation ElementsLocation::parent() const { +ElementsLocation ElementsLocation::parent() const +{ ElementsLocation copy(*this); QRegExp re1("^([a-z]+://)(.*)/*$"); if (re1.exactMatch(m_collection_path)) { @@ -362,7 +368,8 @@ ElementsLocation ElementsLocation::parent() const { \~French le projet de cet emplacement ou 0 si celui-ci n'est pas lie a un projet. */ -QETProject *ElementsLocation::project() const { +QETProject *ElementsLocation::project() const +{ return(m_project); } @@ -384,7 +391,8 @@ void ElementsLocation::setProject(QETProject *project) { \~French true si l'emplacement semble utilisable (chemin virtuel non vide). */ -bool ElementsLocation::isNull() const { +bool ElementsLocation::isNull() const +{ return(m_collection_path.isEmpty()); } @@ -393,7 +401,8 @@ bool ElementsLocation::isNull() const { @return A character string representing the location \~French Une chaine de caracteres representant l'emplacement */ -QString ElementsLocation::toString() const { +QString ElementsLocation::toString() const +{ QString result; if (m_project) { int project_id = QETApp::projectId(m_project); @@ -409,7 +418,8 @@ QString ElementsLocation::toString() const { @brief ElementsLocation::isElement @return true if this location represent an element */ -bool ElementsLocation::isElement() const { +bool ElementsLocation::isElement() const +{ return m_collection_path.endsWith(".elmt"); } @@ -417,7 +427,8 @@ bool ElementsLocation::isElement() const { @brief ElementsLocation::isDirectory @return true if this location represent a directory */ -bool ElementsLocation::isDirectory() const { +bool ElementsLocation::isDirectory() const +{ return (!isElement() && !m_collection_path.isEmpty()); } diff --git a/sources/ElementsCollection/xmlelementcollection.cpp b/sources/ElementsCollection/xmlelementcollection.cpp index 9afbf2c1e..308194d7c 100644 --- a/sources/ElementsCollection/xmlelementcollection.cpp +++ b/sources/ElementsCollection/xmlelementcollection.cpp @@ -107,7 +107,8 @@ XmlElementCollection::XmlElementCollection(const QDomElement &dom_element, of the dom element is : collection @return The root QDomElement of the collection */ -QDomElement XmlElementCollection::root() const { +QDomElement XmlElementCollection::root() const +{ return m_dom_document.documentElement(); } @@ -116,7 +117,8 @@ QDomElement XmlElementCollection::root() const { @return The QDomElement import (the begining of a xml collection) or a null QDomElement if doesn't exist. */ -QDomElement XmlElementCollection::importCategory() const { +QDomElement XmlElementCollection::importCategory() const +{ return root().firstChildElement("category"); } diff --git a/sources/NameList/nameslist.cpp b/sources/NameList/nameslist.cpp index 904ea4377..bd2bac29d 100644 --- a/sources/NameList/nameslist.cpp +++ b/sources/NameList/nameslist.cpp @@ -24,13 +24,15 @@ int NamesList::MetaTypeId = qRegisterMetaType("NamesList"); /** Constructeur */ -NamesList::NamesList() { +NamesList::NamesList() +{ } /** Destructeur */ -NamesList::~NamesList() { +NamesList::~NamesList() +{ } /** @@ -56,28 +58,32 @@ void NamesList::removeName(const QString &lang) { /** Supprime tous les noms */ -void NamesList::clearNames() { +void NamesList::clearNames() +{ hash_names.clear(); } /** @return La liste de toutes les langues disponibles */ -QList NamesList::langs() const { +QList NamesList::langs() const +{ return(hash_names.keys()); } /** @return true si la liste de noms est vide, false sinon */ -bool NamesList::isEmpty() const { +bool NamesList::isEmpty() const +{ return(hash_names.isEmpty()); } /** @return Le nombre de noms dans la liste */ -int NamesList::count() const { +int NamesList::count() const +{ return(hash_names.count()); } @@ -95,7 +101,8 @@ QString &NamesList::operator[](const QString &lang) { @return Le nom dans la langue donnee ou QString() si ce nom n'est pas defini */ -const QString NamesList::operator[](const QString &lang) const { +const QString NamesList::operator[](const QString &lang) const +{ return(hash_names.value(lang)); } @@ -166,7 +173,8 @@ void NamesList::fromXml(const pugi::xml_node &xml_element, const QHash &xml_options) const { +QDomElement NamesList::toXml(QDomDocument &xml_document, const QHash &xml_options) const +{ QHash xml_opt = getXmlOptions(xml_options); QDomElement names_elmt = xml_document.createElement(xml_opt["ParentTagName"]); QHashIterator names_iterator(hash_names); @@ -187,7 +195,8 @@ QDomElement NamesList::toXml(QDomDocument &xml_document, const QHash NamesList::getXmlOptions(const QHash &xml_options) const { +QHash NamesList::getXmlOptions(const QHash &xml_options) const +{ QHash new_xml_options = xml_options; if (!xml_options.contains("ParentTagName")) { new_xml_options.insert("ParentTagName", "names"); @@ -205,7 +214,8 @@ QHash NamesList::getXmlOptions(const QHash & @param nl une autre liste de noms @return true si les listes de noms sont differentes, false sinon */ -bool NamesList::operator!=(const NamesList &nl) const { +bool NamesList::operator!=(const NamesList &nl) const +{ return(hash_names != nl.hash_names); } @@ -213,7 +223,8 @@ bool NamesList::operator!=(const NamesList &nl) const { @param nl une autre liste de noms @return true si les listes de noms sont identiques, false sinon */ -bool NamesList::operator==(const NamesList &nl) const { +bool NamesList::operator==(const NamesList &nl) const +{ return(hash_names == nl.hash_names); } @@ -228,7 +239,8 @@ bool NamesList::operator==(const NamesList &nl) const { @param fallback_name name to be returned when no adequate name has been found @return The adequate name regarding the current system locale. */ -QString NamesList::name(const QString &fallback_name) const { +QString NamesList::name(const QString &fallback_name) const +{ QString system_language = QETApp::langFromSetting(); QString returned_name; if (!hash_names[system_language].isEmpty()) { diff --git a/sources/NameList/ui/namelistdialog.cpp b/sources/NameList/ui/namelistdialog.cpp index 1f90eed88..ea05a7619 100644 --- a/sources/NameList/ui/namelistdialog.cpp +++ b/sources/NameList/ui/namelistdialog.cpp @@ -35,7 +35,8 @@ NameListDialog::NameListDialog(QWidget *parent) : #endif } -NameListDialog::~NameListDialog() { +NameListDialog::~NameListDialog() +{ delete ui; } @@ -48,7 +49,8 @@ void NameListDialog::setInformationText(const QString &text) { @return the name list widget used by this dialog. The ownership of the namelistwidget stay to this dialog */ -NameListWidget *NameListDialog::namelistWidget() const { +NameListWidget *NameListDialog::namelistWidget() const +{ return m_namelist_widget; } @@ -62,6 +64,7 @@ void NameListDialog::setHelpText(const QString &text) } } -void NameListDialog::showHelpDialog() { +void NameListDialog::showHelpDialog() +{ QMessageBox::information(this, tr("Variables de cartouche"), m_help_text); } diff --git a/sources/NameList/ui/namelistwidget.cpp b/sources/NameList/ui/namelistwidget.cpp index 58ab5519c..a0d280970 100644 --- a/sources/NameList/ui/namelistwidget.cpp +++ b/sources/NameList/ui/namelistwidget.cpp @@ -122,7 +122,8 @@ void NameListWidget::setReadOnly(bool ro) @return true if empty. An empty dialog, is a dialog without any edited lang. */ -bool NameListWidget::isEmpty() const { +bool NameListWidget::isEmpty() const +{ return names().isEmpty(); } diff --git a/sources/PropertiesEditor/propertieseditordockwidget.cpp b/sources/PropertiesEditor/propertieseditordockwidget.cpp index 74154feaf..d3278a122 100644 --- a/sources/PropertiesEditor/propertieseditordockwidget.cpp +++ b/sources/PropertiesEditor/propertieseditordockwidget.cpp @@ -103,7 +103,8 @@ bool PropertiesEditorDockWidget::addEditor(PropertiesEditorWidget *editor, @brief PropertiesEditorDockWidget::editors @return all editor used in this dock */ -QList PropertiesEditorDockWidget::editors() const { +QList PropertiesEditorDockWidget::editors() const +{ return m_editor_list; } diff --git a/sources/PropertiesEditor/propertieseditorwidget.cpp b/sources/PropertiesEditor/propertieseditorwidget.cpp index 79c310617..1e3190fd0 100644 --- a/sources/PropertiesEditor/propertieseditorwidget.cpp +++ b/sources/PropertiesEditor/propertieseditorwidget.cpp @@ -41,7 +41,8 @@ QUndoCommand *PropertiesEditorWidget::associatedUndo() const{ @brief PropertiesEditorWidget::title @return the title of this editor */ -QString PropertiesEditorWidget::title() const { +QString PropertiesEditorWidget::title() const +{ return QString(); } @@ -68,6 +69,7 @@ bool PropertiesEditorWidget::setLiveEdit(bool live_edit) { @return true if this editor is in live edit mode else return fasle. */ -bool PropertiesEditorWidget::isLiveEdit() const { +bool PropertiesEditorWidget::isLiveEdit() const +{ return m_live_edit; } diff --git a/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp b/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp index 607e747ca..09947c2fe 100644 --- a/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp +++ b/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp @@ -37,7 +37,8 @@ QetGraphicsHandlerItem::QetGraphicsHandlerItem(qreal size) : @brief QetGraphicsHandlerItem::boundingRect @return */ -QRectF QetGraphicsHandlerItem::boundingRect() const { +QRectF QetGraphicsHandlerItem::boundingRect() const +{ return m_br; } diff --git a/sources/SearchAndReplace/ui/replaceconductordialog.cpp b/sources/SearchAndReplace/ui/replaceconductordialog.cpp index 96aaf7566..3b167045f 100644 --- a/sources/SearchAndReplace/ui/replaceconductordialog.cpp +++ b/sources/SearchAndReplace/ui/replaceconductordialog.cpp @@ -319,7 +319,8 @@ void ReplaceConductorDialog::on_m_neutral_cb_toggled(bool checked) } } -void ReplaceConductorDialog::on_m_update_preview_pb_clicked() { +void ReplaceConductorDialog::on_m_update_preview_pb_clicked() +{ updatePreview(); } diff --git a/sources/SearchAndReplace/ui/replacefoliowidget.cpp b/sources/SearchAndReplace/ui/replacefoliowidget.cpp index 40cedbc74..a86d78d2e 100644 --- a/sources/SearchAndReplace/ui/replacefoliowidget.cpp +++ b/sources/SearchAndReplace/ui/replacefoliowidget.cpp @@ -140,7 +140,8 @@ ReplaceFolioDialog::~ReplaceFolioDialog() @brief ReplaceFolioDialog::titleBlockProperties @return The title block properties edited by this dialog */ -TitleBlockProperties ReplaceFolioDialog::titleBlockProperties() const { +TitleBlockProperties ReplaceFolioDialog::titleBlockProperties() const +{ return m_widget->titleBlockProperties(); } @@ -152,49 +153,56 @@ void ReplaceFolioDialog::setTitleBlockProperties( const TitleBlockProperties &properties) { m_widget->setTitleBlockProperties(properties); } -void ReplaceFolioWidget::on_m_title_cb_clicked() { +void ReplaceFolioWidget::on_m_title_cb_clicked() +{ ui->m_title_le->setText(ui->m_title_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); ui->m_title_le->setDisabled(ui->m_title_cb->isChecked()); } -void ReplaceFolioWidget::on_m_author_cb_clicked() { +void ReplaceFolioWidget::on_m_author_cb_clicked() +{ ui->m_author_le->setText(ui->m_author_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); ui->m_author_le->setDisabled(ui->m_author_cb->isChecked()); } -void ReplaceFolioWidget::on_m_file_cb_clicked() { +void ReplaceFolioWidget::on_m_file_cb_clicked() +{ ui->m_file_le->setText(ui->m_file_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); ui->m_file_le->setDisabled(ui->m_file_cb->isChecked()); } -void ReplaceFolioWidget::on_m_folio_cb_clicked() { +void ReplaceFolioWidget::on_m_folio_cb_clicked() +{ ui->m_folio_le->setText(ui->m_folio_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); ui->m_folio_le->setDisabled(ui->m_folio_cb->isChecked()); } -void ReplaceFolioWidget::on_m_plant_cb_clicked() { +void ReplaceFolioWidget::on_m_plant_cb_clicked() +{ ui->m_plant->setText(ui->m_plant_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); ui->m_plant->setDisabled(ui->m_plant_cb->isChecked()); } -void ReplaceFolioWidget::on_m_loc_cb_clicked() { +void ReplaceFolioWidget::on_m_loc_cb_clicked() +{ ui->m_loc->setText(ui->m_loc_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); ui->m_loc->setDisabled(ui->m_loc_cb->isChecked()); } -void ReplaceFolioWidget::on_m_indice_cb_clicked() { +void ReplaceFolioWidget::on_m_indice_cb_clicked() +{ ui->m_indice->setText(ui->m_indice_cb->isChecked() ? SearchAndReplaceWorker::eraseText() : QString()); diff --git a/sources/SearchAndReplace/ui/searchandreplacewidget.cpp b/sources/SearchAndReplace/ui/searchandreplacewidget.cpp index b94d501ca..cf740b8cf 100644 --- a/sources/SearchAndReplace/ui/searchandreplacewidget.cpp +++ b/sources/SearchAndReplace/ui/searchandreplacewidget.cpp @@ -70,7 +70,8 @@ SearchAndReplaceWidget::SearchAndReplaceWidget(QWidget *parent) : @brief SearchAndReplaceWidget::~SearchAndReplaceWidget Destructor */ -SearchAndReplaceWidget::~SearchAndReplaceWidget() { +SearchAndReplaceWidget::~SearchAndReplaceWidget() +{ delete ui; } diff --git a/sources/autoNum/assignvariables.cpp b/sources/autoNum/assignvariables.cpp index 88d0a67f1..68e03facf 100644 --- a/sources/autoNum/assignvariables.cpp +++ b/sources/autoNum/assignvariables.cpp @@ -44,7 +44,8 @@ namespace autonum hundred_folio = other.hundred_folio; } - sequentialNumbers::~sequentialNumbers() {} + sequentialNumbers::~sequentialNumbers() +{} sequentialNumbers &sequentialNumbers::operator=( const sequentialNumbers &other) diff --git a/sources/autoNum/numerotationcontext.cpp b/sources/autoNum/numerotationcontext.cpp index 25c922b3d..1f932e9fa 100644 --- a/sources/autoNum/numerotationcontext.cpp +++ b/sources/autoNum/numerotationcontext.cpp @@ -23,7 +23,8 @@ /** Constructor */ -NumerotationContext::NumerotationContext(){ +NumerotationContext::NumerotationContext() +{ } /** @@ -36,7 +37,8 @@ NumerotationContext::NumerotationContext(QDomElement &e) { /** @brief NumerotationContext::clear, clear the content */ -void NumerotationContext::clear () { +void NumerotationContext::clear () +{ content_.clear(); } @@ -75,7 +77,8 @@ bool NumerotationContext::addValue(const QString &type, @param i @return the string at position i */ -QString NumerotationContext::operator [] (const int &i) const { +QString NumerotationContext::operator [] (const int &i) const +{ return (content_.at(i)); } @@ -90,7 +93,8 @@ void NumerotationContext::operator << (const NumerotationContext &other) { @brief NumerotationContext::size @return size of context */ -int NumerotationContext::size() const { +int NumerotationContext::size() const +{ return (content_.size()); } @@ -98,7 +102,8 @@ int NumerotationContext::size() const { @brief NumerotationContext::isEmpty @return true if numerotation contet is empty */ -bool NumerotationContext::isEmpty() const { +bool NumerotationContext::isEmpty() const +{ if (content_.size() > 0) return false; return true; } @@ -107,7 +112,8 @@ bool NumerotationContext::isEmpty() const { @param i @return the content at position i 1:type 2:value 3:increase */ -QStringList NumerotationContext::itemAt(const int i) const { +QStringList NumerotationContext::itemAt(const int i) const +{ return (content_.at(i).split("|")); } @@ -115,7 +121,8 @@ QStringList NumerotationContext::itemAt(const int i) const { @brief validRegExpNum @return all type use to numerotation */ -QString NumerotationContext::validRegExpNum () const { +QString NumerotationContext::validRegExpNum () const +{ return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio|string|idfolio|folio|plant|locmach|elementline|elementcolumn|elementprefix"); } @@ -123,7 +130,8 @@ QString NumerotationContext::validRegExpNum () const { @brief NumerotationContext::validRegExpNumber @return all type represents a number */ -QString NumerotationContext::validRegExpNumber() const { +QString NumerotationContext::validRegExpNumber() const +{ return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio"); } @@ -131,7 +139,8 @@ QString NumerotationContext::validRegExpNumber() const { @brief NumerotationContext::keyIsAcceptable @return true if type is acceptable */ -bool NumerotationContext::keyIsAcceptable(const QString &type) const { +bool NumerotationContext::keyIsAcceptable(const QString &type) const +{ return (type.contains(QRegExp(validRegExpNum()))); } @@ -139,7 +148,8 @@ bool NumerotationContext::keyIsAcceptable(const QString &type) const { @brief NumerotationContext::keyIsNumber @return true if type represent a number */ -bool NumerotationContext::keyIsNumber(const QString &type) const { +bool NumerotationContext::keyIsNumber(const QString &type) const +{ return (type.contains(QRegExp(validRegExpNumber()))); } diff --git a/sources/autoNum/numerotationcontextcommands.cpp b/sources/autoNum/numerotationcontextcommands.cpp index 22faf6b4d..706162a20 100644 --- a/sources/autoNum/numerotationcontextcommands.cpp +++ b/sources/autoNum/numerotationcontextcommands.cpp @@ -30,7 +30,8 @@ NumerotationContextCommands::NumerotationContextCommands(const NumerotationConte /** @brief Destructor */ -NumerotationContextCommands::~NumerotationContextCommands() { +NumerotationContextCommands::~NumerotationContextCommands() +{ if (strategy_) delete strategy_; } @@ -38,7 +39,8 @@ NumerotationContextCommands::~NumerotationContextCommands() { @brief NumerotationContextCommands::next @return the next numerotation context */ -NumerotationContext NumerotationContextCommands::next() { +NumerotationContext NumerotationContextCommands::next() +{ NumerotationContext contextnum; for (int i=0; iclear(); @@ -204,7 +205,8 @@ void AutoNumberingDockWidget::setConductorActive(DiagramView* dv) { @brief AutoNumberingDockWidget::setActive Set current used autonumberings */ -void AutoNumberingDockWidget::setActive() { +void AutoNumberingDockWidget::setActive() +{ if (m_project_view!=nullptr) { //Conductor @@ -233,7 +235,8 @@ void AutoNumberingDockWidget::setActive() { @brief AutoNumberingDockWidget::conductorAutoNumChanged Add new or remove conductor auto num from combobox */ -void AutoNumberingDockWidget::conductorAutoNumChanged() { +void AutoNumberingDockWidget::conductorAutoNumChanged() +{ ui->m_conductor_cb->clear(); //Conductor Combobox @@ -263,7 +266,8 @@ void AutoNumberingDockWidget::on_m_conductor_cb_activated(int) @brief AutoNumberingDockWidget::elementAutoNumChanged Add new or remove element auto num from combobox */ -void AutoNumberingDockWidget::elementAutoNumChanged() { +void AutoNumberingDockWidget::elementAutoNumChanged() +{ ui->m_element_cb->clear(); @@ -290,7 +294,8 @@ void AutoNumberingDockWidget::on_m_element_cb_activated(int) @brief AutoNumberingDockWidget::folioAutoNumChanged Add new or remove folio auto num from combobox */ -void AutoNumberingDockWidget::folioAutoNumChanged() { +void AutoNumberingDockWidget::folioAutoNumChanged() +{ ui->m_folio_cb->clear(); diff --git a/sources/autoNum/ui/numparteditorw.cpp b/sources/autoNum/ui/numparteditorw.cpp index 8525ccfc3..7e4e3ae80 100644 --- a/sources/autoNum/ui/numparteditorw.cpp +++ b/sources/autoNum/ui/numparteditorw.cpp @@ -149,7 +149,8 @@ void NumPartEditorW::setVisibleItems() @brief NumPartEditorW::toNumContext @return the display to NumerotationContext */ -NumerotationContext NumPartEditorW::toNumContext() { +NumerotationContext NumPartEditorW::toNumContext() +{ NumerotationContext nc; QString type_str; switch (type_) { @@ -214,7 +215,8 @@ NumerotationContext NumPartEditorW::toNumContext() { @brief NumPartEditorW::isValid @return true if value field isn't empty or if type is folio */ -bool NumPartEditorW::isValid() { +bool NumPartEditorW::isValid() +{ if (type_ == folio || type_ == idfolio || type_ == elementline @@ -266,7 +268,8 @@ void NumPartEditorW::on_type_cb_activated(int) { @brief NumPartEditorW::on_value_field_textChanged emit changed when value_field text changed */ -void NumPartEditorW::on_value_field_textEdited() { +void NumPartEditorW::on_value_field_textEdited() +{ emit changed(); } diff --git a/sources/borderproperties.cpp b/sources/borderproperties.cpp index d3a23d66e..a2aa3de5f 100644 --- a/sources/borderproperties.cpp +++ b/sources/borderproperties.cpp @@ -48,7 +48,8 @@ BorderProperties::BorderProperties() : @brief BorderProperties::~BorderProperties destructor */ -BorderProperties::~BorderProperties() { +BorderProperties::~BorderProperties() +{ } /** @@ -95,7 +96,8 @@ bool BorderProperties::operator!=(const BorderProperties &bp) { XML element to which attributes will be added \~French Element XML auquel seront ajoutes des attributs */ -void BorderProperties::toXml(QDomElement &e) const { +void BorderProperties::toXml(QDomElement &e) const +{ e.setAttribute("cols", columns_count); e.setAttribute("colsize", QString("%1").arg(columns_width)); e.setAttribute("rows", rows_count); @@ -134,7 +136,8 @@ void BorderProperties::fromXml(QDomElement &e) { prefix to be added before the names of the parameters \~French prefixe a ajouter devant les noms des parametres */ -void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const { +void BorderProperties::toSettings(QSettings &settings, const QString &prefix) const +{ settings.setValue(prefix + "cols", columns_count); settings.setValue(prefix + "colsize", columns_width); settings.setValue(prefix + "displaycols", display_columns); diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 073adbac5..9f230cc63 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -71,7 +71,8 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) : @brief BorderTitleBlock::~BorderTitleBlock \~French Destructeur - ne fait rien */ -BorderTitleBlock::~BorderTitleBlock() { +BorderTitleBlock::~BorderTitleBlock() +{ } /** @@ -96,7 +97,8 @@ QRectF BorderTitleBlock::titleBlockRect() const @brief BorderTitleBlock::titleblockInformation @return */ -DiagramContext BorderTitleBlock::titleblockInformation() const { +DiagramContext BorderTitleBlock::titleblockInformation() const +{ return m_titleblock_template_renderer->context(); } @@ -131,7 +133,8 @@ QRectF BorderTitleBlock::titleBlockRectForQPainter() const It's like unite outsideBorderRect and titleBlockRect. The rect is in scene coordinate */ -QRectF BorderTitleBlock::borderAndTitleBlockRect() const { +QRectF BorderTitleBlock::borderAndTitleBlockRect() const +{ return diagram_rect_ | titleBlockRect(); } @@ -276,7 +279,8 @@ void BorderTitleBlock::borderFromXml(const QDomElement &xml_elmt) { @return the properties of the titleblock \~French les proprietes du cartouches */ -TitleBlockProperties BorderTitleBlock::exportTitleBlock() { +TitleBlockProperties BorderTitleBlock::exportTitleBlock() +{ TitleBlockProperties ip; ip.author = author(); @@ -330,7 +334,8 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip) { @return border properties \~French les proprietes de la bordure */ -BorderProperties BorderTitleBlock::exportBorder() { +BorderProperties BorderTitleBlock::exportBorder() +{ BorderProperties bp; bp.columns_count = columnsCount(); bp.columns_width = columnsWidth(); @@ -364,7 +369,8 @@ void BorderTitleBlock::importBorder(const BorderProperties &bp) { @return the titleblock template used to render the titleblock @see TitleBlockTemplateRenderer::titleBlockTemplate() */ -const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate() { +const TitleBlockTemplate *BorderTitleBlock::titleBlockTemplate() +{ return(m_titleblock_template_renderer -> titleBlockTemplate()); } @@ -384,7 +390,8 @@ void BorderTitleBlock::setTitleBlockTemplate( @brief BorderTitleBlock::titleBlockTemplateName @return The name of the template used to render the titleblock. */ -QString BorderTitleBlock::titleBlockTemplateName() const { +QString BorderTitleBlock::titleBlockTemplateName() const +{ QString tbt_name = m_titleblock_template_renderer -> titleBlockTemplate() -> name(); return((tbt_name == "default") ? "" : tbt_name); } diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h index 27c6f6b4f..39a7f93a6 100644 --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -79,14 +79,16 @@ class BorderTitleBlock : public QObject @return the diagram width, i.e. the width of the border without title block */ - qreal diagramWidth() const { + qreal diagramWidth() const +{ return(columnsTotalWidth() + rowsHeaderWidth()); } /** @brief diagramHeight @return the diagram height, i.e. the height of the border without title block */ - qreal diagramHeight() const { + qreal diagramHeight() const +{ return(rowsTotalHeight() + columnsHeaderHeight()); } QRectF titleBlockRect () const; diff --git a/sources/conductorautonumerotation.cpp b/sources/conductorautonumerotation.cpp index fa3152d62..2ef7eb843 100644 --- a/sources/conductorautonumerotation.cpp +++ b/sources/conductorautonumerotation.cpp @@ -53,7 +53,8 @@ ConductorAutoNumerotation::ConductorAutoNumerotation( @brief ConductorAutoNumerotation::numerate execute the automatic numerotation */ -void ConductorAutoNumerotation::numerate() { +void ConductorAutoNumerotation::numerate() +{ if (!m_conductor) return; if (conductor_list.size() >= 1 ) numeratePotential(); else if (m_conductor -> properties().type == ConductorProperties::Multi) diff --git a/sources/conductorprofile.cpp b/sources/conductorprofile.cpp index 422b5052e..edc5a02a5 100644 --- a/sources/conductorprofile.cpp +++ b/sources/conductorprofile.cpp @@ -21,7 +21,8 @@ #include "terminal.h" /// Constructeur -ConductorProfile::ConductorProfile() { +ConductorProfile::ConductorProfile() +{ } /** @@ -64,23 +65,27 @@ ConductorProfile &ConductorProfile::operator=(const ConductorProfile &c) { } /// destructeur -ConductorProfile::~ConductorProfile() { +ConductorProfile::~ConductorProfile() +{ setNull(); } /// @return true si le profil est nul -bool ConductorProfile::isNull() const { +bool ConductorProfile::isNull() const +{ return(segments.isEmpty()); } /// supprime les segments du profil de conducteur -void ConductorProfile::setNull() { +void ConductorProfile::setNull() +{ foreach(ConductorSegmentProfile *csp, segments) delete csp; segments.clear(); } /// @return la largeur occupee par le conducteur -qreal ConductorProfile::width() const { +qreal ConductorProfile::width() const +{ qreal width = 0.0; foreach(ConductorSegmentProfile *csp, segments) { if (csp -> isHorizontal) width += csp -> length; @@ -101,7 +106,8 @@ qreal ConductorProfile::height() const{ @param type Type de Segments @return Le nombre de segments composant le conducteur. */ -uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const { +uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const +{ if (type == QET::Both) return(segments.count()); uint nb_seg = 0; foreach(ConductorSegmentProfile *csp, segments) { @@ -112,7 +118,8 @@ uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const { } /// @return les segments horizontaux de ce profil -QList ConductorProfile::horizontalSegments() { +QList ConductorProfile::horizontalSegments() +{ QList segments_list; foreach(ConductorSegmentProfile *csp, segments) { if (csp -> isHorizontal) segments_list << csp; @@ -121,7 +128,8 @@ QList ConductorProfile::horizontalSegments() { } /// @return les segments verticaux de ce profil -QList ConductorProfile::verticalSegments() { +QList ConductorProfile::verticalSegments() +{ QList segments_list; foreach(ConductorSegmentProfile *csp, segments) { if (!csp -> isHorizontal) segments_list << csp; diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index 231228c00..0377c103f 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -31,7 +31,8 @@ SingleLineProperties::SingleLineProperties() : } /// Destructeur -SingleLineProperties::~SingleLineProperties() { +SingleLineProperties::~SingleLineProperties() +{ } /** @@ -43,7 +44,8 @@ void SingleLineProperties::setPhasesCount(int n) { } /// @return le nombre de phases (0, 1, 2, ou 3) -unsigned short int SingleLineProperties::phasesCount() { +unsigned short int SingleLineProperties::phasesCount() +{ return(phases); } @@ -52,7 +54,8 @@ unsigned short int SingleLineProperties::phasesCount() { (Protective Earth Neutral) representation and if it features the ground and the neutral. */ -bool SingleLineProperties::isPen() const { +bool SingleLineProperties::isPen() const +{ return(hasNeutral && hasGround && is_pen); } @@ -211,7 +214,8 @@ void SingleLineProperties::drawPen(QPainter *painter, ajoutes a l'element e. @param e Element XML auquel seront ajoutes des attributs */ -void SingleLineProperties::toXml(QDomElement &e) const { +void SingleLineProperties::toXml(QDomElement &e) const +{ e.setAttribute("ground", hasGround ? "true" : "false"); e.setAttribute("neutral", hasNeutral ? "true" : "false"); e.setAttribute("phase", phases); @@ -251,7 +255,8 @@ ConductorProperties::ConductorProperties() : /** Destructeur */ -ConductorProperties::~ConductorProperties() { +ConductorProperties::~ConductorProperties() +{ } @@ -802,7 +807,8 @@ void ConductorProperties::readStyle(const QString &style_string) { Exporte le style du conducteur sous forme d'une chaine de caracteres @return une chaine de caracteres decrivant le style du conducteur */ -QString ConductorProperties::writeStyle() const { +QString ConductorProperties::writeStyle() const +{ if (style == Qt::DashLine) { return("line-style: dashed;"); } else if (style == Qt::DashDotLine) { @@ -816,7 +822,8 @@ QString ConductorProperties::writeStyle() const { @param other l'autre ensemble de proprietes avec lequel il faut effectuer la comparaison @return true si les deux ensembles de proprietes sont identiques, false sinon */ -int SingleLineProperties::operator==(const SingleLineProperties &other) const { +int SingleLineProperties::operator==(const SingleLineProperties &other) const +{ return( other.hasGround == hasGround &&\ other.hasNeutral == hasNeutral &&\ @@ -829,7 +836,8 @@ int SingleLineProperties::operator==(const SingleLineProperties &other) const { @param other l'autre ensemble de proprietes avec lequel il faut effectuer la comparaison @return true si les deux ensembles de proprietes sont differents, false sinon */ -int SingleLineProperties::operator!=(const SingleLineProperties &other) const { +int SingleLineProperties::operator!=(const SingleLineProperties &other) const +{ return(!(other == (*this))); } @@ -838,7 +846,8 @@ int SingleLineProperties::operator!=(const SingleLineProperties &other) const { @param prefix prefix a ajouter devant les noms des parametres */ void SingleLineProperties::toSettings(QSettings &settings, - const QString &prefix) const { + const QString &prefix) const +{ settings.setValue(prefix + "hasGround", hasGround); settings.setValue(prefix + "hasNeutral", hasNeutral); settings.setValue(prefix + "phases", phases); diff --git a/sources/conductorsegment.cpp b/sources/conductorsegment.cpp index 200063009..967c2277c 100644 --- a/sources/conductorsegment.cpp +++ b/sources/conductorsegment.cpp @@ -41,7 +41,8 @@ ConductorSegment::ConductorSegment( /** Destructeur - Relie le segment precedent au suivant */ -ConductorSegment::~ConductorSegment() { +ConductorSegment::~ConductorSegment() +{ if (hasPreviousSegment()) previousSegment() -> setNextSegment(nextSegment()); if (hasNextSegment()) nextSegment() -> setPreviousSegment(previousSegment()); } @@ -54,7 +55,8 @@ ConductorSegment::~ConductorSegment() { @param possible_dx La valeur du mouvement possible (au maximum) @return true si le mouvement est possible ; false s'il doit etre limite */ -bool ConductorSegment::canMove1stPointX(const qreal &asked_dx, qreal &possible_dx) const { +bool ConductorSegment::canMove1stPointX(const qreal &asked_dx, qreal &possible_dx) const +{ Q_ASSERT_X(isVertical(), "ConductorSegment::canMove1stPointX", "segment non vertical"); @@ -113,7 +115,8 @@ bool ConductorSegment::canMove1stPointX(const qreal &asked_dx, qreal &possible_d @param possible_dx La valeur du mouvement possible (au maximum) @return true si le mouvement est possible ; false s'il doit etre limite */ -bool ConductorSegment::canMove2ndPointX(const qreal &asked_dx, qreal &possible_dx) const { +bool ConductorSegment::canMove2ndPointX(const qreal &asked_dx, qreal &possible_dx) const +{ Q_ASSERT_X(isVertical(), "ConductorSegment::canMove2ndPointX", "segment non vertical"); @@ -172,7 +175,8 @@ bool ConductorSegment::canMove2ndPointX(const qreal &asked_dx, qreal &possible_d @param possible_dy La valeur du mouvement possible (au maximum) @return true si le mouvement est possible ; false s'il doit etre limite */ -bool ConductorSegment::canMove1stPointY(const qreal &asked_dy, qreal &possible_dy) const { +bool ConductorSegment::canMove1stPointY(const qreal &asked_dy, qreal &possible_dy) const +{ Q_ASSERT_X(isHorizontal(), "ConductorSegment::canMove1stPointY", "segment non horizontal"); @@ -231,7 +235,8 @@ bool ConductorSegment::canMove1stPointY(const qreal &asked_dy, qreal &possible_d @param possible_dy La valeur du mouvement possible (au maximum) @return true si le mouvement est possible ; false s'il doit etre limite */ -bool ConductorSegment::canMove2ndPointY(const qreal &asked_dy, qreal &possible_dy) const { +bool ConductorSegment::canMove2ndPointY(const qreal &asked_dy, qreal &possible_dy) const +{ Q_ASSERT_X(isHorizontal(), "ConductorSegment::canMove2ndPointY", "segment non horizontal"); @@ -401,59 +406,68 @@ void ConductorSegment::setNextSegment(ConductorSegment *ns) { } /// @return true si ce segment est un segment statique, cad un segment relie a une borne -bool ConductorSegment::isStatic() const { +bool ConductorSegment::isStatic() const +{ return(isFirstSegment() || isLastSegment()); } /// @return true si ce segment est le premier du conducteur -bool ConductorSegment::isFirstSegment() const { +bool ConductorSegment::isFirstSegment() const +{ return(!hasPreviousSegment()); } /// @return true si ce segment est le dernier du conducteur -bool ConductorSegment::isLastSegment() const { +bool ConductorSegment::isLastSegment() const +{ return(!hasNextSegment()); } /** @return Le segment precedent */ -ConductorSegment *ConductorSegment::previousSegment() const { +ConductorSegment *ConductorSegment::previousSegment() const +{ return(previous_segment); } /** @return Le segment suivant */ -ConductorSegment *ConductorSegment::nextSegment() const { +ConductorSegment *ConductorSegment::nextSegment() const +{ return(next_segment); } /** @return true si le segment est vertical, false sinon */ -bool ConductorSegment::isVertical() const { +bool ConductorSegment::isVertical() const +{ return(point1.x() == point2.x()); } /** @return true si le segment est horizontal, false sinon */ -bool ConductorSegment::isHorizontal() const { +bool ConductorSegment::isHorizontal() const +{ return(point1.y() == point2.y()); } /** @return le premier point du segment */ -QPointF ConductorSegment::firstPoint() const { +QPointF ConductorSegment::firstPoint() const +{ return(point1); } /** @return le second point du segment */ -QPointF ConductorSegment::secondPoint() const { +QPointF ConductorSegment::secondPoint() const +{ return(point2); } @@ -476,21 +490,24 @@ void ConductorSegment::setSecondPoint(const QPointF &p) { /** @return true si le segment a un segment precedent, false sinon */ -bool ConductorSegment::hasPreviousSegment() const { +bool ConductorSegment::hasPreviousSegment() const +{ return(previous_segment != nullptr); } /** @return true si le segment a un segment suivant, false sinon */ -bool ConductorSegment::hasNextSegment() const { +bool ConductorSegment::hasNextSegment() const +{ return(next_segment != nullptr); } /** @return Le centre du rectangle delimitant le conducteur */ -QPointF ConductorSegment::middle() const { +QPointF ConductorSegment::middle() const +{ return( QPointF( (point1.x()+ point2.x()) / 2.0, @@ -502,7 +519,8 @@ QPointF ConductorSegment::middle() const { /** @return La longueur du conducteur */ -qreal ConductorSegment::length() const { +qreal ConductorSegment::length() const +{ if (isHorizontal()) { return(secondPoint().x() - firstPoint().x()); } else { @@ -511,11 +529,13 @@ qreal ConductorSegment::length() const { } /// @return QET::Horizontal si le segment est horizontal, QET::Vertical sinon -QET::ConductorSegmentType ConductorSegment::type() const { +QET::ConductorSegmentType ConductorSegment::type() const +{ return(isHorizontal() ? QET::Horizontal : QET::Vertical); } /// @return true si les deux points constituant le segment sont egaux -bool ConductorSegment::isPoint() const { +bool ConductorSegment::isPoint() const +{ return(point1 == point2); } diff --git a/sources/configdialog.cpp b/sources/configdialog.cpp index fe5c5e788..0f813706f 100644 --- a/sources/configdialog.cpp +++ b/sources/configdialog.cpp @@ -92,13 +92,15 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) { } /// Destructeur -ConfigDialog::~ConfigDialog() { +ConfigDialog::~ConfigDialog() +{ } /** Construit la liste des pages sur la gauche */ -void ConfigDialog::buildPagesList() { +void ConfigDialog::buildPagesList() +{ pages_list -> clear(); foreach(ConfigPage *page, pages) { addPageToList(page); @@ -119,7 +121,8 @@ void ConfigDialog::addPageToList(ConfigPage *page) { /** Applique la configuration de toutes les pages */ -void ConfigDialog::applyConf() { +void ConfigDialog::applyConf() +{ foreach(ConfigPage *page, pages) { page -> applyConf(); } diff --git a/sources/configpages.cpp b/sources/configpages.cpp index ffc174bf6..573c9c94d 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -103,7 +103,8 @@ NewDiagramPage::NewDiagramPage(QETProject *project, /** @brief NewDiagramPage::~NewDiagramPage */ -NewDiagramPage::~NewDiagramPage() { +NewDiagramPage::~NewDiagramPage() +{ disconnect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab())); } @@ -113,7 +114,8 @@ NewDiagramPage::~NewDiagramPage() { If there is a project, save in the project, else save to the default conf of QElectroTech */ -void NewDiagramPage::applyConf() { +void NewDiagramPage::applyConf() +{ if (m_project) { //If project we save to the project if (m_project -> isReadOnly()) return; bool modified_project = false; @@ -182,7 +184,8 @@ void NewDiagramPage::applyConf() { @brief NewDiagramPage::icon @return icon of this page */ -QIcon NewDiagramPage::icon() const { +QIcon NewDiagramPage::icon() const +{ if (m_project) return(QET::Icons::NewDiagram); return(QET::Icons::Projects); } @@ -191,7 +194,8 @@ QIcon NewDiagramPage::icon() const { @brief NewDiagramPage::title @return title of this page */ -QString NewDiagramPage::title() const { +QString NewDiagramPage::title() const +{ if (m_project) return(tr("Nouveau folio", "configuration page title")); return(tr("Nouveau projet", "configuration page title")); } @@ -200,7 +204,8 @@ QString NewDiagramPage::title() const { @brief NewDiagramPage::changeToAutoFolioTab Set the current tab to Autonum */ -void NewDiagramPage::changeToAutoFolioTab(){ +void NewDiagramPage::changeToAutoFolioTab() +{ if (m_project){ ppd_->setCurrentPage(ProjectPropertiesDialog::Autonum); ppd_->changeToFolio(); @@ -222,7 +227,8 @@ void NewDiagramPage::setFolioAutonum(QString autoNum){ @brief NewDiagramPage::saveCurrentTbp Save current TBP to retrieve after auto folio num */ -void NewDiagramPage::saveCurrentTbp(){ +void NewDiagramPage::saveCurrentTbp() +{ savedTbp = ipw->properties(); } @@ -230,7 +236,8 @@ void NewDiagramPage::saveCurrentTbp(){ @brief NewDiagramPage::loadSavedTbp Retrieve saved auto folio num */ -void NewDiagramPage::loadSavedTbp(){ +void NewDiagramPage::loadSavedTbp() +{ ipw->setProperties(savedTbp); applyConf(); } @@ -260,7 +267,8 @@ ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) { } /// Destructeur -ExportConfigPage::~ExportConfigPage() { +ExportConfigPage::~ExportConfigPage() +{ } /** @@ -273,12 +281,14 @@ void ExportConfigPage::applyConf() } /// @return l'icone de cette page -QIcon ExportConfigPage::icon() const { +QIcon ExportConfigPage::icon() const +{ return(QET::Icons::DocumentExport); } /// @return le titre de cette page -QString ExportConfigPage::title() const { +QString ExportConfigPage::title() const +{ return(tr("Export", "configuration page title")); } @@ -308,7 +318,8 @@ PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) { } /// Destructeur -PrintConfigPage::~PrintConfigPage() { +PrintConfigPage::~PrintConfigPage() +{ } /** @@ -329,12 +340,14 @@ void PrintConfigPage::applyConf() } /// @return l'icone de cette page -QIcon PrintConfigPage::icon() const { +QIcon PrintConfigPage::icon() const +{ return(QET::Icons::Printer); } /// @return le titre de cette page -QString PrintConfigPage::title() const { +QString PrintConfigPage::title() const +{ return(tr("Impression", "configuration page title")); } diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 22ca8c17a..f4c09a51e 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -39,7 +39,7 @@ Createdxf::~Createdxf() } /* Header section of every DXF file.*/ -void Createdxf::dxfBegin (const QString& fileName) +void Createdxf::dxfBegin (const QString& fileName) { // Creation of an output stream object in text mode. @@ -75,7 +75,7 @@ void Createdxf::dxfBegin (const QString& fileName) To_Dxf << 30 << "\r\n"; To_Dxf << "0.0" << "\r\n"; To_Dxf << 9 << "\r\n"; - + To_Dxf << "$EXTMIN" << "\r\n"; To_Dxf << 10 << "\r\n"; To_Dxf << "0.0" << "\r\n"; @@ -87,7 +87,7 @@ void Createdxf::dxfBegin (const QString& fileName) To_Dxf << "4000.0" << "\r\n"; To_Dxf << 20 << "\r\n"; To_Dxf << "4000.0" << "\r\n"; - + To_Dxf << 9 << "\r\n"; To_Dxf << "$LIMMIN" << "\r\n"; To_Dxf << 10 << "\r\n"; @@ -109,7 +109,7 @@ void Createdxf::dxfBegin (const QString& fileName) To_Dxf << 0 << "\r\n"; To_Dxf << "TABLE" << "\r\n"; To_Dxf << 2 << "\r\n"; - + To_Dxf << "VPORT" << "\r\n"; To_Dxf << 70 << "\r\n"; To_Dxf << 1 << "\r\n"; @@ -190,7 +190,7 @@ void Createdxf::dxfBegin (const QString& fileName) To_Dxf << 0 << "\r\n"; To_Dxf << "TABLE" << "\r\n"; To_Dxf << 2 << "\r\n"; - + To_Dxf << "LTYPE" << "\r\n"; To_Dxf << 70 << "\r\n"; To_Dxf << 1 << "\r\n"; @@ -209,7 +209,7 @@ void Createdxf::dxfBegin (const QString& fileName) To_Dxf << 40 << "\r\n"; To_Dxf << 0.00 << "\r\n"; To_Dxf << 0 << "\r\n"; - + To_Dxf << "ENDTAB" << "\r\n"; To_Dxf << 0 << "\r\n"; To_Dxf << "ENDSEC" << "\r\n"; @@ -228,8 +228,12 @@ void Createdxf::dxfBegin (const QString& fileName) } } -/* End Section of every DXF File*/ -void Createdxf::dxfEnd (const QString& fileName) +/** + @brief Createdxf::dxfEnd + End Section of every DXF File + @param fileName +*/ +void Createdxf::dxfEnd(const QString& fileName) { // Creation of an output stream object in text mode. if (!fileName.isEmpty()) { @@ -251,9 +255,21 @@ void Createdxf::dxfEnd (const QString& fileName) } } - -/* draw circle in dxf format*/ -void Createdxf::drawCircle (const QString& fileName, double radius, double x, double y, int colour) +/** + @brief Createdxf::drawCircle + draw circle in dxf format + @param fileName + @param radius + @param x + @param y + @param colour +*/ +void Createdxf::drawCircle( + const QString& fileName, + double radius, + double x, + double y, + int colour) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -285,9 +301,23 @@ void Createdxf::drawCircle (const QString& fileName, double radius, double x, do } } - -/* draw line in DXF Format*/ -void Createdxf::drawLine (const QString &fileName, double x1, double y1, double x2, double y2,const int &colour) +/** + @brief Createdxf::drawLine + draw line in DXF Format + @param fileName + @param x1 + @param y1 + @param x2 + @param y2 + @param colour +*/ +void Createdxf::drawLine ( + const QString &fileName, + double x1, + double y1, + double x2, + double y2, + const int &colour) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -323,7 +353,8 @@ void Createdxf::drawLine (const QString &fileName, double x1, double y1, double } } -long Createdxf::RGBcodeTable[255]{ +long Createdxf::RGBcodeTable[255] +{ 0x000000, 0xff0000, 0xffff00, 0x00ff00, 0x00ffff, 0x0000ff, 0xff00ff, 0xffffff, 0x414141, 0x808080, 0xff0000, 0xffaaaa, 0xbd0000, 0xbd7e7e, 0x810000, @@ -415,7 +446,11 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue) @param line @param colorcode */ -void Createdxf::drawLine(const QString &filepath, const QLineF &line, const int &colorcode) { +void Createdxf::drawLine( + const QString &filepath, + const QLineF &line, + const int &colorcode) +{ drawLine(filepath, line.p1().x() * xScale, sheetHeight - (line.p1().y() * yScale), line.p2().x() * xScale, @@ -423,7 +458,19 @@ void Createdxf::drawLine(const QString &filepath, const QLineF &line, const int colorcode); } -void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal spanAngle, qreal hotspot_x, qreal hotspot_y, qreal rotation_angle, const int &colorcode) { +void Createdxf::drawArcEllipse( + const QString &file_path, + qreal x, + qreal y, + qreal w, + qreal h, + qreal startAngle, + qreal spanAngle, + qreal hotspot_x, + qreal hotspot_y, + qreal rotation_angle, + const int &colorcode) +{ // vector of parts of arc (stored as a pair of startAngle and spanAngle) for each quadrant. QVector< QPair > arc_parts_vector; @@ -534,7 +581,12 @@ void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal arc_endAngle = temp; } - QPointF transformed_point = ExportDialog::rotation_transformed(center_x, center_y, hotspot_x, hotspot_y, rotation_angle); + QPointF transformed_point = ExportDialog::rotation_transformed( + center_x, + center_y, + hotspot_x, + hotspot_y, + rotation_angle); center_x = transformed_point.x(); center_y = transformed_point.y(); arc_endAngle *= 180/3.142; @@ -542,7 +594,14 @@ void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal arc_endAngle -= rotation_angle; arc_startAngle -= rotation_angle; - drawArc(file_path, center_x, center_y, radius, arc_startAngle, arc_endAngle, colorcode); + drawArc( + file_path, + center_x, + center_y, + radius, + arc_startAngle, + arc_endAngle, + colorcode); } } @@ -553,16 +612,37 @@ void Createdxf::drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal @param rect @param colorcode */ -void Createdxf::drawEllipse(const QString &filepath, const QRectF &rect, const int &colorcode) { - drawArcEllipse(filepath, rect.topLeft().x() * xScale, - sheetHeight - (rect.topLeft().y() * yScale), - rect.width() * xScale, - rect.height() * yScale, - 0, 360, 0, 0, 0, colorcode); +void Createdxf::drawEllipse( + const QString &filepath, + const QRectF &rect, + const int &colorcode) +{ + drawArcEllipse( + filepath, + rect.topLeft().x() * xScale, + sheetHeight - (rect.topLeft().y() * yScale), + rect.width() * xScale, + rect.height() * yScale, + 0, 360, 0, 0, 0, colorcode); } -/* draw rectangle in dxf format */ -void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, double width, double height, const int &colour) +/** + @brief Createdxf::drawRectangle + draw rectangle in dxf format + @param fileName + @param x1 + @param y1 + @param width + @param height + @param colour +*/ +void Createdxf::drawRectangle ( + const QString &fileName, + double x1, + double y1, + double width, + double height, + const int &colour) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -654,40 +734,47 @@ void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, do /** @brief Createdxf::drawRectangle - Convenience function for draw rectangle + Convenience function for draw rectangle @param filepath @param rect @param colorcode */ -void Createdxf::drawRectangle(const QString &filepath, - const QRectF &rect, - const int &colorcode) { - drawRectangle(filepath, rect.bottomLeft().x() * xScale, - sheetHeight - (rect.bottomLeft().y() * yScale), - rect.width() * xScale, - rect.height() * yScale, - colorcode); +void Createdxf::drawRectangle( + const QString &filepath, + const QRectF &rect, + const int &colorcode) { + drawRectangle( + filepath, + rect.bottomLeft().x() * xScale, + sheetHeight - (rect.bottomLeft().y() * yScale), + rect.width() * xScale, + rect.height() * yScale, + colorcode); } /** - @brief Createdxf::drawPolygon - Convenience function for draw polygon - @param filepath - @param poly - @param colorcode + @brief Createdxf::drawPolygon + Convenience function for draw polygon + @param filepath + @param poly + @param colorcode */ -void Createdxf::drawPolygon(const QString &filepath, - const QPolygonF &poly, - const int &colorcode) { - int lc = 0; - QPointF plast; - foreach(QPointF p, poly) { - if(lc++) { - QLineF ql(plast,p); - drawLine(filepath,ql,colorcode); - } - plast = p; - } +void Createdxf::drawPolygon( + const QString &filepath, + const QPolygonF &poly, + const int &colorcode) +{ + int lc = 0; + QPointF plast; + foreach(QPointF p, poly) + { + if(lc++) + { + QLineF ql(plast,p); + drawLine(filepath,ql,colorcode); + } + plast = p; + } } /** @brief Createdxf::drawArc @@ -700,13 +787,14 @@ void Createdxf::drawPolygon(const QString &filepath, @param endAngle @param color */ -void Createdxf::drawArc(const QString& fileName, - double x, - double y, - double rad, - double startAngle, - double endAngle, - int color) +void Createdxf::drawArc( + const QString& fileName, + double x, + double y, + double rad, + double startAngle, + double endAngle, + int color) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -753,13 +841,14 @@ void Createdxf::drawArc(const QString& fileName, @param rotation @param colour */ -void Createdxf::drawText(const QString& fileName, - const QString& text, - double x, - double y, - double height, - double rotation, - int colour) +void Createdxf::drawText( + const QString& fileName, + const QString& text, + double x, + double y, + double height, + double rotation, + int colour) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -844,17 +933,17 @@ void Createdxf::drawTextAligned( To_Dxf << 50 << "\r\n"; To_Dxf << rotation << "\r\n"; // Text Rotation #if 0 - // If "Fit to width", then check if width of text < width specified then change it "center align or left align" + // If "Fit to width", then check if width of text < width specified then change it "center align or left align" if (hAlign == 5) { int xDiff = xAlign - x; - int len = text.length(); - int t = xDiff/height; + int len = text.length(); + int t = xDiff/height; if (text.length() < xDiff/height && !leftAlign) { hAlign = 1; - xAlign = x+ (xAlign / 2); + xAlign = x+ (xAlign / 2); } else if (text.length() < xDiff/height && leftAlign) { - hAlign = 0; - xAlign = x; + hAlign = 0; + xAlign = x; // file.close(); // return; } diff --git a/sources/createdxf.h b/sources/createdxf.h index e294ff2b2..7e9f88227 100644 --- a/sources/createdxf.h +++ b/sources/createdxf.h @@ -21,99 +21,112 @@ #include #include - -/* This class exports the project to DXF Format */ +/** + @brief The Createdxf class + This class exports the project to DXF Format +*/ class Createdxf -{ - public: - Createdxf(); - ~Createdxf(); - static void dxfBegin (const QString&); - static void dxfEnd(const QString&); - // you can add more functions to create more drawings. - static void drawCircle(const QString&, - double, - double, - double, - int); - static void drawArc(const QString&, - double x, - double y, - double rad, - double startAngle, - double endAngle, - int color); - static void drawDonut(QString,double,double,double,int); +{ + public: + Createdxf(); + ~Createdxf(); + static void dxfBegin (const QString&); + static void dxfEnd(const QString&); + // you can add more functions to create more drawings. + static void drawCircle( + const QString&, + double, + double, + double, + int); + static void drawArc( + const QString&, + double x, + double y, + double rad, + double startAngle, + double endAngle, + int color); + static void drawDonut(QString,double,double,double,int); - static void drawArcEllipse (const QString &file_path, - qreal x, - qreal y, - qreal w, - qreal h, - qreal startAngle, - qreal spanAngle, - qreal hotspot_x, - qreal hotspot_y, - qreal rotation_angle, - const int &colorcode); + static void drawArcEllipse ( + const QString &file_path, + qreal x, + qreal y, + qreal w, + qreal h, + qreal startAngle, + qreal spanAngle, + qreal hotspot_x, + qreal hotspot_y, + qreal rotation_angle, + const int &colorcode); static void drawEllipse (const QString &filepath, const QRectF &rect, const int &colorcode); - static void drawRectangle(const QString &filepath, - double, - double, - double, - double, - const int &colorcode); - static void drawRectangle(const QString &filepath, - const QRectF &rect, - const int &colorcode); + static void drawRectangle( + const QString &filepath, + double, + double, + double, + double, + const int &colorcode); + static void drawRectangle( + const QString &filepath, + const QRectF &rect, + const int &colorcode); - static void drawPolygon(const QString &filepath, - const QPolygonF &poly, - const int &colorcode); + static void drawPolygon( + const QString &filepath, + const QPolygonF &poly, + const int &colorcode); - static void drawLine(const QString &filapath, - double, - double, - double, - double, - const int &clorcode); - static void drawLine(const QString &filepath, - const QLineF &line, - const int &colorcode); + static void drawLine( + const QString &filapath, + double, + double, + double, + double, + const int &clorcode); + static void drawLine( + const QString &filepath, + const QLineF &line, + const int &colorcode); - static void drawText(const QString&, - const QString&, - double,double, - double, - double, - int); - static void drawTextAligned(const QString& fileName, - const QString& text, - double x, - double y, - double height, - double rotation, - double oblique, - int hAlign, - int vAlign, - double xAlign, - double xScale, - int colour); + static void drawText( + const QString&, + const QString&, + double,double, + double, + double, + int); + static void drawTextAligned( + const QString& fileName, + const QString& text, + double x, + double y, + double height, + double rotation, + double oblique, + int hAlign, + int vAlign, + double xAlign, + double xScale, + int colour); - static int getcolorCode (const long red, - const long green, - const long blue); - static long RGBcodeTable[]; + static int getcolorCode ( + const long red, + const long green, + const long blue); + static long RGBcodeTable[]; - static const double sheetWidth; - static const double sheetHeight; - static double xScale; - static double yScale; + static const double sheetWidth; + static const double sheetHeight; + static double xScale; + static double yScale; }; #endif // CREATEDXF_H diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index 122063f98..072ea30e8 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -49,7 +49,8 @@ projectDataBase::projectDataBase(QETProject *project, const QString &connection_ @brief projectDataBase::~projectDataBase Destructor */ -projectDataBase::~projectDataBase() { +projectDataBase::~projectDataBase() +{ m_data_base.close(); } @@ -71,7 +72,8 @@ void projectDataBase::updateDB() @brief projectDataBase::project @return the project of this database */ -QETProject *projectDataBase::project() const { +QETProject *projectDataBase::project() const +{ return m_project; } diff --git a/sources/dataBase/ui/elementquerywidget.cpp b/sources/dataBase/ui/elementquerywidget.cpp index 0e56f12d7..48d6c8ea2 100644 --- a/sources/dataBase/ui/elementquerywidget.cpp +++ b/sources/dataBase/ui/elementquerywidget.cpp @@ -98,7 +98,8 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) : /** @brief ElementQueryWidget::~ElementQueryWidget */ -ElementQueryWidget::~ElementQueryWidget() { +ElementQueryWidget::~ElementQueryWidget() +{ delete ui; } @@ -413,7 +414,8 @@ void ElementQueryWidget::setCount(QString text, bool set) /** @brief ElementQueryWidget::updateQueryLine */ -void ElementQueryWidget::updateQueryLine() { +void ElementQueryWidget::updateQueryLine() +{ ui->m_sql_query->setText(queryStr()); } @@ -464,7 +466,8 @@ void ElementQueryWidget::setUpItems() @param key @return the filter associated to key */ -QPair ElementQueryWidget::FilterFor(const QString &key) const { +QPair ElementQueryWidget::FilterFor(const QString &key) const +{ return m_filter.value(key, qMakePair(0, QString())); } diff --git a/sources/dataBase/ui/summaryquerywidget.cpp b/sources/dataBase/ui/summaryquerywidget.cpp index 31f9386d9..6c54dedc9 100644 --- a/sources/dataBase/ui/summaryquerywidget.cpp +++ b/sources/dataBase/ui/summaryquerywidget.cpp @@ -153,7 +153,8 @@ void SummaryQueryWidget::fillSavedQuery() /** @brief SummaryQueryWidget::updateQueryLine */ -void SummaryQueryWidget::updateQueryLine() { +void SummaryQueryWidget::updateQueryLine() +{ ui->m_user_query_le->setText(queryStr()); } diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 371cd9227..ae17c2c90 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -516,7 +516,8 @@ void Diagram::keyReleaseEvent(QKeyEvent *e) @brief Diagram::uuid @return the uuid of this diagram */ -QUuid Diagram::uuid() { +QUuid Diagram::uuid() +{ return m_uuid; } @@ -561,7 +562,8 @@ void Diagram::clearEventInterface() @brief Diagram::conductorsAutonumName @return the name of autonum to use. */ -QString Diagram::conductorsAutonumName() const { +QString Diagram::conductorsAutonumName() const +{ return m_conductors_autonum_name; } @@ -648,7 +650,8 @@ bool Diagram::toPaintDevice(QPaintDevice &pix, \~ @return The size of the image generated by toImage() \~French La taille de l'image generee par toImage() */ -QSize Diagram::imageSize() const { +QSize Diagram::imageSize() const +{ // determine la zone source = contenu du schema + marges qreal image_width, image_height; if (!use_border_) { @@ -677,7 +680,8 @@ QSize Diagram::imageSize() const { \~French true si le schema est considere comme vide, false sinon. Un schema vide ne contient ni element, ni conducteur, ni champ de texte */ -bool Diagram::isEmpty() const { +bool Diagram::isEmpty() const +{ return(!items().count()); } @@ -687,7 +691,8 @@ bool Diagram::isEmpty() const { each potential are in the QList and each conductors of one potential are in the QSet */ -QList < QSet > Diagram::potentials() { +QList < QSet > Diagram::potentials() +{ QList < QSet > potential_List; if (content().conductors().size() == 0) return (potential_List); //return an empty potential @@ -1673,7 +1678,8 @@ void Diagram::setTitleBlockTemplate(const QString &template_name) Select all schema objects \~French Selectionne tous les objets du schema */ -void Diagram::selectAll() { +void Diagram::selectAll() +{ if (items().isEmpty()) return; blockSignals(true); @@ -1687,7 +1693,8 @@ void Diagram::selectAll() { Deselects all selected objects \~French Deslectionne tous les objets selectionnes */ -void Diagram::deselectAll() { +void Diagram::deselectAll() +{ if (items().isEmpty()) return; clearSelection(); @@ -1698,7 +1705,8 @@ void Diagram::deselectAll() { Reverses the selection state of all schema objects Inverse l'etat de selection de tous les objets du schema */ -void Diagram::invertSelection() { +void Diagram::invertSelection() +{ if (items().isEmpty()) return; blockSignals(true); @@ -1854,7 +1862,8 @@ void Diagram::changeZValue(QET::DepthOption option) This class loads all folio sequential variables related to the current autonum */ -void Diagram::loadElmtFolioSeq() { +void Diagram::loadElmtFolioSeq() +{ QString title = project()->elementCurrentAutoNum(); NumerotationContext nc = project()->elementAutoNum(title); @@ -1939,7 +1948,8 @@ void Diagram::loadElmtFolioSeq() { This class loads all conductor folio sequential variables related to the current autonum */ -void Diagram::loadCndFolioSeq() { +void Diagram::loadCndFolioSeq() +{ //Conductor QString title = project()->conductorCurrentAutoNum(); NumerotationContext nc = project()->conductorAutoNum(title); @@ -2020,7 +2030,8 @@ void Diagram::loadCndFolioSeq() { @return title of the titleblock \~Frenchle titre du cartouche */ -QString Diagram::title() const { +QString Diagram::title() const +{ return(border_and_titleblock.title()); } @@ -2028,7 +2039,8 @@ QString Diagram::title() const { @brief Diagram::elements @return the list containing all elements */ -QList Diagram::elements() const { +QList Diagram::elements() const +{ QList element_list; foreach (QGraphicsItem *qgi, items()) { if (Element *elmt = qgraphicsitem_cast(qgi)) @@ -2041,7 +2053,8 @@ QList Diagram::elements() const { @brief Diagram::conductors @return the list containing all conductors */ -QList Diagram::conductors() const { +QList Diagram::conductors() const +{ QList cnd_list; foreach (QGraphicsItem *qgi, items()) { if (Conductor *cnd = qgraphicsitem_cast(qgi)) @@ -2054,7 +2067,8 @@ QList Diagram::conductors() const { @brief Diagram::elementsMover @return */ -ElementsMover &Diagram::elementsMover() { +ElementsMover &Diagram::elementsMover() +{ return m_elements_mover; } @@ -2062,7 +2076,8 @@ ElementsMover &Diagram::elementsMover() { @brief Diagram::elementTextsMover @return */ -ElementTextsMover &Diagram::elementTextsMover() { +ElementTextsMover &Diagram::elementTextsMover() +{ return m_element_texts_mover; } @@ -2111,7 +2126,8 @@ void Diagram::freezeElements(bool freeze) { @brief Diagram::unfreezeElements Unfreeze every existent element label. */ -void Diagram::unfreezeElements() { +void Diagram::unfreezeElements() +{ foreach (Element *elmt, elements()) { elmt->freezeLabel(false); } @@ -2129,7 +2145,8 @@ void Diagram::setFreezeNewElements(bool b) { @brief Diagram::freezeNewElements @return current freeze new element status . */ -bool Diagram::freezeNewElements() { +bool Diagram::freezeNewElements() +{ return m_freeze_new_elements; } @@ -2155,7 +2172,8 @@ void Diagram::setFreezeNewConductors(bool b) { @brief Diagram::freezeNewConductors @return current freeze new conductor status . */ -bool Diagram::freezeNewConductors() { +bool Diagram::freezeNewConductors() +{ return m_freeze_new_conductors_; } @@ -2294,7 +2312,8 @@ void Diagram::setDrawColoredConductors(bool dcc) { @return the list of conductors selected on the diagram \~French la liste des conducteurs selectionnes sur le schema */ -QSet Diagram::selectedConductors() const { +QSet Diagram::selectedConductors() const +{ QSet conductors_set; foreach(QGraphicsItem *qgi, selectedItems()) { if (Conductor *c = qgraphicsitem_cast(qgi)) { @@ -2309,7 +2328,8 @@ QSet Diagram::selectedConductors() const { @return true if the clipboard appears to contain a schema \~French true si le presse-papier semble contenir un schema */ -bool Diagram::clipboardMayContainDiagram() { +bool Diagram::clipboardMayContainDiagram() +{ QString clipboard_text = QApplication::clipboard() -> text().trimmed(); bool may_be_diagram = clipboard_text.startsWith(""); @@ -2323,7 +2343,8 @@ bool Diagram::clipboardMayContainDiagram() { \~French le projet auquel ce schema appartient ou 0 s'il s'agit d'un schema independant. */ -QETProject *Diagram::project() const { +QETProject *Diagram::project() const +{ return(m_project); } @@ -2332,7 +2353,8 @@ QETProject *Diagram::project() const { @return the folio number of this diagram within its parent project, or -1 if it is has no parent project */ -int Diagram::folioIndex() const { +int Diagram::folioIndex() const +{ if (!m_project) return(-1); return(m_project -> folioIndex(this)); } @@ -2345,7 +2367,8 @@ int Diagram::folioIndex() const { fallback_to_project is true. @return the declared QElectroTech version of this diagram */ -qreal Diagram::declaredQElectroTechVersion(bool fallback_to_project) const { +qreal Diagram::declaredQElectroTechVersion(bool fallback_to_project) const +{ if (diagram_qet_version_ != -1) { return diagram_qet_version_; } @@ -2372,7 +2395,8 @@ bool Diagram::isReadOnly() const \~French Le contenu du schema. Les conducteurs sont tous places dans conductorsToMove. */ -DiagramContent Diagram::content() const { +DiagramContent Diagram::content() const +{ DiagramContent dc; foreach(QGraphicsItem *qgi, items()) { if (Element *e = qgraphicsitem_cast(qgi)) { diff --git a/sources/diagram.h b/sources/diagram.h index 5044c80e7..3b2c299de 100644 --- a/sources/diagram.h +++ b/sources/diagram.h @@ -410,7 +410,8 @@ inline QGIManager &Diagram::qgiManager() { @brief Diagram::drawTerminals @return true if terminals are rendered, false otherwise */ -inline bool Diagram::drawTerminals() const { +inline bool Diagram::drawTerminals() const +{ return(draw_terminals_); } @@ -418,7 +419,8 @@ inline bool Diagram::drawTerminals() const { @brief Diagram::drawColoredConductors @return true if conductors colors are rendered, false otherwise. */ -inline bool Diagram::drawColoredConductors() const { +inline bool Diagram::drawColoredConductors() const +{ return(draw_colored_conductors_); } diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index 12a48710c..3589c5b94 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -64,7 +64,8 @@ PasteDiagramCommand::PasteDiagramCommand( Diagram *dia, const DiagramContent &c, @brief PasteDiagramCommand::~PasteDiagramCommand Destructor */ -PasteDiagramCommand::~PasteDiagramCommand() { +PasteDiagramCommand::~PasteDiagramCommand() +{ diagram -> qgiManager().release(content.items(filter)); } @@ -162,7 +163,8 @@ CutDiagramCommand::CutDiagramCommand( @brief CutDiagramCommand::~CutDiagramCommand Destructeur */ -CutDiagramCommand::~CutDiagramCommand() { +CutDiagramCommand::~CutDiagramCommand() +{ } /** @@ -210,14 +212,16 @@ MoveElementsCommand::MoveElementsCommand( @brief MoveElementsCommand::~MoveElementsCommand Destructor */ -MoveElementsCommand::~MoveElementsCommand() { +MoveElementsCommand::~MoveElementsCommand() +{ delete m_anim_group; } /** @brief MoveElementsCommand::undo */ -void MoveElementsCommand::undo() { +void MoveElementsCommand::undo() +{ diagram -> showMe(); m_anim_group->setDirection(QAnimationGroup::Forward); m_anim_group->start(); @@ -227,7 +231,8 @@ void MoveElementsCommand::undo() { /** @brief MoveElementsCommand::redo */ -void MoveElementsCommand::redo() { +void MoveElementsCommand::redo() +{ diagram -> showMe(); if (first_redo) { first_redo = false; @@ -329,14 +334,16 @@ MoveConductorsTextsCommand::MoveConductorsTextsCommand( @brief MoveConductorsTextsCommand::~MoveConductorsTextsCommand Destructeur */ -MoveConductorsTextsCommand::~MoveConductorsTextsCommand() { +MoveConductorsTextsCommand::~MoveConductorsTextsCommand() +{ } /** @brief MoveConductorsTextsCommand::undo annule le deplacement */ -void MoveConductorsTextsCommand::undo() { +void MoveConductorsTextsCommand::undo() +{ diagram -> showMe(); foreach(ConductorTextItem *cti, texts_to_move_.keys()) { QPointF movement = texts_to_move_[cti].first; @@ -353,7 +360,8 @@ void MoveConductorsTextsCommand::undo() { @brief MoveConductorsTextsCommand::redo refait le deplacement */ -void MoveConductorsTextsCommand::redo() { +void MoveConductorsTextsCommand::redo() +{ diagram -> showMe(); if (first_redo) { first_redo = false; @@ -397,7 +405,8 @@ void MoveConductorsTextsCommand::addTextMovement(ConductorTextItem *text_item, @brief MoveConductorsTextsCommand::regenerateTextLabel Genere la description de l'objet d'annulation */ -void MoveConductorsTextsCommand::regenerateTextLabel() { +void MoveConductorsTextsCommand::regenerateTextLabel() +{ QString moved_content_sentence = QET::ElementsAndConductorsSentence(0, 0, texts_to_move_.count()); setText( @@ -437,14 +446,16 @@ ChangeDiagramTextCommand::ChangeDiagramTextCommand( @brief ChangeDiagramTextCommand::~ChangeDiagramTextCommand destructeur */ -ChangeDiagramTextCommand::~ChangeDiagramTextCommand() { +ChangeDiagramTextCommand::~ChangeDiagramTextCommand() +{ } /** @brief ChangeDiagramTextCommand::undo annule la modification de texte */ -void ChangeDiagramTextCommand::undo() { +void ChangeDiagramTextCommand::undo() +{ diagram -> showMe(); text_item -> setHtml(text_before); } @@ -488,14 +499,16 @@ ChangeConductorCommand::ChangeConductorCommand( @brief ChangeConductorCommand::~ChangeConductorCommand Destructeur */ -ChangeConductorCommand::~ChangeConductorCommand() { +ChangeConductorCommand::~ChangeConductorCommand() +{ } /** @brief ChangeConductorCommand::undo Annule la modification du conducteur */ -void ChangeConductorCommand::undo() { +void ChangeConductorCommand::undo() +{ diagram -> showMe(); conductor -> setProfile(old_profile, path_type); conductor -> textItem() -> setPos(text_pos_before_mov_); @@ -505,7 +518,8 @@ void ChangeConductorCommand::undo() { @brief ChangeConductorCommand::redo Refait la modification du conducteur */ -void ChangeConductorCommand::redo() { +void ChangeConductorCommand::redo() +{ diagram -> showMe(); if (first_redo) { first_redo = false; @@ -551,13 +565,15 @@ ResetConductorCommand::ResetConductorCommand( /** @brief ResetConductorCommand::~ResetConductorCommand */ -ResetConductorCommand::~ResetConductorCommand() { +ResetConductorCommand::~ResetConductorCommand() +{ } /** @brief ResetConductorCommand::undo */ -void ResetConductorCommand::undo() { +void ResetConductorCommand::undo() +{ diagram -> showMe(); foreach(Conductor *c, conductors_profiles.keys()) { c -> setProfiles(conductors_profiles[c]); @@ -567,7 +583,8 @@ void ResetConductorCommand::undo() { /** @brief ResetConductorCommand::redo */ -void ResetConductorCommand::redo() { +void ResetConductorCommand::redo() +{ diagram -> showMe(); foreach(Conductor *c, conductors_profiles.keys()) { c -> textItem() -> forceMovedByUser (false); @@ -601,14 +618,16 @@ ChangeBorderCommand::ChangeBorderCommand(Diagram *dia, @brief ChangeBorderCommand::~ChangeBorderCommand Destructeur */ -ChangeBorderCommand::~ChangeBorderCommand() { +ChangeBorderCommand::~ChangeBorderCommand() +{ } /** @brief ChangeBorderCommand::undo Annule les changements apportes au schema */ -void ChangeBorderCommand::undo() { +void ChangeBorderCommand::undo() +{ diagram -> showMe(); diagram -> border_and_titleblock.importBorder(old_properties); } @@ -617,7 +636,8 @@ void ChangeBorderCommand::undo() { @brief ChangeBorderCommand::redo Refait les changements apportes au schema */ -void ChangeBorderCommand::redo() { +void ChangeBorderCommand::redo() +{ diagram -> showMe(); diagram -> border_and_titleblock.importBorder(new_properties); } diff --git a/sources/diagramcontent.cpp b/sources/diagramcontent.cpp index a4f05ea7d..ba858918e 100644 --- a/sources/diagramcontent.cpp +++ b/sources/diagramcontent.cpp @@ -32,7 +32,8 @@ /** @brief DiagramContent::DiagramContent */ -DiagramContent::DiagramContent() {} +DiagramContent::DiagramContent() +{} /** @brief DiagramContent::DiagramContent diff --git a/sources/diagramcontext.cpp b/sources/diagramcontext.cpp index a18e7485d..2e0ddf8de 100644 --- a/sources/diagramcontext.cpp +++ b/sources/diagramcontext.cpp @@ -67,14 +67,16 @@ QList DiagramContext::keys(DiagramContext::KeyOrder order) const @param key string key @return true if that key is known to the diagram context, false otherwise */ -bool DiagramContext::contains(const QString &key) const { +bool DiagramContext::contains(const QString &key) const +{ return(m_content.contains(key)); } /** @param key */ -const QVariant DiagramContext::operator[](const QString &key) const { +const QVariant DiagramContext::operator[](const QString &key) const +{ return(m_content[key]); } @@ -97,14 +99,16 @@ bool DiagramContext::addValue(const QString &key, const QVariant &value, bool sh return(false); } -QVariant DiagramContext::value(const QString &key) const { +QVariant DiagramContext::value(const QString &key) const +{ return m_content.value(key); } /** Clear the content of this diagram context. */ -void DiagramContext::clear() { +void DiagramContext::clear() +{ m_content.clear(); m_content_show.clear(); } @@ -112,7 +116,8 @@ void DiagramContext::clear() { /** @return the number of key/value pairs stored in this object. */ -int DiagramContext::count() { +int DiagramContext::count() +{ return(m_content.count()); } @@ -120,18 +125,21 @@ int DiagramContext::count() { @brief DiagramContext::keyMustShow @return the value pairs with key, if key no found, return false */ -bool DiagramContext::keyMustShow(const QString &key) const { +bool DiagramContext::keyMustShow(const QString &key) const +{ if (m_content_show.contains(key)) return m_content_show[key]; return false; } -bool DiagramContext::operator==(const DiagramContext &dc) const { +bool DiagramContext::operator==(const DiagramContext &dc) const +{ return(m_content == dc.m_content && m_content_show == dc.m_content_show); } -bool DiagramContext::operator!=(const DiagramContext &dc) const { +bool DiagramContext::operator!=(const DiagramContext &dc) const +{ return(!(*this == dc)); } @@ -139,7 +147,8 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const { Export this context properties under the \a e XML element, using tags named \a tag_name (defaults to "property"). */ -void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const { +void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const +{ foreach (QString key, keys()) { QDomElement property = e.ownerDocument().createElement(tag_name); property.setAttribute("name", key); @@ -182,7 +191,8 @@ void DiagramContext::fromXml(const pugi::xml_node &dom_element, const QString &t Export this context properties to \a settings by creating an array named \a array_name. */ -void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const { +void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const +{ settings.beginWriteArray(array_name); int i = 0; foreach (QString key, m_content.keys()) { @@ -213,7 +223,8 @@ void DiagramContext::fromSettings(QSettings &settings, const QString &array_name @return the regular expression used to check whether a given key is acceptable. @see keyIsAcceptable() */ -QString DiagramContext::validKeyRegExp() { +QString DiagramContext::validKeyRegExp() +{ return("^[a-z0-9-_]+$"); } @@ -228,7 +239,8 @@ bool DiagramContext::stringLongerThan(const QString &a, const QString &b) { @param key a key string @return true if that key is acceptable, false otherwise */ -bool DiagramContext::keyIsAcceptable(const QString &key) const { +bool DiagramContext::keyIsAcceptable(const QString &key) const +{ QRegExp re(DiagramContext::validKeyRegExp()); return(re.exactMatch(key)); } diff --git a/sources/diagramevent/diagrameventinterface.cpp b/sources/diagramevent/diagrameventinterface.cpp index c8dcb4844..6f3ef1a29 100644 --- a/sources/diagramevent/diagrameventinterface.cpp +++ b/sources/diagramevent/diagrameventinterface.cpp @@ -29,7 +29,8 @@ DiagramEventInterface::DiagramEventInterface(Diagram *diagram) : m_diagram -> clearSelection(); } -DiagramEventInterface::~DiagramEventInterface() {}; +DiagramEventInterface::~DiagramEventInterface() +{}; void DiagramEventInterface::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED (event); @@ -71,7 +72,8 @@ void DiagramEventInterface::keyReleaseEvent(QKeyEvent *event){ Q_UNUSED (event); } -bool DiagramEventInterface::isRunning() const { +bool DiagramEventInterface::isRunning() const +{ return m_running; } diff --git a/sources/diagramposition.cpp b/sources/diagramposition.cpp index cc6e1d107..df4632a2d 100644 --- a/sources/diagramposition.cpp +++ b/sources/diagramposition.cpp @@ -36,13 +36,15 @@ DiagramPosition::DiagramPosition(const QString &letter, unsigned int number) { /** Destructeur */ -DiagramPosition::~DiagramPosition() { +DiagramPosition::~DiagramPosition() +{ } /** @return les coordonnees stockees dans cet objet, ou un QPointF nul sinon. */ -QPointF DiagramPosition::position() const { +QPointF DiagramPosition::position() const +{ return(position_); } @@ -56,7 +58,8 @@ void DiagramPosition::setPosition(const QPointF &position) { /** @return une representation textuelle de la position */ -QString DiagramPosition::toString() { +QString DiagramPosition::toString() +{ if (isOutOfBounds()) { return("-"); } @@ -72,6 +75,7 @@ QString DiagramPosition::toString() { /** @return true si l'element est en dehors des bords du schema */ -bool DiagramPosition::isOutOfBounds() const { +bool DiagramPosition::isOutOfBounds() const +{ return(letter_.isEmpty() || !number_); } diff --git a/sources/diagramprintdialog.cpp b/sources/diagramprintdialog.cpp index 0ab8612a4..36e6b6118 100644 --- a/sources/diagramprintdialog.cpp +++ b/sources/diagramprintdialog.cpp @@ -48,7 +48,8 @@ DiagramPrintDialog::DiagramPrintDialog(QETProject *project, QWidget *parent) : /** Destructeur */ -DiagramPrintDialog::~DiagramPrintDialog() { +DiagramPrintDialog::~DiagramPrintDialog() +{ delete dialog_; delete printer_; Diagram::background_color = backup_diagram_background_color; @@ -64,7 +65,8 @@ void DiagramPrintDialog::setFileName(const QString &name) { /** @return le nom du PDF */ -QString DiagramPrintDialog::fileName() const { +QString DiagramPrintDialog::fileName() const +{ return(file_name_); } @@ -78,7 +80,8 @@ void DiagramPrintDialog::setDocName(const QString &name) { /** @return le nom du document */ -QString DiagramPrintDialog::docName() const { +QString DiagramPrintDialog::docName() const +{ return(doc_name_); } @@ -89,7 +92,8 @@ QString DiagramPrintDialog::docName() const { @return the rectangle to be printed */ QRect DiagramPrintDialog::diagramRect(Diagram *diagram, - const ExportProperties &options) const { + const ExportProperties &options) const +{ if (!diagram) return(QRect()); QRectF diagram_rect = diagram -> border_and_titleblock.borderAndTitleBlockRect(); @@ -107,7 +111,8 @@ QRect DiagramPrintDialog::diagramRect(Diagram *diagram, /** Execute le dialogue d'impression */ -void DiagramPrintDialog::exec() { +void DiagramPrintDialog::exec() +{ // prise en compte du nom du document if (!doc_name_.isEmpty()) printer_ -> setDocName(doc_name_); @@ -172,7 +177,8 @@ void DiagramPrintDialog::exec() { @return Le nombre de pages necessaires pour imprimer le schema avec l'orientation et le format papier utilise dans l'imprimante en cours. */ -int DiagramPrintDialog::pagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const { +int DiagramPrintDialog::pagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const +{ return(horizontalPagesCount(diagram, options, fullpage) * verticalPagesCount(diagram, options, fullpage)); } @@ -183,7 +189,8 @@ int DiagramPrintDialog::pagesCount(Diagram *diagram, const ExportProperties &opt @return La largeur du "poster" en nombre de pages pour imprimer le schema avec l'orientation et le format papier utilise dans l'imprimante en cours. */ -int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const { +int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const +{ // note : pageRect et Paper Rect tiennent compte de l'orientation du papier QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect diagram_rect = diagramRect(diagram, options); @@ -199,7 +206,8 @@ int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportPrope @return La largeur du "poster" en nombre de pages pour imprimer le schema avec l'orientation et le format papier utilise dans l'imprimante en cours. */ -int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const { +int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportProperties &options, bool fullpage) const +{ // note : pageRect et Paper Rect tiennent compte de l'orientation du papier QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect diagram_rect = diagramRect(diagram, options); @@ -212,7 +220,8 @@ int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportPropert Construit un dialogue non standard pour demander a l'utilisateur quelle type d'impression il souhaite effectuer : PDF, PS ou imprimante physique */ -void DiagramPrintDialog::buildPrintTypeDialog() { +void DiagramPrintDialog::buildPrintTypeDialog() +{ // initialisation des widgets dialog_ = new QDialog(parentWidget()); #ifdef Q_OS_MACOS @@ -273,7 +282,8 @@ void DiagramPrintDialog::buildPrintTypeDialog() { /** Assure la coherence du dialogue permettant le choix du type d'impression */ -void DiagramPrintDialog::updatePrintTypeDialog() { +void DiagramPrintDialog::updatePrintTypeDialog() +{ // imprime-t-on vers un fichier ? bool file_print = !(printer_choice_ -> isChecked()); @@ -301,7 +311,8 @@ void DiagramPrintDialog::updatePrintTypeDialog() { Verifie l'etat du dialogue permettant le choix du type d'impression lorsque l'utilisateur le valide. */ -void DiagramPrintDialog::acceptPrintTypeDialog() { +void DiagramPrintDialog::acceptPrintTypeDialog() +{ bool file_print = !(printer_choice_ -> isChecked()); if (file_print) { // un fichier doit avoir ete entre @@ -322,7 +333,8 @@ void DiagramPrintDialog::acceptPrintTypeDialog() { /** Permet a l'utilisateur de choisir un fichier */ -void DiagramPrintDialog::browseFilePrintTypeDialog() { +void DiagramPrintDialog::browseFilePrintTypeDialog() +{ QString extension; QString filter; if (printer_choice_ -> isChecked()) return; diff --git a/sources/diagramschooser.cpp b/sources/diagramschooser.cpp index 66701fe39..2203572de 100644 --- a/sources/diagramschooser.cpp +++ b/sources/diagramschooser.cpp @@ -47,20 +47,23 @@ DiagramsChooser::DiagramsChooser(QETProject *project, QWidget *parent) : /** Destructeur */ -DiagramsChooser::~DiagramsChooser() { +DiagramsChooser::~DiagramsChooser() +{ } /** @return le projet dont ce widget affiche les schemas */ -QETProject *DiagramsChooser::project() const { +QETProject *DiagramsChooser::project() const +{ return(project_); } /** @return la liste des schemas selectionnes */ -QList DiagramsChooser::selectedDiagrams() const { +QList DiagramsChooser::selectedDiagrams() const +{ QList selected_diagrams; foreach(Diagram *diagram, project_ -> diagrams()) { QCheckBox *check_box = diagrams_[diagram]; @@ -74,7 +77,8 @@ QList DiagramsChooser::selectedDiagrams() const { /** @return la liste des schemas qui ne sont pas selectionnes */ -QList DiagramsChooser::nonSelectedDiagrams() const { +QList DiagramsChooser::nonSelectedDiagrams() const +{ QList selected_diagrams; foreach(Diagram *diagram, diagrams_.keys()) { if (!(diagrams_[diagram] -> isChecked())) { @@ -87,7 +91,8 @@ QList DiagramsChooser::nonSelectedDiagrams() const { /** @param diagram Un schema cense etre present dans ce widget */ -bool DiagramsChooser::diagramIsSelected(Diagram *const diagram) const { +bool DiagramsChooser::diagramIsSelected(Diagram *const diagram) const +{ QCheckBox *checkbox = diagrams_.value(diagram); if (!checkbox) return(false); return(checkbox -> isChecked()); @@ -146,7 +151,8 @@ void DiagramsChooser::setSelectedAllDiagrams(bool select) { /** Met a jour la liste des schemas du projet */ -void DiagramsChooser::updateList() { +void DiagramsChooser::updateList() +{ if (!project_) return; // retient la liste des schemas deja selectionnes @@ -176,7 +182,8 @@ void DiagramsChooser::updateList() { /** Met en place la disposition du widget */ -void DiagramsChooser::buildLayout() { +void DiagramsChooser::buildLayout() +{ if (vlayout0_) return; vlayout0_ = new QVBoxLayout(); widget0_ = new QWidget(); diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index fcd9f3e7a..8522b6322 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -113,27 +113,31 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : /** Destructeur */ -DiagramView::~DiagramView() { +DiagramView::~DiagramView() +{ } /** Selectionne tous les objets du schema */ -void DiagramView::selectAll() { +void DiagramView::selectAll() +{ m_diagram -> selectAll(); } /** Deslectionne tous les objets selectionnes */ -void DiagramView::selectNothing() { +void DiagramView::selectNothing() +{ m_diagram -> deselectAll(); } /** Inverse l'etat de selection de tous les objets du schema */ -void DiagramView::selectInvert() { +void DiagramView::selectInvert() +{ m_diagram -> invertSelection(); } @@ -267,7 +271,8 @@ void DiagramView::handleTextDrop(QDropEvent *e) { /** Set the Diagram in visualisation mode */ -void DiagramView::setVisualisationMode() { +void DiagramView::setVisualisationMode() +{ setDragMode(ScrollHandDrag); applyReadOnly(); setInteractive(false); @@ -277,7 +282,8 @@ void DiagramView::setVisualisationMode() { /** Set the Diagram in Selection mode */ -void DiagramView::setSelectionMode() { +void DiagramView::setSelectionMode() +{ setDragMode(RubberBandDrag); setInteractive(true); applyReadOnly(); @@ -315,7 +321,8 @@ void DiagramView::zoom(const qreal zoom_factor) schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema, le zoom est reinitialise */ -void DiagramView::zoomFit() { +void DiagramView::zoomFit() +{ adjustSceneRect(); fitInView(m_diagram->sceneRect(), Qt::KeepAspectRatio); adjustGridToZoom(); @@ -324,7 +331,8 @@ void DiagramView::zoomFit() { /** Adjust zoom to fit all elements in the view, regardless of diagram borders. */ -void DiagramView::zoomContent() { +void DiagramView::zoomContent() +{ fitInView(m_diagram -> itemsBoundingRect(), Qt::KeepAspectRatio); adjustGridToZoom(); } @@ -332,7 +340,8 @@ void DiagramView::zoomContent() { /** Reinitialise le zoom */ -void DiagramView::zoomReset() { +void DiagramView::zoomReset() +{ resetTransform(); adjustGridToZoom(); } @@ -340,7 +349,8 @@ void DiagramView::zoomReset() { /** Copie les elements selectionnes du schema dans le presse-papier puis les supprime */ -void DiagramView::cut() { +void DiagramView::cut() +{ copy(); DiagramContent cut_content(m_diagram); m_diagram -> clearSelection(); @@ -350,7 +360,8 @@ void DiagramView::cut() { /** Copie les elements selectionnes du schema dans le presse-papier */ -void DiagramView::copy() { +void DiagramView::copy() +{ QClipboard *presse_papier = QApplication::clipboard(); QString contenu_presse_papier = m_diagram -> toXml(false).toString(4); if (presse_papier -> supportsSelection()) presse_papier -> setText(contenu_presse_papier, QClipboard::Selection); @@ -387,7 +398,8 @@ void DiagramView::paste(const QPointF &pos, QClipboard::Mode clipboard_mode) { /** Colle le contenu du presse-papier sur le schema a la position de la souris */ -void DiagramView::pasteHere() { +void DiagramView::pasteHere() +{ paste(mapToScene(m_paste_here_pos)); } @@ -811,7 +823,8 @@ void DiagramView::scrollOnMovement(QKeyEvent *e) la mention "Schema sans titre" est utilisee @see Diagram::title() */ -QString DiagramView::title() const { +QString DiagramView::title() const +{ QString view_title; QString diagram_title(m_diagram -> title()); if (diagram_title.isEmpty()) { @@ -826,7 +839,8 @@ QString DiagramView::title() const { @brief DiagramView::editDiagramProperties Edit the properties of the viewed digram */ -void DiagramView::editDiagramProperties() { +void DiagramView::editDiagramProperties() +{ DiagramPropertiesDialog::diagramPropertiesDialog(m_diagram, diagramEditor()); } @@ -854,14 +868,16 @@ void DiagramView::adjustSceneRect() /** Met a jour le titre du widget */ -void DiagramView::updateWindowTitle() { +void DiagramView::updateWindowTitle() +{ emit(titleChanged(this, title())); } /** Enables or disables the drawing grid according to the amount of pixels display */ -void DiagramView::adjustGridToZoom() { +void DiagramView::adjustGridToZoom() +{ QRectF viewed_scene = viewedSceneRect(); if (diagramEditor()->drawGrid()) m_diagram->setDisplayGrid(viewed_scene.width() < 2000 || viewed_scene.height() < 2000); @@ -872,7 +888,8 @@ void DiagramView::adjustGridToZoom() { /** @return le rectangle du schema (classe Diagram) visualise par ce DiagramView */ -QRectF DiagramView::viewedSceneRect() const { +QRectF DiagramView::viewedSceneRect() const +{ // recupere la taille du widget viewport QSize viewport_size = viewport() -> size(); @@ -893,7 +910,8 @@ QRectF DiagramView::viewedSceneRect() const { parent project before being applied to the current diagram, or false if it can be directly applied */ -bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocation &tbt_loc) const { +bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocation &tbt_loc) const +{ // unlike elements, the integration of title block templates is mandatory, so we simply check whether the parent project of the template is also the parent project of the diagram QETProject *tbt_parent_project = tbt_loc.parentProject(); if (!tbt_parent_project) return(true); @@ -905,7 +923,8 @@ bool DiagramView::mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocati Fait en sorte que le schema ne soit editable que s'il n'est pas en lecture seule */ -void DiagramView::applyReadOnly() { +void DiagramView::applyReadOnly() +{ if (!m_diagram) return; bool is_writable = !m_diagram -> isReadOnly(); @@ -970,7 +989,8 @@ void DiagramView::editConductorColor(Conductor *edited_conductor) /** Reinitialise le profil des conducteurs selectionnes */ -void DiagramView::resetConductors() { +void DiagramView::resetConductors() +{ if (m_diagram -> isReadOnly()) return; // recupere les conducteurs selectionnes QSet selected_conductors = m_diagram -> selectedConductors(); @@ -1103,7 +1123,8 @@ bool DiagramView::isCtrlShifting(QInputEvent *e) { /** @return true if there is a selected item and that item has the focus. */ -bool DiagramView::selectedItemHasFocus() { +bool DiagramView::selectedItemHasFocus() +{ return( m_diagram -> hasFocus() && m_diagram -> focusItem() && @@ -1115,7 +1136,8 @@ bool DiagramView::selectedItemHasFocus() { @brief DiagramView::editSelection Edit the selected item if he can be edited and if only one item is selected */ -void DiagramView::editSelection() { +void DiagramView::editSelection() +{ if (m_diagram -> isReadOnly() || m_diagram -> selectedItems().size() != 1 ) return; QGraphicsItem *item = m_diagram->selectedItems().first(); @@ -1225,7 +1247,8 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) /** @return l'editeur de schemas parent ou 0 */ -QETDiagramEditor *DiagramView::diagramEditor() const { +QETDiagramEditor *DiagramView::diagramEditor() const +{ // remonte la hierarchie des widgets QWidget *w = const_cast(this); while (w -> parentWidget() && !w -> isWindow()) { diff --git a/sources/dvevent/dveventinterface.cpp b/sources/dvevent/dveventinterface.cpp index d436db1f5..c6000da25 100644 --- a/sources/dvevent/dveventinterface.cpp +++ b/sources/dvevent/dveventinterface.cpp @@ -28,7 +28,8 @@ DVEventInterface::DVEventInterface(DiagramView *dv) : { } -DVEventInterface::~DVEventInterface() { +DVEventInterface::~DVEventInterface() +{ } bool DVEventInterface::mouseDoubleClickEvent(QMouseEvent *event) { @@ -80,10 +81,12 @@ bool DVEventInterface::KeyReleaseEvent(QKeyEvent *event) { return false; } -bool DVEventInterface::isRunning() const { +bool DVEventInterface::isRunning() const +{ return m_running; } -bool DVEventInterface::isFinish() const { +bool DVEventInterface::isFinish() const +{ return !m_running; } diff --git a/sources/editor/arceditor.cpp b/sources/editor/arceditor.cpp index 87cbcb5dd..73968d653 100644 --- a/sources/editor/arceditor.cpp +++ b/sources/editor/arceditor.cpp @@ -75,7 +75,8 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) : } /// Destructeur -ArcEditor::~ArcEditor() {} +ArcEditor::~ArcEditor() +{} void ArcEditor::setUpChangeConnections() { @@ -140,11 +141,13 @@ bool ArcEditor::setParts(QList parts) @brief ArcEditor::currentPart @return the curent edited part, or 0 if there is no edited part */ -CustomElementPart *ArcEditor::currentPart() const { +CustomElementPart *ArcEditor::currentPart() const +{ return(part); } -QList ArcEditor::currentParts() const { +QList ArcEditor::currentParts() const +{ return style_->currentParts(); } diff --git a/sources/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index 5597b10b7..3d4531f7a 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -56,13 +56,15 @@ ElementEditionCommand::ElementEditionCommand(const QString &text, /** Destructor */ -ElementEditionCommand::~ElementEditionCommand() { +ElementEditionCommand::~ElementEditionCommand() +{ } /** @return the element editor/scene the command should take place on */ -ElementScene *ElementEditionCommand::elementScene() const { +ElementScene *ElementEditionCommand::elementScene() const +{ return(m_scene); } @@ -76,7 +78,8 @@ void ElementEditionCommand::setElementScene(ElementScene *scene) { /** @return the view the effect of the command should be rendered on */ -ElementView *ElementEditionCommand::elementView() const { +ElementView *ElementEditionCommand::elementView() const +{ return(m_view); } @@ -108,14 +111,16 @@ DeletePartsCommand::DeletePartsCommand( } /// Destructeur : detruit egalement les parties supprimees -DeletePartsCommand::~DeletePartsCommand() { +DeletePartsCommand::~DeletePartsCommand() +{ foreach(QGraphicsItem *qgi, deleted_parts) { m_scene -> qgiManager().release(qgi); } } /// Restaure les parties supprimees -void DeletePartsCommand::undo() { +void DeletePartsCommand::undo() +{ m_scene -> blockSignals(true); foreach(QGraphicsItem *qgi, deleted_parts) { m_scene -> addItem(qgi); @@ -124,7 +129,8 @@ void DeletePartsCommand::undo() { } /// Supprime les parties -void DeletePartsCommand::redo() { +void DeletePartsCommand::redo() +{ m_scene -> blockSignals(true); foreach(QGraphicsItem *qgi, deleted_parts) { m_scene -> removeItem(qgi); @@ -150,7 +156,8 @@ CutPartsCommand::CutPartsCommand( } /// Destructeur -CutPartsCommand::~CutPartsCommand() { +CutPartsCommand::~CutPartsCommand() +{ } /*** MovePartsCommand ***/ @@ -175,16 +182,19 @@ MovePartsCommand::MovePartsCommand( } /// Destructeur -MovePartsCommand::~MovePartsCommand() { +MovePartsCommand::~MovePartsCommand() +{ } /// Annule le deplacement -void MovePartsCommand::undo() { +void MovePartsCommand::undo() +{ foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y()); } /// Refait le deplacement -void MovePartsCommand::redo() { +void MovePartsCommand::redo() +{ // le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire if (first_redo) { first_redo = false; @@ -215,17 +225,20 @@ AddPartCommand::AddPartCommand( } /// Destructeur -AddPartCommand::~AddPartCommand() { +AddPartCommand::~AddPartCommand() +{ m_scene -> qgiManager().release(part); } /// Annule l'ajout -void AddPartCommand::undo() { +void AddPartCommand::undo() +{ m_scene -> removeItem(part); } /// Refait l'ajout -void AddPartCommand::redo() { +void AddPartCommand::redo() +{ // le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire if (first_redo) { if (!part -> zValue()) { @@ -262,16 +275,19 @@ ChangeNamesCommand::ChangeNamesCommand( } /// Destructeur -ChangeNamesCommand::~ChangeNamesCommand() { +ChangeNamesCommand::~ChangeNamesCommand() +{ } /// Annule le changement -void ChangeNamesCommand::undo() { +void ChangeNamesCommand::undo() +{ m_scene -> setNames(names_before); } /// Refait le changement -void ChangeNamesCommand::redo() { +void ChangeNamesCommand::redo() +{ m_scene -> setNames(names_after); } @@ -312,16 +328,19 @@ ChangeZValueCommand::ChangeZValueCommand( } /// Destructeur -ChangeZValueCommand::~ChangeZValueCommand() { +ChangeZValueCommand::~ChangeZValueCommand() +{ } /// Annule les changements de zValue -void ChangeZValueCommand::undo() { +void ChangeZValueCommand::undo() +{ foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]); } /// Refait les changements de zValue -void ChangeZValueCommand::redo() { +void ChangeZValueCommand::redo() +{ foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]); } @@ -423,16 +442,19 @@ ChangeInformationsCommand::ChangeInformationsCommand(ElementScene *elmt, const Q } /// Destructeur -ChangeInformationsCommand::~ChangeInformationsCommand() { +ChangeInformationsCommand::~ChangeInformationsCommand() +{ } /// Annule le changement d'autorisation pour les connexions internes -void ChangeInformationsCommand::undo() { +void ChangeInformationsCommand::undo() +{ m_scene -> setInformations(old_informations_); } /// Refait le changement d'autorisation pour les connexions internes -void ChangeInformationsCommand::redo() { +void ChangeInformationsCommand::redo() +{ m_scene -> setInformations(new_informations_); } @@ -449,20 +471,23 @@ ScalePartsCommand::ScalePartsCommand(ElementScene *scene, QUndoCommand * parent) /** Destructor */ -ScalePartsCommand::~ScalePartsCommand() { +ScalePartsCommand::~ScalePartsCommand() +{ } /** Undo the scaling operation */ -void ScalePartsCommand::undo() { +void ScalePartsCommand::undo() +{ scale(new_rect_, original_rect_); } /** Redo the scaling operation */ -void ScalePartsCommand::redo() { +void ScalePartsCommand::redo() +{ if (first_redo) { first_redo = false; return; @@ -473,7 +498,8 @@ void ScalePartsCommand::redo() { /** @return the element editor/scene the command should take place on */ -ElementScene *ScalePartsCommand::elementScene() const { +ElementScene *ScalePartsCommand::elementScene() const +{ return(m_scene); } @@ -488,7 +514,8 @@ void ScalePartsCommand::setScaledPrimitives(const QList &pr /** @return the list of primitives to be scaled by this command */ -QList ScalePartsCommand::scaledPrimitives() const { +QList ScalePartsCommand::scaledPrimitives() const +{ return(scaled_primitives_); } @@ -511,7 +538,8 @@ void ScalePartsCommand::setTransformation(const QRectF &original_rect, are the bounding rectangles for all scaled primitives respectively before and after the operation. */ -QPair ScalePartsCommand::transformation() { +QPair ScalePartsCommand::transformation() +{ return(QPair(original_rect_, new_rect_)); } @@ -532,7 +560,8 @@ void ScalePartsCommand::scale(const QRectF &before, const QRectF &after) { /** Generate the text describing what this command does exactly. */ -void ScalePartsCommand::adjustText() { +void ScalePartsCommand::adjustText() +{ if (scaled_primitives_.count() == 1) { setText(QObject::tr("redimensionnement %1", "undo caption -- %1 is the resized primitive type name").arg(scaled_primitives_.first() -> name())); } else { @@ -562,7 +591,8 @@ ChangePropertiesCommand::ChangePropertiesCommand( setText(QObject::tr("Modifier les propriétés")); } -ChangePropertiesCommand::~ChangePropertiesCommand() {} +ChangePropertiesCommand::~ChangePropertiesCommand() +{} void ChangePropertiesCommand::undo() { diff --git a/sources/editor/elementitemeditor.cpp b/sources/editor/elementitemeditor.cpp index da75df7b6..c87f15a03 100644 --- a/sources/editor/elementitemeditor.cpp +++ b/sources/editor/elementitemeditor.cpp @@ -31,22 +31,26 @@ ElementItemEditor::ElementItemEditor(QETElementEditor *editor, QWidget *parent) } /// @return le QETElementEditor auquel cet editeur appartient -QETElementEditor *ElementItemEditor::elementEditor() const { +QETElementEditor *ElementItemEditor::elementEditor() const +{ return(element_editor); } /// @return l'ElementScene contenant les parties editees par cet editeur -ElementScene *ElementItemEditor::elementScene() const { +ElementScene *ElementItemEditor::elementScene() const +{ return(element_editor -> elementScene()); } /// @return la QUndoStack a utiliser pour les annulations -QUndoStack &ElementItemEditor::undoStack() const { +QUndoStack &ElementItemEditor::undoStack() const +{ return(elementScene() -> undoStack()); } /// @return Le nom du type d'element edite -QString ElementItemEditor::elementTypeName() const { +QString ElementItemEditor::elementTypeName() const +{ return(element_type_name); } @@ -60,6 +64,7 @@ void ElementItemEditor::setElementTypeName(const QString &name) { Equivaut a setPart(0) @see setPart */ -void ElementItemEditor::detach() { +void ElementItemEditor::detach() +{ setPart(nullptr); } diff --git a/sources/editor/elementprimitivedecorator.cpp b/sources/editor/elementprimitivedecorator.cpp index e9c56b7d1..69c84bcbe 100644 --- a/sources/editor/elementprimitivedecorator.cpp +++ b/sources/editor/elementprimitivedecorator.cpp @@ -48,7 +48,8 @@ ElementPrimitiveDecorator::~ElementPrimitiveDecorator() @return the internal bouding rect, i.e. the smallest rectangle containing the bounding rectangle of every selected item. */ -QRectF ElementPrimitiveDecorator::internalBoundingRect() const { +QRectF ElementPrimitiveDecorator::internalBoundingRect() const +{ if (!decorated_items_.count() || !scene()) return(QRectF()); //if @decorated_items_ contain one item and if this item is a vertical or horizontal partline, apply a specific methode @@ -139,14 +140,16 @@ void ElementPrimitiveDecorator::setItems(const QList &items) /** @return the list of items this decorator is supposed to manipulate */ -QList ElementPrimitiveDecorator::items() const { +QList ElementPrimitiveDecorator::items() const +{ return(decorated_items_); } /** @return the list of items this decorator is supposed to manipulate */ -QList ElementPrimitiveDecorator::graphicsItems() const { +QList ElementPrimitiveDecorator::graphicsItems() const +{ QList list; foreach (CustomElementPart *part_item, decorated_items_) { if (QGraphicsItem *item = dynamic_cast(part_item)) { @@ -337,7 +340,8 @@ void ElementPrimitiveDecorator::init() /** Save the original bounding rectangle. */ -void ElementPrimitiveDecorator::saveOriginalBoundingRect() { +void ElementPrimitiveDecorator::saveOriginalBoundingRect() +{ original_bounding_rect_ = internalBoundingRect(); } @@ -345,7 +349,8 @@ void ElementPrimitiveDecorator::saveOriginalBoundingRect() { Adjust the effective bounding rect. This method should be called after the modified_bouding_rect_ attribute was modified. */ -void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() { +void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() +{ prepareGeometryChange(); effective_bounding_rect_ = modified_bounding_rect_ | effective_bounding_rect_; update(); @@ -355,7 +360,8 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() { /** Start a movement (i.e. either a move or scaling operation) */ -void ElementPrimitiveDecorator::startMovement() { +void ElementPrimitiveDecorator::startMovement() +{ adjust(); foreach(CustomElementPart *item, decorated_items_) { @@ -409,7 +415,8 @@ void ElementPrimitiveDecorator::applyMovementToRect(int movement_type, const QPo } } -CustomElementPart *ElementPrimitiveDecorator::singleItem() const { +CustomElementPart *ElementPrimitiveDecorator::singleItem() const +{ if (decorated_items_.count() == 1) { return(decorated_items_.first()); } @@ -450,7 +457,8 @@ void ElementPrimitiveDecorator::scaleItems(const QRectF &original_rect, const QR /** @return the bounding rectangle of \a item, in scene coordinates */ -QRectF ElementPrimitiveDecorator::getSceneBoundingRect(QGraphicsItem *item) const { +QRectF ElementPrimitiveDecorator::getSceneBoundingRect(QGraphicsItem *item) const +{ if (!item) return(QRectF()); return(item -> mapRectToScene(item -> boundingRect())); } @@ -655,7 +663,8 @@ QPointF ElementPrimitiveDecorator::deltaForRoundScaling(const QRectF &original, Round the coordinates of \a point so it is snapped to the grid defined by the grid_step_x_ and grid_step_y_ attributes. */ -QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) const { +QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) const +{ return( QPointF( qRound(point.x() / grid_step_x_) * grid_step_x_, @@ -668,7 +677,8 @@ QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) co Round the coordinates of \a point so it is snapped to the grid defined by the grid_step_x_ and grid_step_y_ attributes. */ -void ElementPrimitiveDecorator::snapPointToGrid(QPointF &point) const { +void ElementPrimitiveDecorator::snapPointToGrid(QPointF &point) const +{ point.rx() = qRound(point.x() / grid_step_x_) * grid_step_x_; point.ry() = qRound(point.y() / grid_step_y_) * grid_step_y_; } diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index 3b9f3b442..deaada775 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -347,7 +347,8 @@ void ElementScene::setBehavior(ElementScene::Behavior b) { m_behavior = b; } -ElementScene::Behavior ElementScene::behavior() const { +ElementScene::Behavior ElementScene::behavior() const +{ return m_behavior; } @@ -356,7 +357,8 @@ ElementScene::Behavior ElementScene::behavior() const { @return the horizontal size of the grid \~French la taille horizontale de la grille */ -int ElementScene::xGrid() const { +int ElementScene::xGrid() const +{ return(m_x_grid); } @@ -365,7 +367,8 @@ int ElementScene::xGrid() const { @return vertical grid size \~French la taille verticale de la grille */ -int ElementScene::yGrid() const { +int ElementScene::yGrid() const +{ return(m_y_grid); } @@ -580,7 +583,8 @@ QRectF ElementScene::elementSceneGeometricRect() const{ \~French true si l'element comporte au moins une borne, false s'il n'en a aucune. */ -bool ElementScene::containsTerminals() const { +bool ElementScene::containsTerminals() const +{ foreach(QGraphicsItem *qgi,items()) { if (qgraphicsitem_cast(qgi)) { return(true); @@ -594,7 +598,8 @@ bool ElementScene::containsTerminals() const { @return the undo stack of this element editor \~French la pile d'annulations de cet editeur d'element */ -QUndoStack &ElementScene::undoStack() { +QUndoStack &ElementScene::undoStack() +{ return(m_undo_stack); } @@ -603,7 +608,8 @@ QUndoStack &ElementScene::undoStack() { @return the QGraphicsItem manager of this item editor \~French le gestionnaire de QGraphicsItem de cet editeur d'element */ -QGIManager &ElementScene::qgiManager() { +QGIManager &ElementScene::qgiManager() +{ return(m_qgi_manager); } @@ -612,7 +618,8 @@ QGIManager &ElementScene::qgiManager() { @return true if the clipboard appears to contain an element \~French true si le presse-papier semble contenir un element */ -bool ElementScene::clipboardMayContainElement() { +bool ElementScene::clipboardMayContainElement() +{ QString clipboard_text = QApplication::clipboard() -> text().trimmed(); bool may_be_element = clipboard_text.startsWith(""); @@ -639,7 +646,8 @@ bool ElementScene::wasCopiedFromThisElement(const QString &clipboard_content) { \~French Gere le fait de couper la selection = l'exporter en XML dans le presse-papier puis la supprimer. */ -void ElementScene::cut() { +void ElementScene::cut() +{ copy(); QList cut_content = selectedItems(); clearSelection(); @@ -653,7 +661,8 @@ void ElementScene::cut() { \~French Gere le fait de copier la selection = l'exporter en XML dans lepresse-papier. */ -void ElementScene::copy() { +void ElementScene::copy() +{ // accede au presse-papier QClipboard *clipboard = QApplication::clipboard(); @@ -674,7 +683,8 @@ void ElementScene::copy() { @brief ElementScene::editor @return */ -QETElementEditor* ElementScene::editor() const { +QETElementEditor* ElementScene::editor() const +{ return m_element_editor; } @@ -727,7 +737,8 @@ void ElementScene::slot_select(const ElementContent &content) @brief ElementScene::slot_selectAll Select all items */ -void ElementScene::slot_selectAll() { +void ElementScene::slot_selectAll() +{ slot_select(items()); } @@ -735,7 +746,8 @@ void ElementScene::slot_selectAll() { @brief ElementScene::slot_deselectAll deselect all item */ -void ElementScene::slot_deselectAll() { +void ElementScene::slot_deselectAll() +{ slot_select(ElementContent()); } @@ -744,7 +756,8 @@ void ElementScene::slot_deselectAll() { Inverse Selection \~French Inverse la selection */ -void ElementScene::slot_invertSelection() { +void ElementScene::slot_invertSelection() +{ blockSignals(true); foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(!qgi -> isSelected()); @@ -757,7 +770,8 @@ void ElementScene::slot_invertSelection() { Delete selected items \~French Supprime les elements selectionnes */ -void ElementScene::slot_delete() { +void ElementScene::slot_delete() +{ // check that there is something selected // verifie qu'il y a qqc de selectionne QList selected_items = selectedItems(); @@ -781,7 +795,8 @@ void ElementScene::slot_delete() { de cet element. Concretement, ce champ libre est destine a accueillir des informations sur l'auteur de l'element, sa licence, etc. */ -void ElementScene::slot_editAuthorInformations() { +void ElementScene::slot_editAuthorInformations() +{ bool is_read_only = m_element_editor && m_element_editor -> isReadOnly(); // create a dialogue @@ -886,7 +901,8 @@ void ElementScene::slot_editNames() @brief ElementScene::primitives @return the list of primitives currently present on the scene. */ -QList ElementScene::primitives() const { +QList ElementScene::primitives() const +{ QList primitives_list; foreach (QGraphicsItem *item, items()) { if (CustomElementPart *primitive = dynamic_cast(item)) { @@ -902,7 +918,8 @@ QList ElementScene::primitives() const { @return the parts of the element ordered by increasing zValue \~French les parties de l'element ordonnes par zValue croissante */ -QList ElementScene::zItems(ItemOptions options) const { +QList ElementScene::zItems(ItemOptions options) const +{ // handle dummy request, i.e. when neither Selected nor NonSelected are set if (!(options & ElementScene::Selected) && @@ -968,7 +985,8 @@ QList ElementScene::zItems(ItemOptions options) const { @return the selected graphic parts \~French les parties graphiques selectionnees */ -ElementContent ElementScene::selectedContent() const { +ElementContent ElementScene::selectedContent() const +{ ElementContent content; foreach(QGraphicsItem *qgi, zItems()) { if (qgi -> isSelected()) content << qgi; @@ -1031,7 +1049,8 @@ void ElementScene::reset() exprime dans les coordonnes de la scene */ QRectF ElementScene::elementContentBoundingRect( - const ElementContent &content) const { + const ElementContent &content) const +{ QRectF bounding_rect; foreach(QGraphicsItem *qgi, content) { // skip non-primitives QGraphicsItems (paste area, selection decorator) @@ -1234,7 +1253,8 @@ void ElementScene::addPrimitive(QGraphicsItem *primitive) { Initializes the paste area \~French Initialise la zone de collage */ -void ElementScene::initPasteArea() { +void ElementScene::initPasteArea() +{ m_paste_area = new QGraphicsRectItem(); m_paste_area -> setZValue(1000000); @@ -1282,7 +1302,8 @@ bool ElementScene::zValueLessThan(QGraphicsItem *item1, QGraphicsItem *item2) { try to center better is possible the element to the scene (the calcul isn't optimal but work good) */ -void ElementScene::centerElementToOrigine() { +void ElementScene::centerElementToOrigine() +{ QRectF size= elementSceneGeometricRect(); int center_x = qRound(size.center().x()); int center_y = qRound(size.center().y()); diff --git a/sources/editor/elementscene.h b/sources/editor/elementscene.h index 873267008..5199c9d5d 100644 --- a/sources/editor/elementscene.h +++ b/sources/editor/elementscene.h @@ -192,7 +192,8 @@ inline void ElementScene::setNames(const NamesList &nameslist) { @brief ElementScene::names @return the list of names of the currently edited element */ -inline NamesList ElementScene::names() const { +inline NamesList ElementScene::names() const +{ return(m_names_list); } @@ -200,7 +201,8 @@ inline NamesList ElementScene::names() const { @brief ElementScene::informations @return extra informations of the currently edited element */ -inline QString ElementScene::informations() const { +inline QString ElementScene::informations() const +{ return(m_informations); } diff --git a/sources/editor/elementview.cpp b/sources/editor/elementview.cpp index ef04c4dc9..8eb65c465 100644 --- a/sources/editor/elementview.cpp +++ b/sources/editor/elementview.cpp @@ -41,18 +41,21 @@ ElementView::ElementView(ElementScene *scene, QWidget *parent) : } /// Destructeur -ElementView::~ElementView() { +ElementView::~ElementView() +{ } /// @return l'ElementScene visualisee par cette ElementView -ElementScene *ElementView::scene() const { +ElementScene *ElementView::scene() const +{ return(m_scene); } /** @return le rectangle de l'element visualise par cet ElementView */ -QRectF ElementView::viewedSceneRect() const { +QRectF ElementView::viewedSceneRect() const +{ // recupere la taille du widget viewport QSize viewport_size = viewport() -> size(); @@ -79,7 +82,8 @@ void ElementView::setScene(ElementScene *s) { /** Set the Diagram in visualisation mode */ -void ElementView::setVisualisationMode() { +void ElementView::setVisualisationMode() +{ setDragMode(ScrollHandDrag); setInteractive(false); emit(modeChanged()); @@ -88,7 +92,8 @@ void ElementView::setVisualisationMode() { /** Set the Diagram in Selection mode */ -void ElementView::setSelectionMode() { +void ElementView::setSelectionMode() +{ setDragMode(RubberBandDrag); setInteractive(true); emit(modeChanged()); @@ -97,7 +102,8 @@ void ElementView::setSelectionMode() { /** Agrandit le schema (+33% = inverse des -25 % de zoomMoins()) */ -void ElementView::zoomIn() { +void ElementView::zoomIn() +{ adjustSceneRect(); scale(4.0/3.0, 4.0/3.0); } @@ -105,7 +111,8 @@ void ElementView::zoomIn() { /** Retrecit le schema (-25% = inverse des +33 % de zoomPlus()) */ -void ElementView::zoomOut() { +void ElementView::zoomOut() +{ adjustSceneRect(); scale(0.75, 0.75); } @@ -113,14 +120,16 @@ void ElementView::zoomOut() { /** Agrandit le schema avec le trackpad */ -void ElementView::zoomInSlowly() { +void ElementView::zoomInSlowly() +{ scale(1.02, 1.02); } /** Retrecit le schema avec le trackpad */ -void ElementView::zoomOutSlowly() { +void ElementView::zoomOutSlowly() +{ scale(0.98, 0.98); } @@ -129,7 +138,8 @@ void ElementView::zoomOutSlowly() { schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema, le zoom est reinitialise */ -void ElementView::zoomFit() { +void ElementView::zoomFit() +{ resetSceneRect(); fitInView(sceneRect(), Qt::KeepAspectRatio); } @@ -137,7 +147,8 @@ void ElementView::zoomFit() { /** Reinitialise le zoom */ -void ElementView::zoomReset() { +void ElementView::zoomReset() +{ resetSceneRect(); resetTransform(); scale(4.0, 4.0); @@ -148,7 +159,8 @@ void ElementView::zoomReset() { Adjust the scenRect, so that he include all primitives of element plus the viewport of the scene with a margin of 1/3 of herself */ -void ElementView::adjustSceneRect() { +void ElementView::adjustSceneRect() +{ QRectF esgr = m_scene -> elementSceneGeometricRect(); QRectF vpbr = mapToScene(this -> viewport()->rect()).boundingRect(); QRectF new_scene_rect = vpbr.adjusted(-vpbr.width()/3, -vpbr.height()/3, vpbr.width()/3, vpbr.height()/3); @@ -160,7 +172,8 @@ void ElementView::adjustSceneRect() { reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que celui-ci inclut uniquement les primitives de l'élément dessiné. */ -void ElementView::resetSceneRect() { +void ElementView::resetSceneRect() +{ setSceneRect(m_scene -> elementSceneGeometricRect()); } @@ -168,7 +181,8 @@ void ElementView::resetSceneRect() { Gere le fait de couper la selection = l'exporter en XML dans le presse-papier puis la supprimer. */ -void ElementView::cut() { +void ElementView::cut() +{ // delegue cette action a la scene m_scene -> cut(); offset_paste_count_ = -1; @@ -178,7 +192,8 @@ void ElementView::cut() { Gere le fait de copier la selection = l'exporter en XML dans le presse-papier. */ -void ElementView::copy() { +void ElementView::copy() +{ // delegue cette action a la scene m_scene -> copy(); offset_paste_count_ = 0; @@ -194,7 +209,8 @@ void ElementView::copy() { collage devra s'effectuer. @see pasteAreaDefined(const QRectF &) */ -void ElementView::paste() { +void ElementView::paste() +{ QString clipboard_text = QApplication::clipboard() -> text(); if (clipboard_text.isEmpty()) return; @@ -218,7 +234,8 @@ void ElementView::paste() { Colle le contenu du presse-papier en demandant systematiquement a l'utilisateur de choisir une zone de collage */ -void ElementView::pasteInArea() { +void ElementView::pasteInArea() +{ QString clipboard_text = QApplication::clipboard() -> text(); if (clipboard_text.isEmpty()) return; diff --git a/sources/editor/ellipseeditor.cpp b/sources/editor/ellipseeditor.cpp index b414bdfc6..02c6d7a01 100644 --- a/sources/editor/ellipseeditor.cpp +++ b/sources/editor/ellipseeditor.cpp @@ -67,7 +67,8 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *ellipse, QWi } /// Destructeur -EllipseEditor::~EllipseEditor() { +EllipseEditor::~EllipseEditor() +{ } void EllipseEditor::setUpChangeConnections() @@ -126,11 +127,13 @@ bool EllipseEditor::setParts(QList parts) /** @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas */ -CustomElementPart *EllipseEditor::currentPart() const { +CustomElementPart *EllipseEditor::currentPart() const +{ return(part); } -QList EllipseEditor::currentParts() const { +QList EllipseEditor::currentParts() const +{ return style_->currentParts(); } diff --git a/sources/editor/esevent/eseventaddarc.cpp b/sources/editor/esevent/eseventaddarc.cpp index 5f37f4981..2fc758287 100644 --- a/sources/editor/esevent/eseventaddarc.cpp +++ b/sources/editor/esevent/eseventaddarc.cpp @@ -35,7 +35,8 @@ ESEventAddArc::ESEventAddArc(ElementScene *scene) : /** @brief ESEventAddArc::~ESEventAddArc */ -ESEventAddArc::~ESEventAddArc() { +ESEventAddArc::~ESEventAddArc() +{ if (m_running || m_abort) delete m_arc; } diff --git a/sources/editor/esevent/eseventadddynamictextfield.cpp b/sources/editor/esevent/eseventadddynamictextfield.cpp index 9933ce513..32e14989d 100644 --- a/sources/editor/esevent/eseventadddynamictextfield.cpp +++ b/sources/editor/esevent/eseventadddynamictextfield.cpp @@ -37,7 +37,8 @@ ESEventAddDynamicTextField::ESEventAddDynamicTextField(ElementScene *scene) : /** @brief ESEventAddDynamicTextField::~ESEventAddDynamicTextField */ -ESEventAddDynamicTextField::~ESEventAddDynamicTextField() { +ESEventAddDynamicTextField::~ESEventAddDynamicTextField() +{ delete m_text; } diff --git a/sources/editor/esevent/eseventaddellipse.cpp b/sources/editor/esevent/eseventaddellipse.cpp index 4fa910ab0..485228fbf 100644 --- a/sources/editor/esevent/eseventaddellipse.cpp +++ b/sources/editor/esevent/eseventaddellipse.cpp @@ -34,7 +34,8 @@ ESEventAddEllipse::ESEventAddEllipse(ElementScene *scene) : /** @brief ESEventAddEllipse::~ESEventAddEllipse */ -ESEventAddEllipse::~ESEventAddEllipse() { +ESEventAddEllipse::~ESEventAddEllipse() +{ if (m_running || m_abort){ delete m_ellipse; } diff --git a/sources/editor/esevent/eseventaddline.cpp b/sources/editor/esevent/eseventaddline.cpp index 7c7373775..bca0880f9 100644 --- a/sources/editor/esevent/eseventaddline.cpp +++ b/sources/editor/esevent/eseventaddline.cpp @@ -38,7 +38,8 @@ ESEventAddLine::ESEventAddLine(ElementScene *scene) : @brief ESEventAddLine::~ESEventAddLine destructor */ -ESEventAddLine::~ESEventAddLine() { +ESEventAddLine::~ESEventAddLine() +{ if (m_running || m_abort) delete m_line; } diff --git a/sources/editor/esevent/eseventaddpolygon.cpp b/sources/editor/esevent/eseventaddpolygon.cpp index 07dc78789..75f7cd6aa 100644 --- a/sources/editor/esevent/eseventaddpolygon.cpp +++ b/sources/editor/esevent/eseventaddpolygon.cpp @@ -34,7 +34,8 @@ ESEventAddPolygon::ESEventAddPolygon(ElementScene *scene) : /** @brief ESEventAddPolygon::~ESEventAddPolygon */ -ESEventAddPolygon::~ESEventAddPolygon() { +ESEventAddPolygon::~ESEventAddPolygon() +{ if (m_running || m_abort) delete m_polygon; } diff --git a/sources/editor/esevent/eseventaddrect.cpp b/sources/editor/esevent/eseventaddrect.cpp index 0e3386701..4a85fe1a4 100644 --- a/sources/editor/esevent/eseventaddrect.cpp +++ b/sources/editor/esevent/eseventaddrect.cpp @@ -34,7 +34,8 @@ ESEventAddRect::ESEventAddRect(ElementScene *scene) : /** @brief ESEventAddRect::~ESEventAddRect */ -ESEventAddRect::~ESEventAddRect() { +ESEventAddRect::~ESEventAddRect() +{ if (m_running || m_abort) delete m_rect; } diff --git a/sources/editor/esevent/eseventaddterminal.cpp b/sources/editor/esevent/eseventaddterminal.cpp index beac60416..3e34a5072 100644 --- a/sources/editor/esevent/eseventaddterminal.cpp +++ b/sources/editor/esevent/eseventaddterminal.cpp @@ -37,7 +37,8 @@ ESEventAddTerminal::ESEventAddTerminal(ElementScene *scene) : /** @brief ESEventAddTerminal::~ESEventAddTerminal */ -ESEventAddTerminal::~ESEventAddTerminal() { +ESEventAddTerminal::~ESEventAddTerminal() +{ delete m_terminal; } diff --git a/sources/editor/esevent/eseventaddtext.cpp b/sources/editor/esevent/eseventaddtext.cpp index 041747a1f..6ddcfbbc0 100644 --- a/sources/editor/esevent/eseventaddtext.cpp +++ b/sources/editor/esevent/eseventaddtext.cpp @@ -37,7 +37,8 @@ ESEventAddText::ESEventAddText(ElementScene *scene) : /** @brief ESEventAddText::~ESEventAddText */ -ESEventAddText::~ESEventAddText() { +ESEventAddText::~ESEventAddText() +{ delete m_text; } diff --git a/sources/editor/esevent/eseventinterface.cpp b/sources/editor/esevent/eseventinterface.cpp index d44fa0811..0cc2825dc 100644 --- a/sources/editor/esevent/eseventinterface.cpp +++ b/sources/editor/esevent/eseventinterface.cpp @@ -99,11 +99,13 @@ bool ESEventInterface::KeyReleaseEvent(QKeyEvent *event) { return false; } -bool ESEventInterface::isRunning() const { +bool ESEventInterface::isRunning() const +{ return m_running; } -bool ESEventInterface::isFinish() const { +bool ESEventInterface::isFinish() const +{ return !m_running; } diff --git a/sources/editor/graphicspart/abstractpartellipse.cpp b/sources/editor/graphicspart/abstractpartellipse.cpp index 32a1920fd..68d3e5c59 100644 --- a/sources/editor/graphicspart/abstractpartellipse.cpp +++ b/sources/editor/graphicspart/abstractpartellipse.cpp @@ -87,7 +87,8 @@ QRectF AbstractPartEllipse::boundingRect() const and it is different from shape because it is a regular rectangle, not a complex shape. */ -QRectF AbstractPartEllipse::sceneGeometricRect() const { +QRectF AbstractPartEllipse::sceneGeometricRect() const +{ return(mapToScene(rect()).boundingRect()); } @@ -95,7 +96,8 @@ QRectF AbstractPartEllipse::sceneGeometricRect() const { @brief AbstractPartEllipse::sceneTopLeft @return return the top left of rectangle, in scene coordinate */ -QPointF AbstractPartEllipse::sceneTopLeft() const { +QPointF AbstractPartEllipse::sceneTopLeft() const +{ return(mapToScene(rect().topLeft())); } @@ -103,7 +105,8 @@ QPointF AbstractPartEllipse::sceneTopLeft() const { @brief AbstractPartEllipse::rect Returns the item's ellipse geometry as a QRectF. */ -QRectF AbstractPartEllipse::rect() const { +QRectF AbstractPartEllipse::rect() const +{ return m_rect; } @@ -131,7 +134,8 @@ void AbstractPartEllipse::setRect(const QRectF &rect) and does not deserve to be Retained / registered. An ellipse is relevant when is rect is not null. */ -bool AbstractPartEllipse::isUseless() const { +bool AbstractPartEllipse::isUseless() const +{ return(rect().isNull()); } diff --git a/sources/editor/graphicspart/customelementpart.cpp b/sources/editor/graphicspart/customelementpart.cpp index f04dca94d..979267b76 100644 --- a/sources/editor/graphicspart/customelementpart.cpp +++ b/sources/editor/graphicspart/customelementpart.cpp @@ -19,7 +19,8 @@ #include "qetelementeditor.h" /// @return le QETElementEditor auquel cet editeur appartient -QETElementEditor *CustomElementPart::elementEditor() const { +QETElementEditor *CustomElementPart::elementEditor() const +{ return(element_editor); } @@ -27,24 +28,28 @@ QETElementEditor *CustomElementPart::elementEditor() const { Appelle le slot updateCurrentPartEditor de l'editeur @see QETElementEditor::updateCurrentPartEditor() */ -void CustomElementPart::updateCurrentPartEditor() const { +void CustomElementPart::updateCurrentPartEditor() const +{ if (element_editor) { element_editor -> updateCurrentPartEditor(); } } /// @return l'ElementScene contenant les parties editees par cet editeur -ElementScene *CustomElementPart::elementScene() const { +ElementScene *CustomElementPart::elementScene() const +{ return(element_editor -> elementScene()); } /// @return la QUndoStack a utiliser pour les annulations -QUndoStack &CustomElementPart::undoStack() const { +QUndoStack &CustomElementPart::undoStack() const +{ return(elementScene() -> undoStack()); } /// @return this primitive as a QGraphicsItem -QGraphicsItem *CustomElementPart::toItem() { +QGraphicsItem *CustomElementPart::toItem() +{ return(dynamic_cast(this)); } @@ -55,7 +60,8 @@ QGraphicsItem *CustomElementPart::toItem() { The default implementation systematically returns QET::SnapScalingPointToGrid */ -QET::ScalingMethod CustomElementPart::preferredScalingMethod() const { +QET::ScalingMethod CustomElementPart::preferredScalingMethod() const +{ return(QET::SnapScalingPointToGrid); } diff --git a/sources/editor/graphicspart/partarc.cpp b/sources/editor/graphicspart/partarc.cpp index 344f6a8e0..0129ff920 100644 --- a/sources/editor/graphicspart/partarc.cpp +++ b/sources/editor/graphicspart/partarc.cpp @@ -95,7 +95,8 @@ void PartArc::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, @param xml_document : Xml document to use for create the xml element. @return : an xml element that describe this arc */ -const QDomElement PartArc::toXml(QDomDocument &xml_document) const { +const QDomElement PartArc::toXml(QDomDocument &xml_document) const +{ QDomElement xml_element = xml_document.createElement("arc"); QPointF top_left(sceneTopLeft()); xml_element.setAttribute("x", QString("%1").arg(top_left.x())); diff --git a/sources/editor/graphicspart/partdynamictextfield.cpp b/sources/editor/graphicspart/partdynamictextfield.cpp index 03f3033cb..30693d7c8 100644 --- a/sources/editor/graphicspart/partdynamictextfield.cpp +++ b/sources/editor/graphicspart/partdynamictextfield.cpp @@ -49,11 +49,13 @@ PartDynamicTextField::PartDynamicTextField(QETElementEditor *editor, QGraphicsIt document() -> setDefaultTextOption(option); } -QString PartDynamicTextField::name() const { +QString PartDynamicTextField::name() const +{ return tr("Champ de texte dynamique", "element part name"); } -QString PartDynamicTextField::xmlName() const { +QString PartDynamicTextField::xmlName() const +{ return QString("dynamic_text"); } @@ -90,7 +92,8 @@ void PartDynamicTextField::handleUserTransformation( @param dom_doc @return */ -const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const { +const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const +{ QDomElement root_element = dom_doc.createElement(xmlName()); root_element.setAttribute("x", QString::number(pos().x())); @@ -260,7 +263,8 @@ void PartDynamicTextField::fromTextFieldXml(const QDomElement &dom_element) @brief PartDynamicTextField::textFrom @return what the final text is created from. */ -DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom() const { +DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom() const +{ return m_text_from; } @@ -291,7 +295,8 @@ void PartDynamicTextField::setTextFrom(DynamicElementTextItem::TextFrom text_fro @brief PartDynamicTextField::text @return the text of this text */ -QString PartDynamicTextField::text() const { +QString PartDynamicTextField::text() const +{ return m_text; } @@ -337,7 +342,8 @@ void PartDynamicTextField::setCompositeText(const QString &text) { @brief PartDynamicTextField::compositeText @return the composite text of this text */ -QString PartDynamicTextField::compositeText() const { +QString PartDynamicTextField::compositeText() const +{ return m_composite_text; } @@ -354,7 +360,8 @@ void PartDynamicTextField::setColor(const QColor& color) { @brief PartDynamicTextField::color @return The color of this text */ -QColor PartDynamicTextField::color() const { +QColor PartDynamicTextField::color() const +{ return defaultTextColor(); } @@ -364,7 +371,8 @@ void PartDynamicTextField::setFrame(bool frame) { emit frameChanged(m_frame); } -bool PartDynamicTextField::frame() const { +bool PartDynamicTextField::frame() const +{ return m_frame; } @@ -403,7 +411,8 @@ void PartDynamicTextField::setAlignment(Qt::Alignment alignment) { emit alignmentChanged(m_alignment); } -Qt::Alignment PartDynamicTextField::alignment() const { +Qt::Alignment PartDynamicTextField::alignment() const +{ return m_alignment; } @@ -532,7 +541,8 @@ void PartDynamicTextField::paint(QPainter *painter, const QStyleOptionGraphicsIt Used to up to date this text field, when the element information (see elementScene) changed */ -void PartDynamicTextField::elementInfoChanged() { +void PartDynamicTextField::elementInfoChanged() +{ if(!elementScene()) return; @@ -543,11 +553,13 @@ void PartDynamicTextField::elementInfoChanged() { m_composite_text, elementScene() -> elementInformation())); } -void PartDynamicTextField::prepareAlignment() { +void PartDynamicTextField::prepareAlignment() +{ m_alignment_rect = boundingRect(); } -void PartDynamicTextField::finishAlignment() { +void PartDynamicTextField::finishAlignment() +{ if(m_block_alignment) return; diff --git a/sources/editor/graphicspart/partline.cpp b/sources/editor/graphicspart/partline.cpp index c6cd22339..7992bffdd 100644 --- a/sources/editor/graphicspart/partline.cpp +++ b/sources/editor/graphicspart/partline.cpp @@ -346,7 +346,8 @@ void PartLine::removeHandler() @brief PartLine::sceneP1 @return the point p1 in scene coordinate */ -QPointF PartLine::sceneP1() const { +QPointF PartLine::sceneP1() const +{ return(mapToScene(m_line.p1())); } @@ -354,7 +355,8 @@ QPointF PartLine::sceneP1() const { @brief PartLine::sceneP2 @return the point p2 in scen coordinate */ -QPointF PartLine::sceneP2() const { +QPointF PartLine::sceneP2() const +{ return(mapToScene(m_line.p2())); } @@ -473,7 +475,8 @@ QRectF PartLine::firstEndCircleRect() const @brief PartLine::secondEndCircleRect @return the rectangle bordering the entirety of the second extremity */ -QRectF PartLine::secondEndCircleRect() const { +QRectF PartLine::secondEndCircleRect() const +{ QList interesting_points = fourEndPoints(m_line.p2(), m_line.p1(), second_length); @@ -543,7 +546,8 @@ QRectF PartLine::boundingRect() const @return true if this part is irrelevant and does not deserve to be Retained / registered. A line is relevant when is two point is different */ -bool PartLine::isUseless() const { +bool PartLine::isUseless() const +{ return(m_line.p1() == m_line.p2()); } @@ -554,7 +558,8 @@ bool PartLine::isUseless() const { to imply any margin, and it is different from shape because it is a regular rectangle, not a complex shape. */ -QRectF PartLine::sceneGeometricRect() const { +QRectF PartLine::sceneGeometricRect() const +{ return(QRectF(sceneP1(), sceneP2())); } @@ -617,7 +622,8 @@ QList PartLine::fourEndPoints(const QPointF &end_point, const QPointF & return(QList() << o << a << b << c); } -QLineF PartLine::line() const { +QLineF PartLine::line() const +{ return m_line; } diff --git a/sources/editor/graphicspart/partpolygon.cpp b/sources/editor/graphicspart/partpolygon.cpp index 794b2fbd9..e859ef8b4 100644 --- a/sources/editor/graphicspart/partpolygon.cpp +++ b/sources/editor/graphicspart/partpolygon.cpp @@ -150,7 +150,8 @@ bool PartPolygon::isUseless() const to imply any margin, and it is different from shape because it is a regular rectangle, not a complex shape. */ -QRectF PartPolygon::sceneGeometricRect() const { +QRectF PartPolygon::sceneGeometricRect() const +{ return(mapToScene(m_polygon.boundingRect()).boundingRect()); } @@ -185,7 +186,8 @@ void PartPolygon::handleUserTransformation(const QRectF &initial_selection_rect, single primitive is being scaled. @return : This reimplementation systematically returns QET::RoundScaleRatios. */ -QET::ScalingMethod PartPolygon::preferredScalingMethod() const { +QET::ScalingMethod PartPolygon::preferredScalingMethod() const +{ return(QET::RoundScaleRatios); } @@ -193,7 +195,8 @@ QET::ScalingMethod PartPolygon::preferredScalingMethod() const { @brief PartPolygon::polygon @return the item's polygon, or an empty polygon if no polygon has been set. */ -QPolygonF PartPolygon::polygon() const { +QPolygonF PartPolygon::polygon() const +{ return m_polygon; } diff --git a/sources/editor/graphicspart/partrectangle.cpp b/sources/editor/graphicspart/partrectangle.cpp index 152bf659f..1ad7d7685 100644 --- a/sources/editor/graphicspart/partrectangle.cpp +++ b/sources/editor/graphicspart/partrectangle.cpp @@ -34,7 +34,8 @@ PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent) : /** @brief PartRectangle::~PartRectangle */ -PartRectangle::~PartRectangle() { +PartRectangle::~PartRectangle() +{ removeHandler(); } @@ -126,7 +127,8 @@ void PartRectangle::fromXml(const QDomElement &qde) @brief PartRectangle::rect @return : Returns the item's rectangle. */ -QRectF PartRectangle::rect() const { +QRectF PartRectangle::rect() const +{ return m_rect; } @@ -167,7 +169,8 @@ void PartRectangle::setYRadius(qreal Y) to imply any margin, and it is different from shape because it is a regular rectangle, not a complex shape. */ -QRectF PartRectangle::sceneGeometricRect() const { +QRectF PartRectangle::sceneGeometricRect() const +{ return(mapToScene(rect()).boundingRect()); } @@ -175,7 +178,8 @@ QRectF PartRectangle::sceneGeometricRect() const { @brief PartRectangle::sceneTopLeft @return the top left of rectangle, in scene coordinate */ -QPointF PartRectangle::sceneTopLeft() const { +QPointF PartRectangle::sceneTopLeft() const +{ return(mapToScene(rect().topLeft())); } @@ -228,7 +232,8 @@ QRectF PartRectangle::boundingRect() const @return true if this part is irrelevant and does not deserve to be Retained / registered. An rectangle is relevant when he's not null. */ -bool PartRectangle::isUseless() const { +bool PartRectangle::isUseless() const +{ return(rect().isNull()); } diff --git a/sources/editor/graphicspart/partterminal.cpp b/sources/editor/graphicspart/partterminal.cpp index ed256e4fb..0f8621f19 100644 --- a/sources/editor/graphicspart/partterminal.cpp +++ b/sources/editor/graphicspart/partterminal.cpp @@ -36,7 +36,8 @@ PartTerminal::PartTerminal(QETElementEditor *editor, QGraphicsItem *parent) : } /// Destructeur -PartTerminal::~PartTerminal() { +PartTerminal::~PartTerminal() +{ } /** @@ -54,7 +55,8 @@ void PartTerminal::fromXml(const QDomElement &xml_elmt) { @param xml_document Document XML a utiliser pour creer l'element XML @return un element XML decrivant la borne */ -const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const { +const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const +{ return d -> toXml(xml_document); } @@ -97,7 +99,8 @@ void PartTerminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, Q @brief PartTerminal::shape @return the shape of this item */ -QPainterPath PartTerminal::shape() const { +QPainterPath PartTerminal::shape() const +{ QPainterPath shape; shape.lineTo(d -> second_point); @@ -111,7 +114,8 @@ QPainterPath PartTerminal::shape() const { @brief PartTerminal::boundingRect @return the bounding rect of this item */ -QRectF PartTerminal::boundingRect() const { +QRectF PartTerminal::boundingRect() const +{ QRectF br(QPointF(0, 0), d -> second_point); br = br.normalized(); @@ -141,7 +145,8 @@ void PartTerminal::setName(QString& name) { emit nameChanged(); } -void PartTerminal::setNewUuid() { +void PartTerminal::setNewUuid() +{ d -> m_uuid = QUuid::createUuid(); } @@ -149,7 +154,8 @@ void PartTerminal::setNewUuid() { Met a jour la position du second point en fonction de la position et de l'orientation de la borne. */ -void PartTerminal::updateSecondPoint() { +void PartTerminal::updateSecondPoint() +{ qreal ts = 4.0; // terminal size switch(d -> m_orientation) { case Qet::North: d -> second_point = QPointF(0.0, ts); break; @@ -165,7 +171,8 @@ void PartTerminal::updateSecondPoint() { Une borne est toujours pertinente ; cette fonction renvoie donc toujours false */ -bool PartTerminal::isUseless() const { +bool PartTerminal::isUseless() const +{ return(false); } @@ -175,7 +182,8 @@ bool PartTerminal::isUseless() const { to imply any margin, and it is different from shape because it is a regular rectangle, not a complex shape. */ -QRectF PartTerminal::sceneGeometricRect() const { +QRectF PartTerminal::sceneGeometricRect() const +{ return(sceneBoundingRect()); } diff --git a/sources/editor/graphicspart/parttext.cpp b/sources/editor/graphicspart/parttext.cpp index bae1ab802..497d66b31 100644 --- a/sources/editor/graphicspart/parttext.cpp +++ b/sources/editor/graphicspart/parttext.cpp @@ -58,7 +58,8 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) : } /// Destructeur -PartText::~PartText() { +PartText::~PartText() +{ } /** @@ -95,7 +96,8 @@ void PartText::fromXml(const QDomElement &xml_element) { @param xml_document Document XML a utiliser pour creer l'element XML @return un element XML decrivant le texte statique */ -const QDomElement PartText::toXml(QDomDocument &xml_document) const { +const QDomElement PartText::toXml(QDomDocument &xml_document) const +{ QDomElement xml_element = xml_document.createElement(xmlName()); xml_element.setAttribute("x", QString::number(pos().x())); @@ -111,7 +113,8 @@ const QDomElement PartText::toXml(QDomDocument &xml_document) const { /** @return Les coordonnees du point situe en bas a gauche du texte. */ -QPointF PartText::margin() const { +QPointF PartText::margin() const +{ QFont used_font = font(); QFontMetrics qfm(used_font); qreal document_margin = document() -> documentMargin(); @@ -191,7 +194,8 @@ QVariant PartText::itemChange(GraphicsItemChange change, const QVariant &value) /** @return le rectangle delimitant cette partie. */ -QRectF PartText::boundingRect() const { +QRectF PartText::boundingRect() const +{ QRectF r = QGraphicsTextItem::boundingRect(); r.adjust(0.0, -1.1, 0.0, 0.0); return(r); @@ -202,7 +206,8 @@ QRectF PartText::boundingRect() const { conservee / enregistree. Un texte statique n'est pas pertinent lorsque son texte est vide. */ -bool PartText::isUseless() const { +bool PartText::isUseless() const +{ return(toPlainText().isEmpty()); } @@ -212,7 +217,8 @@ bool PartText::isUseless() const { to imply any margin, and it is different from shape because it is a regular rectangle, not a complex shape. */ -QRectF PartText::sceneGeometricRect() const { +QRectF PartText::sceneGeometricRect() const +{ return(sceneBoundingRect()); } @@ -327,7 +333,8 @@ void PartText::setEditable(bool editable) { /** Start text edition by storing the former value of the text. */ -void PartText::startEdition() { +void PartText::startEdition() +{ // !previous_text.isNull() means the text is being edited previous_text = toPlainText(); } @@ -336,7 +343,8 @@ void PartText::startEdition() { End text edition, potentially generating a ChangePartCommand if the text has changed. */ -void PartText::endEdition() { +void PartText::endEdition() +{ if (!previous_text.isNull()) { // the text was being edited QString new_text = toPlainText(); diff --git a/sources/editor/lineeditor.cpp b/sources/editor/lineeditor.cpp index ecb9ae939..d2942dcb8 100644 --- a/sources/editor/lineeditor.cpp +++ b/sources/editor/lineeditor.cpp @@ -89,7 +89,8 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent } /// Destructeur -LineEditor::~LineEditor() { +LineEditor::~LineEditor() +{ } void LineEditor::setUpChangeConnections() @@ -155,11 +156,13 @@ bool LineEditor::setParts(QList parts) /** @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas */ -CustomElementPart *LineEditor::currentPart() const { +CustomElementPart *LineEditor::currentPart() const +{ return(part); } -QList LineEditor::currentParts() const { +QList LineEditor::currentParts() const +{ return style_->currentParts(); } @@ -167,7 +170,8 @@ QList LineEditor::currentParts() const { @brief LineEditor::editedP1 @return The edited P1 in item coordinate */ -QPointF LineEditor::editedP1() const { +QPointF LineEditor::editedP1() const +{ return part -> mapFromScene(x1->value(), y1->value()); } @@ -175,7 +179,8 @@ QPointF LineEditor::editedP1() const { @brief LineEditor::editedP2 @return The edited P2 in item coordinate */ -QPointF LineEditor::editedP2() const { +QPointF LineEditor::editedP2() const +{ return part -> mapFromScene(x2->value(), y2->value()); } diff --git a/sources/editor/qetelementeditor.cpp b/sources/editor/qetelementeditor.cpp index c29b7ed17..58ca30be7 100644 --- a/sources/editor/qetelementeditor.cpp +++ b/sources/editor/qetelementeditor.cpp @@ -93,7 +93,8 @@ QETElementEditor::QETElementEditor(QWidget *parent) : } /// Destructeur -QETElementEditor::~QETElementEditor() { +QETElementEditor::~QETElementEditor() +{ /* retire le widget d'edition de primitives affiche par le dock cela evite qu'il ne soit supprime par son widget parent @@ -135,7 +136,8 @@ void QETElementEditor::setFileName(const QString &fn) { @brief QETElementEditor::setupActions Create action used in Element editor */ -void QETElementEditor::setupActions() { +void QETElementEditor::setupActions() +{ new_element = new QAction(QET::Icons::DocumentNew, tr("&Nouveau"), this); open = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir"), this); open_file = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir depuis un fichier"), this); @@ -361,7 +363,8 @@ void QETElementEditor::setupActions() { /** @brief QETElementEditor::setupMenus */ -void QETElementEditor::setupMenus() { +void QETElementEditor::setupMenus() +{ file_menu = new QMenu(tr("&Fichier"), this); edit_menu = new QMenu(tr("&Édition"), this); display_menu = new QMenu(tr("Afficha&ge"), this); @@ -461,7 +464,8 @@ void QETElementEditor::contextMenu(QPoint p, QList actions) { /** Met a jour les menus */ -void QETElementEditor::slot_updateMenus() { +void QETElementEditor::slot_updateMenus() +{ bool selected_items = !read_only && !m_elmt_scene -> selectedItems().isEmpty(); bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement(); @@ -497,7 +501,8 @@ void QETElementEditor::slot_updateMenus() { /** Met a jour le titre de la fenetre */ -void QETElementEditor::slot_updateTitle() { +void QETElementEditor::slot_updateTitle() +{ QString title = min_title; title += " - " + m_elmt_scene -> names().name() + " "; if (!filename_.isEmpty() || !location_.isNull()) { @@ -514,7 +519,8 @@ void QETElementEditor::slot_updateTitle() { /** @brief QETElementEditor::setupInterface */ -void QETElementEditor::setupInterface() { +void QETElementEditor::setupInterface() +{ // editeur m_elmt_scene = new ElementScene(this, this); m_view = new ElementView(m_elmt_scene, this); @@ -592,14 +598,16 @@ void QETElementEditor::setupInterface() { Passe l'editeur d'element en mode selection : le pointeur deplace les elements selectionnes et il est possible d'utiliser un rectangle de selection. */ -void QETElementEditor::slot_setRubberBandToView() { +void QETElementEditor::slot_setRubberBandToView() +{ m_view -> setDragMode(QGraphicsView::RubberBandDrag); } /** Passe l'editeur d'element en mode immobile (utilise pour la lecture seule) */ -void QETElementEditor::slot_setNoDragToView() { +void QETElementEditor::slot_setNoDragToView() +{ m_view -> setDragMode(QGraphicsView::NoDrag); } @@ -608,7 +616,8 @@ void QETElementEditor::slot_setNoDragToView() { Si plusieurs primitives sont selectionnees, seule leur quantite est affichee. Sinon, un widget d'edition approprie est mis en place. */ -void QETElementEditor::slot_updateInformations() { +void QETElementEditor::slot_updateInformations() +{ QList selected_qgis = m_elmt_scene -> selectedItems(); if (selected_qgis.isEmpty()) { clearToolsDock(); @@ -752,7 +761,8 @@ void QETElementEditor::slot_updateInformations() { Do several check about element. If error is occurred return false */ -bool QETElementEditor::checkElement() { +bool QETElementEditor::checkElement() +{ //List of warning and error typedef QPair QETWarning; QList warnings; @@ -998,7 +1008,8 @@ void QETElementEditor::setReadOnly(bool ro) { /** @return true si l'editeur d'element est en mode lecture seule */ -bool QETElementEditor::isReadOnly() const { +bool QETElementEditor::isReadOnly() const +{ return(read_only); } @@ -1006,7 +1017,8 @@ bool QETElementEditor::isReadOnly() const { @brief QETElementEditor::addLine Set line creation interface to scene */ -void QETElementEditor::addLine() { +void QETElementEditor::addLine() +{ m_elmt_scene -> setEventInterface(new ESEventAddLine(m_elmt_scene)); } @@ -1014,7 +1026,8 @@ void QETElementEditor::addLine() { @brief QETElementEditor::addRect Set rectangle creation interface to scene */ -void QETElementEditor::addRect() { +void QETElementEditor::addRect() +{ m_elmt_scene -> setEventInterface(new ESEventAddRect(m_elmt_scene)); } @@ -1022,7 +1035,8 @@ void QETElementEditor::addRect() { @brief QETElementEditor::addEllipse Set ellipse creation interface to scene */ -void QETElementEditor::addEllipse() { +void QETElementEditor::addEllipse() +{ m_elmt_scene -> setEventInterface(new ESEventAddEllipse(m_elmt_scene)); } @@ -1030,7 +1044,8 @@ void QETElementEditor::addEllipse() { @brief QETElementEditor::addPolygon Set polygon creation interface to scene */ -void QETElementEditor::addPolygon() { +void QETElementEditor::addPolygon() +{ m_elmt_scene -> setEventInterface(new ESEventAddPolygon(m_elmt_scene)); } @@ -1038,7 +1053,8 @@ void QETElementEditor::addPolygon() { @brief QETElementEditor::addArc Set arc creation interface to scene */ -void QETElementEditor::addArc() { +void QETElementEditor::addArc() +{ m_elmt_scene -> setEventInterface(new ESEventAddArc(m_elmt_scene)); } @@ -1046,7 +1062,8 @@ void QETElementEditor::addArc() { @brief QETElementEditor::addText Set text creation interface to scene */ -void QETElementEditor::addText() { +void QETElementEditor::addText() +{ m_elmt_scene -> setEventInterface(new ESEventAddText(m_elmt_scene)); } @@ -1054,7 +1071,8 @@ void QETElementEditor::addText() { @brief QETElementEditor::addTerminal Set terminal creation interface to scene */ -void QETElementEditor::addTerminal() { +void QETElementEditor::addTerminal() +{ m_elmt_scene -> setEventInterface(new ESEventAddTerminal(m_elmt_scene)); } @@ -1062,7 +1080,8 @@ void QETElementEditor::addTerminal() { @brief QETElementEditor::addDynamicTextField Set dynamic text field creation interface to scene */ -void QETElementEditor::addDynamicTextField() { +void QETElementEditor::addDynamicTextField() +{ m_elmt_scene -> setEventInterface(new ESEventAddDynamicTextField(m_elmt_scene)); } @@ -1070,7 +1089,8 @@ void QETElementEditor::addDynamicTextField() { @brief QETElementEditor::UncheckAddPrimitive Uncheck all action related to primitive */ -void QETElementEditor::UncheckAddPrimitive() { +void QETElementEditor::UncheckAddPrimitive() +{ foreach(QAction *action, parts -> actions()) { action -> setChecked(false); } @@ -1079,7 +1099,8 @@ void QETElementEditor::UncheckAddPrimitive() { /** Lance l'assistant de creation d'un nouvel element. */ -void QETElementEditor::slot_new() { +void QETElementEditor::slot_new() +{ NewElementWizard new_element_wizard(this); new_element_wizard.exec(); } @@ -1087,7 +1108,8 @@ void QETElementEditor::slot_new() { /** Ouvre un element */ -void QETElementEditor::slot_open() { +void QETElementEditor::slot_open() +{ // demande le chemin virtuel de l'element a ouvrir a l'utilisateur ElementsLocation location = ElementDialog::getOpenElementLocation(this); if (location.isNull()) { @@ -1100,7 +1122,8 @@ void QETElementEditor::slot_open() { Ouvre un fichier Demande un fichier a l'utilisateur et ouvre ce fichier */ -void QETElementEditor::slot_openFile() { +void QETElementEditor::slot_openFile() +{ // repertoire a afficher initialement dans le dialogue QString open_dir = filename_.isEmpty() ? QETApp::customElementsDir() : QDir(filename_).absolutePath(); @@ -1129,7 +1152,8 @@ void QETElementEditor::openRecentFile(const QString &filepath) { /** @brief QETElementEditor::slot_openDxf */ -void QETElementEditor::slot_openDxf (){ +void QETElementEditor::slot_openDxf () +{ #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) QString program = (QDir::homePath() + "/Application Data/qet/DXFtoQET.exe"); @@ -1174,7 +1198,8 @@ void QETElementEditor::openElement(const QString &filepath) { @brief QETElementEditor::slot_reload Reload the element from the file or location */ -void QETElementEditor::slot_reload() { +void QETElementEditor::slot_reload() +{ //If user already edit the element, ask confirmation to reload if (!m_elmt_scene -> undoStack().isClean()) { QMessageBox::StandardButton answer = QET::QetMessageBox::question(this, @@ -1203,7 +1228,8 @@ void QETElementEditor::slot_reload() { If the filepath or location is unknown, use save_as instead @return true if save with success */ -bool QETElementEditor::slot_save() { +bool QETElementEditor::slot_save() +{ // Check element befor writing if (checkElement()) { //If we don't know the name of the current file, use save as instead @@ -1242,7 +1268,8 @@ bool QETElementEditor::slot_save() { to this location @return true if save with success */ -bool QETElementEditor::slot_saveAs() { +bool QETElementEditor::slot_saveAs() +{ // Check element befor writing if (checkElement()) { //Ask a location to user @@ -1269,7 +1296,8 @@ bool QETElementEditor::slot_saveAs() { Ask a file to user and save the current edited element to this file @return true if save with success */ -bool QETElementEditor::slot_saveAsFile() { +bool QETElementEditor::slot_saveAsFile() +{ // Check element befor writing if (checkElement()) { //Ask a filename to user, for save the element @@ -1312,7 +1340,8 @@ bool QETElementEditor::slot_saveAsFile() { Si l'element comporte des modifications, la question est posee a l'utilisateur. */ -bool QETElementEditor::canClose() { +bool QETElementEditor::canClose() +{ if (m_elmt_scene -> undoStack().isClean()) { return(true); } @@ -1351,7 +1380,8 @@ bool QETElementEditor::canClose() { parties. @return le widget enleve, ou 0 s'il n'y avait pas de widget a enlever */ -QWidget *QETElementEditor::clearToolsDock() { +QWidget *QETElementEditor::clearToolsDock() +{ if (QWidget *previous_widget = m_tools_dock_stack -> widget(1)) { m_tools_dock_stack -> removeWidget(previous_widget); previous_widget -> setParent(nullptr); @@ -1410,7 +1440,8 @@ void QETElementEditor::firstActivation(QEvent *event) { /** Remplit la liste des parties */ -void QETElementEditor::slot_createPartsList() { +void QETElementEditor::slot_createPartsList() +{ m_parts_list -> blockSignals(true); m_parts_list -> clear(); QList qgis = m_elmt_scene -> zItems(); @@ -1441,7 +1472,8 @@ void QETElementEditor::slot_createPartsList() { /** Met a jour la selection dans la liste des parties */ -void QETElementEditor::slot_updatePartsList() { +void QETElementEditor::slot_updatePartsList() +{ int items_count = m_elmt_scene -> items().count(); if (m_parts_list -> count() != items_count) { slot_createPartsList(); @@ -1464,7 +1496,8 @@ void QETElementEditor::slot_updatePartsList() { Met a jour la selection des parties de l'element a partir de la liste des parties */ -void QETElementEditor::slot_updateSelectionFromPartsList() { +void QETElementEditor::slot_updateSelectionFromPartsList() +{ m_elmt_scene -> blockSignals(true); m_parts_list -> blockSignals(true); for (int i = 0 ; i < m_parts_list -> count() ; ++ i) { @@ -1484,7 +1517,8 @@ void QETElementEditor::slot_updateSelectionFromPartsList() { @brief QETElementEditor::readSettings Read settings */ -void QETElementEditor::readSettings() { +void QETElementEditor::readSettings() +{ QSettings settings; // dimensions et position de la fenetre @@ -1507,7 +1541,8 @@ void QETElementEditor::readSettings() { @brief QETElementEditor::writeSettings Write the settings */ -void QETElementEditor::writeSettings() { +void QETElementEditor::writeSettings() +{ QSettings settings; settings.setValue("elementeditor/geometry", saveGeometry()); settings.setValue("elementeditor/state", saveState()); @@ -1517,7 +1552,8 @@ void QETElementEditor::writeSettings() { @return les decalages horizontaux et verticaux (sous la forme d'un point) a utiliser lors d'un copier/coller avec decalage. */ -QPointF QETElementEditor::pasteOffset() { +QPointF QETElementEditor::pasteOffset() +{ QPointF paste_offset(5.0, 0.0); return(paste_offset); } @@ -1594,7 +1630,8 @@ void QETElementEditor::fromLocation(const ElementsLocation &location) { Demande un fichier a l'utilisateur, l'ouvre en tant que fichier element, met son contenu dans le presse-papiers, et appelle ElementView::PasteInArea */ -void QETElementEditor::pasteFromFile() { +void QETElementEditor::pasteFromFile() +{ // demande le chemin du fichier a ouvrir a l'utilisateur QString element_file_path = getOpenElementFileName(this); if (element_file_path.isEmpty()) { @@ -1627,7 +1664,8 @@ void QETElementEditor::pasteFromFile() { Ask an element to user, copy the xml definition of the element to the clipboard and call ElementView::PasteInArea */ -void QETElementEditor::pasteFromElement() { +void QETElementEditor::pasteFromElement() +{ //Ask for a location ElementsLocation location = ElementDialog::getOpenElementLocation(this); if (location.isNull()) { @@ -1659,7 +1697,8 @@ void QETElementEditor::pasteFromElement() { Met a jour l'editeur de primitive actuellement visible. Si aucun editeur de primitive n'est visible, ce slot ne fait rien. */ -void QETElementEditor::updateCurrentPartEditor() { +void QETElementEditor::updateCurrentPartEditor() +{ // si aucun widget d'edition n'est affiche, on ne fait rien if (!m_tools_dock_stack -> currentIndex()) { return; diff --git a/sources/editor/qetelementeditor.h b/sources/editor/qetelementeditor.h index 7ae72066a..ea4d7bbd6 100644 --- a/sources/editor/qetelementeditor.h +++ b/sources/editor/qetelementeditor.h @@ -166,21 +166,24 @@ inline void QETElementEditor::setNames(const NamesList &nameslist) { /** @return the location of the currently edited element */ -inline ElementsLocation QETElementEditor::location() const { +inline ElementsLocation QETElementEditor::location() const +{ return(location_); } /** @return the filename of the currently edited element */ -inline QString QETElementEditor::fileName() const { +inline QString QETElementEditor::fileName() const +{ return(filename_); } /** @return the editing scene */ -inline ElementScene *QETElementEditor::elementScene() const { +inline ElementScene *QETElementEditor::elementScene() const +{ return(m_elmt_scene); } diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 631179fa6..3103eb46e 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -403,31 +403,37 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, } /// Destructeur -StyleEditor::~StyleEditor() { +StyleEditor::~StyleEditor() +{ } /// Update antialiasing with undo command -void StyleEditor::updatePartAntialiasing() { +void StyleEditor::updatePartAntialiasing() +{ makeUndo(tr("style antialiasing"), "antialias", antialiasing -> isChecked()); } /// Update color with undo command -void StyleEditor::updatePartColor() { +void StyleEditor::updatePartColor() +{ makeUndo(tr("style couleur"),"color", outline_color->itemData(outline_color -> currentIndex())); } /// Update style with undo command -void StyleEditor::updatePartLineStyle() { +void StyleEditor::updatePartLineStyle() +{ makeUndo(tr("style ligne"), "line_style", line_style->itemData(line_style -> currentIndex())); } /// Update weight with undo command -void StyleEditor::updatePartLineWeight() { +void StyleEditor::updatePartLineWeight() +{ makeUndo(tr("style epaisseur"), "line_weight", size_weight->itemData(size_weight -> currentIndex())); } /// Update color filling with undo command -void StyleEditor::updatePartFilling() { +void StyleEditor::updatePartFilling() +{ makeUndo(tr("style remplissage"), "filling", filling_color->itemData(filling_color -> currentIndex())); } @@ -536,11 +542,13 @@ bool StyleEditor::setParts(QList part_list) /** @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas */ -CustomElementPart *StyleEditor::currentPart() const { +CustomElementPart *StyleEditor::currentPart() const +{ return(part); } -QList StyleEditor::currentParts() const { +QList StyleEditor::currentParts() const +{ return m_cep_list; } diff --git a/sources/editor/terminaleditor.cpp b/sources/editor/terminaleditor.cpp index 81181d9d8..af72d585f 100644 --- a/sources/editor/terminaleditor.cpp +++ b/sources/editor/terminaleditor.cpp @@ -59,7 +59,8 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, /** @brief TerminalEditor::init */ -void TerminalEditor::init() { +void TerminalEditor::init() +{ qle_x = new QDoubleSpinBox(); qle_y = new QDoubleSpinBox(); @@ -98,7 +99,8 @@ void TerminalEditor::init() { @brief TerminalEditor::~TerminalEditor Destructeur */ -TerminalEditor::~TerminalEditor() { +TerminalEditor::~TerminalEditor() +{ } /** @@ -161,11 +163,13 @@ bool TerminalEditor::setParts(QList parts) { /** @return la primitive actuellement editee, ou 0 si ce widget n'en edite pas */ -CustomElementPart *TerminalEditor::currentPart() const { +CustomElementPart *TerminalEditor::currentPart() const +{ return(m_part); } -QList TerminalEditor::currentParts() const { +QList TerminalEditor::currentParts() const +{ QList parts; for (auto term: m_terminals) { parts.append(static_cast(term)); @@ -174,7 +178,8 @@ QList TerminalEditor::currentParts() const { } /// Met a jour l'orientation de la borne et cree un objet d'annulation -void TerminalEditor::updateTerminalO() { +void TerminalEditor::updateTerminalO() +{ if (m_locked) return; m_locked = true; QVariant var(orientation -> itemData(orientation -> currentIndex())); @@ -194,7 +199,8 @@ void TerminalEditor::updateTerminalO() { /** @brief TerminalEditor::updateXPos */ -void TerminalEditor::updateXPos() { +void TerminalEditor::updateXPos() +{ if (m_locked) return; m_locked = true; QPointF new_pos(qle_x->value(), 0); @@ -215,7 +221,8 @@ void TerminalEditor::updateXPos() { /** @brief TerminalEditor::updateYPos */ -void TerminalEditor::updateYPos() { +void TerminalEditor::updateYPos() +{ if (m_locked) return; m_locked = true; QPointF new_pos(0, qle_y->value()); // change only y value @@ -237,7 +244,8 @@ void TerminalEditor::updateYPos() { /** Met a jour le formulaire d'edition */ -void TerminalEditor::updateForm() { +void TerminalEditor::updateForm() +{ if (!m_part) return; activeConnections(false); qle_x -> setValue(m_part->property("x").toReal()); diff --git a/sources/editor/ui/dynamictextfieldeditor.cpp b/sources/editor/ui/dynamictextfieldeditor.cpp index ac7314280..f9936e484 100644 --- a/sources/editor/ui/dynamictextfieldeditor.cpp +++ b/sources/editor/ui/dynamictextfieldeditor.cpp @@ -43,7 +43,8 @@ DynamicTextFieldEditor::DynamicTextFieldEditor( fillInfoComboBox(); } -DynamicTextFieldEditor::~DynamicTextFieldEditor() { +DynamicTextFieldEditor::~DynamicTextFieldEditor() +{ delete ui; if(!m_connection_list.isEmpty()) { for(const QMetaObject::Connection& con : m_connection_list) { @@ -108,11 +109,13 @@ bool DynamicTextFieldEditor::setParts(QList parts) { @return The current edited part, note they can return nullptr if there is not a currently edited part. */ -CustomElementPart *DynamicTextFieldEditor::currentPart() const { +CustomElementPart *DynamicTextFieldEditor::currentPart() const +{ return m_text_field.data(); } -QList DynamicTextFieldEditor::currentParts() const { +QList DynamicTextFieldEditor::currentParts() const +{ QList parts; for (auto part: m_parts) { parts.append(static_cast(part)); @@ -120,7 +123,8 @@ QList DynamicTextFieldEditor::currentParts() const { return parts; } -void DynamicTextFieldEditor::updateForm() { +void DynamicTextFieldEditor::updateForm() +{ if(m_text_field) { ui -> m_x_sb -> setValue(m_text_field.data() -> x()); ui -> m_y_sb -> setValue(m_text_field.data() ->y ()); @@ -152,7 +156,8 @@ void DynamicTextFieldEditor::updateForm() { } } -void DynamicTextFieldEditor::setUpConnections() { +void DynamicTextFieldEditor::setUpConnections() +{ assert(m_connection_list.isEmpty()); //Setup the connection m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged, @@ -177,7 +182,8 @@ void DynamicTextFieldEditor::setUpConnections() { [this](){this -> updateForm();}); } -void DynamicTextFieldEditor::disconnectConnections() { +void DynamicTextFieldEditor::disconnectConnections() +{ //Remove previous connection if(!m_connection_list.isEmpty()) for(const QMetaObject::Connection& con : m_connection_list) { @@ -190,7 +196,8 @@ void DynamicTextFieldEditor::disconnectConnections() { @brief DynamicTextFieldEditor::fillInfoComboBox Fill the combo box "element information" */ -void DynamicTextFieldEditor::fillInfoComboBox() { +void DynamicTextFieldEditor::fillInfoComboBox() +{ ui -> m_elmt_info_cb -> clear(); QStringList strl; @@ -212,7 +219,8 @@ void DynamicTextFieldEditor::fillInfoComboBox() { ui -> m_elmt_info_cb -> addItem(key, info_map.value(key)); } -void DynamicTextFieldEditor::on_m_x_sb_editingFinished() { +void DynamicTextFieldEditor::on_m_x_sb_editingFinished() +{ double value = ui -> m_x_sb -> value(); for (int i = 0; i < m_parts.length(); i++) { QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "x", m_parts[i] -> x(), value); @@ -222,7 +230,8 @@ void DynamicTextFieldEditor::on_m_x_sb_editingFinished() { } } -void DynamicTextFieldEditor::on_m_y_sb_editingFinished() { +void DynamicTextFieldEditor::on_m_y_sb_editingFinished() +{ double value = ui -> m_y_sb -> value(); for (int i = 0; i < m_parts.length(); i++) { QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "y", m_parts[i] -> y(), value); @@ -232,7 +241,8 @@ void DynamicTextFieldEditor::on_m_y_sb_editingFinished() { } } -void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() { +void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() +{ int value = ui -> m_rotation_sb -> value(); for (int i = 0; i < m_parts.length(); i++) { QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotation", m_parts[i] -> rotation(), value); @@ -242,7 +252,8 @@ void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() { } } -void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() { +void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() +{ QString text = ui -> m_user_text_le -> text(); for (int i = 0; i < m_parts.length(); i++) { QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "text", m_parts[i] -> text(), text); @@ -251,7 +262,8 @@ void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() { } } -void DynamicTextFieldEditor::on_m_size_sb_editingFinished() { +void DynamicTextFieldEditor::on_m_size_sb_editingFinished() +{ QFont font_ = m_text_field -> font(); font_.setPointSize(ui -> m_size_sb -> value()); for (int i = 0; i < m_parts.length(); i++) { @@ -261,7 +273,8 @@ void DynamicTextFieldEditor::on_m_size_sb_editingFinished() { } } -void DynamicTextFieldEditor::on_m_frame_cb_clicked() { +void DynamicTextFieldEditor::on_m_frame_cb_clicked() +{ bool frame = ui -> m_frame_cb -> isChecked(); for (int i = 0; i < m_parts.length(); i++) { @@ -273,7 +286,8 @@ void DynamicTextFieldEditor::on_m_frame_cb_clicked() { } } -void DynamicTextFieldEditor::on_m_width_sb_editingFinished() { +void DynamicTextFieldEditor::on_m_width_sb_editingFinished() +{ qreal width = (qreal)ui -> m_width_sb -> value(); for (int i = 0; i < m_parts.length(); i++) { @@ -335,7 +349,8 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index) { } } -void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() { +void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() +{ CompositeTextEditDialog ctd(m_text_field.data() -> compositeText(), this); if(ctd.exec()) { QString ct = ctd.plainText(); @@ -349,7 +364,8 @@ void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() { } } -void DynamicTextFieldEditor::on_m_alignment_pb_clicked() { +void DynamicTextFieldEditor::on_m_alignment_pb_clicked() +{ AlignmentTextDialog atd(m_text_field.data() -> alignment(), this); atd.exec(); @@ -364,7 +380,8 @@ void DynamicTextFieldEditor::on_m_alignment_pb_clicked() { } } -void DynamicTextFieldEditor::on_m_font_pb_clicked() { +void DynamicTextFieldEditor::on_m_font_pb_clicked() +{ bool ok; QFont font_ = QFontDialog::getFont(&ok, m_text_field -> font(), this); if (ok && font_ != this -> font()) { diff --git a/sources/editor/ui/polygoneditor.cpp b/sources/editor/ui/polygoneditor.cpp index ed60e5c14..ed008fb04 100644 --- a/sources/editor/ui/polygoneditor.cpp +++ b/sources/editor/ui/polygoneditor.cpp @@ -48,7 +48,8 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor, /** @brief PolygonEditor::~PolygonEditor */ -PolygonEditor::~PolygonEditor() { +PolygonEditor::~PolygonEditor() +{ delete ui; } @@ -115,11 +116,13 @@ bool PolygonEditor::setPart(CustomElementPart *new_part) @brief PolygonEditor::currentPart @return the curent edited part */ -CustomElementPart *PolygonEditor::currentPart() const { +CustomElementPart *PolygonEditor::currentPart() const +{ return m_part; } -QList PolygonEditor::currentParts() const { +QList PolygonEditor::currentParts() const +{ return m_style->currentParts(); } diff --git a/sources/editor/ui/rectangleeditor.cpp b/sources/editor/ui/rectangleeditor.cpp index 913b1976c..1bbc500c5 100644 --- a/sources/editor/ui/rectangleeditor.cpp +++ b/sources/editor/ui/rectangleeditor.cpp @@ -42,7 +42,8 @@ RectangleEditor::RectangleEditor(QETElementEditor *editor, PartRectangle *rect, /** @brief RectangleEditor::~RectangleEditor */ -RectangleEditor::~RectangleEditor() { +RectangleEditor::~RectangleEditor() +{ delete ui; } @@ -112,11 +113,13 @@ bool RectangleEditor::setParts(QList parts) @brief RectangleEditor::currentPart @return */ -CustomElementPart *RectangleEditor::currentPart() const { +CustomElementPart *RectangleEditor::currentPart() const +{ return m_part; } -QList RectangleEditor::currentParts() const { +QList RectangleEditor::currentParts() const +{ return m_style->currentParts(); } @@ -124,7 +127,8 @@ QList RectangleEditor::currentParts() const { @brief RectangleEditor::topLeft @return The edited topLeft already mapped to part coordinate */ -QPointF RectangleEditor::editedTopLeft() const { +QPointF RectangleEditor::editedTopLeft() const +{ return m_part->mapFromScene(ui->m_x_sb->value(), ui->m_y_sb->value()); } diff --git a/sources/editor/ui/texteditor.cpp b/sources/editor/ui/texteditor.cpp index 7cc49dbd6..626cff20a 100644 --- a/sources/editor/ui/texteditor.cpp +++ b/sources/editor/ui/texteditor.cpp @@ -42,7 +42,8 @@ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *paren /** @brief TextEditor::~TextEditor */ -TextEditor::~TextEditor() { +TextEditor::~TextEditor() +{ delete ui; } @@ -79,14 +80,16 @@ void TextEditor::setUpChangeConnection(QPointer part) { m_change_connection << connect(part, &PartText::colorChanged, this, &TextEditor::updateForm); } -void TextEditor::disconnectChangeConnection() { +void TextEditor::disconnectChangeConnection() +{ for (QMetaObject::Connection c : m_change_connection) { disconnect(c); } m_change_connection.clear(); } -void TextEditor::disconnectEditConnection() { +void TextEditor::disconnectEditConnection() +{ for (QMetaObject::Connection c : m_edit_connection) { disconnect(c); } @@ -150,11 +153,13 @@ bool TextEditor::setParts(QList parts) { @brief TextEditor::currentPart @return The current part */ -CustomElementPart *TextEditor::currentPart() const { +CustomElementPart *TextEditor::currentPart() const +{ return m_text; } -QList TextEditor::currentParts() const { +QList TextEditor::currentParts() const +{ QList parts; for (auto part: m_parts) { parts.append(static_cast(part)); @@ -167,7 +172,8 @@ QList TextEditor::currentParts() const { Setup the connection between the widgets of this editor and the undo command use to apply the change to the edited text. */ -void TextEditor::setUpEditConnection() { +void TextEditor::setUpEditConnection() +{ disconnectEditConnection(); m_edit_connection << connect(ui -> m_line_edit, &QLineEdit::editingFinished, [this]() { @@ -236,7 +242,8 @@ void TextEditor::setUpEditConnection() { /** @brief TextEditor::on_m_font_pb_clicked */ -void TextEditor::on_m_font_pb_clicked() { +void TextEditor::on_m_font_pb_clicked() +{ bool ok; QFont font_ = QFontDialog::getFont(&ok, m_text -> font(), this); diff --git a/sources/elementprovider.cpp b/sources/elementprovider.cpp index 005fc2890..186aef0a0 100644 --- a/sources/elementprovider.cpp +++ b/sources/elementprovider.cpp @@ -72,7 +72,8 @@ QList ElementProvider::freeElement(const int filter) const{ @param uuid_list list of uuid must be found @return all elements with uuid corresponding to uuid in uuid_list */ -QList ElementProvider::fromUuids(QList uuid_list) const { +QList ElementProvider::fromUuids(QList uuid_list) const +{ QList found_element; foreach (Diagram *d, m_diagram_list) { @@ -93,7 +94,8 @@ QList ElementProvider::fromUuids(QList uuid_list) const { the filter for search element (You can find all filter with the define in Element.h) */ -QList ElementProvider::find(const int filter) const { +QList ElementProvider::find(const int filter) const +{ QList elmt_; //serch in all diagram diff --git a/sources/elementscategoryeditor.cpp b/sources/elementscategoryeditor.cpp index 6eceedc65..5848b6206 100644 --- a/sources/elementscategoryeditor.cpp +++ b/sources/elementscategoryeditor.cpp @@ -87,7 +87,8 @@ ElementsCategoryEditor::ElementsCategoryEditor(const ElementsLocation &location, @brief ElementsCategoryEditor::~ElementsCategoryEditor Destructor */ -ElementsCategoryEditor::~ElementsCategoryEditor() { +ElementsCategoryEditor::~ElementsCategoryEditor() +{ } /** diff --git a/sources/elementscollectioncache.cpp b/sources/elementscollectioncache.cpp index 4bc5bfe47..f5d856aa2 100644 --- a/sources/elementscollectioncache.cpp +++ b/sources/elementscollectioncache.cpp @@ -104,7 +104,8 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q /** Destructor */ -ElementsCollectionCache::~ElementsCollectionCache() { +ElementsCollectionCache::~ElementsCollectionCache() +{ delete select_name_; delete select_pixmap_; delete insert_name_; @@ -123,7 +124,8 @@ void ElementsCollectionCache::setLocale(const QString &locale) { /** @return The locale to be used when dealing with names. */ -QString ElementsCollectionCache::locale() const { +QString ElementsCollectionCache::locale() const +{ return(locale_); } @@ -145,7 +147,8 @@ bool ElementsCollectionCache::setPixmapStorageFormat(const QString &format) { @return the pixmap storage format. Default is "PNG" @see setPixmapStorageFormat() */ -QString ElementsCollectionCache::pixmapStorageFormat() const { +QString ElementsCollectionCache::pixmapStorageFormat() const +{ return(pixmap_storage_format_); } @@ -190,14 +193,16 @@ bool ElementsCollectionCache::fetchElement(ElementsLocation &location) /** @return The last name fetched through fetchElement(). */ -QString ElementsCollectionCache::name() const { +QString ElementsCollectionCache::name() const +{ return(current_name_); } /** @return The last pixmap fetched through fetchElement(). */ -QPixmap ElementsCollectionCache::pixmap() const { +QPixmap ElementsCollectionCache::pixmap() const +{ return(current_pixmap_); } diff --git a/sources/elementsmover.cpp b/sources/elementsmover.cpp index a1a144e06..f147510e2 100644 --- a/sources/elementsmover.cpp +++ b/sources/elementsmover.cpp @@ -43,7 +43,8 @@ ElementsMover::ElementsMover() : /** @brief ElementsMover::~ElementsMover Destructor */ -ElementsMover::~ElementsMover() { +ElementsMover::~ElementsMover() +{ } /** @@ -51,7 +52,8 @@ ElementsMover::~ElementsMover() { @return True if this element mover is ready to be used. A element mover is ready when the previous managed movement is finish. */ -bool ElementsMover::isReady() const { +bool ElementsMover::isReady() const +{ return(!movement_running_); } diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index 253e0f214..cbc93e4a9 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -74,7 +74,8 @@ ElementsPanel::ElementsPanel(QWidget *parent) : /** Destructeur */ -ElementsPanel::~ElementsPanel() { +ElementsPanel::~ElementsPanel() +{ } /** @@ -111,7 +112,8 @@ void ElementsPanel::startTitleBlockTemplateDrag(const TitleBlockTemplateLocation /** Ensure the filter is applied again after the panel content has changed. */ -void ElementsPanel::panelContentChange() { +void ElementsPanel::panelContentChange() +{ if (!filter_.isEmpty()) { filter(filter_); } @@ -373,7 +375,8 @@ void ElementsPanel::projectWasClosed(QETProject *project) { /** Build filter list for multiple filter */ -void ElementsPanel::buildFilterList() { +void ElementsPanel::buildFilterList() +{ if (filter_.isEmpty()) return; filter_list_ = filter_.split( '+' ); /* diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 3ac356a84..0c97f92c7 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -124,14 +124,16 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { /** Destructeur */ -ElementsPanelWidget::~ElementsPanelWidget() { +ElementsPanelWidget::~ElementsPanelWidget() +{ } /** Require the desktop environment to open the directory containing the file represented by the selected item, if any. */ -void ElementsPanelWidget::openDirectoryForSelectedItem() { +void ElementsPanelWidget::openDirectoryForSelectedItem() +{ if (QTreeWidgetItem *qtwi = elements_panel -> currentItem()) { QString dir_path = elements_panel -> dirPathForItem(qtwi); if (!dir_path.isEmpty()) { @@ -144,7 +146,8 @@ void ElementsPanelWidget::openDirectoryForSelectedItem() { Copy the full path to the file represented by the selected item to the clipboard. */ -void ElementsPanelWidget::copyPathForSelectedItem() { +void ElementsPanelWidget::copyPathForSelectedItem() +{ if (QTreeWidgetItem *qtwi = elements_panel -> currentItem()) { QString file_path = elements_panel -> filePathForItem(qtwi); file_path = QDir::toNativeSeparators(file_path); @@ -157,7 +160,8 @@ void ElementsPanelWidget::copyPathForSelectedItem() { /** Recharge le panel d'elements */ -void ElementsPanelWidget::reloadAndFilter() { +void ElementsPanelWidget::reloadAndFilter() +{ // recharge tous les elements elements_panel -> reload(); // reapplique le filtre @@ -169,7 +173,8 @@ void ElementsPanelWidget::reloadAndFilter() { /** * Emit the requestForProject signal with te selected project */ -void ElementsPanelWidget::activateProject() { +void ElementsPanelWidget::activateProject() +{ if (QETProject *selected_project = elements_panel -> selectedProject()) { emit(requestForProject(selected_project)); } @@ -178,7 +183,8 @@ void ElementsPanelWidget::activateProject() { /** Emet le signal requestForProjectClosing avec le projet selectionne */ -void ElementsPanelWidget::closeProject() { +void ElementsPanelWidget::closeProject() +{ if (QETProject *selected_project = elements_panel -> selectedProject()) { emit(requestForProjectClosing(selected_project)); } @@ -187,7 +193,8 @@ void ElementsPanelWidget::closeProject() { /** Emet le signal requestForProjectPropertiesEdition avec le projet selectionne */ -void ElementsPanelWidget::editProjectProperties() { +void ElementsPanelWidget::editProjectProperties() +{ if (QETProject *selected_project = elements_panel -> selectedProject()) { emit(requestForProjectPropertiesEdition(selected_project)); } @@ -196,7 +203,8 @@ void ElementsPanelWidget::editProjectProperties() { /** Emet le signal requestForDiagramPropertiesEdition avec le schema selectionne */ -void ElementsPanelWidget::editDiagramProperties() { +void ElementsPanelWidget::editDiagramProperties() +{ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { emit(requestForDiagramPropertiesEdition(selected_diagram)); } @@ -205,7 +213,8 @@ void ElementsPanelWidget::editDiagramProperties() { /** Emet le signal requestForNewDiagram avec le projet selectionne */ -void ElementsPanelWidget::newDiagram() { +void ElementsPanelWidget::newDiagram() +{ if (QETProject *selected_project = elements_panel -> selectedProject()) { emit(requestForNewDiagram(selected_project)); } @@ -214,7 +223,8 @@ void ElementsPanelWidget::newDiagram() { /** Emet le signal requestForDiagramDeletion avec le schema selectionne */ -void ElementsPanelWidget::deleteDiagram() { +void ElementsPanelWidget::deleteDiagram() +{ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { emit(requestForDiagramDeletion(selected_diagram)); } @@ -223,7 +233,8 @@ void ElementsPanelWidget::deleteDiagram() { /** Emet le signal requestForDiagramMoveUpTop avec le schema selectionne +*/ -void ElementsPanelWidget::moveDiagramUpTop() { +void ElementsPanelWidget::moveDiagramUpTop() +{ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { emit(requestForDiagramMoveUpTop(selected_diagram)); } @@ -234,7 +245,8 @@ void ElementsPanelWidget::moveDiagramUpTop() { /** Emet le signal requestForDiagramMoveUp avec le schema selectionne */ -void ElementsPanelWidget::moveDiagramUp() { +void ElementsPanelWidget::moveDiagramUp() +{ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { emit(requestForDiagramMoveUp(selected_diagram)); } @@ -243,7 +255,8 @@ void ElementsPanelWidget::moveDiagramUp() { /** Emet le signal requestForDiagramMoveDown avec le schema selectionne */ -void ElementsPanelWidget::moveDiagramDown() { +void ElementsPanelWidget::moveDiagramDown() +{ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { emit(requestForDiagramMoveDown(selected_diagram)); } @@ -252,7 +265,8 @@ void ElementsPanelWidget::moveDiagramDown() { /** Emet le signal requestForDiagramMoveUpx10 avec le schema selectionne */ -void ElementsPanelWidget::moveDiagramUpx10() { +void ElementsPanelWidget::moveDiagramUpx10() +{ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { emit(requestForDiagramMoveUpx10(selected_diagram)); } @@ -261,7 +275,8 @@ void ElementsPanelWidget::moveDiagramUpx10() { /** Emet le signal requestForDiagramMoveDownx10 avec le schema selectionne */ -void ElementsPanelWidget::moveDiagramDownx10() { +void ElementsPanelWidget::moveDiagramDownx10() +{ if (Diagram *selected_diagram = elements_panel -> selectedDiagram()) { emit(requestForDiagramMoveDownx10(selected_diagram)); } @@ -271,7 +286,8 @@ void ElementsPanelWidget::moveDiagramDownx10() { /** Opens a template editor to create a new title block template. */ -void ElementsPanelWidget::addTitleBlockTemplate() { +void ElementsPanelWidget::addTitleBlockTemplate() +{ QTreeWidgetItem *current_item = elements_panel -> currentItem(); if (!current_item) return; @@ -285,7 +301,8 @@ void ElementsPanelWidget::addTitleBlockTemplate() { /** Opens an editor to edit the currently selected title block template, if any. */ -void ElementsPanelWidget::editTitleBlockTemplate() { +void ElementsPanelWidget::editTitleBlockTemplate() +{ QTreeWidgetItem *current_item = elements_panel -> currentItem(); if (current_item && current_item -> type() == QET::TitleBlockTemplate) { QETApp::instance() -> openTitleBlockTemplate( @@ -297,7 +314,8 @@ void ElementsPanelWidget::editTitleBlockTemplate() { /** Delete the currently selected title block template, if any. */ -void ElementsPanelWidget::removeTitleBlockTemplate() { +void ElementsPanelWidget::removeTitleBlockTemplate() +{ QTreeWidgetItem *current_item = elements_panel -> currentItem(); if (current_item && current_item -> type() == QET::TitleBlockTemplate) { TitleBlockTemplateDeleter( @@ -310,7 +328,8 @@ void ElementsPanelWidget::removeTitleBlockTemplate() { /** Met a jour les boutons afin d'assurer la coherence de l'interface */ -void ElementsPanelWidget::updateButtons() { +void ElementsPanelWidget::updateButtons() +{ QTreeWidgetItem *current_item = elements_panel -> currentItem(); int current_type = elements_panel -> currentItemType(); diff --git a/sources/elementspanelwidget.h b/sources/elementspanelwidget.h index e1905621a..3d85f3e2a 100644 --- a/sources/elementspanelwidget.h +++ b/sources/elementspanelwidget.h @@ -107,7 +107,8 @@ class ElementsPanelWidget : public QWidget { @brief ElementsPanelWidget::elementsPanel @return The elements panel embedded within this widget. */ -inline ElementsPanel &ElementsPanelWidget::elementsPanel() const { +inline ElementsPanel &ElementsPanelWidget::elementsPanel() const +{ return(*elements_panel); } diff --git a/sources/elementtextsmover.cpp b/sources/elementtextsmover.cpp index cb3cca76f..d7a5ed66d 100644 --- a/sources/elementtextsmover.cpp +++ b/sources/elementtextsmover.cpp @@ -25,14 +25,16 @@ /** @brief ElementTextsMover::ElementTextsMover */ -ElementTextsMover::ElementTextsMover() {} +ElementTextsMover::ElementTextsMover() +{} /** @brief ElementTextsMover::isReady @return true if this ElementTextsMover is ready to process a new movement. False if this ElementTextsMover is actually process a movement */ -bool ElementTextsMover::isReady() const { +bool ElementTextsMover::isReady() const +{ return(!m_movement_running); } diff --git a/sources/exportpropertieswidget.cpp b/sources/exportpropertieswidget.cpp index ec483fab2..902eb7347 100644 --- a/sources/exportpropertieswidget.cpp +++ b/sources/exportpropertieswidget.cpp @@ -45,14 +45,16 @@ ExportPropertiesWidget::ExportPropertiesWidget(const ExportProperties &export_pr @brief ExportPropertiesWidget::~ExportPropertiesWidget Destructeur */ -ExportPropertiesWidget::~ExportPropertiesWidget() { +ExportPropertiesWidget::~ExportPropertiesWidget() +{ } /** @brief ExportPropertiesWidget::exportProperties @return les parametres d'export definis via le widget */ -ExportProperties ExportPropertiesWidget::exportProperties() const { +ExportProperties ExportPropertiesWidget::exportProperties() const +{ ExportProperties export_properties; export_properties.destination_directory = QDir(dirpath -> text()); @@ -120,7 +122,8 @@ void ExportPropertiesWidget::setPrintingMode(bool mode) { Slot asking the user to choose a folder / Slot demandant a l'utilisateur de choisir un dossier */ -void ExportPropertiesWidget::slot_chooseADirectory() { +void ExportPropertiesWidget::slot_chooseADirectory() +{ QString user_dir = QFileDialog::getExistingDirectory( this, tr("Exporter dans le dossier", "dialog title"), @@ -136,7 +139,8 @@ void ExportPropertiesWidget::slot_chooseADirectory() { Generated the ExportPropertiesWidget ui / Cette methode construit le widget en lui-meme */ -void ExportPropertiesWidget::build() { +void ExportPropertiesWidget::build() +{ // le dialogue est un empilement vertical d'elements QVBoxLayout *vboxLayout = new QVBoxLayout(); vboxLayout -> setContentsMargins(0, 0, 0, 0); diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index 34021c030..d21b237ae 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -126,7 +126,8 @@ ElementPictureFactory::primitives ElementPictureFactory::getPrimitives( return m_primitives_H.value(location.uuid()); } -ElementPictureFactory::~ElementPictureFactory() { +ElementPictureFactory::~ElementPictureFactory() +{ for (primitives p : m_primitives_H.values()) { qDeleteAll(p.m_texts); } diff --git a/sources/factory/ui/addtabledialog.cpp b/sources/factory/ui/addtabledialog.cpp index 4023add76..b547813ee 100644 --- a/sources/factory/ui/addtabledialog.cpp +++ b/sources/factory/ui/addtabledialog.cpp @@ -48,7 +48,8 @@ AddTableDialog::AddTableDialog(QWidget *content_widget, QWidget *parent) : /** @brief AddTableDialog::~AddNomenclatureDialog */ -AddTableDialog::~AddTableDialog() { +AddTableDialog::~AddTableDialog() +{ delete ui; } @@ -65,7 +66,8 @@ void AddTableDialog::setQueryWidget(QWidget *widget) { @brief AddTableDialog::adjustTableToFolio @return */ -bool AddTableDialog::adjustTableToFolio() const { +bool AddTableDialog::adjustTableToFolio() const +{ return ui->m_adjust_table_size_cb->isChecked(); } @@ -73,7 +75,8 @@ bool AddTableDialog::adjustTableToFolio() const { @brief AddTableDialog::addNewTableToNewDiagram @return */ -bool AddTableDialog::addNewTableToNewDiagram() const { +bool AddTableDialog::addNewTableToNewDiagram() const +{ return ui->m_add_table_and_folio->isChecked(); } @@ -81,7 +84,8 @@ bool AddTableDialog::addNewTableToNewDiagram() const { @brief AddTableDialog::tableName @return */ -QString AddTableDialog::tableName() const { +QString AddTableDialog::tableName() const +{ return ui->m_table_name_le->text(); } @@ -89,7 +93,8 @@ QString AddTableDialog::tableName() const { @brief AddTableDialog::headerMargins @return */ -QMargins AddTableDialog::headerMargins() const { +QMargins AddTableDialog::headerMargins() const +{ return m_header_margins; } @@ -113,7 +118,8 @@ Qt::Alignment AddTableDialog::headerAlignment() const @brief AddTableDialog::headerFont @return */ -QFont AddTableDialog::headerFont() const { +QFont AddTableDialog::headerFont() const +{ return m_header_font; } @@ -121,7 +127,8 @@ QFont AddTableDialog::headerFont() const { @brief AddTableDialog::tableMargins @return */ -QMargins AddTableDialog::tableMargins() const { +QMargins AddTableDialog::tableMargins() const +{ return m_table_margins; } @@ -145,11 +152,13 @@ Qt::Alignment AddTableDialog::tableAlignment() const @brief AddTableDialog::tableFont @return */ -QFont AddTableDialog::tableFont() const { +QFont AddTableDialog::tableFont() const +{ return m_table_font; } -QWidget *AddTableDialog::contentWidget() const { +QWidget *AddTableDialog::contentWidget() const +{ return m_content_widget; } diff --git a/sources/genericpanel.cpp b/sources/genericpanel.cpp index d054fb309..e125616bb 100644 --- a/sources/genericpanel.cpp +++ b/sources/genericpanel.cpp @@ -39,13 +39,15 @@ GenericPanel::GenericPanel(QWidget *parent) : /** Destructor */ -GenericPanel::~GenericPanel() { +GenericPanel::~GenericPanel() +{ } /** @return the type of the current item */ -int GenericPanel::currentItemType() { +int GenericPanel::currentItemType() +{ QTreeWidgetItem *current_qtwi = currentItem(); if (!current_qtwi) return(0); return(current_qtwi -> type()); @@ -56,7 +58,8 @@ int GenericPanel::currentItemType() { @param item @return nullptr */ -QETProject *GenericPanel::projectForItem(QTreeWidgetItem *item) const { +QETProject *GenericPanel::projectForItem(QTreeWidgetItem *item) const +{ if (item && item -> type() == QET::Project) { return(valueForItem(item)); } @@ -69,7 +72,8 @@ QETProject *GenericPanel::projectForItem(QTreeWidgetItem *item) const { @param item @return nullptr */ -Diagram *GenericPanel::diagramForItem(QTreeWidgetItem *item) const { +Diagram *GenericPanel::diagramForItem(QTreeWidgetItem *item) const +{ if (item && item -> type() == QET::Diagram) { return(valueForItem(item)); } @@ -82,7 +86,8 @@ Diagram *GenericPanel::diagramForItem(QTreeWidgetItem *item) const { @return TitleBlockTemplateLocation() */ TitleBlockTemplateLocation GenericPanel::templateLocationForItem( - QTreeWidgetItem *item) const { + QTreeWidgetItem *item) const +{ if (item && item -> type() & QET::TitleBlockTemplatesCollectionItem) { return(valueForItem(item)); } @@ -93,7 +98,8 @@ TitleBlockTemplateLocation GenericPanel::templateLocationForItem( @brief GenericPanel::selectedProject @return projectForItem(currentItem()) */ -QETProject *GenericPanel::selectedProject() const { +QETProject *GenericPanel::selectedProject() const +{ return(projectForItem(currentItem())); } @@ -101,7 +107,8 @@ QETProject *GenericPanel::selectedProject() const { @brief GenericPanel::selectedDiagram @return diagramForItem(currentItem()) */ -Diagram *GenericPanel::selectedDiagram() const { +Diagram *GenericPanel::selectedDiagram() const +{ return(diagramForItem(currentItem())); } @@ -109,7 +116,8 @@ Diagram *GenericPanel::selectedDiagram() const { @brief GenericPanel::selectedTemplateLocation @return templateLocationForItem(currentItem()) */ -TitleBlockTemplateLocation GenericPanel::selectedTemplateLocation() const { +TitleBlockTemplateLocation GenericPanel::selectedTemplateLocation() const +{ return(templateLocationForItem(currentItem())); } @@ -931,7 +939,8 @@ void GenericPanel::reparent(QTreeWidgetItem *item, QTreeWidgetItem *parent) { QList GenericPanel::childItems( QTreeWidgetItem *item, QET::ItemType type, - bool recursive) const { + bool recursive) const +{ QList items; if (!item) return(items); for (int i = 0 ; i < item -> childCount() ; ++ i) { @@ -976,7 +985,8 @@ void GenericPanel::removeObsoleteItems( @return the value stored in \a item */ template -T GenericPanel::valueForItem(QTreeWidgetItem *item) const { +T GenericPanel::valueForItem(QTreeWidgetItem *item) const +{ return item -> data(0, GenericPanel::Item).value(); } template TitleBlockTemplateLocation @@ -1027,6 +1037,7 @@ bool GenericPanel::event(QEvent *event) { @brief GenericPanel::emitFirstActivated Emit the signal firstActivated(). */ -void GenericPanel::emitFirstActivated() { +void GenericPanel::emitFirstActivated() +{ emit(firstActivated()); } diff --git a/sources/newelementwizard.cpp b/sources/newelementwizard.cpp index 65113e8a5..2ed23594e 100644 --- a/sources/newelementwizard.cpp +++ b/sources/newelementwizard.cpp @@ -51,7 +51,8 @@ NewElementWizard::NewElementWizard(QWidget *parent, Qt::WindowFlags f) : /** Destructeur */ -NewElementWizard::~NewElementWizard() { +NewElementWizard::~NewElementWizard() +{ } /** @@ -99,7 +100,8 @@ QWizardPage *NewElementWizard::buildStep1() @brief NewElementWizard::buildStep2 @return */ -QWizardPage *NewElementWizard::buildStep2() { +QWizardPage *NewElementWizard::buildStep2() +{ QWizardPage *page = new QWizardPage(); page -> setProperty("WizardState", Filename); page -> setTitle(tr("Étape 2/3 : Nom du fichier", "wizard page title")); @@ -123,7 +125,8 @@ QWizardPage *NewElementWizard::buildStep2() { @brief NewElementWizard::buildStep3 @return */ -QWizardPage *NewElementWizard::buildStep3() { +QWizardPage *NewElementWizard::buildStep3() +{ QWizardPage *page = new QWizardPage(); page -> setProperty("WizardState", Names); page -> setTitle(tr("Étape 3/3 : Noms de l'élément", "wizard page title")); @@ -202,7 +205,8 @@ bool NewElementWizard::validStep1() Valid the step 2 @return true if step is valid */ -bool NewElementWizard::validStep2() { +bool NewElementWizard::validStep2() +{ QString file_name = m_qle_filename -> text(); if (file_name.isEmpty()) { @@ -233,7 +237,8 @@ bool NewElementWizard::validStep2() { @brief NewElementWizard::createNewElement Lauch an element editor for create the new element */ -void NewElementWizard::createNewElement() { +void NewElementWizard::createNewElement() +{ QETElementEditor *edit_new_element = new QETElementEditor(parentWidget()); edit_new_element -> setNames(m_names_list -> names()); diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 92505d649..a26b4d547 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -46,13 +46,15 @@ ProjectConfigPage::ProjectConfigPage(QETProject *project, QWidget *parent) : /** Destructor */ -ProjectConfigPage::~ProjectConfigPage() { +ProjectConfigPage::~ProjectConfigPage() +{ } /** @return the project being edited by this page */ -QETProject *ProjectConfigPage::project() const { +QETProject *ProjectConfigPage::project() const +{ return(m_project); } @@ -81,7 +83,8 @@ QETProject *ProjectConfigPage::setProject(QETProject *new_project, /** Apply the configuration after user input */ -void ProjectConfigPage::applyConf() { +void ProjectConfigPage::applyConf() +{ if (!m_project || m_project -> isReadOnly()) return; applyProjectConf(); } @@ -91,7 +94,8 @@ void ProjectConfigPage::applyConf() { readValuesFromProject() and adjustReadOnly() if a non-zero project has been set. Typically, you should call this function in your subclass constructor. */ -void ProjectConfigPage::init() { +void ProjectConfigPage::init() +{ initWidgets(); initLayout(); if (m_project) { @@ -116,27 +120,31 @@ ProjectMainConfigPage::ProjectMainConfigPage(QETProject *project, QWidget *paren /** Destructor */ -ProjectMainConfigPage::~ProjectMainConfigPage() { +ProjectMainConfigPage::~ProjectMainConfigPage() +{ } /** @return the title for this page */ -QString ProjectMainConfigPage::title() const { +QString ProjectMainConfigPage::title() const +{ return(tr("Général", "configuration page title")); } /** @return the icon for this page */ -QIcon ProjectMainConfigPage::icon() const { +QIcon ProjectMainConfigPage::icon() const +{ return(QET::Icons::Settings); } /** Apply the configuration after user input */ -void ProjectMainConfigPage::applyProjectConf() { +void ProjectMainConfigPage::applyProjectConf() +{ bool modified_project = false; QString new_title = title_value_ -> text(); @@ -158,14 +166,16 @@ void ProjectMainConfigPage::applyProjectConf() { /** @return the project title entered by the user */ -QString ProjectMainConfigPage::projectTitle() const { +QString ProjectMainConfigPage::projectTitle() const +{ return(title_value_ -> text()); } /** Initialize widgets displayed by the page. */ -void ProjectMainConfigPage::initWidgets() { +void ProjectMainConfigPage::initWidgets() +{ title_label_ = new QLabel(tr("Titre du projet :", "label when configuring")); title_value_ = new QLineEdit(); title_information_ = new QLabel(tr("Ce titre sera disponible pour tous les folios de ce projet en tant que %projecttitle.", "informative label")); @@ -183,7 +193,8 @@ void ProjectMainConfigPage::initWidgets() { /** Initialize the layout of this page. */ -void ProjectMainConfigPage::initLayout() { +void ProjectMainConfigPage::initLayout() +{ QVBoxLayout *main_layout0 = new QVBoxLayout(); QHBoxLayout *title_layout0 = new QHBoxLayout(); title_layout0 -> addWidget(title_label_); @@ -201,7 +212,8 @@ void ProjectMainConfigPage::initLayout() { /** Read properties from the edited project then fill widgets with them. */ -void ProjectMainConfigPage::readValuesFromProject() { +void ProjectMainConfigPage::readValuesFromProject() +{ title_value_ -> setText(m_project -> title()); project_variables_ -> setContext(m_project -> projectProperties()); } @@ -210,7 +222,8 @@ void ProjectMainConfigPage::readValuesFromProject() { Set the content of this page read only if the project is read only, editable if the project is editable. */ -void ProjectMainConfigPage::adjustReadOnly() { +void ProjectMainConfigPage::adjustReadOnly() +{ bool is_read_only = m_project -> isReadOnly(); title_value_ -> setReadOnly(is_read_only); } @@ -237,7 +250,8 @@ ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project, Title of this config page @return */ -QString ProjectAutoNumConfigPage::title() const { +QString ProjectAutoNumConfigPage::title() const +{ return tr("Numérotation auto"); } @@ -246,14 +260,16 @@ QString ProjectAutoNumConfigPage::title() const { Icon of this config pafe @return */ -QIcon ProjectAutoNumConfigPage::icon() const { +QIcon ProjectAutoNumConfigPage::icon() const +{ return QIcon (QET::Icons::AutoNum); } /** @brief ProjectAutoNumConfigPage::applyProjectConf */ -void ProjectAutoNumConfigPage::applyProjectConf() {} +void ProjectAutoNumConfigPage::applyProjectConf() +{} /** @brief ProjectAutoNumConfigPage::initWidgets @@ -314,7 +330,8 @@ void ProjectAutoNumConfigPage::readValuesFromProject() @brief ProjectAutoNumConfigPage::adjustReadOnly set this config page disable if project is read only */ -void ProjectAutoNumConfigPage::adjustReadOnly() { +void ProjectAutoNumConfigPage::adjustReadOnly() +{ } /** @@ -460,7 +477,8 @@ void ProjectAutoNumConfigPage::saveContextConductor() @brief ProjectAutoNumConfigPage::saveContext_folio Save the current displayed folio context in project */ -void ProjectAutoNumConfigPage::saveContextFolio() { +void ProjectAutoNumConfigPage::saveContextFolio() +{ // If the text is the default text "Name of new numerotation" save the edited context // With the the name "No name" if (m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation")) { @@ -483,7 +501,8 @@ void ProjectAutoNumConfigPage::saveContextFolio() { @brief ProjectAutoNumConfigPage::applyAutoNum Apply auto folio numbering, New Folios or Selected Folios */ -void ProjectAutoNumConfigPage::applyAutoNum() { +void ProjectAutoNumConfigPage::applyAutoNum() +{ if (m_faw->newFolios){ int foliosRemaining = m_faw->newFoliosNumber(); @@ -507,7 +526,8 @@ void ProjectAutoNumConfigPage::applyAutoNum() { @brief ProjectAutoNumConfigPage::applyAutoManagement Apply Management Options in Selected Folios */ -void ProjectAutoNumConfigPage::applyManagement() { +void ProjectAutoNumConfigPage::applyManagement() +{ int from; int to; //Apply to Entire Project @@ -601,7 +621,8 @@ void ProjectAutoNumConfigPage::applyManagement() { @brief ProjectAutoNumConfigPage::removeContext Remove from project the current conductor numerotation context */ -void ProjectAutoNumConfigPage::removeContextConductor() { +void ProjectAutoNumConfigPage::removeContextConductor() +{ //if default text, return if ( m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation") ) return; m_project -> removeConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText() ); @@ -613,7 +634,8 @@ void ProjectAutoNumConfigPage::removeContextConductor() { @brief ProjectAutoNumConfigPage::removeContext_folio Remove from project the current folio numerotation context */ -void ProjectAutoNumConfigPage::removeContextFolio() { +void ProjectAutoNumConfigPage::removeContextFolio() +{ //if default text, return if ( m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation") ) return; m_project -> removeFolioAutoNum (m_saw_folio->contextComboBox() -> currentText() ); diff --git a/sources/projectview.cpp b/sources/projectview.cpp index 73966d1c9..95b99b4ee 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -54,7 +54,8 @@ ProjectView::ProjectView(QETProject *project, QWidget *parent) : Destructeur Supprime les DiagramView embarquees */ -ProjectView::~ProjectView() { +ProjectView::~ProjectView() +{ for (auto dv_ : m_diagram_ids.values()) dv_->deleteLater(); } @@ -62,7 +63,8 @@ ProjectView::~ProjectView() { /** @return le projet actuellement visualise par le ProjectView */ -QETProject *ProjectView::project() { +QETProject *ProjectView::project() +{ return(m_project); } @@ -94,7 +96,8 @@ void ProjectView::setProject(QETProject *project) /** @return la liste des schemas ouverts dans le projet */ -QList ProjectView::diagram_views() const { +QList ProjectView::diagram_views() const +{ return(m_diagram_view_list); } @@ -102,7 +105,8 @@ QList ProjectView::diagram_views() const { @brief ProjectView::currentDiagram @return The current active diagram view or nullptr if there isn't diagramView in this project view. */ -DiagramView *ProjectView::currentDiagram() const { +DiagramView *ProjectView::currentDiagram() const +{ int current_tab_index = m_tab -> currentIndex(); if (current_tab_index == -1) return nullptr; @@ -126,7 +130,8 @@ void ProjectView::closeEvent(QCloseEvent *qce) { /** @brief change current diagramview to next folio */ -void ProjectView::changeTabDown(){ +void ProjectView::changeTabDown() +{ DiagramView *nextDiagramView = this->nextDiagram(); if (nextDiagramView!=nullptr){ rebuildDiagramsMap(); @@ -137,7 +142,8 @@ void ProjectView::changeTabDown(){ /** @return next folio of current diagramview */ -DiagramView *ProjectView::nextDiagram() { +DiagramView *ProjectView::nextDiagram() +{ int current_tab_index = m_tab -> currentIndex(); int next_tab_index = current_tab_index + 1; //get next tab index if (next_tab_index= greatest tab the last tab is activated so no need to change tab. @@ -149,7 +155,8 @@ DiagramView *ProjectView::nextDiagram() { /** @brief change current diagramview to previous tab */ -void ProjectView::changeTabUp(){ +void ProjectView::changeTabUp() +{ DiagramView *previousDiagramView = this->previousDiagram(); if (previousDiagramView!=nullptr){ rebuildDiagramsMap(); @@ -160,7 +167,8 @@ void ProjectView::changeTabUp(){ /** @return previous folio of current diagramview */ -DiagramView *ProjectView::previousDiagram() { +DiagramView *ProjectView::previousDiagram() +{ int current_tab_index = m_tab -> currentIndex(); int previous_tab_index = current_tab_index - 1; //get previous tab index if (previous_tab_index>=0) //if previous tab index = 0 then the first tab is activated so no need to change tab. @@ -172,7 +180,8 @@ DiagramView *ProjectView::previousDiagram() { /** @brief change current diagramview to last tab */ -void ProjectView::changeLastTab(){ +void ProjectView::changeLastTab() +{ DiagramView *lastDiagramView = this->lastDiagram(); m_tab->setCurrentWidget(lastDiagramView); } @@ -180,14 +189,16 @@ void ProjectView::changeLastTab(){ /** @return last folio of current project */ -DiagramView *ProjectView::lastDiagram(){ +DiagramView *ProjectView::lastDiagram() +{ return(m_diagram_ids.last()); } /** @brief change current diagramview to first tab */ -void ProjectView::changeFirstTab(){ +void ProjectView::changeFirstTab() +{ DiagramView *firstDiagramView = this->firstDiagram(); m_tab->setCurrentWidget(firstDiagramView); } @@ -195,7 +206,8 @@ void ProjectView::changeFirstTab(){ /** @return first folio of current project */ -DiagramView *ProjectView::firstDiagram(){ +DiagramView *ProjectView::firstDiagram() +{ return(m_diagram_ids.first()); } @@ -208,7 +220,8 @@ DiagramView *ProjectView::firstDiagram(){ @see tryClosingElementEditors() @see tryClosingDiagrams() */ -bool ProjectView::tryClosing() { +bool ProjectView::tryClosing() +{ if (!m_project) return(true); // First step: require external editors closing -- users may either cancel @@ -257,7 +270,8 @@ bool ProjectView::tryClosing() { d'un editeur d'element. @return true si tous les editeurs d'element ont pu etre fermes, false sinon */ -bool ProjectView::tryClosingElementEditors() { +bool ProjectView::tryClosingElementEditors() +{ if (!m_project) return(true); /* La QETApp permet d'acceder rapidement aux editeurs d'element @@ -281,7 +295,8 @@ bool ProjectView::tryClosingElementEditors() { a dialog ask if user want to save the modification. @return the answer of dialog or discard if no change. */ -int ProjectView::tryClosingDiagrams() { +int ProjectView::tryClosingDiagrams() +{ if (!m_project) return(QMessageBox::Discard); if (!project()->projectOptionsWereModified() && @@ -339,7 +354,8 @@ QString ProjectView::askUserForFilePath(bool assign) { @return the QETResult object to be returned when it appears this project view is not associated to any project. */ -QETResult ProjectView::noProjectResult() const { +QETResult ProjectView::noProjectResult() const +{ QETResult no_project(tr("aucun projet affiché", "error message"), false); return(no_project); } @@ -421,7 +437,8 @@ void ProjectView::showDiagram(Diagram *diagram) { Enable the user to edit properties of the current project through a configuration dialog. */ -void ProjectView::editProjectProperties() { +void ProjectView::editProjectProperties() +{ if (!m_project) return; ProjectPropertiesDialog dialog(m_project, parentWidget()); dialog.exec(); @@ -430,7 +447,8 @@ void ProjectView::editProjectProperties() { /** Edite les proprietes du schema courant */ -void ProjectView::editCurrentDiagramProperties() { +void ProjectView::editCurrentDiagramProperties() +{ editDiagramProperties(currentDiagram()); } @@ -561,7 +579,8 @@ void ProjectView::moveDiagramDownx10(Diagram *diagram) { Ce slot demarre un dialogue permettant a l'utilisateur de parametrer et de lancer l'impression de toute ou partie du projet. */ -void ProjectView::printProject() { +void ProjectView::printProject() +{ if (!m_project) return; // transforme le titre du projet en nom utilisable pour le document @@ -591,7 +610,8 @@ void ProjectView::printProject() { /** Exporte le schema. */ -void ProjectView::exportProject() { +void ProjectView::exportProject() +{ if (!m_project) return; ExportDialog ed(m_project, parentWidget()); @@ -607,7 +627,8 @@ void ProjectView::exportProject() { @see setFilePath() @return a QETResult object reflecting the situation */ -QETResult ProjectView::save() { +QETResult ProjectView::save() +{ return(doSave()); } @@ -658,7 +679,8 @@ QETResult ProjectView::doSave() @return an integer value above zero if elements and/or categories were cleaned. */ -int ProjectView::cleanProject() { +int ProjectView::cleanProject() +{ if (!m_project) return(0); // s'assure que le schema n'est pas en lecture seule @@ -733,7 +755,8 @@ void ProjectView::initActions() /** Initialize child widgets for this widget. */ -void ProjectView::initWidgets() { +void ProjectView::initWidgets() +{ setObjectName("ProjectView"); setWindowIcon(QET::Icons::ProjectFileGP); @@ -790,7 +813,8 @@ void ProjectView::initWidgets() { /** Initialize layout for this widget. */ -void ProjectView::initLayout() { +void ProjectView::initLayout() +{ QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_); fallback_widget_layout_ -> addWidget(fallback_label_); @@ -849,7 +873,8 @@ void ProjectView::loadDiagrams() @brief ProjectView::updateWindowTitle Update the project view title */ -void ProjectView::updateWindowTitle() { +void ProjectView::updateWindowTitle() +{ QString title; if (m_project) { title = m_project -> pathNameTitle(); @@ -863,7 +888,8 @@ void ProjectView::updateWindowTitle() { Effectue les actions necessaires lorsque le projet visualise entre ou sort du mode lecture seule. */ -void ProjectView::adjustReadOnlyState() { +void ProjectView::adjustReadOnlyState() +{ bool editable = !(m_project -> isReadOnly()); // prevent users from moving existing diagrams @@ -984,7 +1010,8 @@ DiagramView *ProjectView::findDiagram(Diagram *diagram) { /** Reconstruit la map associant les index des onglets avec les DiagramView */ -void ProjectView::rebuildDiagramsMap() { +void ProjectView::rebuildDiagramsMap() +{ // vide la map m_diagram_ids.clear(); diff --git a/sources/properties/terminaldata.cpp b/sources/properties/terminaldata.cpp index 57ac35609..5fc00d72e 100644 --- a/sources/properties/terminaldata.cpp +++ b/sources/properties/terminaldata.cpp @@ -15,7 +15,8 @@ TerminalData::TerminalData(QGraphicsObject *parent): init(); } -void TerminalData::init() { +void TerminalData::init() +{ } TerminalData::~TerminalData() diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp index 2a239d069..c89077ec8 100644 --- a/sources/properties/xrefproperties.cpp +++ b/sources/properties/xrefproperties.cpp @@ -42,7 +42,8 @@ XRefProperties::XRefProperties() @param prefix: prefix before properties name */ void XRefProperties::toSettings(QSettings &settings, - const QString prefix) const { + const QString prefix) const +{ settings.setValue(prefix + "showpowerctc", m_show_power_ctc); QString display = m_display == Cross? "cross" : "contacts"; settings.setValue(prefix + "displayhas", display); @@ -96,7 +97,8 @@ void XRefProperties::fromSettings(const QSettings &settings, @param xml_document : QDomElement to use for saving @return QDomElement */ -QDomElement XRefProperties::toXml(QDomDocument &xml_document) const { +QDomElement XRefProperties::toXml(QDomDocument &xml_document) const +{ QDomElement xml_element = xml_document.createElement("xref"); xml_element.setAttribute("type", m_key); @@ -191,7 +193,8 @@ bool XRefProperties::operator ==(const XRefProperties &xrp) const{ m_xref_pos == xrp.m_xref_pos ); } -bool XRefProperties::operator !=(const XRefProperties &xrp) const { +bool XRefProperties::operator !=(const XRefProperties &xrp) const +{ return (! (*this == xrp)); } diff --git a/sources/qet.cpp b/sources/qet.cpp index 110bce76c..dac87f5f3 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -371,7 +371,8 @@ QList QET::findInDomElement(const QDomElement &e, } /// @return le texte de la licence de QElectroTech (GNU/GPL) -QString QET::license() { +QString QET::license() +{ // Recuperation du texte de la GNU/GPL dans un fichier integre a l'application QFile *file_license = new QFile(":/LICENSE"); QString txt_license; @@ -399,7 +400,8 @@ QString QET::license() { @return la liste des caracteres interdits dans les noms de fichiers sous Windows */ -QList QET::forbiddenCharacters() { +QList QET::forbiddenCharacters() +{ return(QList() << '\\' << '/' << ':' << '*' << '?' << '"' << '<' << '>' << '|'); } diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 7878cd614..fff72edc4 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -261,7 +261,8 @@ void QETApp::systray(QSystemTrayIcon::ActivationReason reason) { Minimizes all application windows in the systray \~French Reduit toutes les fenetres de l'application dans le systray */ -void QETApp::reduceEveryEditor() { +void QETApp::reduceEveryEditor() +{ reduceDiagramEditors(); reduceElementEditors(); reduceTitleBlockTemplateEditors(); @@ -273,7 +274,8 @@ void QETApp::reduceEveryEditor() { Restores all application windows in the systray \~French Restaure toutes les fenetres de l'application dans le systray */ -void QETApp::restoreEveryEditor() { +void QETApp::restoreEveryEditor() +{ restoreDiagramEditors(); restoreElementEditors(); restoreTitleBlockTemplateEditors(); @@ -285,7 +287,8 @@ void QETApp::restoreEveryEditor() { Minimize all schema editors in the systray \~French Reduit tous les editeurs de schemas dans le systray */ -void QETApp::reduceDiagramEditors() { +void QETApp::reduceDiagramEditors() +{ setMainWindowsVisible(false); } @@ -294,7 +297,8 @@ void QETApp::reduceDiagramEditors() { Restore all schema editors in the systray \~French Restaure tous les editeurs de schemas dans le systray */ -void QETApp::restoreDiagramEditors() { +void QETApp::restoreDiagramEditors() +{ setMainWindowsVisible(true); } @@ -304,7 +308,8 @@ void QETApp::restoreDiagramEditors() { Minimize all element editors in systray \~French Reduit tous les editeurs d'element dans le systray */ -void QETApp::reduceElementEditors() { +void QETApp::reduceElementEditors() +{ setMainWindowsVisible(false); } @@ -313,7 +318,8 @@ void QETApp::reduceElementEditors() { Restore all element editors in the systray \~French Restaure tous les editeurs d'element dans le systray */ -void QETApp::restoreElementEditors() { +void QETApp::restoreElementEditors() +{ setMainWindowsVisible(true); } @@ -321,7 +327,8 @@ void QETApp::restoreElementEditors() { @brief QETApp::reduceTitleBlockTemplateEditors Reduce all known template editors */ -void QETApp::reduceTitleBlockTemplateEditors() { +void QETApp::reduceTitleBlockTemplateEditors() +{ setMainWindowsVisible(false); } @@ -329,7 +336,8 @@ void QETApp::reduceTitleBlockTemplateEditors() { @brief QETApp::restoreTitleBlockTemplateEditors Restore all known template editors */ -void QETApp::restoreTitleBlockTemplateEditors() { +void QETApp::restoreTitleBlockTemplateEditors() +{ setMainWindowsVisible(true); } @@ -338,7 +346,8 @@ void QETApp::restoreTitleBlockTemplateEditors() { launches a new schema editor \~French lance un nouvel editeur de schemas */ -void QETApp::newDiagramEditor() { +void QETApp::newDiagramEditor() +{ new QETDiagramEditor(); } @@ -347,7 +356,8 @@ void QETApp::newDiagramEditor() { launches a new element editor \~French lance un nouvel editeur d'element */ -void QETApp::newElementEditor() { +void QETApp::newElementEditor() +{ new QETElementEditor(); } @@ -355,7 +365,8 @@ void QETApp::newElementEditor() { @brief QETApp::collectionCache @return the collection cache provided by the application itself. */ -ElementsCollectionCache *QETApp::collectionCache() { +ElementsCollectionCache *QETApp::collectionCache() +{ return(collections_cache_); } @@ -510,7 +521,8 @@ QString QETApp::diagramTranslatedInfoKey(const QString &key) @return the common title block templates collection, i.e. the one provided by QElecrotTech */ -TitleBlockTemplatesFilesCollection *QETApp::commonTitleBlockTemplatesCollection() { +TitleBlockTemplatesFilesCollection *QETApp::commonTitleBlockTemplatesCollection() +{ if (!m_common_tbt_collection) { m_common_tbt_collection = new TitleBlockTemplatesFilesCollection( @@ -530,7 +542,8 @@ TitleBlockTemplatesFilesCollection *QETApp::commonTitleBlockTemplatesCollection( @return the custom title block templates collection, i.e. the one managed by the end user */ -TitleBlockTemplatesFilesCollection *QETApp::customTitleBlockTemplatesCollection() { +TitleBlockTemplatesFilesCollection *QETApp::customTitleBlockTemplatesCollection() +{ if (!m_custom_tbt_collection) { m_custom_tbt_collection = new TitleBlockTemplatesFilesCollection( @@ -549,7 +562,8 @@ TitleBlockTemplatesFilesCollection *QETApp::customTitleBlockTemplatesCollection( @return the list of all available title block tempaltes collections, beginning with the common and custom ones, plus the projects-embedded ones. */ -QList QETApp::availableTitleBlockTemplatesCollections() { +QList QETApp::availableTitleBlockTemplatesCollections() +{ QList collections_list; collections_list << commonTitleBlockTemplatesCollection(); @@ -718,7 +732,8 @@ void QETApp::resetUserElementsDir() @return the path of the directory containing the common title block templates collection. */ -QString QETApp::commonTitleBlockTemplatesDir() { +QString QETApp::commonTitleBlockTemplatesDir() +{ #ifdef QET_ALLOW_OVERRIDE_CTBTD_OPTION if (common_tbt_dir_ != QString()) return(common_tbt_dir_); #endif @@ -747,7 +762,8 @@ QString QETApp::commonTitleBlockTemplatesDir() { @return the path of the directory containing the custom title block templates collection. */ -QString QETApp::customTitleBlockTemplatesDir() { +QString QETApp::customTitleBlockTemplatesDir() +{ if (m_user_custom_tbt_dir.isEmpty()) { QSettings settings; @@ -794,7 +810,8 @@ QString QETApp::customTitleBlockTemplatesDir() { \~ @return The path of the QElectroTech configuration folder \~French Le chemin du dossier de configuration de QElectroTech */ -QString QETApp::configDir() { +QString QETApp::configDir() +{ #ifdef QET_ALLOW_OVERRIDE_CD_OPTION if (config_dir != QString()) return(config_dir); #endif @@ -888,7 +905,8 @@ QString QETApp::symbolicPath(const QString &real_path) { @return the list of file extensions QElectroTech is able to open and supposed to handle. Note they are provided with no leading point. */ -QStringList QETApp::handledFileExtensions() { +QStringList QETApp::handledFileExtensions() +{ static QStringList ext; if (!ext.count()) { ext << "qet"; @@ -1036,7 +1054,8 @@ void QETApp::overrideLangDir(const QString &new_ld) { @return The path of the folder containing the language files \~French Le chemin du dossier contenant les fichiers de langue */ -QString QETApp::languagesPath() { +QString QETApp::languagesPath() +{ if (!lang_dir.isEmpty()) { return(lang_dir); } else { @@ -1076,7 +1095,8 @@ QString QETApp::languagesPath() { \~French true si l'utilisateur a accepte toutes les fermetures, false sinon */ -bool QETApp::closeEveryEditor() { +bool QETApp::closeEveryEditor() +{ // make sure all windows are visible before leaving // s'assure que toutes les fenetres soient visibles avant de quitter restoreEveryEditor(); @@ -1203,7 +1223,8 @@ QFont QETApp::indiTextsItemFont(qreal size) @return schema editors \~French les editeurs de schemas */ -QList QETApp::diagramEditors() { +QList QETApp::diagramEditors() +{ return(QETApp::instance() -> detectWindows()); } @@ -1212,7 +1233,8 @@ QList QETApp::diagramEditors() { @return element editors \~French les editeurs d'elements */ -QList QETApp::elementEditors() { +QList QETApp::elementEditors() +{ return(QETApp::instance() -> detectWindows()); } @@ -1220,7 +1242,8 @@ QList QETApp::elementEditors() { @brief QETApp::titleBlockTemplateEditors @return the title block template editors */ -QList QETApp::titleBlockTemplateEditors() { +QList QETApp::titleBlockTemplateEditors() +{ return(QETApp::instance() -> detectWindows()); } @@ -1261,7 +1284,8 @@ QList QETApp::titleBlockTemplateEditors( \~ @return \~ @see QTextOrientationSpinBoxWidget */ -QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() { +QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() +{ QTextOrientationSpinBoxWidget *widget = new QTextOrientationSpinBoxWidget(); widget -> orientationWidget() -> setFont(QETApp::diagramTextsFont()); widget -> orientationWidget() -> setUsableTexts(QList() @@ -1283,7 +1307,8 @@ QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() { @brief QETApp::defaultTitleBlockTemplate @return the default titleblock template for diagrams */ -TitleBlockTemplate *QETApp::defaultTitleBlockTemplate() { +TitleBlockTemplate *QETApp::defaultTitleBlockTemplate() +{ if (!QETApp::default_titleblock_template_) { TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(QETApp::instance()); if (titleblock_template -> loadFromXmlFile(":/titleblocks/default.titleblock")) { @@ -1349,7 +1374,8 @@ void QETApp::receiveMessage(int instanceId, QByteArray message) @param T a class inheriting QMainWindow @return the list of windows of type T */ -template QList QETApp::detectWindows() const { +template QList QETApp::detectWindows() const +{ QList windows; foreach(QWidget *widget, qApp->topLevelWidgets()) { if (!widget -> isWindow()) continue; @@ -1375,7 +1401,8 @@ template void QETApp::setMainWindowsVisible(bool visible) { @return The list of recent files for projects \~French La liste des fichiers recents pour les projets */ -RecentFiles *QETApp::projectsRecentFiles() { +RecentFiles *QETApp::projectsRecentFiles() +{ return(m_projects_recent_files); } @@ -1384,7 +1411,8 @@ RecentFiles *QETApp::projectsRecentFiles() { @return The list of recent files for the elements \~French La liste des fichiers recents pour les elements */ -RecentFiles *QETApp::elementsRecentFiles() { +RecentFiles *QETApp::elementsRecentFiles() +{ return(m_elements_recent_files); } @@ -1464,7 +1492,8 @@ void QETApp::useSystemPalette(bool use) { \~French Demande la fermeture de toutes les fenetres ; si l'utilisateur les accepte, l'application quitte */ -void QETApp::quitQET() { +void QETApp::quitQET() +{ #pragma message("@TODO Segmentation fault when closing program before loading elements is finished") if (closeEveryEditor()) { qApp->quit(); @@ -1478,7 +1507,8 @@ void QETApp::quitQET() { \~French Verifie s'il reste des fenetres (cachees ou non) et quitte s'il n'en reste plus. */ -void QETApp::checkRemainingWindows() { +void QETApp::checkRemainingWindows() +{ /* little hack: * the slot remembers after 500 ms of waiting in order to compensate * for the fact that some windows can still appear alive when they @@ -1733,7 +1763,8 @@ void QETApp::openTitleBlockTemplateFiles(const QStringList &files_list) { en lancant un dialogue approprie. \~ @see ConfigDialog */ -void QETApp::configureQET() { +void QETApp::configureQET() +{ // determine the parent widget to use for the dialog // determine le widget parent a utiliser pour le dialogue QWidget *parent_widget = qApp->activeWindow(); @@ -1783,7 +1814,8 @@ void QETApp::aboutQET() \~French les barres d'outils et dock flottants de la fenetre */ QList QETApp::floatingToolbarsAndDocksForMainWindow( - QMainWindow *window) const { + QMainWindow *window) const +{ QList widgets; foreach(QWidget *qw, qApp->topLevelWidgets()) { if (!qw -> isWindow()) continue; @@ -1822,7 +1854,8 @@ QList QETApp::floatingToolbarsAndDocksForMainWindow( S'ils existent, ils sont juste memorises dans l'attribut arguments_files_. Sinon, ils sont memorises dans l'attribut arguments_options_. */ -void QETApp::parseArguments() { +void QETApp::parseArguments() +{ // get the arguments // recupere les arguments QList arguments_list(qApp->arguments()); @@ -1877,7 +1910,8 @@ void QETApp::parseArguments() { \~French Initialise le splash screen si et seulement si l'execution est interactive. Autrement, l'attribut splash_screen_ vaut 0. */ -void QETApp::initSplashScreen() { +void QETApp::initSplashScreen() +{ if (non_interactive_execution_) return; m_splash_screen = new QSplashScreen(QPixmap(":/ico/splash.png")); m_splash_screen -> show(); @@ -1909,7 +1943,8 @@ void QETApp::setSplashScreenStep(const QString &message) { Determine and apply the language to use for the application \~French Determine et applique le langage a utiliser pour l'application */ -void QETApp::initLanguage() { +void QETApp::initLanguage() +{ setLanguage(langFromSetting()); } @@ -1917,7 +1952,8 @@ void QETApp::initLanguage() { @brief QETApp::initStyle Setup the gui style */ -void QETApp::initStyle() { +void QETApp::initStyle() +{ initial_palette_ = qApp->palette(); //Apply or not the system style @@ -1939,7 +1975,8 @@ void QETApp::initStyle() { - le dossier de la collection perso - the directory for custom title blocks */ -void QETApp::initConfiguration() { +void QETApp::initConfiguration() +{ // create configuration files if necessary // cree les dossiers de configuration si necessaire QDir config_dir(QETApp::configDir()); @@ -1974,7 +2011,8 @@ void QETApp::initConfiguration() { Build the icon in the systray and its menu \~French Construit l'icone dans le systray et son menu */ -void QETApp::initSystemTray() { +void QETApp::initSystemTray() +{ setSplashScreenStep(tr("Chargement... icône du systray", "splash screen caption")); // initialization of the icon menus in the systray @@ -2093,7 +2131,8 @@ QETProject *QETApp::projectFromString(const QString &url) { builds the icon menu in the systray \~French construit le menu de l'icone dans le systray */ -void QETApp::buildSystemTrayMenu() { +void QETApp::buildSystemTrayMenu() +{ menu_systray -> clear(); // get editors @@ -2295,7 +2334,8 @@ bool QETApp::eventFiltrer(QObject *object, QEvent *e) { Display help and usage on standard output \~French Affiche l'aide et l'usage sur la sortie standard */ -void QETApp::printHelp() { +void QETApp::printHelp() +{ QString help( tr("Usage : ") + QFileInfo(qApp->applicationFilePath()).fileName() @@ -2324,7 +2364,8 @@ void QETApp::printHelp() { Print version to standard output \~French Affiche la version sur la sortie standard */ -void QETApp::printVersion() { +void QETApp::printVersion() +{ std::cout << qPrintable(QET::displayedVersion) << std::endl; } @@ -2333,7 +2374,8 @@ void QETApp::printVersion() { Display license on standard output \~French Affiche la licence sur la sortie standard */ -void QETApp::printLicense() { +void QETApp::printLicense() +{ std::cout << qPrintable(QET::license()) << std::endl; } @@ -2342,7 +2384,8 @@ void QETApp::printLicense() { @return the list of projects with their associated ids \~French la liste des projets avec leurs ids associes */ -QMap QETApp::registeredProjects() { +QMap QETApp::registeredProjects() +{ return(registered_projects_); } diff --git a/sources/qetarguments.cpp b/sources/qetarguments.cpp index 370b976c9..3f1ae48e0 100644 --- a/sources/qetarguments.cpp +++ b/sources/qetarguments.cpp @@ -100,7 +100,8 @@ QETArguments &QETArguments::operator=(const QETArguments &qet_arguments) { /** Destructeur */ -QETArguments::~QETArguments() { +QETArguments::~QETArguments() +{ } /** @@ -117,7 +118,8 @@ void QETArguments::setArguments(const QList &args) { dans l'ordre suivant : options connues puis inconnues, fichiers de types projet puis element. */ -QList QETArguments::arguments() const { +QList QETArguments::arguments() const +{ return(options_ + unknown_options_ + project_files_ + element_files_ + tbt_files_); } @@ -125,49 +127,56 @@ QList QETArguments::arguments() const { @return tous les fichiers (projets et elements) passes en parametres. Les fichiers de type projet viennent avant les fichiers de type element. */ -QList QETArguments::files() const { +QList QETArguments::files() const +{ return(project_files_ + element_files_ + tbt_files_); } /** @return les fichiers de type projet */ -QList QETArguments::projectFiles() const { +QList QETArguments::projectFiles() const +{ return(project_files_); } /** @return les fichiers de type element */ -QList QETArguments::elementFiles() const { +QList QETArguments::elementFiles() const +{ return(element_files_); } /** @return title block template files */ -QList QETArguments::titleBlockTemplateFiles() const { +QList QETArguments::titleBlockTemplateFiles() const +{ return(tbt_files_); } /** @return les options reconnues */ -QList QETArguments::options() const { +QList QETArguments::options() const +{ return(options_); } /** @return les options non reconnues */ -QList QETArguments::unknownOptions() const { +QList QETArguments::unknownOptions() const +{ return(unknown_options_); } /** Oublie tous les arguments de cet objet */ -void QETArguments::clear() { +void QETArguments::clear() +{ project_files_.clear(); element_files_.clear(); options_.clear(); @@ -290,7 +299,8 @@ void QETArguments::handleOptionArgument(const QString &option) { @return true si l'utilisateur a specifie un dossier pour la collection commune. */ -bool QETArguments::commonElementsDirSpecified() const { +bool QETArguments::commonElementsDirSpecified() const +{ return(!common_elements_dir_.isEmpty()); } @@ -298,7 +308,8 @@ bool QETArguments::commonElementsDirSpecified() const { @return le dossier de la collection commune specifie par l'utilisateur. Si l'utilisateur n'en a pas specifie, une chaine vide est retournee. */ -QString QETArguments::commonElementsDir() const { +QString QETArguments::commonElementsDir() const +{ return(common_elements_dir_); } #endif @@ -308,7 +319,8 @@ QString QETArguments::commonElementsDir() const { @return true if the user has specified a directory for the common title block templates collection */ -bool QETArguments::commonTitleBlockTemplatesDirSpecified() const { +bool QETArguments::commonTitleBlockTemplatesDirSpecified() const +{ return(!common_tbt_dir_.isEmpty()); } @@ -316,7 +328,8 @@ bool QETArguments::commonTitleBlockTemplatesDirSpecified() const { @return the directory of the common title block templates collection specified by the user. If none were specified, return an empty string. */ -QString QETArguments::commonTitleBlockTemplatesDir() const { +QString QETArguments::commonTitleBlockTemplatesDir() const +{ return(common_tbt_dir_); } #endif @@ -325,7 +338,8 @@ QString QETArguments::commonTitleBlockTemplatesDir() const { /** @return true si l'utilisateur a specifie un dossier pour la configuration. */ -bool QETArguments::configDirSpecified() const { +bool QETArguments::configDirSpecified() const +{ return(!config_dir_.isEmpty()); } @@ -333,7 +347,8 @@ bool QETArguments::configDirSpecified() const { @return le dossier de configuration specifie par l'utilisateur. Si l'utilisateur n'en a pas specifie, une chaine vide est retournee. */ -QString QETArguments::configDir() const { +QString QETArguments::configDir() const +{ return(config_dir_); } #endif @@ -341,7 +356,8 @@ QString QETArguments::configDir() const { /** @return true si l'utilisateur a specifie un dossier pour les fichiers de langue */ -bool QETArguments::langDirSpecified() const { +bool QETArguments::langDirSpecified() const +{ return(!lang_dir_.isEmpty()); } @@ -349,7 +365,8 @@ bool QETArguments::langDirSpecified() const { @return le dossier de langue specifie par l'utilisateur. Si l'utilisateur n'en a pas specifie, une chaine vide est retournee. */ -QString QETArguments::langDir() const { +QString QETArguments::langDir() const +{ return(lang_dir_); } @@ -357,7 +374,8 @@ QString QETArguments::langDir() const { @return true si les arguments comportent une demande d'affichage de l'aide, false sinon */ -bool QETArguments::printHelpRequested() const { +bool QETArguments::printHelpRequested() const +{ return(print_help_); } @@ -365,7 +383,8 @@ bool QETArguments::printHelpRequested() const { @return true si les arguments comportent une demande d'affichage de la licence, false sinon */ -bool QETArguments::printLicenseRequested() const { +bool QETArguments::printLicenseRequested() const +{ return(print_license_); } @@ -373,6 +392,7 @@ bool QETArguments::printLicenseRequested() const { @return true si les arguments comportent une demande d'affichage de la version, false sinon */ -bool QETArguments::printVersionRequested() const { +bool QETArguments::printVersionRequested() const +{ return(print_version_); } diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index d8011c349..19d9b2e28 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -106,8 +106,14 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : setMinimumSize(QSize(500, 350)); setWindowState(Qt::WindowMaximized); - connect (&m_workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(subWindowActivated(QMdiSubWindow*))); - connect (QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slot_updatePasteAction())); + connect (&m_workspace, + SIGNAL(subWindowActivated(QMdiSubWindow *)), + this, + SLOT(subWindowActivated(QMdiSubWindow*))); + connect (QApplication::clipboard(), + SIGNAL(dataChanged()), + this, + SLOT(slot_updatePasteAction())); readSettings(); show(); @@ -128,14 +134,16 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : /** Destructeur */ -QETDiagramEditor::~QETDiagramEditor() { +QETDiagramEditor::~QETDiagramEditor() +{ } /** @brief QETDiagramEditor::setUpElementsPanel Setup the element panel and element panel widget */ -void QETDiagramEditor::setUpElementsPanel() { +void QETDiagramEditor::setUpElementsPanel() +{ //Add the element panel as a QDockWidget qdw_pa = new QDockWidget(tr("Projets", "dock title"), this); @@ -184,7 +192,8 @@ void QETDiagramEditor::setUpElementsCollectionWidget() @brief QETDiagramEditor::setUpUndoStack Setup the undostack and undo stack widget */ -void QETDiagramEditor::setUpUndoStack() { +void QETDiagramEditor::setUpUndoStack() +{ QUndoView *undo_view = new QUndoView(&undo_group, this); @@ -498,10 +507,10 @@ void QETDiagramEditor::setUpActions() m_close_file ->setShortcut(QKeySequence::Close); m_save_file ->setShortcut(QKeySequence::Save); - new_file ->setStatusTip( tr("Crée un nouveau projet", "status bar tip") ); - open_file ->setStatusTip( tr("Ouvre un projet existant", "status bar tip") ); - m_close_file ->setStatusTip( tr("Ferme le projet courant", "status bar tip") ); - m_save_file ->setStatusTip( tr("Enregistre le projet courant et tous ses folios", "status bar tip") ); + new_file ->setStatusTip( tr("Crée un nouveau projet", "status bar tip") ); + open_file ->setStatusTip( tr("Ouvre un projet existant", "status bar tip") ); + m_close_file ->setStatusTip( tr("Ferme le projet courant", "status bar tip") ); + m_save_file ->setStatusTip( tr("Enregistre le projet courant et tous ses folios", "status bar tip") ); m_save_file_as ->setStatusTip( tr("Enregistre le projet courant avec un autre nom de fichier", "status bar tip") ); connect(m_save_file_as, &QAction::triggered, this, &QETDiagramEditor::saveAs); @@ -568,8 +577,8 @@ void QETDiagramEditor::setUpActions() select_nothing->setShortcut(QKeySequence::Deselect); select_invert ->setShortcut(QKeySequence( tr("Ctrl+I"))); - select_all ->setStatusTip( tr("Sélectionne tous les éléments du folio", "status bar tip") ); - select_nothing->setStatusTip( tr("Désélectionne tous les éléments du folio", "status bar tip") ); + select_all ->setStatusTip( tr("Sélectionne tous les éléments du folio", "status bar tip") ); + select_nothing->setStatusTip( tr("Désélectionne tous les éléments du folio", "status bar tip") ); select_invert ->setStatusTip( tr("Désélectionne les éléments sélectionnés et sélectionne les éléments non sélectionnés", "status bar tip") ); select_all ->setData("select_all"); @@ -711,7 +720,8 @@ void QETDiagramEditor::setUpToolBar() /** @brief QETDiagramEditor::setUpMenu */ -void QETDiagramEditor::setUpMenu() { +void QETDiagramEditor::setUpMenu() +{ QMenu *menu_fichier = new QMenu(tr("&Fichier")); QMenu *menu_edition = new QMenu(tr("&Édition")); @@ -729,7 +739,8 @@ void QETDiagramEditor::setUpMenu() { // File menu QMenu *recentfile = menu_fichier -> addMenu(QET::Icons::DocumentOpenRecent, tr("&Récemment ouverts")); recentfile->addActions(QETApp::projectsRecentFiles()->menu()->actions()); - connect(QETApp::projectsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)), this, SLOT(openRecentFile(const QString &))); + connect(QETApp::projectsRecentFiles(), SIGNAL(fileOpeningRequested(const QString &)), + this, SLOT(openRecentFile(const QString &))); menu_fichier -> addActions(m_file_actions_group.actions()); menu_fichier -> addSeparator(); //menu_fichier -> addAction(import_diagram); @@ -804,7 +815,8 @@ void QETDiagramEditor::setUpMenu() { Permet de quitter l'application lors de la fermeture de la fenetre principale @param qce Le QCloseEvent correspondant a l'evenement de fermeture */ -void QETDiagramEditor::closeEvent(QCloseEvent *qce) { +void QETDiagramEditor::closeEvent(QCloseEvent *qce) +{ // quitte directement s'il n'y a aucun projet ouvert bool can_quit = true; if (openedProjects().count()) { @@ -850,7 +862,8 @@ bool QETDiagramEditor::event(QEvent *e) @brief QETDiagramEditor::save Ask the current active project to save */ -void QETDiagramEditor::save() { +void QETDiagramEditor::save() +{ if (ProjectView *project_view = currentProjectView()) { QETResult saved = project_view -> save(); @@ -874,7 +887,8 @@ void QETDiagramEditor::save() { @brief QETDiagramEditor::saveAs Ask the current active project to save as */ -void QETDiagramEditor::saveAs() { +void QETDiagramEditor::saveAs() +{ if (ProjectView *project_view = currentProjectView()) { QETResult save_file = project_view -> saveAs(); if (save_file.isOk()) { @@ -914,7 +928,8 @@ bool QETDiagramEditor::newProject() @param filepath Fichier a ouvrir @see openAndAddDiagram */ -bool QETDiagramEditor::openRecentFile(const QString &filepath) { +bool QETDiagramEditor::openRecentFile(const QString &filepath) +{ // small hack to prevent all diagram editors from trying to topen the required // recent file at the same time if (qApp -> activeWindow() != this) return(false); @@ -925,7 +940,8 @@ bool QETDiagramEditor::openRecentFile(const QString &filepath) { Cette fonction demande un nom de fichier a ouvrir a l'utilisateur @return true si l'ouverture a reussi, false sinon */ -bool QETDiagramEditor::openProject() { +bool QETDiagramEditor::openProject() +{ // demande un chemin de fichier a ouvrir a l'utilisateur QString filepath = QFileDialog::getOpenFileName( this, @@ -948,7 +964,8 @@ bool QETDiagramEditor::openProject() { @return true si la fermeture du projet a reussi, false sinon Note : cette methode renvoie true si project est nul */ -bool QETDiagramEditor::closeProject(ProjectView *project_view) { +bool QETDiagramEditor::closeProject(ProjectView *project_view) +{ if (project_view) { activateProject(project_view); if (QMdiSubWindow *sub_window = subWindowForWidget(project_view)){ @@ -964,7 +981,8 @@ bool QETDiagramEditor::closeProject(ProjectView *project_view) { @return true si la fermeture du fichier a reussi, false sinon Note : cette methode renvoie true si project est nul */ -bool QETDiagramEditor::closeProject(QETProject *project) { +bool QETDiagramEditor::closeProject(QETProject *project) +{ if (ProjectView *project_view = findProject(project)) { return(closeProject(project_view)); } @@ -977,13 +995,15 @@ bool QETDiagramEditor::closeProject(QETProject *project) { @param interactive true pour afficher des messages a l'utilisateur, false sinon @return true si l'ouverture a reussi, false sinon */ -bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interactive) +bool QETDiagramEditor::openAndAddProject( + const QString &filepath, + bool interactive) { if (filepath.isEmpty()) return(false); QFileInfo filepath_info(filepath); - //Check if project is not open in another editor + //Check if project is not open in another editor if (QETDiagramEditor *diagram_editor = QETApp::diagramEditorForFile(filepath)) { if (diagram_editor == this) @@ -1003,7 +1023,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti } } - // check the file exists + // check the file exists if (!filepath_info.exists()) { if (interactive) @@ -1019,8 +1039,8 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti } return(false); } - - //Check if file readable + + //Check if file readable if (!filepath_info.isReadable()) { if (interactive) { @@ -1035,7 +1055,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti return(false); } - //Check if file is read only + //Check if file is read only if (!filepath_info.isWritable()) { if (interactive) { @@ -1049,7 +1069,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti } } - //Create the project + //Create the project DialogWaiting::instance(this); QETProject *project = new QETProject(filepath); @@ -1086,10 +1106,11 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti @param update_panel Whether the elements panel should be warned this project has been added. Defaults to true. */ -bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) { +bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) +{ // enregistre le projet QETApp::registerProject(project); - + // cree un ProjectView pour visualiser le projet ProjectView *project_view = new ProjectView(project); addProjectView(project_view); @@ -1111,7 +1132,8 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) { /** @return la liste des projets ouverts dans cette fenetre */ -QList QETDiagramEditor::openedProjects() const { +QList QETDiagramEditor::openedProjects() const +{ QList result; QList window_list(m_workspace.subWindowList()); foreach(QMdiSubWindow *window, window_list) { @@ -1126,7 +1148,8 @@ QList QETDiagramEditor::openedProjects() const { @return Le projet actuellement edite (= qui a le focus dans l'interface MDI) ou 0 s'il n'y en a pas */ -ProjectView *QETDiagramEditor::currentProjectView() const { +ProjectView *QETDiagramEditor::currentProjectView() const +{ QMdiSubWindow *current_window = m_workspace.activeSubWindow(); if (!current_window) return(nullptr); @@ -1159,7 +1182,8 @@ QETProject *QETDiagramEditor::currentProject() const @return Le schema actuellement edite (= l'onglet ouvert dans le projet courant) ou 0 s'il n'y en a pas */ -DiagramView *QETDiagramEditor::currentDiagramView() const { +DiagramView *QETDiagramEditor::currentDiagramView() const +{ if (ProjectView *project_view = currentProjectView()) { return(project_view -> currentDiagram()); } @@ -1190,7 +1214,8 @@ Element *QETDiagramEditor::currentElement() const @param diagram_view Schema dont il faut retrouver @return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas */ -ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const { +ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const +{ foreach(ProjectView *project_view, openedProjects()) { if (project_view -> diagram_views().contains(diagram_view)) { return(project_view); @@ -1204,7 +1229,8 @@ ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const { @param diagram Schema dont il faut retrouver @return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas */ -ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const { +ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const +{ foreach(ProjectView *project_view, openedProjects()) { foreach(DiagramView *diagram_view, project_view -> diagram_views()) { if (diagram_view -> diagram() == diagram) { @@ -1219,7 +1245,8 @@ ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const { @param project Projet dont il faut trouver la vue @return la vue du projet passe en parametre */ -ProjectView *QETDiagramEditor::findProject(QETProject *project) const { +ProjectView *QETDiagramEditor::findProject(QETProject *project) const +{ foreach(ProjectView *opened_project, openedProjects()) { if (opened_project -> project() == project) { return(opened_project); @@ -1233,7 +1260,8 @@ ProjectView *QETDiagramEditor::findProject(QETProject *project) const { @return le ProjectView correspondant au chemin passe en parametre, ou 0 si celui-ci n'a pas ete trouve */ -ProjectView *QETDiagramEditor::findProject(const QString &filepath) const { +ProjectView *QETDiagramEditor::findProject(const QString &filepath) const +{ foreach(ProjectView *opened_project, openedProjects()) { if (QETProject *project = opened_project -> project()) { if (project -> filePath() == filepath) { @@ -1249,7 +1277,8 @@ ProjectView *QETDiagramEditor::findProject(const QString &filepath) const { @return La sous-fenetre accueillant le widget passe en parametre, ou 0 si celui-ci n'a pas ete trouve. */ -QMdiSubWindow *QETDiagramEditor::subWindowForWidget(QWidget *widget) const { +QMdiSubWindow *QETDiagramEditor::subWindowForWidget(QWidget *widget) const +{ foreach(QMdiSubWindow *sub_window, m_workspace.subWindowList()) { if (sub_window -> widget() == widget) { return(sub_window); @@ -1470,7 +1499,8 @@ void QETDiagramEditor::slot_updateActions() @brief QETDiagramEditor::slot_updateAutoNumDock Update Auto Num Dock Widget when changing Project */ -void QETDiagramEditor::slot_updateAutoNumDock() { +void QETDiagramEditor::slot_updateAutoNumDock() +{ if ( m_workspace.subWindowList().indexOf(m_workspace.activeSubWindow()) != activeSubWindowIndex) { activeSubWindowIndex = m_workspace.subWindowList().indexOf(m_workspace.activeSubWindow()); if (currentProjectView() != nullptr && currentDiagramView() != nullptr) { @@ -1543,7 +1573,7 @@ void QETDiagramEditor::slot_updateComplexActions() for(DiagramTextItem *dti : texts) { if(dti->type() == ConductorTextItem::Type) - selected_conductor_texts++; + selected_conductor_texts++; } int selected_dynamic_elmt_text = 0; for(DiagramTextItem *dti : texts) @@ -1672,7 +1702,8 @@ void QETDiagramEditor::slot_updateModeActions() @brief QETDiagramEditor::slot_updatePasteAction Gere les actions ayant besoin du presse-papier */ -void QETDiagramEditor::slot_updatePasteAction() { +void QETDiagramEditor::slot_updatePasteAction() +{ DiagramView *dv = currentDiagramView(); bool editable_diagram = (dv && !dv -> diagram() -> isReadOnly()); @@ -1742,7 +1773,8 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) /** @return la liste des fichiers edites par cet editeur de schemas */ -QList QETDiagramEditor::editedFiles() const { +QList QETDiagramEditor::editedFiles() const +{ QList edited_files_list; foreach (ProjectView *project_view, openedProjects()) { QString diagram_file(project_view -> project() -> filePath()); @@ -1759,7 +1791,8 @@ QList QETDiagramEditor::editedFiles() const { @return le ProjectView editant le fichier filepath, ou 0 si ce fichier n'est pas edite par cet editeur de schemas. */ -ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const { +ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const +{ if (filepath.isEmpty()) return(nullptr); QString searched_can_file_path = QFileInfo(filepath).canonicalFilePath(); @@ -1780,7 +1813,8 @@ ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const { @brief QETDiagramEditor::drawGrid @return true if the grid of folio must be displayed */ -bool QETDiagramEditor::drawGrid() const { +bool QETDiagramEditor::drawGrid() const +{ return m_draw_grid->isChecked(); } @@ -1800,9 +1834,12 @@ void QETDiagramEditor::openBackupFiles(QList backup_files) { if (project -> state() != QETProject::FileOpenDiscard) { - QET::QetMessageBox::warning(this, tr("Échec de l'ouverture du projet", "message box title"), - QString(tr("Une erreur est survenue lors de l'ouverture du fichier %1.", - "message box content")).arg(file->managedFile().fileName())); + QET::QetMessageBox::warning( + this, + tr("Échec de l'ouverture du projet", "message box title"), + QString(tr( + "Une erreur est survenue lors de l'ouverture du fichier %1.", + "message box content")).arg(file->managedFile().fileName())); } delete project; DialogWaiting::dropInstance(); @@ -1815,7 +1852,8 @@ void QETDiagramEditor::openBackupFiles(QList backup_files) /** met a jour le menu "Fenetres" */ -void QETDiagramEditor::slot_updateWindowsMenu() { +void QETDiagramEditor::slot_updateWindowsMenu() +{ // nettoyage du menu foreach(QAction *a, windows_menu -> actions()) windows_menu -> removeAction(a); @@ -1859,7 +1897,8 @@ void QETDiagramEditor::slot_updateWindowsMenu() { Edite les proprietes du schema diagram @param diagram_view schema dont il faut editer les proprietes */ -void QETDiagramEditor::editDiagramProperties(DiagramView *diagram_view) { +void QETDiagramEditor::editDiagramProperties(DiagramView *diagram_view) +{ if (ProjectView *project_view = findProject(diagram_view)) { activateProject(project_view); project_view -> editDiagramProperties(diagram_view); @@ -1870,7 +1909,8 @@ void QETDiagramEditor::editDiagramProperties(DiagramView *diagram_view) { Edite les proprietes du schema diagram @param diagram schema dont il faut editer les proprietes */ -void QETDiagramEditor::editDiagramProperties(Diagram *diagram) { +void QETDiagramEditor::editDiagramProperties(Diagram *diagram) +{ if (ProjectView *project_view = findProject(diagram)) { activateProject(project_view); project_view -> editDiagramProperties(diagram); @@ -1880,7 +1920,8 @@ void QETDiagramEditor::editDiagramProperties(Diagram *diagram) { /** Affiche les projets dans des fenetres. */ -void QETDiagramEditor::setWindowedMode() { +void QETDiagramEditor::setWindowedMode() +{ m_workspace.setViewMode(QMdiArea::SubWindowView); m_windowed_view_mode -> setChecked(true); slot_updateWindowsMenu(); @@ -1889,7 +1930,8 @@ void QETDiagramEditor::setWindowedMode() { /** Affiche les projets dans des onglets. */ -void QETDiagramEditor::setTabbedMode() { +void QETDiagramEditor::setTabbedMode() +{ m_workspace.setViewMode(QMdiArea::TabbedView); m_tabbed_view_mode -> setChecked(true); slot_updateWindowsMenu(); @@ -1935,7 +1977,8 @@ void QETDiagramEditor::writeSettings() Active le schema passe en parametre @param diagram Schema a activer */ -void QETDiagramEditor::activateDiagram(Diagram *diagram) { +void QETDiagramEditor::activateDiagram(Diagram *diagram) +{ if (QETProject *project = diagram -> project()) { if (ProjectView *project_view = findProject(project)) { activateWidget(project_view); @@ -1950,7 +1993,8 @@ void QETDiagramEditor::activateDiagram(Diagram *diagram) { Active le projet passe en parametre @param project Projet a activer */ -void QETDiagramEditor::activateProject(QETProject *project) { +void QETDiagramEditor::activateProject(QETProject *project) +{ activateProject(findProject(project)); } @@ -1958,12 +2002,14 @@ void QETDiagramEditor::activateProject(QETProject *project) { Active le projet passe en parametre @param project_view Projet a activer */ -void QETDiagramEditor::activateProject(ProjectView *project_view) { +void QETDiagramEditor::activateProject(ProjectView *project_view) +{ if (!project_view) return; activateWidget(project_view); } -/*** @brief QETDiagramEditor::projectWasClosed +/** + @brief QETDiagramEditor::projectWasClosed Manage the close of a project. @param project_view */ @@ -1976,11 +2022,11 @@ void QETDiagramEditor::projectWasClosed(ProjectView *project_view) m_element_collection_widget->removeProject(project); undo_group.removeStack(project -> undoStack()); QETApp::unregisterProject(project); - } - //When project is closed, a lot of signal are emited, notably if there is an item selected in a diagram. - //In some special case, since signal/slot connection can be direct or queued, some signal are handled after QObject is deleted, and crash qet - //notably in the function Diagram::elements when she call items() (I don't know exactly why). - //set nullptr to "m_selection_properties_editor->setDiagram()" fix this crash + } + //When project is closed, a lot of signal are emited, notably if there is an item selected in a diagram. + //In some special case, since signal/slot connection can be direct or queued, some signal are handled after QObject is deleted, and crash qet + //notably in the function Diagram::elements when she call items() (I don't know exactly why). + //set nullptr to "m_selection_properties_editor->setDiagram()" fix this crash m_selection_properties_editor->setDiagram(nullptr); project_view -> deleteLater(); project -> deleteLater(); @@ -1990,7 +2036,8 @@ void QETDiagramEditor::projectWasClosed(ProjectView *project_view) Edite les proprietes du projet project_view. @param project_view Vue sur le projet dont il faut editer les proprietes */ -void QETDiagramEditor::editProjectProperties(ProjectView *project_view) { +void QETDiagramEditor::editProjectProperties(ProjectView *project_view) +{ if (!project_view) return; activateProject(project_view); project_view -> editProjectProperties(); @@ -2000,7 +2047,8 @@ void QETDiagramEditor::editProjectProperties(ProjectView *project_view) { Edite les proprietes du projet project. @param project Projet dont il faut editer les proprietes */ -void QETDiagramEditor::editProjectProperties(QETProject *project) { +void QETDiagramEditor::editProjectProperties(QETProject *project) +{ editProjectProperties(findProject(project)); } @@ -2026,7 +2074,8 @@ void QETDiagramEditor::addDiagramToProject(QETProject *project) Supprime un schema de son projet @param diagram Schema a supprimer */ -void QETDiagramEditor::removeDiagram(Diagram *diagram) { +void QETDiagramEditor::removeDiagram(Diagram *diagram) +{ if (!diagram) return; // recupere le projet contenant le schema @@ -2048,7 +2097,8 @@ void QETDiagramEditor::removeDiagram(Diagram *diagram) { la gauche @param diagram Schema a decaler vers le haut / la gauche */ -void QETDiagramEditor::moveDiagramUp(Diagram *diagram) { +void QETDiagramEditor::moveDiagramUp(Diagram *diagram) +{ if (!diagram) return; // recupere le projet contenant le schema @@ -2067,7 +2117,8 @@ void QETDiagramEditor::moveDiagramUp(Diagram *diagram) { la droite @param diagram Schema a decaler vers le bas / la droite */ -void QETDiagramEditor::moveDiagramDown(Diagram *diagram) { +void QETDiagramEditor::moveDiagramDown(Diagram *diagram) +{ if (!diagram) return; // recupere le projet contenant le schema @@ -2086,7 +2137,8 @@ void QETDiagramEditor::moveDiagramDown(Diagram *diagram) { la gauche en position 0 @param diagram Schema a decaler vers le haut / la gauche en position 0 */ -void QETDiagramEditor::moveDiagramUpTop(Diagram *diagram) { +void QETDiagramEditor::moveDiagramUpTop(Diagram *diagram) +{ if (!diagram) return; // recupere le projet contenant le schema @@ -2106,7 +2158,8 @@ void QETDiagramEditor::moveDiagramUpTop(Diagram *diagram) { la gauche x10 @param diagram Schema a decaler vers le haut / la gauche x10 */ -void QETDiagramEditor::moveDiagramUpx10(Diagram *diagram) { +void QETDiagramEditor::moveDiagramUpx10(Diagram *diagram) +{ if (!diagram) return; // recupere le projet contenant le schema @@ -2125,7 +2178,8 @@ void QETDiagramEditor::moveDiagramUpx10(Diagram *diagram) { la droite x10 @param diagram Schema a decaler vers le bas / la droite x10 */ -void QETDiagramEditor::moveDiagramDownx10(Diagram *diagram) { +void QETDiagramEditor::moveDiagramDownx10(Diagram *diagram) +{ if (!diagram) return; // recupere le projet contenant le schema @@ -2139,7 +2193,8 @@ void QETDiagramEditor::moveDiagramDownx10(Diagram *diagram) { } } -void QETDiagramEditor::reloadOldElementPanel() { +void QETDiagramEditor::reloadOldElementPanel() +{ pa->reloadAndFilter(); } @@ -2187,7 +2242,8 @@ void QETDiagramEditor::findElementInPanel(const ElementsLocation &location) Lance l'editeur d'element pour l'element filename @param location Emplacement de l'element a editer */ -void QETDiagramEditor::editElementInEditor(const ElementsLocation &location) { +void QETDiagramEditor::editElementInEditor(const ElementsLocation &location) +{ QETApp::instance() -> openElementLocations(QList() << location); } @@ -2196,7 +2252,8 @@ void QETDiagramEditor::editElementInEditor(const ElementsLocation &location) { Launch an element editor to edit the selected element in the current diagram view. */ -void QETDiagramEditor::editSelectedElementInEditor() { +void QETDiagramEditor::editSelectedElementInEditor() +{ if (Element *selected_element = currentElement()) { editElementInEditor(selected_element -> location()); } @@ -2205,7 +2262,8 @@ void QETDiagramEditor::editSelectedElementInEditor() { /** Show the error message contained in \a result. */ -void QETDiagramEditor::showError(const QETResult &result) { +void QETDiagramEditor::showError(const QETResult &result) +{ if (result.isOk()) return; showError(result.errorMessage()); } @@ -2213,7 +2271,8 @@ void QETDiagramEditor::showError(const QETResult &result) { /** Show the \a error message. */ -void QETDiagramEditor::showError(const QString &error) { +void QETDiagramEditor::showError(const QString &error) +{ if (error.isEmpty()) return; QET::QetMessageBox::critical(this, tr("Erreur", "message box title"), error); } diff --git a/sources/qetdiagrameditor.h b/sources/qetdiagrameditor.h index 73e28c0d8..12b4adc69 100644 --- a/sources/qetdiagrameditor.h +++ b/sources/qetdiagrameditor.h @@ -52,14 +52,10 @@ class QETDiagramEditor : public QETMainWindow Q_OBJECT public: - QETDiagramEditor(const QStringList & = QStringList(), - QWidget * = nullptr); + QETDiagramEditor( + const QStringList & = QStringList(), + QWidget * = nullptr); ~QETDiagramEditor() override; - - private: - QETDiagramEditor(const QETDiagramEditor &); - - public: void closeEvent (QCloseEvent *) override; QList openedProjects () const; void addProjectView (ProjectView *); @@ -73,8 +69,8 @@ class QETDiagramEditor : public QETMainWindow protected: bool event(QEvent *) override; - private: + QETDiagramEditor(const QETDiagramEditor &); void setUpElementsPanel (); void setUpElementsCollectionWidget(); void setUpUndoStack (); @@ -148,70 +144,78 @@ class QETDiagramEditor : public QETMainWindow void selectionChanged(); public: - QAction *m_edit_diagram_properties; ///< Show a dialog to edit diagram properties - QAction *m_conductor_reset; ///< Reset paths of selected conductors - QAction *m_cut; ///< Cut selection to clipboard - QAction *m_copy; ///< Copy selection to clipboard + QAction + *m_edit_diagram_properties, ///< Show a dialog to edit diagram properties + *m_conductor_reset, ///< Reset paths of selected conductors + *m_cut, ///< Cut selection to clipboard + *m_copy; ///< Copy selection to clipboard - QActionGroup m_row_column_actions_group; /// Action related to add/remove rows/column in diagram - QActionGroup m_selection_actions_group; ///Action related to edit a selected item - QActionGroup *m_depth_action_group = nullptr; + QActionGroup + m_row_column_actions_group, /// Action related to add/remove rows/column in diagram + m_selection_actions_group, ///Action related to edit a selected item + *m_depth_action_group = nullptr; private: - QActionGroup *grp_visu_sel; ///< Action group for visualisation vs edition mode - QActionGroup *m_group_view_mode; ///< Action group for project - QActionGroup m_add_item_actions_group; ///Action related to adding (add text image shape...) - QActionGroup m_zoom_actions_group; ///Action related to zoom for diagram - QActionGroup m_select_actions_group; ///Action related to global selections - QActionGroup m_file_actions_group; ///Actions related to file (open, close, save...) + QActionGroup + *grp_visu_sel, ///< Action group for visualisation vs edition mode + *m_group_view_mode, ///< Action group for project + m_add_item_actions_group, ///Action related to adding (add text image shape...) + m_zoom_actions_group, ///Action related to zoom for diagram + m_select_actions_group, ///Action related to global selections + m_file_actions_group; ///Actions related to file (open, close, save...) - QAction *m_tabbed_view_mode; ///< Display projects as tabs - QAction *m_windowed_view_mode; ///< Display projects as windows - QAction *m_mode_selection; ///< Set edition mode - QAction *m_mode_visualise; ///< Set visualisation mode - QAction *m_export_diagram; ///< Export diagrams of the current project as imagess - QAction *m_print; ///< Print diagrams of the current project - QAction *m_quit_editor; ///< Quit the diagram editor - QAction *undo; ///< Cancel the latest action - QAction *redo; ///< Redo the latest cancelled operation - QAction *m_paste; ///< Paste clipboard content on the current diagram - QAction *m_auto_conductor; ///< Enable/Disable the use of auto conductor - QAction *conductor_default; ///< Show a dialog to edit default conductor properties - QAction *m_grey_background; ///< Switch the background color in white or grey - QAction *m_draw_grid; ///< Switch the background grid display or not - QAction *m_project_edit_properties; ///< Edit the properties of the current project. - QAction *m_project_add_diagram; ///< Add a diagram to the current project. - QAction *m_remove_diagram_from_project; ///< Delete a diagram from the current project - QAction *m_clean_project; ///< Clean the content of the curent project by removing useless items - QAction *m_project_folio_list; ///< Sommaire des schemas - QAction *m_csv_export; ///< generate nomenclature - QAction *m_add_nomenclature; ///< Add nomenclature graphics item; - QAction *m_add_summary; /// m_zoom_action_toolBar; ///Only zoom action must displayed in the toolbar - QAction *m_delete_selection; ///< Delete selection - QAction *m_rotate_selection; ///< Rotate selected elements and text items by 90 degrees - QAction *m_rotate_texts; ///< Direct selected text items to a specific angle - QAction *m_find_element; ///< Find the selected element in the panel - QAction *m_group_selected_texts = nullptr; - QAction *m_close_file; ///< Close current project file - QAction *m_save_file; ///< Save current project - QAction *m_save_file_as; ///< Save current project as a specific file - QAction *m_find = nullptr; QMdiArea m_workspace; QSignalMapper windowMapper; QDir open_dialog_dir; /// Directory to use for file dialogs such as File > save - QDockWidget *qdw_pa; /// Dock for the elements panel - QDockWidget *m_qdw_elmt_collection; - QDockWidget *qdw_undo; /// Dock for the undo list + + QDockWidget + *qdw_pa, /// Dock for the elements panel + *m_qdw_elmt_collection, + *qdw_undo; /// Dock for the undo list + ElementsCollectionWidget *m_element_collection_widget; DiagramPropertiesEditorDockWidget *m_selection_properties_editor; @@ -219,11 +223,12 @@ class QETDiagramEditor : public QETMainWindow ElementsPanelWidget *pa; QMenu *windows_menu; - QToolBar *main_tool_bar = nullptr, - *view_tool_bar = nullptr, - *diagram_tool_bar = nullptr, - *m_add_item_tool_bar = nullptr, - *m_depth_tool_bar = nullptr; + QToolBar + *main_tool_bar = nullptr, + *view_tool_bar = nullptr, + *diagram_tool_bar = nullptr, + *m_add_item_tool_bar = nullptr, + *m_depth_tool_bar = nullptr; QUndoGroup undo_group; AutoNumberingDockWidget *m_autonumbering_dock; diff --git a/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp b/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp index 620006624..67f9d47a9 100644 --- a/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp +++ b/sources/qetgraphicsitem/ViewItem/projectdbmodel.cpp @@ -215,11 +215,13 @@ void ProjectDBModel::setQuery(const QString &query) @brief ProjectDBModel::queryString @return the current query used by this model */ -QString ProjectDBModel::queryString() const { +QString ProjectDBModel::queryString() const +{ return m_query; } -QETProject *ProjectDBModel::project() const { +QETProject *ProjectDBModel::project() const +{ return m_project.data(); } diff --git a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp index 44feeca0b..8d8664401 100644 --- a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp +++ b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp @@ -34,11 +34,13 @@ @param table @param parent */ -GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(QetGraphicsTableItem *table, QWidget *parent) : +GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor( + QetGraphicsTableItem *table, + QWidget *parent) : PropertiesEditorWidget(parent), - ui(new Ui::GraphicsTablePropertiesEditor) + ui(new Ui::GraphicsTablePropertiesEditor) { - ui->setupUi(this); + ui->setupUi(this); m_header_button_group = new QButtonGroup(this); m_header_button_group->addButton(ui->m_header_align_left_rb, Qt::AlignLeft); m_header_button_group->addButton(ui->m_header_align_center_rb, Qt::AlignHCenter); @@ -59,7 +61,8 @@ GraphicsTablePropertiesEditor::GraphicsTablePropertiesEditor(QetGraphicsTableIte /** @brief GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor */ -GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor() { +GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor() +{ delete ui; } @@ -84,8 +87,14 @@ void GraphicsTablePropertiesEditor::setTable(QetGraphicsTableItem *table) m_table_item = table; m_connect_list.clear(); - m_connect_list << connect(m_table_item.data(), &QetGraphicsTableItem::xChanged, this, &GraphicsTablePropertiesEditor::updateUi); - m_connect_list << connect(m_table_item.data(), &QetGraphicsTableItem::yChanged, this, &GraphicsTablePropertiesEditor::updateUi); + m_connect_list << connect(m_table_item.data(), + &QetGraphicsTableItem::xChanged, + this, + &GraphicsTablePropertiesEditor::updateUi); + m_connect_list << connect(m_table_item.data(), + &QetGraphicsTableItem::yChanged, + this, + &GraphicsTablePropertiesEditor::updateUi); if (auto editor = PropertiesEditorFactory::propertiesEditor(table->model(), this)) @@ -121,63 +130,103 @@ QUndoCommand *GraphicsTablePropertiesEditor::associatedUndo() const if (m_live_edit) { if (!qFuzzyCompare(ui->m_x_pos->value(), m_table_item->pos().x())) { - auto undo = new QPropertyUndoCommand(m_table_item.data(), "x", m_table_item->pos().x(), ui->m_x_pos->value()); + auto undo = new QPropertyUndoCommand( + m_table_item.data(), + "x", + m_table_item->pos().x(), + ui->m_x_pos->value()); undo->setAnimated(true, false); undo->setText(tr("Déplacer un tableau")); return undo; } if (!qFuzzyCompare(ui->m_y_pos->value(), m_table_item->pos().y())) { - auto undo = new QPropertyUndoCommand(m_table_item.data(), "y", m_table_item->pos().y(), ui->m_y_pos->value()); + auto undo = new QPropertyUndoCommand( + m_table_item.data(), + "y", + m_table_item->pos().y(), + ui->m_y_pos->value()); undo->setAnimated(true, false); undo->setText(tr("Déplacer un tableau")); return undo; } if (ui->m_display_n_row_sb->value() != m_table_item->displayNRow()) { - auto undo = new QPropertyUndoCommand(m_table_item.data(), "displayNRow", m_table_item->displayNRow(), ui->m_display_n_row_sb->value()); + auto undo = new QPropertyUndoCommand( + m_table_item.data(), + "displayNRow", + m_table_item->displayNRow(), + ui->m_display_n_row_sb->value()); undo->setText(tr("Modifier le nombre de ligne affiché par un tableau")); return undo; } - QMargins edited_header_margins(ui->m_header_left_margin->value(), - ui->m_header_top_margin->value(), - ui->m_header_right_margin->value(), - ui->m_header_bottom_margin->value()); - auto model_header_margins = QETUtils::marginsFromString(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::UserRole+1).toString()); + QMargins edited_header_margins( + ui->m_header_left_margin->value(), + ui->m_header_top_margin->value(), + ui->m_header_right_margin->value(), + ui->m_header_bottom_margin->value()); + auto model_header_margins = QETUtils::marginsFromString( + m_table_item->model()->headerData( + 0, + Qt::Horizontal, + Qt::UserRole+1).toString()); if (edited_header_margins != model_header_margins) { auto undo = new ModelHeaderDataCommand(m_table_item->model()); - undo->setData(0, Qt::Horizontal, QETUtils::marginsToString(edited_header_margins), Qt::UserRole+1); + undo->setData( + 0, + Qt::Horizontal, + QETUtils::marginsToString(edited_header_margins), + Qt::UserRole+1); undo->setText(tr("Modifier les marges d'une en tête de tableau")); return undo; } - QMargins edited_table_margins(ui->m_table_left_margin->value(), - ui->m_table_top_margin->value(), - ui->m_table_right_margin->value(), - ui->m_table_bottom_margin->value()); - auto model_margins = QETUtils::marginsFromString(m_table_item->model()->index(0,0).data(Qt::UserRole+1).toString()); + QMargins edited_table_margins( + ui->m_table_left_margin->value(), + ui->m_table_top_margin->value(), + ui->m_table_right_margin->value(), + ui->m_table_bottom_margin->value()); + auto model_margins = QETUtils::marginsFromString( + m_table_item->model()->index(0,0).data(Qt::UserRole+1).toString()); if (edited_table_margins != model_margins) { - auto undo = new ModelIndexCommand(m_table_item->model(), m_table_item->model()->index(0,0)); - undo->setData(QETUtils::marginsToString(edited_table_margins), Qt::UserRole+1); + auto undo = new ModelIndexCommand( + m_table_item->model(), + m_table_item->model()->index(0,0)); + undo->setData( + QETUtils::marginsToString(edited_table_margins), + Qt::UserRole+1); undo->setText(tr("Modifier les marges d'un tableau")); return undo; } - if (m_header_button_group->checkedId() != m_table_item->model()->headerData(0, Qt::Horizontal, Qt::TextAlignmentRole).toInt()) + if (m_header_button_group->checkedId() + != m_table_item->model()->headerData( + 0, + Qt::Horizontal, + Qt::TextAlignmentRole).toInt()) { auto undo = new ModelHeaderDataCommand(m_table_item->model()); - undo->setData(0, Qt::Horizontal, m_header_button_group->checkedId(), Qt::TextAlignmentRole); + undo->setData( + 0, + Qt::Horizontal, + m_header_button_group->checkedId(), + Qt::TextAlignmentRole); undo->setText(tr("Modifier l'alignement d'une en tête de tableau")); return undo; } - if (m_table_button_group->checkedId() != m_table_item->model()->index(0,0).data(Qt::TextAlignmentRole).toInt()) + if (m_table_button_group->checkedId() + != m_table_item->model()->index(0,0).data(Qt::TextAlignmentRole).toInt()) { - auto undo = new ModelIndexCommand(m_table_item->model(), m_table_item->model()->index(0,0)); - undo->setData(m_table_button_group->checkedId(), Qt::TextAlignmentRole); + auto undo = new ModelIndexCommand( + m_table_item->model(), + m_table_item->model()->index(0,0)); + undo->setData( + m_table_button_group->checkedId(), + Qt::TextAlignmentRole); undo->setText(tr("Modifier l'alignement des textes d'un tableau")); return undo; } @@ -205,13 +254,21 @@ void GraphicsTablePropertiesEditor::on_m_header_font_pb_clicked() if (m_table_item && m_table_item->model()) { bool ok; - auto font = QFontDialog::getFont(&ok, - m_table_item->model()->headerData(0, Qt::Horizontal, Qt::FontRole).value(), - this); + auto font = QFontDialog::getFont( + &ok, + m_table_item->model()->headerData( + 0, + Qt::Horizontal, + Qt::FontRole).value(), + this); if (ok && m_table_item->model()) { auto undo = new ModelHeaderDataCommand(m_table_item->model()); - undo->setData(0, Qt::Horizontal, QVariant::fromValue(font), Qt::FontRole); + undo->setData( + 0, + Qt::Horizontal, + QVariant::fromValue(font), + Qt::FontRole); undo->setText(tr("Modifier la police d'une en tête de tableau")); m_table_item->diagram()->undoStack().push(undo); } @@ -227,12 +284,15 @@ void GraphicsTablePropertiesEditor::on_m_table_font_pb_clicked() { bool ok; auto index = m_table_item->model()->index(0,0); - auto old_font = m_table_item->model()->data(index, Qt::FontRole).value(); + auto old_font = m_table_item->model()->data( + index, + Qt::FontRole).value(); auto new_font = QFontDialog::getFont(&ok, old_font, this); if (ok && m_table_item->diagram()) { - auto undo = new ModelIndexCommand(m_table_item->model(), index); + auto undo = new ModelIndexCommand( + m_table_item->model(), index); undo->setData(QVariant::fromValue(new_font), Qt::FontRole); undo->setText(tr("Changer la police d'un tableau")); m_table_item->diagram()->undoStack().push(undo); @@ -268,8 +328,12 @@ void GraphicsTablePropertiesEditor::updateUi() if (auto item_ = m_table_item->previousTable()) //Add the current previous table { m_other_table_vector.append(item_); - ui->m_previous_table_cb->addItem(item_->tableName(), m_other_table_vector.indexOf(item_)); - ui->m_previous_table_cb->setCurrentIndex(ui->m_previous_table_cb->findData(m_other_table_vector.indexOf(item_))); + ui->m_previous_table_cb->addItem( + item_->tableName(), + m_other_table_vector.indexOf(item_)); + ui->m_previous_table_cb->setCurrentIndex( + ui->m_previous_table_cb->findData( + m_other_table_vector.indexOf(item_))); } ElementProvider ep(m_table_item->diagram()->project()); @@ -279,19 +343,27 @@ void GraphicsTablePropertiesEditor::updateUi() item_->nextTable() == nullptr) { m_other_table_vector.append(item_); - ui->m_previous_table_cb->addItem(item_->tableName(), m_other_table_vector.indexOf(item_)); + ui->m_previous_table_cb->addItem( + item_->tableName(), + m_other_table_vector.indexOf(item_)); } } updateInfoLabel(); - auto margin = QETUtils::marginsFromString(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::UserRole+1).toString()); + auto margin = QETUtils::marginsFromString( + m_table_item->model()->headerData( + 0, + Qt::Horizontal, + Qt::UserRole+1).toString()); ui->m_header_top_margin ->setValue(margin.top()); ui->m_header_left_margin ->setValue(margin.left()); ui->m_header_right_margin ->setValue(margin.right()); ui->m_header_bottom_margin->setValue(margin.bottom()); - margin = QETUtils::marginsFromString(m_table_item->model()->index(0,0).data(Qt::UserRole+1).toString()); + margin = QETUtils::marginsFromString( + m_table_item->model()->index(0,0).data( + Qt::UserRole+1).toString()); ui->m_table_top_margin ->setValue(margin.top()); ui->m_table_left_margin ->setValue(margin.left()); ui->m_table_right_margin ->setValue(margin.right()); @@ -302,9 +374,16 @@ void GraphicsTablePropertiesEditor::updateUi() return; } - if (auto button = m_header_button_group->button(m_table_item->model()->headerData(0, Qt::Horizontal, Qt::TextAlignmentRole).toInt())) + if (auto button = m_header_button_group->button( + m_table_item->model()->headerData( + 0, + Qt::Horizontal, + Qt::TextAlignmentRole).toInt())) button->setChecked(true); - if (auto button = m_table_button_group->button(m_table_item->model()->data(m_table_item->model()->index(0,0), Qt::TextAlignmentRole).toInt())) + if (auto button = m_table_button_group->button( + m_table_item->model()->data( + m_table_item->model()->index(0,0), + Qt::TextAlignmentRole).toInt())) button->setChecked(true); setUpEditConnection(); @@ -378,7 +457,8 @@ void GraphicsTablePropertiesEditor::setUpEditConnection() } } -void GraphicsTablePropertiesEditor::on_m_table_name_le_textEdited(const QString &arg1) { +void GraphicsTablePropertiesEditor::on_m_table_name_le_textEdited(const QString &arg1) +{ m_table_item->setTableName(arg1); } @@ -387,7 +467,9 @@ void GraphicsTablePropertiesEditor::on_m_previous_table_cb_activated(int index) if (index == 0) { m_table_item->setPreviousTable(); } else { - m_table_item->setPreviousTable(m_other_table_vector.at(ui->m_previous_table_cb->currentData().toInt())); + m_table_item->setPreviousTable( + m_other_table_vector.at( + ui->m_previous_table_cb->currentData().toInt())); } } @@ -424,7 +506,10 @@ void GraphicsTablePropertiesEditor::on_m_auto_geometry_pb_clicked() */ void GraphicsTablePropertiesEditor::on_m_apply_geometry_to_linked_table_pb_clicked() { - if (m_table_item.isNull() || !m_table_item->diagram() || (!m_table_item->nextTable() && !m_table_item->previousTable())) { + if (m_table_item.isNull() + || !m_table_item->diagram() + || (!m_table_item->nextTable() + && !m_table_item->previousTable())) { return; } auto first_table = m_table_item; diff --git a/sources/qetgraphicsitem/ViewItem/ui/projectdbmodelpropertieswidget.cpp b/sources/qetgraphicsitem/ViewItem/ui/projectdbmodelpropertieswidget.cpp index 7f7d5b6bc..414a70a1c 100644 --- a/sources/qetgraphicsitem/ViewItem/ui/projectdbmodelpropertieswidget.cpp +++ b/sources/qetgraphicsitem/ViewItem/ui/projectdbmodelpropertieswidget.cpp @@ -29,27 +29,31 @@ @param model @param parent */ -ProjectDBModelPropertiesWidget::ProjectDBModelPropertiesWidget(ProjectDBModel *model, QWidget *parent) : +ProjectDBModelPropertiesWidget::ProjectDBModelPropertiesWidget( + ProjectDBModel *model, + QWidget *parent) : PropertiesEditorWidget(parent), ui(new Ui::ProjectDBModelPropertiesWidget) { - ui->setupUi(this); + ui->setupUi(this); setModel(model); } /** @brief projectDBModelPropertiesWidget::~projectDBModelPropertiesWidget */ -ProjectDBModelPropertiesWidget::~ProjectDBModelPropertiesWidget() { - delete ui; +ProjectDBModelPropertiesWidget::~ProjectDBModelPropertiesWidget() +{ + delete ui; } /** @brief projectDBModelPropertiesWidget::setModel @param model */ -void ProjectDBModelPropertiesWidget::setModel(ProjectDBModel *model) { - m_model = model; +void ProjectDBModelPropertiesWidget::setModel(ProjectDBModel *model) +{ + m_model = model; ui->m_edit_query_pb->setEnabled(m_model); ui->m_refresh_pb->setEnabled(m_model); } @@ -93,7 +97,8 @@ void ProjectDBModelPropertiesWidget::on_m_edit_query_pb_clicked() } } -void ProjectDBModelPropertiesWidget::on_m_refresh_pb_clicked() { +void ProjectDBModelPropertiesWidget::on_m_refresh_pb_clicked() +{ if (m_model && m_model->project()) { m_model->project()->dataBase()->updateDB(); } diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 804b6e651..2ae46197d 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -147,7 +147,8 @@ Conductor::~Conductor() @return true if conductor is valid else false; A non valid conductor, is a conductor without two terminal */ -bool Conductor::isValid() const { +bool Conductor::isValid() const +{ return m_valid; } @@ -288,7 +289,8 @@ QHash Conductor::shareOffsetBetweenSegments( const qreal &offset, const QList &segments_list, const qreal &precision -) const { +) const +{ // construit le QHash qui sera retourne QHash segments_hash; foreach(ConductorSegmentProfile *csp, segments_list) { @@ -556,14 +558,16 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi } /// @return le Diagram auquel ce conducteur appartient, ou 0 si ce conducteur est independant -Diagram *Conductor::diagram() const { +Diagram *Conductor::diagram() const +{ return(qobject_cast(scene())); } /**4 @return le champ de texte associe a ce conducteur */ -ConductorTextItem *Conductor::textItem() const { +ConductorTextItem *Conductor::textItem() const +{ return(m_text_item); } @@ -913,7 +917,8 @@ QPainterPath Conductor::nearShape() const @param type Type de Segments @return Le nombre de segments composant le conducteur. */ -uint Conductor::segmentsCount(QET::ConductorSegmentType type) const { +uint Conductor::segmentsCount(QET::ConductorSegmentType type) const +{ QList segments_list = segmentsList(); if (type == QET::Both) return(segments_list.count()); uint nb_seg = 0; @@ -927,7 +932,8 @@ uint Conductor::segmentsCount(QET::ConductorSegmentType type) const { Genere une liste de points a partir des segments de ce conducteur @return La liste de points representant ce conducteur */ -QList Conductor::segmentsToPoints() const { +QList Conductor::segmentsToPoints() const +{ // liste qui sera retournee QList points_list; @@ -1168,7 +1174,8 @@ QVector Conductor::handlerPoints() const } /// @return les segments de ce conducteur -const QList Conductor::segmentsList() const { +const QList Conductor::segmentsList() const +{ if (segments == nullptr) return(QList()); QList segments_vector; @@ -1193,7 +1200,8 @@ qreal Conductor::length() const{ /** @return Le segment qui contient le point au milieu du conducteur */ -ConductorSegment *Conductor::middleSegment() { +ConductorSegment *Conductor::middleSegment() +{ if (segments == nullptr) return(nullptr); qreal half_length = length() / 2.0; @@ -1440,7 +1448,8 @@ void Conductor::setProfile(const ConductorProfile &cp, Qt::Corner path_type) { } /// @return le profil de ce conducteur -ConductorProfile Conductor::profile(Qt::Corner path_type) const { +ConductorProfile Conductor::profile(Qt::Corner path_type) const +{ return(conductor_profiles[path_type]); } @@ -1586,7 +1595,8 @@ ConductorProperties Conductor::properties() const /** @return true si le conducteur est mis en evidence */ -Conductor::Highlight Conductor::highlight() const { +Conductor::Highlight Conductor::highlight() const +{ return(must_highlight_); } @@ -1700,7 +1710,8 @@ QSet Conductor::relatedPotentialConductors(const bool all_diagram, @brief Conductor::diagramEditor @return The parent diagram editor or nullptr; */ -QETDiagramEditor* Conductor::diagramEditor() const { +QETDiagramEditor* Conductor::diagramEditor() const +{ if (!diagram()) return nullptr; if (diagram() -> views().isEmpty()) return nullptr; @@ -1714,7 +1725,8 @@ QETDiagramEditor* Conductor::diagramEditor() const { /** @brief Conductor::editProperty */ -void Conductor::editProperty() { +void Conductor::editProperty() +{ ConductorPropertiesDialog::PropertiesDialog(this, diagramEditor()); } @@ -1770,7 +1782,8 @@ bool isContained(const QPointF &a, const QPointF &b, const QPointF &c) { /** @return la liste des positions des jonctions avec d'autres conducteurs */ -QList Conductor::junctions() const { +QList Conductor::junctions() const +{ QList junctions_list; // pour qu'il y ait des jonctions, il doit y avoir d'autres conducteurs et des bifurcations @@ -1840,7 +1853,8 @@ QList Conductor::junctions() const { (en coordonnees locales) de la bifurcation tandis que le Corner indique le type de bifurcation. */ -QList Conductor::bends() const { +QList Conductor::bends() const +{ QList points; if (!segments) return(points); @@ -1908,12 +1922,14 @@ Qt::Corner Conductor::movementType(const QPointF &start, const QPointF &end) { } /// @return le type de trajet actuel de ce conducteur -Qt::Corner Conductor::currentPathType() const { +Qt::Corner Conductor::currentPathType() const +{ return(movementType(terminal1 -> dockConductor(), terminal2 -> dockConductor())); } /// @return les profils de ce conducteur -ConductorProfilesGroup Conductor::profiles() const { +ConductorProfilesGroup Conductor::profiles() const +{ return(conductor_profiles); } @@ -1936,7 +1952,8 @@ void Conductor::setProfiles(const ConductorProfilesGroup &cpg) { } /// Supprime les segments -void Conductor::deleteSegments() { +void Conductor::deleteSegments() +{ if (segments != nullptr) { while (segments -> hasNextSegment()) delete segments -> nextSegment(); delete segments; diff --git a/sources/qetgraphicsitem/conductor.h b/sources/qetgraphicsitem/conductor.h index 812b02fc7..5794ee2b1 100644 --- a/sources/qetgraphicsitem/conductor.h +++ b/sources/qetgraphicsitem/conductor.h @@ -79,14 +79,15 @@ class Conductor : public QGraphicsObject ConductorTextItem *textItem() const; void updatePath(const QRectF & = QRectF()); - //This method do nothing, it's only made to be used with Q_PROPERTY - //It's used to anim the path when is change + //This method do nothing, it's only made to be used with Q_PROPERTY + //It's used to anim the path when is change void updatePathAnimate(const int = 1) {updatePath();} int fakePath() {return 1;} - void paint(QPainter *, - const QStyleOptionGraphicsItem *, - QWidget *) override; + void paint( + QPainter *, + const QStyleOptionGraphicsItem *, + QWidget *) override; QRectF boundingRect() const override; QPainterPath shape() const override; virtual QPainterPath nearShape() const; @@ -100,9 +101,10 @@ class Conductor : public QGraphicsObject public: static bool valideXml (QDomElement &); bool fromXml (QDomElement &); - QDomElement toXml (QDomDocument &, - QHash &) const; + QDomElement toXml ( + QDomDocument &, + QHash &) const; private: bool pathFromXml(const QDomElement &); @@ -110,8 +112,9 @@ class Conductor : public QGraphicsObject QVector handlerPoints() const; const QList segmentsList() const; - void setPropertyToPotential(const ConductorProperties &property, - bool only_text = false); + void setPropertyToPotential( + const ConductorProperties &property, + bool only_text = false); void setProperties(const ConductorProperties &property); ConductorProperties properties() const; @@ -128,12 +131,15 @@ class Conductor : public QGraphicsObject QETDiagramEditor* diagramEditor() const; void editProperty (); - autonum::sequentialNumbers sequenceNum () const {return m_autoNum_seq;} - autonum::sequentialNumbers& rSequenceNum() {return m_autoNum_seq;} + autonum::sequentialNumbers sequenceNum () const + {return m_autoNum_seq;} + autonum::sequentialNumbers& rSequenceNum() + {return m_autoNum_seq;} void setSequenceNum(const autonum::sequentialNumbers& sn); private: - void setUpConnectionForFormula(QString old_formula, QString new_formula); + void setUpConnectionForFormula( + QString old_formula, QString new_formula); autonum::sequentialNumbers m_autoNum_seq; public: @@ -143,20 +149,30 @@ class Conductor : public QGraphicsObject void displayedTextChanged(); protected: - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; + void mouseDoubleClickEvent( + QGraphicsSceneMouseEvent *event) override; void mousePressEvent(QGraphicsSceneMouseEvent *event) override; - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent( + QGraphicsSceneMouseEvent *event) override; void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override; void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override; - QVariant itemChange(GraphicsItemChange, const QVariant &) override; - bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override; + QVariant itemChange( + GraphicsItemChange, const QVariant &) override; + bool sceneEventFilter( + QGraphicsItem *watched, QEvent *event) override; private: void adjusteHandlerPos(); - void handlerMousePressEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); - void handlerMouseMoveEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); - void handlerMouseReleaseEvent (QetGraphicsHandlerItem *qghi, QGraphicsSceneMouseEvent *event); + void handlerMousePressEvent( + QetGraphicsHandlerItem *qghi, + QGraphicsSceneMouseEvent *event); + void handlerMouseMoveEvent( + QetGraphicsHandlerItem *qghi, + QGraphicsSceneMouseEvent *event); + void handlerMouseReleaseEvent( + QetGraphicsHandlerItem *qghi, + QGraphicsSceneMouseEvent *event); void addHandler(); void removeHandler(); diff --git a/sources/qetgraphicsitem/conductortextitem.cpp b/sources/qetgraphicsitem/conductortextitem.cpp index 339d6cc8a..e15c24429 100644 --- a/sources/qetgraphicsitem/conductortextitem.cpp +++ b/sources/qetgraphicsitem/conductortextitem.cpp @@ -38,8 +38,8 @@ ConductorTextItem::ConductorTextItem(Conductor *parent_conductor) : @param text Le texte affiche par le champ de texte @param parent_conductor Conducteur auquel ce texte est rattache */ -ConductorTextItem::ConductorTextItem(const QString &text, - Conductor *parent_conductor) : +ConductorTextItem::ConductorTextItem( + const QString &text, Conductor *parent_conductor) : DiagramTextItem(text, parent_conductor), parent_conductor_(parent_conductor), moved_by_user_(false), @@ -49,14 +49,16 @@ ConductorTextItem::ConductorTextItem(const QString &text, /** Destructeur */ -ConductorTextItem::~ConductorTextItem() { +ConductorTextItem::~ConductorTextItem() +{ } /** @return le conducteur parent de ce champ de texte, ou 0 si celui-ci n'en a pas */ -Conductor *ConductorTextItem::parentConductor() const { +Conductor *ConductorTextItem::parentConductor() const +{ return(parent_conductor_); } @@ -81,7 +83,8 @@ void ConductorTextItem::fromXml(const QDomElement &e) { @return true si ce champ de texte a ete explictement deplace par l'utilisateur, false sinon */ -bool ConductorTextItem::wasMovedByUser() const { +bool ConductorTextItem::wasMovedByUser() const +{ return(moved_by_user_); } @@ -89,7 +92,8 @@ bool ConductorTextItem::wasMovedByUser() const { @brief ConductorTextItem::wasRotateByUser @return true if text was explicit moved by user else false */ -bool ConductorTextItem::wasRotateByUser() const { +bool ConductorTextItem::wasRotateByUser() const +{ return(rotate_by_user_); } @@ -120,7 +124,7 @@ void ConductorTextItem::forceRotateByUser(bool rotate_by_user) { rotate_by_user_ = rotate_by_user; if (!rotate_by_user && parent_conductor_) { parent_conductor_ -> calculateTextItemPosition(); - } + } } /** @@ -154,8 +158,8 @@ void ConductorTextItem::setPos(const QPointF &pos) */ void ConductorTextItem::setPos(qreal x, qreal y) { - QPointF p(x,y); - setPos(p); + QPointF p(x,y); + setPos(p); } /** diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index cbdb8cb15..30fed63f0 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -65,7 +65,8 @@ CrossRefItem::CrossRefItem(Element *elmt, ElementTextItemGroup *group) : @brief CrossRefItem::~CrossRefItem Default destructor */ -CrossRefItem::~CrossRefItem() {} +CrossRefItem::~CrossRefItem() +{} /** @brief CrossRefItem::init @@ -107,16 +108,25 @@ void CrossRefItem::setUpConnection() set=true; else if(m_properties.snapTo() == XRefProperties::Bottom && !m_text && !m_group) //Snap to bottom of element and parent is the element itself { - m_update_connection << connect(m_element, SIGNAL(yChanged()), this, SLOT(autoPos())); - m_update_connection << connect(m_element, SIGNAL(rotationChanged()), this, SLOT(autoPos())); + m_update_connection << connect(m_element, SIGNAL(yChanged()), + this, SLOT(autoPos())); + m_update_connection << connect(m_element, SIGNAL(rotationChanged()), + this, SLOT(autoPos())); set=true; } if(set) { - m_update_connection << connect(project, &QETProject::projectDiagramsOrderChanged, this, &CrossRefItem::updateLabel); - m_update_connection << connect(project, &QETProject::diagramRemoved, this, &CrossRefItem::updateLabel); - m_update_connection << connect(m_element, &Element::linkedElementChanged, this, &CrossRefItem::linkedChanged); + m_update_connection + << connect(project, + &QETProject::projectDiagramsOrderChanged, + this, &CrossRefItem::updateLabel); + m_update_connection << connect(project, + &QETProject::diagramRemoved, + this, &CrossRefItem::updateLabel); + m_update_connection << connect(m_element, + &Element::linkedElementChanged, + this, &CrossRefItem::linkedChanged); linkedChanged(); updateLabel(); } @@ -126,7 +136,8 @@ void CrossRefItem::setUpConnection() @brief CrossRefItem::boundingRect @return the bounding rect of this item */ -QRectF CrossRefItem::boundingRect() const { +QRectF CrossRefItem::boundingRect() const +{ return m_bounding_rect; } @@ -146,8 +157,8 @@ QPainterPath CrossRefItem::shape() const{ if add_prefix is true, prefix (for power and delay contact) is added to the poistion text. */ -QString CrossRefItem::elementPositionText(const Element *elmt, - const bool &add_prefix) const +QString CrossRefItem::elementPositionText( + const Element *elmt, const bool &add_prefix) const { XRefProperties xrp = m_element->diagram()->project()->defaultXRefProperties( @@ -232,7 +243,8 @@ void CrossRefItem::updateLabel() @brief CrossRefItem::autoPos Calculate and set position automaticaly. */ -void CrossRefItem::autoPos() { +void CrossRefItem::autoPos() +{ //We calcul the position according to the snapTo of the xrefproperties if (m_properties.snapTo() == XRefProperties::Bottom) centerToBottomDiagram(this, @@ -285,9 +297,11 @@ bool CrossRefItem::sceneEvent(QEvent *event) @param option @param widget */ -void CrossRefItem::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) { +void CrossRefItem::paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ Q_UNUSED(option) Q_UNUSED(widget) m_drawing.play(painter); @@ -406,9 +420,9 @@ void CrossRefItem::linkedChanged() { for(const QMetaObject::Connection& c : m_slave_connection) disconnect(c); - + m_slave_connection.clear(); - + if(!isVisible()) return; @@ -423,7 +437,7 @@ void CrossRefItem::linkedChanged() this, &CrossRefItem::updateLabel); } - + updateLabel(); } @@ -431,7 +445,8 @@ void CrossRefItem::linkedChanged() @brief CrossRefItem::buildHeaderContact Draw the QPicture of m_hdr_no_ctc and m_hdr_nc_ctc */ -void CrossRefItem::buildHeaderContact() { +void CrossRefItem::buildHeaderContact() +{ if (!m_hdr_no_ctc.isNull() && !m_hdr_nc_ctc.isNull()) return; //init the painter @@ -483,7 +498,7 @@ void CrossRefItem::buildHeaderContact() { */ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) { - //No need to calcul if nothing is linked + //No need to calcul if nothing is linked if (m_element->isFree()) return; QStringList no_str, nc_str; @@ -495,14 +510,13 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) nc_str.append(elementPositionText(elmt, true)); } - - //There is no string to display, we return now + //There is no string to display, we return now if (no_str.isEmpty() && nc_str.isEmpty()) return; - //this is the default size of cross ref item + //this is the default size of cross ref item QRectF default_bounding(0, 0, 40, header + cross_min_heigth); - //Bounding rect of the NO text + //Bounding rect of the NO text QRectF no_bounding; for (auto str : no_str) { @@ -510,13 +524,13 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) no_bounding = no_bounding.united(bounding); no_bounding.setHeight(no_bounding.height() + bounding.height()); } - //Adjust according to the NO + //Adjust according to the NO if (no_bounding.height() > default_bounding.height() - header) default_bounding.setHeight(no_bounding.height() + header); //adjust the height if (no_bounding.width() > default_bounding.width()/2) - default_bounding.setWidth(no_bounding.width()*2); //adjust the width + default_bounding.setWidth(no_bounding.width()*2);//adjust the width - //Bounding rect of the NC text + //Bounding rect of the NC text QRectF nc_bounding; for (auto str : nc_str) { @@ -524,13 +538,13 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) nc_bounding = nc_bounding.united(bounding); nc_bounding.setHeight(nc_bounding.height() + bounding.height()); } - //Adjust according to the NC + //Adjust according to the NC if (nc_bounding.height() > default_bounding.height() - header) default_bounding.setHeight(nc_bounding.height() + header); //adjust the heigth if (nc_bounding.width() > default_bounding.width()/2) - default_bounding.setWidth(nc_bounding.width()*2); //adjust the width + default_bounding.setWidth(nc_bounding.width()*2);//adjust the width - //Minor adjustement for better visual + //Minor adjustement for better visual default_bounding.adjust(0, 0, 4, 0); m_shape_path.addRect(default_bounding); prepareGeometryChange(); @@ -544,26 +558,26 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) */ void CrossRefItem::drawAsCross(QPainter &painter) { - //calcul the size of the cross + //calcul the size of the cross setUpCrossBoundingRect(painter); m_hovered_contacts_map.clear(); - //Bounding rect is empty that mean there's no contact to draw + //Bounding rect is empty that mean there's no contact to draw if (boundingRect().isEmpty()) return; - //draw the cross + //draw the cross QRectF br = boundingRect(); painter.drawLine(br.width()/2, 0, br.width()/2, br.height()); //vertical line painter.drawLine(0, header, br.width(), header); //horizontal line - //Add the symbolic contacts + //Add the symbolic contacts buildHeaderContact(); QPointF p((m_bounding_rect.width()/4) - (m_hdr_no_ctc.width()/2), 0); painter.drawPicture (p, m_hdr_no_ctc); p.setX((m_bounding_rect.width() * 3/4) - (m_hdr_nc_ctc.width()/2)); painter.drawPicture (p, m_hdr_nc_ctc); - //and fill it + //and fill it fillCrossRef(painter); } diff --git a/sources/qetgraphicsitem/crossrefitem.h b/sources/qetgraphicsitem/crossrefitem.h index fbbb8727c..1194c9967 100644 --- a/sources/qetgraphicsitem/crossrefitem.h +++ b/sources/qetgraphicsitem/crossrefitem.h @@ -50,10 +50,10 @@ class CrossRefItem : public QGraphicsObject //Methods public: explicit CrossRefItem(Element *elmt); - explicit CrossRefItem(Element *elmt, - DynamicElementTextItem *text); - explicit CrossRefItem(Element *elmt, - ElementTextItemGroup *group); + explicit CrossRefItem( + Element *elmt, DynamicElementTextItem *text); + explicit CrossRefItem( + Element *elmt, ElementTextItemGroup *group); ~CrossRefItem() override; private: void init(); diff --git a/sources/qetgraphicsitem/diagramimageitem.cpp b/sources/qetgraphicsitem/diagramimageitem.cpp index 578fe0c5f..d1f4471ae 100644 --- a/sources/qetgraphicsitem/diagramimageitem.cpp +++ b/sources/qetgraphicsitem/diagramimageitem.cpp @@ -49,7 +49,8 @@ DiagramImageItem::DiagramImageItem(const QPixmap &pixmap, QetGraphicsItem *paren @brief DiagramImageItem::~DiagramImageItem Destructor */ -DiagramImageItem::~DiagramImageItem() { +DiagramImageItem::~DiagramImageItem() +{ } /** @@ -106,7 +107,8 @@ void DiagramImageItem::setPixmap(const QPixmap &pixmap) { if no pixmap are set, return a default QRectF @return a QRectF represent the bounding rectangle */ -QRectF DiagramImageItem::boundingRect() const { +QRectF DiagramImageItem::boundingRect() const +{ if (!pixmap_.isNull()) { return (QRectF(pixmap_.rect())); } else { @@ -119,7 +121,8 @@ QRectF DiagramImageItem::boundingRect() const { @brief DiagramImageItem::name @return the generic name of this item (picture) */ -QString DiagramImageItem::name() const { +QString DiagramImageItem::name() const +{ return tr("une image"); } @@ -163,7 +166,8 @@ bool DiagramImageItem::fromXml(const QDomElement &e) @param document Le document XML a utiliser @return L'element XML representant l'image */ -QDomElement DiagramImageItem::toXml(QDomDocument &document) const { +QDomElement DiagramImageItem::toXml(QDomDocument &document) const +{ QDomElement result = document.createElement("image"); //write some attribute result.setAttribute("x", QString::number(pos().x())); diff --git a/sources/qetgraphicsitem/diagramtextitem.cpp b/sources/qetgraphicsitem/diagramtextitem.cpp index fc36afd37..75818083a 100644 --- a/sources/qetgraphicsitem/diagramtextitem.cpp +++ b/sources/qetgraphicsitem/diagramtextitem.cpp @@ -60,7 +60,8 @@ void DiagramTextItem::build() @brief DiagramTextItem::diagram @return The diagram of this item or 0 if this text isn't in a diagram */ -Diagram *DiagramTextItem::diagram() const { +Diagram *DiagramTextItem::diagram() const +{ return(qobject_cast(scene())); } @@ -70,7 +71,8 @@ Diagram *DiagramTextItem::diagram() const { This is used to be inherited by child class @return */ -QDomElement DiagramTextItem::toXml(QDomDocument &) const { +QDomElement DiagramTextItem::toXml(QDomDocument &) const +{ return QDomElement(); } @@ -80,7 +82,8 @@ QDomElement DiagramTextItem::toXml(QDomDocument &) const { @param movement Vecteur exprime en coordonnees locales @return le meme vecteur, exprime en coordonnees de la scene */ -QPointF DiagramTextItem::mapMovementToScene(const QPointF &movement) const { +QPointF DiagramTextItem::mapMovementToScene(const QPointF &movement) const +{ // on definit deux points en coordonnees locales QPointF local_origin(0.0, 0.0); QPointF local_movement_point(movement); @@ -99,7 +102,8 @@ QPointF DiagramTextItem::mapMovementToScene(const QPointF &movement) const { @param movement Vecteur exprime en coordonnees de la scene @return le meme vecteur, exprime en coordonnees locales */ -QPointF DiagramTextItem::mapMovementFromScene(const QPointF &movement) const { +QPointF DiagramTextItem::mapMovementFromScene(const QPointF &movement) const +{ // on definit deux points sur la scene QPointF scene_origin(0.0, 0.0); QPointF scene_movement_point(movement); @@ -118,7 +122,8 @@ QPointF DiagramTextItem::mapMovementFromScene(const QPointF &movement) const { @param movement Vecteur exprime en coordonnees locales @return le meme vecteur, exprime en coordonnees du parent */ -QPointF DiagramTextItem::mapMovementToParent(const QPointF &movement) const { +QPointF DiagramTextItem::mapMovementToParent(const QPointF &movement) const +{ // on definit deux points en coordonnees locales QPointF local_origin(0.0, 0.0); QPointF local_movement_point(movement); @@ -137,7 +142,8 @@ QPointF DiagramTextItem::mapMovementToParent(const QPointF &movement) const { @param movement Vecteur exprime en coordonnees du parent @return le meme vecteur, exprime en coordonnees locales */ -QPointF DiagramTextItem::mapMovementFromParent(const QPointF &movement) const { +QPointF DiagramTextItem::mapMovementFromParent(const QPointF &movement) const +{ // on definit deux points sur le parent QPointF parent_origin(0.0, 0.0); QPointF parent_movement_point(movement); @@ -170,7 +176,8 @@ void DiagramTextItem::setColor(const QColor& color) emit colorChanged(color); } -QColor DiagramTextItem::color() const { +QColor DiagramTextItem::color() const +{ return defaultTextColor(); } @@ -221,7 +228,8 @@ void DiagramTextItem::setPlainText(const QString &text) m_is_html = false; } -bool DiagramTextItem::isHtml() const { +bool DiagramTextItem::isHtml() const +{ return m_is_html; } diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 77b9c9fe8..f47840960 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -224,7 +224,8 @@ void DynamicElementTextItem::fromXml(const QDomElement &dom_elmt) Note that the text can return a parent element, even if the text belong to a group of this same element. */ -Element *DynamicElementTextItem::parentElement() const { +Element *DynamicElementTextItem::parentElement() const +{ return m_parent_element; } @@ -312,7 +313,8 @@ void DynamicElementTextItem::refreshLabelConnection() @brief DynamicElementTextItem::textFrom @return what the final text is created from. */ -DynamicElementTextItem::TextFrom DynamicElementTextItem::textFrom() const { +DynamicElementTextItem::TextFrom DynamicElementTextItem::textFrom() const +{ return m_text_from; } @@ -375,7 +377,8 @@ void DynamicElementTextItem::setTextFrom(DynamicElementTextItem::TextFrom text_f @brief DynamicElementTextItem::text @return the text of this text */ -QString DynamicElementTextItem::text() const { +QString DynamicElementTextItem::text() const +{ return m_text; } @@ -442,7 +445,8 @@ void DynamicElementTextItem::setInfoName(const QString &info_name) @brief DynamicElementTextItem::infoName @return the info name of this text */ -QString DynamicElementTextItem::infoName() const { +QString DynamicElementTextItem::infoName() const +{ return m_info_name; } diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index cc5134465..57097477a 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -38,9 +38,10 @@ class ElementXmlRetroCompatibility { friend class Element; - static void loadSequential(const QDomElement &dom_element, - const QString& seq, - QStringList* list) + static void loadSequential( + const QDomElement &dom_element, + const QString& seq, + QStringList* list) { int i = 0; while (!dom_element.attribute(seq + @@ -53,8 +54,8 @@ class ElementXmlRetroCompatibility } } - static void loadSequential(const QDomElement &dom_element, - Element *element) + static void loadSequential( + const QDomElement &dom_element, Element *element) { autonum::sequentialNumbers sn; @@ -76,10 +77,11 @@ class ElementXmlRetroCompatibility @param state : state of the instanciation @param link_type */ -Element::Element(const ElementsLocation &location, - QGraphicsItem *parent, - int *state, - kind link_type) : +Element::Element( + const ElementsLocation &location, + QGraphicsItem *parent, + int *state, + kind link_type) : QetGraphicsItem(parent), m_link_type (link_type), m_location (location) @@ -111,7 +113,8 @@ Element::Element(const ElementsLocation &location, | QGraphicsItem::ItemIsSelectable); setAcceptHoverEvents(true); - connect(this, &Element::rotationChanged, [this]() { + connect(this, &Element::rotationChanged, [this]() +{ for(QGraphicsItem *qgi : childItems()) { if (Terminal *t = qgraphicsitem_cast(qgi)) @@ -133,7 +136,8 @@ Element::~Element() @brief Element::terminals @return the list of terminals of this element. */ -QList Element::terminals() const { +QList Element::terminals() const +{ return m_terminals; } @@ -175,7 +179,8 @@ void Element::editProperty() /** @param hl true pour mettre l'element en evidence, false sinon */ -void Element::setHighlighted(bool hl) { +void Element::setHighlighted(bool hl) +{ m_must_highlight = hl; update(); } @@ -196,9 +201,10 @@ void Element::displayHelpLine(bool b) @param painter @param options */ -void Element::paint(QPainter *painter, - const QStyleOptionGraphicsItem *options, - QWidget *) +void Element::paint( + QPainter *painter, + const QStyleOptionGraphicsItem *options, + QWidget *) { if (m_must_highlight) { drawHighlight(painter, options); @@ -219,7 +225,8 @@ void Element::paint(QPainter *painter, /** @return Le rectangle delimitant le contour de l'element */ -QRectF Element::boundingRect() const { +QRectF Element::boundingRect() const +{ return(QRectF(QPointF(-hotspot_coord.x(), -hotspot_coord.y()), dimensions)); } @@ -244,7 +251,8 @@ void Element::setSize(int wid, int hei) /** @return la taille de l'element sur le schema */ -QSize Element::size() const { +QSize Element::size() const +{ return(dimensions); } @@ -253,7 +261,8 @@ QSize Element::size() const { Necessite que la taille ait deja ete definie @param hs Coordonnees du hotspot */ -QPoint Element::setHotspot(QPoint hs) { +QPoint Element::setHotspot(QPoint hs) +{ // la taille doit avoir ete definie prepareGeometryChange(); if (dimensions.isNull()) hotspot_coord = QPoint(0, 0); @@ -269,7 +278,8 @@ QPoint Element::setHotspot(QPoint hs) { /** @return Le hotspot courant de l'element */ -QPoint Element::hotspot() const { +QPoint Element::hotspot() const +{ return(hotspot_coord); } @@ -277,7 +287,8 @@ QPoint Element::hotspot() const { @brief Element::pixmap @return the pixmap of this element */ -QPixmap Element::pixmap() { +QPixmap Element::pixmap() +{ return ElementPictureFactory::instance()->pixmap(m_location); } @@ -288,8 +299,10 @@ QPixmap Element::pixmap() { @param painter Le QPainter a utiliser pour dessiner les axes @param options Les options de style a prendre en compte */ -void Element::drawAxes(QPainter *painter, - const QStyleOptionGraphicsItem *options) { +void Element::drawAxes( + QPainter *painter, + const QStyleOptionGraphicsItem *options) +{ Q_UNUSED(options); painter -> setPen(Qt::blue); painter -> drawLine(0, 0, 10, 0); @@ -308,8 +321,10 @@ void Element::drawAxes(QPainter *painter, @param painter Le QPainter a utiliser pour dessiner les bornes. @param options Les options de style a prendre en compte */ -void Element::drawSelection(QPainter *painter, - const QStyleOptionGraphicsItem *options) { +void Element::drawSelection( + QPainter *painter, + const QStyleOptionGraphicsItem *options) +{ Q_UNUSED(options); painter -> save(); // Annulation des renderhints @@ -334,8 +349,10 @@ void Element::drawSelection(QPainter *painter, @param painter Le QPainter a utiliser pour dessiner les bornes. @param options Les options de style a prendre en compte */ -void Element::drawHighlight(QPainter *painter, - const QStyleOptionGraphicsItem *options) { +void Element::drawHighlight( + QPainter *painter, + const QStyleOptionGraphicsItem *options) +{ Q_UNUSED(options); painter -> save(); @@ -618,14 +635,13 @@ DynamicElementTextItem *Element::parseDynamicText( */ Terminal *Element::parseTerminal(const QDomElement &dom_element) { + TerminalData* data = new TerminalData(); + if (!data->fromXml(dom_element)) { + delete data; + return nullptr; + } - TerminalData* data = new TerminalData(); - if (!data->fromXml(dom_element)) { - delete data; - return nullptr; - } - - Terminal *new_terminal = new Terminal(data, this); + Terminal *new_terminal = new Terminal(data, this); m_terminals << new_terminal; //Sort from top to bottom and left to rigth @@ -681,10 +697,11 @@ bool Element::valideXml(QDomElement &e) { @param handle_inputs_rotation : apply the rotation of this element to his child text @return */ -bool Element::fromXml(QDomElement &e, - QHash &table_id_adr, - bool handle_inputs_rotation) +bool Element::fromXml( + QDomElement &e, + QHash &table_id_adr, + bool handle_inputs_rotation) { m_state = QET::GILoadingFromXml; /* @@ -792,7 +809,7 @@ bool Element::fromXml(QDomElement &e, for(DynamicElementTextItem *deti : m_dynamic_text_list) delete deti; m_dynamic_text_list.clear(); - + //************************// //***Dynamic texts item***// //************************// @@ -800,12 +817,11 @@ bool Element::fromXml(QDomElement &e, e, "dynamic_texts", DynamicElementTextItem::xmlTagName())) - { - DynamicElementTextItem *deti = new DynamicElementTextItem(this); - addDynamicTextItem(deti); - deti->fromXml(qde); - } - + { + DynamicElementTextItem *deti = new DynamicElementTextItem(this); + addDynamicTextItem(deti); + deti->fromXml(qde); + } //************************// //***Element texts item***// @@ -822,9 +838,11 @@ bool Element::fromXml(QDomElement &e, { for(const QDomElement& dom_input : dom_inputs) { - //we use the same method used in ElementTextItem::fromXml to compar and know if the input dom element is for one of the text stored. - //The comparaison is made from the text position : if the position of the text is the same as the position stored in 'input' dom element - //that mean this is the good text + //we use the same method used in ElementTextItem::fromXml + //to compar and know if the input dom element is for one of the text stored. + //The comparaison is made from the text position : + //if the position of the text is the same as the position stored in 'input' dom element + //that mean this is the good text if (qFuzzyCompare(qreal(dom_input.attribute("x").toDouble()), m_converted_text_from_xml_description.value(deti).x()) && qFuzzyCompare(qreal(dom_input.attribute("y").toDouble()), @@ -851,9 +869,13 @@ bool Element::fromXml(QDomElement &e, if(dom_input.hasAttribute("usery")) xml_pos.setY(dom_input.attribute("usery", "0").toDouble()); - //the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size - //The origin transformation point of PartTextField is the middle of left edge, and so by definition, change with the size of the font - //We need to use a QTransform to find the pos of this text from the saved pos of text item + //the origin transformation point of PartDynamicTextField + //is the top left corner, no matter the font size + //The origin transformation point of PartTextField + //is the middle of left edge, and so by definition, + //change with the size of the font + //We need to use a QTransform to find the pos of + //this text from the saved pos of text item deti->setPos(xml_pos); deti->setRotation(rotation); @@ -869,9 +891,11 @@ bool Element::fromXml(QDomElement &e, transform.translate(xml_pos.x(), xml_pos.y()); deti->setPos(transform.map(pos)); - //dom_input and deti matched we remove the dom_input from inputs list, - //to avoid unnecessary checking made below - //we also move deti from the m_converted_text_from_xml_description to m_dynamic_text_list + //dom_input and deti matched we remove + //the dom_input from inputs list, + //to avoid unnecessary checking made below + //we also move deti from the + //m_converted_text_from_xml_description to m_dynamic_text_list inputs.removeAll(dom_input); m_dynamic_text_list.append(deti); m_converted_text_from_xml_description.remove(deti); @@ -880,14 +904,14 @@ bool Element::fromXml(QDomElement &e, } } - //###Firts case : if this is the first time the user open the project since text item are converted to dynamic text, - //in the previous opening of the project, every texts field present in the element description was created. - //At save time, the values of each of them was save in the 'input' dom element. - //The loop upper is made for the first case, to import the values in 'input' to the new converted dynamic texts field. - //###Second case : this is not the first time the user open the project since text item are converted to dynamic text. - //That mean, in a previous opening of the project, the text item was already converted and save as a dynamic text field. - //So there isn't 'input' dom element in the project, and every dynamic text item present in m_converted_text_from_xml_description - //need to be deleted (because already exist in m_dynamic_text_list, from a previous save) + //###Firts case : if this is the first time the user open the project since text item are converted to dynamic text, + //in the previous opening of the project, every texts field present in the element description was created. + //At save time, the values of each of them was save in the 'input' dom element. + //The loop upper is made for the first case, to import the values in 'input' to the new converted dynamic texts field. + //###Second case : this is not the first time the user open the project since text item are converted to dynamic text. + //That mean, in a previous opening of the project, the text item was already converted and save as a dynamic text field. + //So there isn't 'input' dom element in the project, and every dynamic text item present in m_converted_text_from_xml_description + //need to be deleted (because already exist in m_dynamic_text_list, from a previous save) for (DynamicElementTextItem *deti : m_converted_text_from_xml_description.keys()) delete deti; m_converted_text_from_xml_description.clear(); @@ -1127,9 +1151,10 @@ bool Element::fromXml(QDomElement &e, \~ @return The XML element representing this electrical element \~French L'element XML representant cet element electrique */ -QDomElement Element::toXml(QDomDocument &document, - QHash &table_adr_id) const +QDomElement Element::toXml( + QDomDocument &document, + QHash &table_adr_id) const { QDomElement element = document.createElement("element"); @@ -1199,7 +1224,7 @@ QDomElement Element::toXml(QDomDocument &document, element.appendChild(links_uuids); } - //save information of this element + //save information of this element if (! m_element_informations.keys().isEmpty()) { QDomElement infos = document.createElement("elementInformations"); @@ -1207,7 +1232,7 @@ QDomElement Element::toXml(QDomDocument &document, element.appendChild(infos); } - //Dynamic texts + //Dynamic texts QDomElement dyn_text = document.createElement("dynamic_texts"); for (DynamicElementTextItem *deti : m_dynamic_text_list) dyn_text.appendChild(deti->toXml(document)); @@ -1313,7 +1338,8 @@ void Element::removeDynamicTextItem(DynamicElementTextItem *deti) Texts in text-groups belonging to this element are not returned by this function. @see ElementTextItemGroup::texts */ -QList Element::dynamicTextItems() const { +QList Element::dynamicTextItems() const +{ return m_dynamic_text_list; } @@ -1514,7 +1540,7 @@ void Element::initLink(QETProject *prj) foreach (Element *elmt, ep.fromUuids(tmp_uuids_link)) { elmt->linkToElement(this); } - tmp_uuids_link.clear(); + tmp_uuids_link.clear(); } QString Element::linkTypeToString() const @@ -1546,9 +1572,9 @@ QString Element::linkTypeToString() const */ void Element::setElementInformations(DiagramContext dc) { - if (m_element_informations == dc) { - return; - } + if (m_element_informations == dc) { + return; + } DiagramContext old_info = m_element_informations; m_element_informations = dc; @@ -1563,7 +1589,8 @@ void Element::setElementInformations(DiagramContext dc) returns a response when a comparison is found. @return true if elmt1 is at lower position than elmt 2, else false */ -bool comparPos(const Element *elmt1, const Element *elmt2) { +bool comparPos(const Element *elmt1, const Element *elmt2) +{ //Compare folio first if (elmt1->diagram()->folioIndex() != elmt2->diagram()->folioIndex()) return elmt1->diagram()->folioIndex() @@ -1616,7 +1643,8 @@ void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Also highlight linked elements @param e QGraphicsSceneHoverEvent */ -void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) { +void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) +{ Q_UNUSED(e) foreach (Element *elmt, linkedElements()) @@ -1633,7 +1661,8 @@ void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) { Also un-highlight linked elements @param e QGraphicsSceneHoverEvent */ -void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) { +void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) +{ Q_UNUSED(e) foreach (Element *elmt, linkedElements()) @@ -1696,7 +1725,8 @@ void Element::setUpFormula(bool code_letter) @brief Element::getPrefix get Element Prefix */ -QString Element::getPrefix() const{ +QString Element::getPrefix() const +{ return m_prefix; } @@ -1704,7 +1734,8 @@ QString Element::getPrefix() const{ @brief Element::setPrefix set Element Prefix */ -void Element::setPrefix(QString prefix) { +void Element::setPrefix(QString prefix) +{ m_prefix = std::move(prefix); } @@ -1721,7 +1752,8 @@ void Element::freezeLabel(bool freeze) @brief Element::freezeNewAddedElement Freeze this label if needed */ -void Element::freezeNewAddedElement() { +void Element::freezeNewAddedElement() +{ if (this->diagram()->freezeNewElements() || this->diagram()->project()->isFreezeNewElements()) { freezeLabel(true); @@ -1753,10 +1785,12 @@ QString Element::actualLabel() @brief Element::name @return the human name of this element */ -QString Element::name() const { +QString Element::name() const +{ return m_names.name(m_location.baseName()); } -ElementsLocation Element::location() const { +ElementsLocation Element::location() const +{ return m_location; } diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index a825d1094..9de7db721 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -48,13 +48,14 @@ class Element : public QetGraphicsItem Used to know the kind of this element (master, slave, report ect...) */ - enum kind {Simple = 1, - NextReport = 2, - PreviousReport = 4, - AllReport = 6, - Master = 8, - Slave = 16, - Terminale = 32}; + enum kind { + Simple = 1, + NextReport = 2, + PreviousReport = 4, + AllReport = 6, + Master = 8, + Slave = 16, + Terminale = 32}; Element(const ElementsLocation &location, QGraphicsItem * = nullptr, @@ -76,16 +77,19 @@ class Element : public QetGraphicsItem signals: void linkedElementChanged(); //This signal is emited when the linked elements with this element change - void elementInfoChange(DiagramContext old_info, - DiagramContext new_info); + void elementInfoChange( + DiagramContext old_info, + DiagramContext new_info); void textAdded(DynamicElementTextItem *deti); void textRemoved(DynamicElementTextItem *deti); void textsGroupAdded(ElementTextItemGroup *group); void textsGroupAboutToBeRemoved(ElementTextItemGroup *group); - void textAddedToGroup(DynamicElementTextItem *text, - ElementTextItemGroup *group); - void textRemovedFromGroup(DynamicElementTextItem *text, - ElementTextItemGroup *group); + void textAddedToGroup( + DynamicElementTextItem *text, + ElementTextItemGroup *group); + void textRemovedFromGroup( + DynamicElementTextItem *text, + ElementTextItemGroup *group); public: @@ -125,13 +129,15 @@ class Element : public QetGraphicsItem QPoint hotspot() const; void editProperty() override; static bool valideXml(QDomElement &); - virtual bool fromXml(QDomElement &, - QHash &, - bool = false); - virtual QDomElement toXml(QDomDocument &, - QHash &) const; + virtual bool fromXml( + QDomElement &, + QHash &, + bool = false); + virtual QDomElement toXml( + QDomDocument &, + QHash &) const; QUuid uuid() const; int orientation() const; @@ -144,10 +150,12 @@ class Element : public QetGraphicsItem void removeTextGroup(ElementTextItemGroup *group); ElementTextItemGroup *textGroup(const QString &name) const; QList textGroups() const; - bool addTextToGroup(DynamicElementTextItem *text, - ElementTextItemGroup *group); - bool removeTextFromGroup(DynamicElementTextItem *text, - ElementTextItemGroup *group); + bool addTextToGroup( + DynamicElementTextItem *text, + ElementTextItemGroup *group); + bool removeTextFromGroup( + DynamicElementTextItem *text, + ElementTextItemGroup *group); //METHODS related to linked element bool isFree() const; @@ -165,10 +173,12 @@ class Element : public QetGraphicsItem void setSize(int, int); private: - void drawSelection(QPainter *, - const QStyleOptionGraphicsItem *); - void drawHighlight(QPainter *, - const QStyleOptionGraphicsItem *); + void drawSelection( + QPainter *, + const QStyleOptionGraphicsItem *); + void drawHighlight( + QPainter *, + const QStyleOptionGraphicsItem *); bool buildFromXml(const QDomElement &, int * = nullptr); bool parseElement(const QDomElement &dom); bool parseInput(const QDomElement &dom_element); @@ -178,9 +188,10 @@ class Element : public QetGraphicsItem //Reimplemented from QGraphicsItem public: - void paint(QPainter *, - const QStyleOptionGraphicsItem *, - QWidget *) override; + void paint( + QPainter *, + const QStyleOptionGraphicsItem *, + QWidget *) override; QRectF boundingRect() const override; protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; @@ -190,9 +201,15 @@ class Element : public QetGraphicsItem void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override; protected: - // m_converted_text_from_description, when a element is created from his description, the old element text item (tagged as 'input' in the xml) - // are converted to dynamic text field, the QPointF is the original position of the text item, because the origin transformation point of text item - // and dynamic text item are not the same, so we must to keep a track of this value, to be use in the function element::fromXml + // m_converted_text_from_description, + // when a element is created from his description, + // the old element text item (tagged as 'input' in the xml) + // are converted to dynamic text field, + // the QPointF is the original position of the text item, + // because the origin transformation point of text item + // and dynamic text item are not the same, + // so we must to keep a track of this value, + // to be use in the function element::fromXml QHash m_converted_text_from_xml_description; @@ -227,7 +244,8 @@ class Element : public QetGraphicsItem bool comparPos(const Element * elmt1, const Element * elmt2); -inline bool Element::isFree() const { +inline bool Element::isFree() const +{ return (connected_elements.isEmpty()); } @@ -239,7 +257,8 @@ inline bool Element::isFree() const { 3 = 270° @return the current orientation of this element */ -inline int Element::orientation() const { +inline int Element::orientation() const +{ return(QET::correctAngle(rotation())/90); } @@ -247,18 +266,19 @@ inline int Element::orientation() const { @brief Element::uuid @return the uuid of this element */ -inline QUuid Element::uuid() const { - return m_uuid; -} +inline QUuid Element::uuid() const +{return m_uuid;} /** @brief Element::linkedElements @return the list of linked elements, the list is sorted by position */ -inline QList Element::linkedElements() { - std::sort(connected_elements.begin(), - connected_elements.end(), - comparPos); +inline QList Element::linkedElements() +{ + std::sort( + connected_elements.begin(), + connected_elements.end(), + comparPos); return connected_elements; } diff --git a/sources/qetgraphicsitem/elementtextitemgroup.cpp b/sources/qetgraphicsitem/elementtextitemgroup.cpp index 0fe1dee87..aca072633 100644 --- a/sources/qetgraphicsitem/elementtextitemgroup.cpp +++ b/sources/qetgraphicsitem/elementtextitemgroup.cpp @@ -79,16 +79,25 @@ void ElementTextItemGroup::addToGroup(QGraphicsItem *item) updateAlignment(); DynamicElementTextItem *deti = qgraphicsitem_cast(item); - connect(deti, &DynamicElementTextItem::fontChanged, this, &ElementTextItemGroup::updateAlignment); - connect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment); - connect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateAlignment); - connect(deti, &DynamicElementTextItem::infoNameChanged, this, &ElementTextItemGroup::updateAlignment); - connect(deti, &DynamicElementTextItem::compositeTextChanged, this, &ElementTextItemGroup::updateAlignment); - connect(deti, &DynamicElementTextItem::plainTextChanged, this, &ElementTextItemGroup::updateAlignment); - connect(deti, &DynamicElementTextItem::textWidthChanged, this, &ElementTextItemGroup::updateAlignment); + connect(deti, &DynamicElementTextItem::fontChanged, + this, &ElementTextItemGroup::updateAlignment); + connect(deti, &DynamicElementTextItem::textChanged, + this, &ElementTextItemGroup::updateAlignment); + connect(deti, &DynamicElementTextItem::textFromChanged, + this, &ElementTextItemGroup::updateAlignment); + connect(deti, &DynamicElementTextItem::infoNameChanged, + this, &ElementTextItemGroup::updateAlignment); + connect(deti, &DynamicElementTextItem::compositeTextChanged, + this, &ElementTextItemGroup::updateAlignment); + connect(deti, &DynamicElementTextItem::plainTextChanged, + this, &ElementTextItemGroup::updateAlignment); + connect(deti, &DynamicElementTextItem::textWidthChanged, + this, &ElementTextItemGroup::updateAlignment); - connect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateXref); - connect(deti, &DynamicElementTextItem::infoNameChanged, this, &ElementTextItemGroup::updateXref); + connect(deti, &DynamicElementTextItem::textFromChanged, + this, &ElementTextItemGroup::updateXref); + connect(deti, &DynamicElementTextItem::infoNameChanged, + this, &ElementTextItemGroup::updateXref); updateXref(); } @@ -101,8 +110,11 @@ void ElementTextItemGroup::addToGroup(QGraphicsItem *item) void ElementTextItemGroup::removeFromGroup(QGraphicsItem *item) { QGraphicsItemGroup::removeFromGroup(item); - //the item transformation is not reseted, we must to do it, because for exemple if the group rotation is 45° - //When item is removed from group, visually the item is unchanged (so 45°) but if we call item->rotation() the returned value is 0. + //the item transformation is not reseted, we must to do it, + // because for exemple if the group rotation is 45° + //When item is removed from group, + // visually the item is unchanged (so 45°) + // but if we call item->rotation() the returned value is 0. item->resetTransform(); item->setRotation(this->rotation()); item->setFlag(QGraphicsItem::ItemIsSelectable, true); @@ -110,16 +122,25 @@ void ElementTextItemGroup::removeFromGroup(QGraphicsItem *item) if(DynamicElementTextItem *deti = qgraphicsitem_cast(item)) { - disconnect(deti, &DynamicElementTextItem::fontChanged, this, &ElementTextItemGroup::updateAlignment); - disconnect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment); - disconnect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateAlignment); - disconnect(deti, &DynamicElementTextItem::infoNameChanged, this, &ElementTextItemGroup::updateAlignment); - disconnect(deti, &DynamicElementTextItem::compositeTextChanged, this, &ElementTextItemGroup::updateAlignment); - disconnect(deti, &DynamicElementTextItem::plainTextChanged, this, &ElementTextItemGroup::updateAlignment); - disconnect(deti, &DynamicElementTextItem::textWidthChanged, this, &ElementTextItemGroup::updateAlignment); + disconnect(deti, &DynamicElementTextItem::fontChanged, + this, &ElementTextItemGroup::updateAlignment); + disconnect(deti, &DynamicElementTextItem::textChanged, + this, &ElementTextItemGroup::updateAlignment); + disconnect(deti, &DynamicElementTextItem::textFromChanged, + this, &ElementTextItemGroup::updateAlignment); + disconnect(deti, &DynamicElementTextItem::infoNameChanged, + this, &ElementTextItemGroup::updateAlignment); + disconnect(deti, &DynamicElementTextItem::compositeTextChanged, + this, &ElementTextItemGroup::updateAlignment); + disconnect(deti, &DynamicElementTextItem::plainTextChanged, + this, &ElementTextItemGroup::updateAlignment); + disconnect(deti, &DynamicElementTextItem::textWidthChanged, + this, &ElementTextItemGroup::updateAlignment); - disconnect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateXref); - disconnect(deti, &DynamicElementTextItem::infoNameChanged, this, &ElementTextItemGroup::updateXref); + disconnect(deti, &DynamicElementTextItem::textFromChanged, + this, &ElementTextItemGroup::updateXref); + disconnect(deti, &DynamicElementTextItem::infoNameChanged, + this, &ElementTextItemGroup::updateXref); updateXref(); } @@ -285,13 +306,28 @@ void ElementTextItemGroup::setHoldToBottomPage(bool hold) connect(m_parent_element, &Element::rotationChanged, this, &ElementTextItemGroup::autoPos); if(m_parent_element->linkType() == Element::Master) { - //We use timer to let the time of the parent element xref to be updated, befor update the position of this group - //because the position of this group is related to the size of the parent element Xref - m_linked_changed_timer = connect(m_parent_element, &Element::linkedElementChanged, - [this]() {QTimer::singleShot(200, this, &ElementTextItemGroup::autoPos);}); + //We use timer to let the time of the parent element + // xref to be updated, + // befor update the position of this group + //because the position of this group is related + // to the size of the parent element Xref + m_linked_changed_timer = connect( + m_parent_element, + &Element::linkedElementChanged, + [this]() + {QTimer::singleShot(200, + this, + &ElementTextItemGroup::autoPos);} + ); if(m_parent_element->diagram()) - m_XrefChanged_timer = connect(m_parent_element->diagram()->project(), &QETProject::XRefPropertiesChanged, - [this]() {QTimer::singleShot(200, this, &ElementTextItemGroup::autoPos);}); + m_XrefChanged_timer = connect( + m_parent_element->diagram()->project(), + &QETProject::XRefPropertiesChanged, + [this]() + {QTimer::singleShot(200, + this, + &ElementTextItemGroup::autoPos);} + ); } autoPos(); } @@ -299,8 +335,10 @@ void ElementTextItemGroup::setHoldToBottomPage(bool hold) { setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsMovable, true); - disconnect(m_parent_element, &Element::yChanged, this, &ElementTextItemGroup::autoPos); - disconnect(m_parent_element, &Element::rotationChanged, this, &ElementTextItemGroup::autoPos); + disconnect(m_parent_element, &Element::yChanged, + this, &ElementTextItemGroup::autoPos); + disconnect(m_parent_element, &Element::rotationChanged, + this, &ElementTextItemGroup::autoPos); if(m_parent_element->linkType() == Element::Master) { disconnect(m_linked_changed_timer); @@ -319,7 +357,8 @@ void ElementTextItemGroup::setFrame(const bool frame) emit frameChanged(m_frame); } -bool ElementTextItemGroup::frame() const { +bool ElementTextItemGroup::frame() const +{ return m_frame; } @@ -383,7 +422,8 @@ QDomElement ElementTextItemGroup::toXml(QDomDocument &dom_document) const dom_element.setAttribute("vertical_adjustment", m_vertical_adjustment); dom_element.setAttribute("frame", m_frame? "true" : "false"); - dom_element.setAttribute("hold_to_bottom_page", m_hold_to_bottom_of_page == true ? "true" : "false"); + dom_element.setAttribute("hold_to_bottom_page", + m_hold_to_bottom_of_page == true ? "true" : "false"); QDomElement dom_texts = dom_document.createElement("texts"); for(DynamicElementTextItem *deti : texts()) @@ -411,8 +451,17 @@ void ElementTextItemGroup::fromXml(QDomElement &dom_element) setName(dom_element.attribute("name", "no name")); QMetaEnum me = QMetaEnum::fromType(); - setAlignment(Qt::Alignment(me.keyToValue(dom_element.attribute("alignment").toStdString().data()))); - + setAlignment( + Qt::Alignment( + me.keyToValue( + dom_element.attribute( + "alignment") + .toStdString() + .data() + ) + ) + ); + setPos(dom_element.attribute("x", QString::number(0)).toDouble(), dom_element.attribute("y", QString::number(0)).toDouble()); @@ -448,7 +497,10 @@ void ElementTextItemGroup::fromXml(QDomElement &dom_element) @param option @param widget */ -void ElementTextItemGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void ElementTextItemGroup::paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); @@ -460,7 +512,8 @@ void ElementTextItemGroup::paint(QPainter *painter, const QStyleOptionGraphicsIt t.setStyle(Qt::DashDotLine); t.setCosmetic(true); painter->setPen(t); - painter->drawRoundedRect(boundingRect().adjusted(1, 1, -1, -1), 10, 10); + painter->drawRoundedRect(boundingRect().adjusted(1, 1, -1, -1), + 10, 10); painter->restore(); } @@ -502,15 +555,16 @@ void ElementTextItemGroup::paint(QPainter *painter, const QStyleOptionGraphicsIt */ QRectF ElementTextItemGroup::boundingRect() const { - //If we refer to the Qt doc, the bounding rect of a QGraphicsItemGroup, - //is the bounding of all childrens in the group - //When add an item in the group, the bounding rect is good, but - //if we move an item already in the group, the bounding rect of the group stay unchanged. - //We reimplement this function to avoid this behavior. + //If we refer to the Qt doc, the bounding rect of a QGraphicsItemGroup, + //is the bounding of all childrens in the group + //When add an item in the group, the bounding rect is good, but + //if we move an item already in the group, the bounding rect of the group stay unchanged. + //We reimplement this function to avoid this behavior. QRectF rect; for(QGraphicsItem *qgi : texts()) { - QRectF r(qgi->pos(), QSize(qgi->boundingRect().width(), qgi->boundingRect().height())); + QRectF r(qgi->pos(), QSize(qgi->boundingRect().width(), + qgi->boundingRect().height())); rect = rect.united(r); } return rect; @@ -567,7 +621,8 @@ void ElementTextItemGroup::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if((event->buttons() & Qt::LeftButton) && (flags() & ItemIsMovable)) { if(diagram() && m_first_move) - diagram()->elementTextsMover().beginMovement(diagram(), this); + diagram()->elementTextsMover().beginMovement(diagram(), + this); if(m_first_move) { @@ -611,7 +666,8 @@ void ElementTextItemGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QGraphicsItemGroup::mouseReleaseEvent(event); } -void ElementTextItemGroup::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +void ElementTextItemGroup::mouseDoubleClickEvent( + QGraphicsSceneMouseEvent *event) { if(m_slave_Xref_item) { diff --git a/sources/qetgraphicsitem/independenttextitem.cpp b/sources/qetgraphicsitem/independenttextitem.cpp index 9b655f888..7868f543c 100644 --- a/sources/qetgraphicsitem/independenttextitem.cpp +++ b/sources/qetgraphicsitem/independenttextitem.cpp @@ -46,7 +46,8 @@ IndependentTextItem::IndependentTextItem(const QString &text) : {} /// Destructeur -IndependentTextItem::~IndependentTextItem() { +IndependentTextItem::~IndependentTextItem() +{ } /** diff --git a/sources/qetgraphicsitem/masterelement.cpp b/sources/qetgraphicsitem/masterelement.cpp index edb0b3872..92d22328c 100644 --- a/sources/qetgraphicsitem/masterelement.cpp +++ b/sources/qetgraphicsitem/masterelement.cpp @@ -28,9 +28,10 @@ @param qgi : parent QGraphicItem @param state : int used to know if the creation of element have error */ -MasterElement::MasterElement(const ElementsLocation &location, - QGraphicsItem *qgi, - int *state) : +MasterElement::MasterElement( + const ElementsLocation &location, + QGraphicsItem *qgi, + int *state) : Element(location, qgi, state, Element::Master) {} @@ -38,7 +39,8 @@ MasterElement::MasterElement(const ElementsLocation &location, @brief MasterElement::~MasterElement default destructor */ -MasterElement::~MasterElement() { +MasterElement::~MasterElement() +{ unlinkAllElements(); } diff --git a/sources/qetgraphicsitem/masterelement.h b/sources/qetgraphicsitem/masterelement.h index 451ed1f43..97f6f18a2 100644 --- a/sources/qetgraphicsitem/masterelement.h +++ b/sources/qetgraphicsitem/masterelement.h @@ -31,9 +31,12 @@ class CrossRefItem; class MasterElement : public Element { Q_OBJECT - + public: - explicit MasterElement(const ElementsLocation &, QGraphicsItem * = nullptr, int * = nullptr); + explicit MasterElement( + const ElementsLocation &, + QGraphicsItem * = nullptr, + int * = nullptr); ~MasterElement() override; void linkToElement (Element *elmt) override; @@ -43,7 +46,9 @@ class MasterElement : public Element QRectF XrefBoundingRect() const; protected: - QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; + QVariant itemChange( + GraphicsItemChange change, + const QVariant &value) override; private: void xrefPropertiesChanged(); diff --git a/sources/qetgraphicsitem/qetgraphicsitem.cpp b/sources/qetgraphicsitem/qetgraphicsitem.cpp index f59eb58fa..059182e20 100644 --- a/sources/qetgraphicsitem/qetgraphicsitem.cpp +++ b/sources/qetgraphicsitem/qetgraphicsitem.cpp @@ -67,7 +67,8 @@ void QetGraphicsItem::setPos(qreal x, qreal y) { @brief QetGraphicsItem::state @return the current state of this item */ -QET::GraphicsItemState QetGraphicsItem::state() const { +QET::GraphicsItemState QetGraphicsItem::state() const +{ return m_state; } diff --git a/sources/qetgraphicsitem/qetgraphicsitem.h b/sources/qetgraphicsitem/qetgraphicsitem.h index 3f4fb7070..eba811c35 100644 --- a/sources/qetgraphicsitem/qetgraphicsitem.h +++ b/sources/qetgraphicsitem/qetgraphicsitem.h @@ -28,24 +28,26 @@ class QetGraphicsItem : public QGraphicsObject Q_OBJECT public: - //constructor destructor + //constructor destructor QetGraphicsItem(QGraphicsItem *parent = nullptr); ~QetGraphicsItem() override = 0; - //public methode - Diagram *diagram () const; - virtual void setPos (const QPointF &p); - virtual void setPos (qreal x, qreal y); + //public methode + Diagram *diagram () const; + virtual void setPos (const QPointF &p); + virtual void setPos (qreal x, qreal y); - virtual bool isMovable () const {return is_movable_;} + virtual bool isMovable () const +{return is_movable_;} virtual void setMovable (bool movable) { is_movable_ = movable;} - virtual void editProperty () {} - virtual QString name ()const {return QString("");} + virtual void editProperty () {} + virtual QString name ()const +{return QString("");} QET::GraphicsItemState state() const; - //protected method + //protected method protected: void mousePressEvent(QGraphicsSceneMouseEvent *event) override; void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; diff --git a/sources/qetgraphicsitem/qetshapeitem.cpp b/sources/qetgraphicsitem/qetshapeitem.cpp index 896e87d7f..89f99b90e 100644 --- a/sources/qetgraphicsitem/qetshapeitem.cpp +++ b/sources/qetgraphicsitem/qetshapeitem.cpp @@ -203,7 +203,8 @@ void QetShapeItem::setYRadius(qreal Y) @brief QetShapeItem::pointCount @return the number of point in the polygon */ -int QetShapeItem::pointsCount() const { +int QetShapeItem::pointsCount() const +{ return m_polygon.size(); } @@ -246,7 +247,8 @@ void QetShapeItem::removePoints(int number) @brief QetShapeItem::boundingRect @return the bounding rect of this item */ -QRectF QetShapeItem::boundingRect() const { +QRectF QetShapeItem::boundingRect() const +{ return shape().boundingRect().adjusted(-6, -6, 6, 6); } @@ -265,9 +267,10 @@ QPainterPath QetShapeItem::shape() const path.lineTo(m_P2); break; case Rectangle: - path.addRoundedRect(QRectF(m_P1, m_P2), - m_xRadius, - m_yRadius); + path.addRoundedRect( + QRectF(m_P1, m_P2), + m_xRadius, + m_yRadius); break; case Ellipse: path.addEllipse(QRectF(m_P1, m_P2)); @@ -319,19 +322,19 @@ void QetShapeItem::paint( painter -> drawPath (shape()); painter -> restore (); } - - switch (m_shapeType) - { - case Line: painter->drawLine(QLineF(m_P1, m_P2)); break; + + switch (m_shapeType) + { + case Line: painter->drawLine(QLineF(m_P1, m_P2)); break; case Rectangle: painter->drawRoundedRect(QRectF(m_P1, m_P2), m_xRadius, m_yRadius); break; - case Ellipse: painter->drawEllipse(QRectF(m_P1, m_P2)); break; + case Ellipse: painter->drawEllipse(QRectF(m_P1, m_P2)); break; case Polygon: m_closed ? painter->drawPolygon(m_polygon) : painter->drawPolyline(m_polygon); break; - } - - painter->restore(); + } + + painter->restore(); } /** @@ -1005,7 +1008,8 @@ void QetShapeItem::editProperty() @brief QetShapeItem::name @return the name of the curent shape. */ -QString QetShapeItem::name() const { +QString QetShapeItem::name() const +{ switch (m_shapeType) { case Line: return tr("une ligne"); case Rectangle: return tr("un rectangle"); diff --git a/sources/qetgraphicsitem/qetshapeitem.h b/sources/qetgraphicsitem/qetshapeitem.h index 699c37737..166a20203 100644 --- a/sources/qetgraphicsitem/qetshapeitem.h +++ b/sources/qetgraphicsitem/qetshapeitem.h @@ -62,7 +62,11 @@ class QetShapeItem : public QetGraphicsItem enum { Type = UserType + 1008 }; - QetShapeItem(QPointF, QPointF = QPointF(0,0), ShapeType = Line, QGraphicsItem *parent = nullptr); + QetShapeItem( + QPointF, + QPointF = QPointF(0,0), + ShapeType = Line, + QGraphicsItem *parent = nullptr); ~QetShapeItem() override; //Enable the use of qgraphicsitem_cast to safely cast a @@ -106,13 +110,21 @@ class QetShapeItem : public QetGraphicsItem QPainterPath shape() const override; protected: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; - void hoverEnterEvent (QGraphicsSceneHoverEvent *event) override; - void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override; - void mousePressEvent (QGraphicsSceneMouseEvent *event) override; - QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; - bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) override; - void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; + void paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) override; + void hoverEnterEvent (QGraphicsSceneHoverEvent *event) override; + void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override; + void mousePressEvent (QGraphicsSceneMouseEvent *event) override; + QVariant itemChange( + GraphicsItemChange change, + const QVariant &value) override; + bool sceneEventFilter( + QGraphicsItem *watched, + QEvent *event) override; + void contextMenuEvent( + QGraphicsSceneContextMenuEvent *event) override; private: void switchResizeMode(); @@ -129,24 +141,24 @@ class QetShapeItem : public QetGraphicsItem private: ShapeType m_shapeType; QPen m_pen; - QBrush m_brush; + QBrush m_brush; QPointF m_P1, - m_P2, - m_old_P1, - m_old_P2, - m_context_menu_pos; + m_P2, + m_old_P1, + m_old_P2, + m_context_menu_pos; QPolygonF m_polygon, m_old_polygon; bool m_hovered; - int m_vector_index; - bool m_closed = false, - m_modifie_radius_equaly = false; - int m_resize_mode = 1; + int m_vector_index; + bool m_closed = false, + m_modifie_radius_equaly = false; + int m_resize_mode = 1; QVector m_handler_vector; - QAction *m_insert_point, - *m_remove_point; - qreal m_xRadius = 0, - m_yRadius = 0, - m_old_xRadius, - m_old_yRadius; + QAction *m_insert_point, + *m_remove_point; + qreal m_xRadius = 0, + m_yRadius = 0, + m_old_xRadius, + m_old_yRadius; }; #endif // QETSHAPEITEM_H diff --git a/sources/qetgraphicsitem/reportelement.h b/sources/qetgraphicsitem/reportelement.h index 361fe0194..0cca8b654 100644 --- a/sources/qetgraphicsitem/reportelement.h +++ b/sources/qetgraphicsitem/reportelement.h @@ -30,14 +30,18 @@ class ReportElement : public Element Q_OBJECT public : - explicit ReportElement(const ElementsLocation &,const QString& link_type, QGraphicsItem * = nullptr, int * = nullptr); + explicit ReportElement( + const ElementsLocation &, + const QString& link_type, + QGraphicsItem * = nullptr, + int * = nullptr); ~ReportElement() override; void linkToElement(Element *) override; void unlinkAllElements() override; void unlinkElement(Element *elmt) override; private: - int m_inverse_report; + int m_inverse_report; }; #endif // REPORTELEMENT_H diff --git a/sources/qetgraphicsitem/simpleelement.cpp b/sources/qetgraphicsitem/simpleelement.cpp index 915f5d96e..87098dff3 100644 --- a/sources/qetgraphicsitem/simpleelement.cpp +++ b/sources/qetgraphicsitem/simpleelement.cpp @@ -24,16 +24,18 @@ @param qgi @param state */ -SimpleElement::SimpleElement(const ElementsLocation &location, - QGraphicsItem *qgi, - int *state) : +SimpleElement::SimpleElement( + const ElementsLocation &location, + QGraphicsItem *qgi, + int *state) : Element(location, qgi, state, Element::Simple) {} /** @brief SimpleElement::~SimpleElement */ -SimpleElement::~SimpleElement() {} +SimpleElement::~SimpleElement() +{} /** @brief SimpleElement::initLink diff --git a/sources/qetgraphicsitem/simpleelement.h b/sources/qetgraphicsitem/simpleelement.h index d47745102..30ff2a151 100644 --- a/sources/qetgraphicsitem/simpleelement.h +++ b/sources/qetgraphicsitem/simpleelement.h @@ -31,9 +31,10 @@ class SimpleElement : public Element { Q_OBJECT public : - explicit SimpleElement(const ElementsLocation &, - QGraphicsItem * = nullptr, - int * = nullptr); + explicit SimpleElement( + const ElementsLocation &, + QGraphicsItem * = nullptr, + int * = nullptr); ~SimpleElement() override; void initLink(QETProject *project) override; diff --git a/sources/qetgraphicsitem/slaveelement.cpp b/sources/qetgraphicsitem/slaveelement.cpp index 4135a7129..2289981b9 100644 --- a/sources/qetgraphicsitem/slaveelement.cpp +++ b/sources/qetgraphicsitem/slaveelement.cpp @@ -40,7 +40,8 @@ SlaveElement::SlaveElement(const ElementsLocation &location, @brief SlaveElement::~SlaveElement default destructor */ -SlaveElement::~SlaveElement() { +SlaveElement::~SlaveElement() +{ unlinkAllElements(); } diff --git a/sources/qetgraphicsitem/slaveelement.h b/sources/qetgraphicsitem/slaveelement.h index d5a076892..2aba4305c 100644 --- a/sources/qetgraphicsitem/slaveelement.h +++ b/sources/qetgraphicsitem/slaveelement.h @@ -25,9 +25,10 @@ class SlaveElement : public Element { Q_OBJECT public: - explicit SlaveElement (const ElementsLocation &, - QGraphicsItem * = nullptr, - int * = nullptr); + explicit SlaveElement ( + const ElementsLocation &, + QGraphicsItem * = nullptr, + int * = nullptr); ~SlaveElement() override; void linkToElement(Element *elmt) override; void unlinkAllElements() override; diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index 708b90695..9c083b078 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -40,12 +40,11 @@ const qreal Terminal::Z = 1000; @param name of terminal @param hiddenName */ -void Terminal::init(QString number, - QString name, - bool hiddenName) { - +void Terminal::init( + QString number, QString name, bool hiddenName) +{ hovered_color_ = Terminal::neutralColor; - + // calcul de la position du point d'amarrage a l'element dock_elmt_ = d->m_pos; switch(d->m_orientation) { @@ -61,7 +60,7 @@ void Terminal::init(QString number, name_terminal_ = std::move(name); name_terminal_hidden = hiddenName; // par defaut : pas de conducteur - + // QRectF null br_ = new QRectF(); previous_terminal_ = nullptr; @@ -82,7 +81,12 @@ void Terminal::init(QString number, \param name \param hiddenName */ -void Terminal::init(QPointF pf, Qet::Orientation o, QString number, QString name, bool hiddenName) +void Terminal::init( + QPointF pf, + Qet::Orientation o, + QString number, + QString name, + bool hiddenName) { // definition du pount d'amarrage pour un conducteur d->m_pos = pf; @@ -132,12 +136,13 @@ Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e) : @param hiddenName hide or show the name @param e Element auquel cette borne appartient */ -Terminal::Terminal(QPointF pf, - Qet::Orientation o, - QString num, - QString name, - bool hiddenName, - Element *e) : +Terminal::Terminal( + QPointF pf, + Qet::Orientation o, + QString num, + QString name, + bool hiddenName, + Element *e) : QGraphicsObject (e), d(new TerminalData(this)), parent_element_ (e) @@ -160,7 +165,8 @@ Terminal::Terminal(TerminalData* data, Element* e) : La destruction de la borne entraine la destruction des conducteurs associes. */ -Terminal::~Terminal() { +Terminal::~Terminal() +{ foreach(Conductor *c, conductors_) delete c; delete br_; } @@ -172,7 +178,8 @@ Terminal::~Terminal() { pivote. Sinon elle renvoie son sens normal. @return L'orientation actuelle de la Terminal. */ -Qet::Orientation Terminal::orientation() const { +Qet::Orientation Terminal::orientation() const +{ if (Element *elt = qgraphicsitem_cast(parentItem())) { // orientations actuelle et par defaut de l'element int ori_cur = elt -> orientation(); @@ -192,7 +199,8 @@ Qet::Orientation Terminal::orientation() const { @brief Terminal::setNumber @param number */ -void Terminal::setNumber(QString number) { +void Terminal::setNumber(QString number) +{ number_terminal_ = std::move(number); } @@ -201,7 +209,8 @@ void Terminal::setNumber(QString number) { @param name : QString @param hiddenName : bool */ -void Terminal::setName(QString name, bool hiddenName) { +void Terminal::setName(QString name, bool hiddenName) +{ name_terminal_ = std::move(name); name_terminal_hidden = hiddenName; } @@ -215,13 +224,16 @@ void Terminal::setName(QString name, bool hiddenName) { bool Terminal::addConductor(Conductor *conductor) { if (!conductor) return(false); + + Q_ASSERT_X(((conductor -> terminal1 == this) ^ (conductor -> terminal2 == this)), + "Terminal::addConductor", + "The conductor must be linked exactly once to this terminal"); + + //Get the other terminal where the conductor must be linked + Terminal *other_terminal = (conductor -> terminal1 == this) + ? conductor->terminal2 : conductor->terminal1; - Q_ASSERT_X(((conductor -> terminal1 == this) ^ (conductor -> terminal2 == this)), "Terminal::addConductor", "The conductor must be linked exactly once to this terminal"); - - //Get the other terminal where the conductor must be linked - Terminal *other_terminal = (conductor -> terminal1 == this) ? conductor->terminal2 : conductor->terminal1; - - //Check if this terminal isn't already linked with other_terminal + //Check if this terminal isn't already linked with other_terminal foreach (Conductor* cond, conductors_) if (cond -> terminal1 == other_terminal || cond -> terminal2 == other_terminal) return false; //They already a conductor linked to this and other_terminal @@ -250,35 +262,37 @@ void Terminal::removeConductor(Conductor *conductor) @param p Le QPainter a utiliser @param options Les options de dessin */ -void Terminal::paint(QPainter *p, - const QStyleOptionGraphicsItem *options, - QWidget *) { +void Terminal::paint( + QPainter *p, + const QStyleOptionGraphicsItem *options, + QWidget *) +{ // en dessous d'un certain zoom, les bornes ne sont plus dessinees if (options && options -> levelOfDetail < 0.5) return; - + p -> save(); //annulation des renderhints p -> setRenderHint(QPainter::Antialiasing, false); p -> setRenderHint(QPainter::TextAntialiasing, false); p -> setRenderHint(QPainter::SmoothPixmapTransform, false); - + // on travaille avec les coordonnees de l'element parent QPointF c = mapFromParent(d->m_pos); QPointF e = mapFromParent(dock_elmt_); - + QPen t; t.setWidthF(1.0); - + if (options && options -> levelOfDetail < 1.0) { t.setCosmetic(true); } - + // dessin de la borne en rouge t.setColor(Qt::red); p -> setPen(t); p -> drawLine(c, e); - + // dessin du point d'amarrage au conducteur en bleu t.setColor(hovered_color_); p -> setPen(t); @@ -288,11 +302,11 @@ void Terminal::paint(QPainter *p, p -> drawEllipse(QRectF(c.x() - 2.5, c.y() - 2.5, 5.0, 5.0)); } else p -> drawPoint(c); - //Draw help line if needed, + //Draw help line if needed, if (diagram() && m_draw_help_line) { - //Draw the help line with same orientation of terminal - //Only if there isn't docked conductor + //Draw the help line with same orientation of terminal + //Only if there isn't docked conductor if (conductors().isEmpty()) { if (!m_help_line) @@ -312,14 +326,14 @@ void Terminal::paint(QPainter *p, } } - //Map the line (in scene coordinate) to m_help_line coordinate + //Map the line (in scene coordinate) to m_help_line coordinate line.setP1(m_help_line -> mapFromScene(line.p1())); line.setP2(m_help_line -> mapFromScene(line.p2())); m_help_line -> setPen(pen); m_help_line -> setLine(line); } - //Draw the help line perpendicular to the terminal + //Draw the help line perpendicular to the terminal if (!m_help_line_a) { m_help_line_a = new QGraphicsLineItem(this); @@ -415,7 +429,8 @@ QLineF Terminal::HelpLine() const @brief Terminal::boundingRect @return Le rectangle (en precision flottante) delimitant la borne et ses alentours. */ -QRectF Terminal::boundingRect() const { +QRectF Terminal::boundingRect() const +{ if (br_ -> isNull()) { qreal dcx = d->m_pos.x(); @@ -497,7 +512,8 @@ Terminal* Terminal::alignedWithTerminal() const @brief Terminal::hoverEnterEvent Gere l'entree de la souris sur la zone de la Borne. */ -void Terminal::hoverEnterEvent(QGraphicsSceneHoverEvent *) { +void Terminal::hoverEnterEvent(QGraphicsSceneHoverEvent *) +{ hovered_ = true; update(); } @@ -506,14 +522,14 @@ void Terminal::hoverEnterEvent(QGraphicsSceneHoverEvent *) { @brief Terminal::hoverMoveEvent Gere les mouvements de la souris sur la zone de la Borne. */ -void Terminal::hoverMoveEvent(QGraphicsSceneHoverEvent *) { -} +void Terminal::hoverMoveEvent(QGraphicsSceneHoverEvent *) {} /** @brief Terminal::hoverLeaveEvent Gere le fait que la souris sorte de la zone de la Borne. */ -void Terminal::hoverLeaveEvent(QGraphicsSceneHoverEvent *) { +void Terminal::hoverLeaveEvent(QGraphicsSceneHoverEvent *) +{ hovered_ = false; update(); } @@ -523,7 +539,8 @@ void Terminal::hoverLeaveEvent(QGraphicsSceneHoverEvent *) { Gere le fait qu'on enfonce un bouton de la souris sur la Borne. @param e L'evenement souris correspondant */ -void Terminal::mousePressEvent(QGraphicsSceneMouseEvent *e) { +void Terminal::mousePressEvent(QGraphicsSceneMouseEvent *e) +{ if (Diagram *diag = diagram()) { diag -> setConductorStart(mapToScene(QPointF(d->m_pos))); diag -> setConductorStop(e -> scenePos()); @@ -537,10 +554,11 @@ void Terminal::mousePressEvent(QGraphicsSceneMouseEvent *e) { Gere le fait qu'on bouge la souris sur la Borne. @param e L'evenement souris correspondant */ -void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { +void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) +{ // pendant la pose d'un conducteur, on adopte un autre curseur //setCursor(Qt::CrossCursor); - + // d'un mouvement a l'autre, il faut retirer l'effet hover de la borne precedente if (previous_terminal_) { if (previous_terminal_ == this) hovered_ = true; @@ -583,7 +601,7 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { } else { other_terminal -> hovered_color_ = allowedColor; } - + other_terminal -> hovered_ = true; other_terminal -> update(); } @@ -667,7 +685,8 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) @brief Terminal::updateConductor Update the path of conductor docked to this terminal */ -void Terminal::updateConductor() { +void Terminal::updateConductor() +{ foreach (Conductor *conductor, conductors_) conductor->updatePath(); } @@ -712,7 +731,8 @@ bool Terminal::canBeLinkedTo(Terminal *other_terminal) @brief Terminal::conductors @return La liste des conducteurs lies a cette borne */ -QList Terminal::conductors() const { +QList Terminal::conductors() const +{ return(conductors_); } @@ -722,7 +742,8 @@ QList Terminal::conductors() const { @param doc Le Document XML a utiliser pour creer l'element XML @return un QDomElement representant cette borne */ -QDomElement Terminal::toXml(QDomDocument &doc) const { +QDomElement Terminal::toXml(QDomDocument &doc) const +{ QDomElement qdo = doc.createElement("terminal"); // for backward compatibility @@ -743,7 +764,8 @@ QDomElement Terminal::toXml(QDomDocument &doc) const { @param terminal Le QDomElement a analyser @return true si le QDomElement passe en parametre est une borne, false sinon */ -bool Terminal::valideXml(QDomElement &terminal) { +bool Terminal::valideXml(QDomElement &terminal) +{ // verifie le nom du tag if (terminal.tagName() != "terminal") return(false); @@ -785,7 +807,8 @@ bool Terminal::valideXml(QDomElement &terminal) { @return true si la borne "se reconnait" (memes coordonnes, meme orientation), false sinon */ -bool Terminal::fromXml(QDomElement &terminal) { +bool Terminal::fromXml(QDomElement &terminal) +{ number_terminal_ = terminal.attribute("number"); name_terminal_ = terminal.attribute("name"); name_terminal_hidden = terminal.attribute("nameHidden").toInt(); @@ -802,7 +825,8 @@ bool Terminal::fromXml(QDomElement &terminal) { @return the position, relative to the scene, of the docking point for conductors. */ -QPointF Terminal::dockConductor() const { +QPointF Terminal::dockConductor() const +{ return(mapToScene(d->m_pos)); } @@ -811,7 +835,8 @@ QPointF Terminal::dockConductor() const { @return le Diagram auquel cette borne appartient, ou 0 si cette borne est independant */ -Diagram *Terminal::diagram() const { +Diagram *Terminal::diagram() const +{ return(qobject_cast(scene())); } @@ -819,11 +844,13 @@ Diagram *Terminal::diagram() const { @brief Terminal::parentElement @return L'element auquel cette borne est rattachee */ -Element *Terminal::parentElement() const { +Element *Terminal::parentElement() const +{ return(parent_element_); } -QUuid Terminal::uuid() const { +QUuid Terminal::uuid() const +{ return d->m_uuid; } @@ -838,9 +865,10 @@ QUuid Terminal::uuid() const { false return only terminal in the same diagram of t @return the list of terminal at the same potential */ -QList relatedPotentialTerminal (const Terminal *terminal, const bool all_diagram) +QList relatedPotentialTerminal ( + const Terminal *terminal, const bool all_diagram) { - // If terminal parent element is a folio report. + // If terminal parent element is a folio report. if (all_diagram && terminal -> parentElement() -> linkType() & Element::AllReport) { QList elmt_list = terminal -> parentElement() -> linkedElements(); @@ -849,7 +877,7 @@ QList relatedPotentialTerminal (const Terminal *terminal, const bool return (elmt_list.first()->terminals()); } } - // If terminal parent element is a Terminal element. + // If terminal parent element is a Terminal element. else if (terminal -> parentElement() -> linkType() & Element::Terminale) { QList terminals = terminal->parentElement()->terminals(); diff --git a/sources/qetgraphicsitem/terminal.h b/sources/qetgraphicsitem/terminal.h index 17e9d7833..1fd66fa1b 100644 --- a/sources/qetgraphicsitem/terminal.h +++ b/sources/qetgraphicsitem/terminal.h @@ -159,7 +159,8 @@ class Terminal : public QGraphicsObject @brief Terminal::conductorsCount @return the number of conductors attached to the terminal. */ -inline int Terminal::conductorsCount() const { +inline int Terminal::conductorsCount() const +{ return(conductors_.size()); } @@ -167,7 +168,8 @@ inline int Terminal::conductorsCount() const { @brief Terminal::number @return the number of terminal. */ -inline QString Terminal::number() const { +inline QString Terminal::number() const +{ return(number_terminal_); } @@ -175,7 +177,8 @@ inline QString Terminal::number() const { @brief Terminal::name @return the name of terminal. */ -inline QString Terminal::name() const { +inline QString Terminal::name() const +{ return(name_terminal_); } diff --git a/sources/qetgraphicsitem/terminalelement.cpp b/sources/qetgraphicsitem/terminalelement.cpp index dde95d152..b0e117ed8 100644 --- a/sources/qetgraphicsitem/terminalelement.cpp +++ b/sources/qetgraphicsitem/terminalelement.cpp @@ -29,7 +29,8 @@ TerminalElement::TerminalElement(const ElementsLocation &location, Element(location, qgi, state, Element::Terminale) {} -TerminalElement::~TerminalElement() {} +TerminalElement::~TerminalElement() +{} /** @brief TerminalElement::initLink diff --git a/sources/qeticons.cpp b/sources/qeticons.cpp index 1457a77ea..a74c0c885 100644 --- a/sources/qeticons.cpp +++ b/sources/qeticons.cpp @@ -369,7 +369,8 @@ namespace QET { /** Initialise les icones de l'application QElectroTech */ -void QET::Icons::initIcons() { +void QET::Icons::initIcons() +{ // we may need to mirror some icons for right-to-left languages bool rtl = QApplication::isRightToLeft(); QTransform reverse = QTransform().scale(-1, 1); diff --git a/sources/qetmainwindow.cpp b/sources/qetmainwindow.cpp index bd83e84e9..cfcdf76f7 100644 --- a/sources/qetmainwindow.cpp +++ b/sources/qetmainwindow.cpp @@ -45,13 +45,15 @@ QETMainWindow::QETMainWindow(QWidget *widget, Qt::WindowFlags flags) : /** Destructor */ -QETMainWindow::~QETMainWindow() { +QETMainWindow::~QETMainWindow() +{ } /** Initialize common actions. */ -void QETMainWindow::initCommonActions() { +void QETMainWindow::initCommonActions() +{ QETApp *qet_app = QETApp::instance(); configure_action_ = new QAction(QET::Icons::Configure, tr("&Configurer QElectroTech"), this); @@ -89,7 +91,7 @@ void QETMainWindow::initCommonActions() { QDesktopServices::openUrl(QUrl(link)); }); - manual_online_ -> setShortcut(Qt::Key_F1); + manual_online_ -> setShortcut(Qt::Key_F1); youtube_ = new QAction(QET::Icons::QETVideo, tr("Chaine Youtube"), this); youtube_ -> setStatusTip(tr("Lance le navigateur par défaut vers la chaine Youtube de QElectroTech", "status bar tip")); @@ -131,7 +133,8 @@ void QETMainWindow::initCommonActions() { /** Initialize common menus. */ -void QETMainWindow::initCommonMenus() { +void QETMainWindow::initCommonMenus() +{ settings_menu_ = new QMenu(tr("&Configuration", "window menu")); settings_menu_ -> addAction(fullscreen_action_); settings_menu_ -> addAction(configure_action_); @@ -191,7 +194,8 @@ QAction *QETMainWindow::actionForMenu(QMenu *menu) { /** Toggle the window from/to full screen. */ -void QETMainWindow::toggleFullScreen() { +void QETMainWindow::toggleFullScreen() +{ setWindowState(windowState() ^ Qt::WindowFullScreen); } @@ -199,7 +203,8 @@ void QETMainWindow::toggleFullScreen() { Update the look of the full screen action according to the current state of the window. */ -void QETMainWindow::updateFullScreenAction() { +void QETMainWindow::updateFullScreenAction() +{ if (windowState() & Qt::WindowFullScreen) { fullscreen_action_ -> setText(tr("Sortir du &mode plein écran")); fullscreen_action_ -> setIcon(QET::Icons::FullScreenExit); @@ -216,7 +221,8 @@ void QETMainWindow::updateFullScreenAction() { Check whether a sub menu dedicated to docks and toolbars can be inserted on top of the settings menu. */ -void QETMainWindow::checkToolbarsmenu() { +void QETMainWindow::checkToolbarsmenu() +{ if (display_toolbars_) return; display_toolbars_ = createPopupMenu(); if (display_toolbars_) { diff --git a/sources/qetmessagebox.cpp b/sources/qetmessagebox.cpp index 73c38cd71..9c37a728b 100644 --- a/sources/qetmessagebox.cpp +++ b/sources/qetmessagebox.cpp @@ -20,12 +20,29 @@ /** @see Documentation Qt pour QMessageBox::critical */ -QMessageBox::StandardButton QET::QetMessageBox::critical (QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { +QMessageBox::StandardButton QET::QetMessageBox::critical ( + QWidget *parent, + const QString &title, + const QString &text, + QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton) +{ #ifdef Q_OS_MACOS - QMessageBox message_box(QMessageBox::Critical, title, text, buttons, parent, Qt::Sheet); + QMessageBox message_box( + QMessageBox::Critical, + title, + text, + buttons, + parent, + Qt::Sheet); message_box.setWindowModality(Qt::WindowModal); #else - QMessageBox message_box(QMessageBox::Critical, title, text, buttons, parent); + QMessageBox message_box( + QMessageBox::Critical, + title, + text, + buttons, + parent); #endif message_box.setDefaultButton(defaultButton); @@ -35,12 +52,29 @@ QMessageBox::StandardButton QET::QetMessageBox::critical (QWidget *parent, con /** @see Documentation Qt pour QMessageBox::information */ -QMessageBox::StandardButton QET::QetMessageBox::information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { +QMessageBox::StandardButton QET::QetMessageBox::information( + QWidget *parent, + const QString &title, + const QString &text, + QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton) +{ #ifdef Q_OS_MACOS - QMessageBox message_box(QMessageBox::Information, title, text, buttons, parent, Qt::Sheet); + QMessageBox message_box( + QMessageBox::Information, + title, + text, + buttons, + parent, + Qt::Sheet); message_box.setWindowModality(Qt::WindowModal); #else - QMessageBox message_box(QMessageBox::Information, title, text, buttons, parent); + QMessageBox message_box( + QMessageBox::Information, + title, + text, + buttons, + parent); #endif message_box.setDefaultButton(defaultButton); @@ -50,12 +84,29 @@ QMessageBox::StandardButton QET::QetMessageBox::information(QWidget *parent, con /** @see Documentation Qt pour QMessageBox::question */ -QMessageBox::StandardButton QET::QetMessageBox::question (QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { +QMessageBox::StandardButton QET::QetMessageBox::question ( + QWidget *parent, + const QString &title, + const QString &text, + QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton) +{ #ifdef Q_OS_MACOS - QMessageBox message_box(QMessageBox::Question, title, text, buttons, parent, Qt::Sheet); + QMessageBox message_box( + QMessageBox::Question, + title, + text, + buttons, + parent, + Qt::Sheet); message_box.setWindowModality(Qt::WindowModal); #else - QMessageBox message_box(QMessageBox::Question, title, text, buttons, parent); + QMessageBox message_box( + QMessageBox::Question, + title, + text, + buttons, + parent); #endif message_box.setDefaultButton(defaultButton); @@ -65,12 +116,29 @@ QMessageBox::StandardButton QET::QetMessageBox::question (QWidget *parent, con /** @see Documentation Qt pour QMessageBox::warning */ -QMessageBox::StandardButton QET::QetMessageBox::warning (QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { +QMessageBox::StandardButton QET::QetMessageBox::warning ( + QWidget *parent, + const QString &title, + const QString &text, + QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton) +{ #ifdef Q_OS_MACOS - QMessageBox message_box(QMessageBox::Warning, title, text, buttons, parent, Qt::Sheet); + QMessageBox message_box( + QMessageBox::Warning, + title, + text, + buttons, + parent, + Qt::Sheet); message_box.setWindowModality(Qt::WindowModal); #else - QMessageBox message_box(QMessageBox::Warning, title, text, buttons, parent); + QMessageBox message_box( + QMessageBox::Warning, + title, + text, + buttons, + parent); #endif message_box.setDefaultButton(defaultButton); diff --git a/sources/qetmessagebox.h b/sources/qetmessagebox.h index d92c28eec..ef5b3711b 100644 --- a/sources/qetmessagebox.h +++ b/sources/qetmessagebox.h @@ -27,10 +27,30 @@ namespace QET { Qt:Sheet flag, thus enabling a better MacOS integration. */ namespace QetMessageBox { - QMessageBox::StandardButton critical (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton); - QMessageBox::StandardButton information(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton); - QMessageBox::StandardButton question (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton); - QMessageBox::StandardButton warning (QWidget *, const QString &, const QString &, QMessageBox::StandardButtons = QMessageBox::Ok, QMessageBox::StandardButton = QMessageBox::NoButton); + QMessageBox::StandardButton critical ( + QWidget *, + const QString &, + const QString &, + QMessageBox::StandardButtons = QMessageBox::Ok, + QMessageBox::StandardButton = QMessageBox::NoButton); + QMessageBox::StandardButton information( + QWidget *, + const QString &, + const QString &, + QMessageBox::StandardButtons = QMessageBox::Ok, + QMessageBox::StandardButton = QMessageBox::NoButton); + QMessageBox::StandardButton question ( + QWidget *, + const QString &, + const QString &, + QMessageBox::StandardButtons = QMessageBox::Ok, + QMessageBox::StandardButton = QMessageBox::NoButton); + QMessageBox::StandardButton warning ( + QWidget *, + const QString &, + const QString &, + QMessageBox::StandardButtons = QMessageBox::Ok, + QMessageBox::StandardButton = QMessageBox::NoButton); }; }; #endif diff --git a/sources/qetprintpreviewdialog.cpp b/sources/qetprintpreviewdialog.cpp index 102d522a6..e70c8e26a 100644 --- a/sources/qetprintpreviewdialog.cpp +++ b/sources/qetprintpreviewdialog.cpp @@ -32,7 +32,11 @@ @param widget Widget parent @param f Flags passes au constructeur de QDialog puis QWidget */ -QETPrintPreviewDialog::QETPrintPreviewDialog(QETProject *project, QPrinter *printer, QWidget *widget, Qt::WindowFlags f) : +QETPrintPreviewDialog::QETPrintPreviewDialog( + QETProject *project, + QPrinter *printer, + QWidget *widget, + Qt::WindowFlags f) : QDialog(widget, f), project_(project), printer_(printer) @@ -40,9 +44,12 @@ QETPrintPreviewDialog::QETPrintPreviewDialog(QETProject *project, QPrinter *prin setWindowTitle(tr("QElectroTech : Aperçu avant impression")); build(); - connect(preview_, SIGNAL(paintRequested(QPrinter *)), this, SLOT(requestPaint(QPrinter *))); - connect(diagrams_list_, SIGNAL(selectionChanged()), preview_, SLOT(updatePreview())); - connect(diagrams_list_, SIGNAL(selectionChanged()), this, SLOT(checkDiagramsCount())); + connect(preview_, SIGNAL(paintRequested(QPrinter *)), + this, SLOT(requestPaint(QPrinter *))); + connect(diagrams_list_, SIGNAL(selectionChanged()), + preview_, SLOT(updatePreview())); + connect(diagrams_list_, SIGNAL(selectionChanged()), + this, SLOT(checkDiagramsCount())); setWindowState(windowState() | Qt::WindowMaximized); } @@ -50,41 +57,47 @@ QETPrintPreviewDialog::QETPrintPreviewDialog(QETProject *project, QPrinter *prin /** Destructeur */ -QETPrintPreviewDialog::~QETPrintPreviewDialog() { +QETPrintPreviewDialog::~QETPrintPreviewDialog() +{ } /** @return le widget permettant de choisir les schemas a imprimer. */ -DiagramsChooser *QETPrintPreviewDialog::diagramsChooser() { +DiagramsChooser *QETPrintPreviewDialog::diagramsChooser() +{ return(diagrams_list_); } /** @return true si l'option "Adapter le schema a la page" est activee */ -bool QETPrintPreviewDialog::fitDiagramsToPages() const { +bool QETPrintPreviewDialog::fitDiagramsToPages() const +{ return(fit_diagram_to_page_ -> isChecked()); } /** @return les options de rendu definies par l'utilisateur */ -ExportProperties QETPrintPreviewDialog::exportProperties() const { +ExportProperties QETPrintPreviewDialog::exportProperties() const +{ return(render_properties_ -> exportProperties()); } /** Passe a la premiere page */ -void QETPrintPreviewDialog::firstPage() { +void QETPrintPreviewDialog::firstPage() +{ preview_ -> setCurrentPage(1); } /** Passe a la page precedente */ -void QETPrintPreviewDialog::previousPage() { +void QETPrintPreviewDialog::previousPage() +{ int preview_previous_page = preview_ -> currentPage() - 1; preview_ -> setCurrentPage(qMax(preview_previous_page, 0)); } @@ -92,22 +105,26 @@ void QETPrintPreviewDialog::previousPage() { /** Passe a la page suivante */ -void QETPrintPreviewDialog::nextPage() { +void QETPrintPreviewDialog::nextPage() +{ int preview_next_page = preview_ -> currentPage() + 1; - preview_ -> setCurrentPage(qMin(preview_next_page, preview_ -> pageCount())); + preview_ -> setCurrentPage(qMin(preview_next_page, + preview_ -> pageCount())); } /** Passe a la derniere page */ -void QETPrintPreviewDialog::lastPage() { +void QETPrintPreviewDialog::lastPage() +{ preview_ -> setCurrentPage(preview_ -> pageCount()); } /** Copnfigure la mise en page */ -void QETPrintPreviewDialog::pageSetup() { +void QETPrintPreviewDialog::pageSetup() +{ QPageSetupDialog page_setup_dialog(printer_, this); if (page_setup_dialog.exec() == QDialog::Accepted) { preview_ -> updatePreview(); @@ -127,7 +144,8 @@ void QETPrintPreviewDialog::useFullPage(bool full_page) { /** Fait tenir ou non chaque schema sur une page - @param fit_diagram true pour adapter chaque schema sur une page, false sinon + @param fit_diagram true pour adapter chaque schema sur une page, + false sinon */ void QETPrintPreviewDialog::fitDiagramToPage(bool fit_diagram) { Q_UNUSED(fit_diagram); @@ -138,7 +156,8 @@ void QETPrintPreviewDialog::fitDiagramToPage(bool fit_diagram) { /** Effectue l'action "zoom avant" sur l'apercu avant impression */ -void QETPrintPreviewDialog::zoomIn() { +void QETPrintPreviewDialog::zoomIn() +{ preview_ -> zoomIn(4.0/3.0); updateZoomList(); } @@ -146,7 +165,8 @@ void QETPrintPreviewDialog::zoomIn() { /** Effectue l'action "zoom arriere" sur l'apercu avant impression */ -void QETPrintPreviewDialog::zoomOut() { +void QETPrintPreviewDialog::zoomOut() +{ preview_ -> zoomOut(4.0/3.0); updateZoomList(); } @@ -154,21 +174,24 @@ void QETPrintPreviewDialog::zoomOut() { /** Selectionne tous les schemas */ -void QETPrintPreviewDialog::selectAllDiagrams() { +void QETPrintPreviewDialog::selectAllDiagrams() +{ diagrams_list_ -> setSelectedAllDiagrams(true); } /** Deselectionne tous les schemas */ -void QETPrintPreviewDialog::selectNoDiagram() { +void QETPrintPreviewDialog::selectNoDiagram() +{ diagrams_list_ -> setSelectedAllDiagrams(false); } /** Met en place le dialogue */ -void QETPrintPreviewDialog::build() { +void QETPrintPreviewDialog::build() +{ preview_ = new QPrintPreviewWidget(printer_); diagrams_label_ = new QLabel(tr("Folios à imprimer :")); diagrams_list_ = new DiagramsChooser(project_); @@ -345,7 +368,8 @@ void QETPrintPreviewDialog::requestPaint(QPrinter *printer) { Ce slot prive verifie que le nombre de schemas a imprimer est bien superieur a 0 et active ou desactive le bouton "Imprimer" en consequence. */ -void QETPrintPreviewDialog::checkDiagramsCount() { +void QETPrintPreviewDialog::checkDiagramsCount() +{ int diagrams_count = diagrams_list_ -> selectedDiagrams().count(); // desactive le premier bouton de la liste (= le bouton "Imprimer") @@ -389,7 +413,8 @@ void QETPrintPreviewDialog::setPrintOptionsVisible(bool display) { /** Met a jour la liste des zooms disponibles */ -void QETPrintPreviewDialog::updateZoomList() { +void QETPrintPreviewDialog::updateZoomList() +{ // recupere le zooom courant qreal current_zoom = preview_ -> zoomFactor(); bool current_zoom_is_not_null = bool(int(current_zoom * 100.0)); @@ -419,7 +444,8 @@ void QETPrintPreviewDialog::updateZoomList() { /** Change le zoom de l'apercu en fonctiopn du contenu du zoom selectionne */ -void QETPrintPreviewDialog::updatePreviewZoom() { +void QETPrintPreviewDialog::updatePreviewZoom() +{ preview_ -> setZoomFactor( zoom_box_ -> itemData(zoom_box_ -> currentIndex()).toDouble() ); diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 8f64a187a..f1599b864 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -121,7 +121,8 @@ QETProject::~QETProject() @brief QETProject::dataBase @return The data base of this project */ -projectDataBase *QETProject::dataBase() { +projectDataBase *QETProject::dataBase() +{ return &m_data_base; } @@ -129,7 +130,8 @@ projectDataBase *QETProject::dataBase() { @brief QETProject::uuid @return the uuid of this project */ -QUuid QETProject::uuid() const { +QUuid QETProject::uuid() const +{ return m_uuid; } @@ -207,14 +209,16 @@ QETProject::ProjectState QETProject::openFile(QFile *file) @return l'etat du projet @see ProjectState */ -QETProject::ProjectState QETProject::state() const { +QETProject::ProjectState QETProject::state() const +{ return(m_state); } /** @return la liste des schemas de ce projet */ -QList QETProject::diagrams() const { +QList QETProject::diagrams() const +{ return(m_diagrams_list); } @@ -224,7 +228,8 @@ QList QETProject::diagrams() const { or -1 if it is not part of this project. Note: this returns 0 for the first diagram, not 1 */ -int QETProject::folioIndex(const Diagram *diagram) const { +int QETProject::folioIndex(const Diagram *diagram) const +{ // QList::indexOf returns -1 if no item matched. return(m_diagrams_list.indexOf(const_cast(diagram))); } @@ -233,21 +238,24 @@ int QETProject::folioIndex(const Diagram *diagram) const { @brief QETProject::embeddedCollection @return The embedded collection */ -XmlElementCollection *QETProject::embeddedElementCollection() const { +XmlElementCollection *QETProject::embeddedElementCollection() const +{ return m_elements_collection; } /** @return the title block templates collection enbeedded within this project */ -TitleBlockTemplatesProjectCollection *QETProject::embeddedTitleBlockTemplatesCollection() { +TitleBlockTemplatesProjectCollection *QETProject::embeddedTitleBlockTemplatesCollection() +{ return(&m_titleblocks_collection); } /** @return le chemin du fichier dans lequel ce projet est enregistre */ -QString QETProject::filePath() { +QString QETProject::filePath() +{ return(m_file_path); } @@ -295,7 +303,8 @@ void QETProject::setFilePath(const QString &filepath) enregistre ; dans le cas contraire, cette methode retourne l'emplacement du bureau de l'utilisateur. */ -QString QETProject::currentDir() const { +QString QETProject::currentDir() const +{ QString current_directory; if (m_file_path.isEmpty()) { current_directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); @@ -314,7 +323,8 @@ QString QETProject::currentDir() const { De plus, si le projet est en lecture seule, le tag "[lecture seule]" est ajoute. */ -QString QETProject::pathNameTitle() const { +QString QETProject::pathNameTitle() const +{ QString final_title; if (!project_title_.isEmpty()) { @@ -363,7 +373,8 @@ QString QETProject::pathNameTitle() const { /** @return le titre du projet */ -QString QETProject::title() const { +QString QETProject::title() const +{ return(project_title_); } @@ -372,7 +383,8 @@ QString QETProject::title() const { celui-ci a ete ouvert ; si ce projet n'a jamais ete enregistre / ouvert depuis un fichier, cette methode retourne -1. */ -qreal QETProject::declaredQElectroTechVersion() { +qreal QETProject::declaredQElectroTechVersion() +{ return(m_project_qet_version); } @@ -396,7 +408,8 @@ void QETProject::setTitle(const QString &title) { @return les dimensions par defaut utilisees lors de la creation d'un nouveau schema dans ce projet. */ -BorderProperties QETProject::defaultBorderProperties() const { +BorderProperties QETProject::defaultBorderProperties() const +{ return(default_border_properties_); } @@ -413,7 +426,8 @@ void QETProject::setDefaultBorderProperties(const BorderProperties &border) { @return le cartouche par defaut utilise lors de la creation d'un nouveau schema dans ce projet. */ -TitleBlockProperties QETProject::defaultTitleBlockProperties() const { +TitleBlockProperties QETProject::defaultTitleBlockProperties() const +{ return(default_titleblock_properties_); } @@ -451,7 +465,8 @@ void QETProject::setDefaultTitleBlockProperties(const TitleBlockProperties &titl @return le type de conducteur par defaut utilise lors de la creation d'un nouveau schema dans ce projet. */ -ConductorProperties QETProject::defaultConductorProperties() const { +ConductorProperties QETProject::defaultConductorProperties() const +{ return(default_conductor_properties_); } @@ -463,7 +478,8 @@ void QETProject::setDefaultConductorProperties(const ConductorProperties &conduc default_conductor_properties_ = conductor; } -QString QETProject::defaultReportProperties() const { +QString QETProject::defaultReportProperties() const +{ return m_default_report_properties; } @@ -490,7 +506,8 @@ void QETProject::setDefaultXRefProperties(QHash hash) @brief QETProject::conductorAutoNum @return All value of conductor autonum stored in project */ -QHash QETProject::conductorAutoNum() const { +QHash QETProject::conductorAutoNum() const +{ return m_conductor_autonum; } @@ -498,7 +515,8 @@ QHash QETProject::conductorAutoNum() const { @brief QETProject::elementAutoNum @return All value of element autonum stored in project */ -QHash QETProject::elementAutoNum() const { +QHash QETProject::elementAutoNum() const +{ return m_element_autonum; } @@ -520,7 +538,8 @@ QString QETProject::elementAutoNumFormula (const QString& key) const @brief QETProject::elementAutoNumCurrentFormula @return current formula being used by project */ -QString QETProject::elementAutoNumCurrentFormula() const { +QString QETProject::elementAutoNumCurrentFormula() const +{ return elementAutoNumFormula(m_current_element_autonum); } @@ -528,7 +547,8 @@ QString QETProject::elementAutoNumCurrentFormula() const { @brief QETProject::elementCurrentAutoNum @return current element autonum title */ -QString QETProject::elementCurrentAutoNum () const { +QString QETProject::elementCurrentAutoNum () const +{ return m_current_element_autonum; } @@ -557,7 +577,8 @@ QString QETProject::conductorAutoNumFormula (const QString& key) const @brief QETProject::conductorCurrentAutoNum @return current conductor autonum title */ -QString QETProject::conductorCurrentAutoNum () const { +QString QETProject::conductorCurrentAutoNum () const +{ return m_current_conductor_autonum; } @@ -573,7 +594,8 @@ void QETProject::setCurrentConductorAutoNum(QString autoNum) { @brief QETProject::folioAutoNum @return All value of folio autonum stored in project */ -QHash QETProject::folioAutoNum() const { +QHash QETProject::folioAutoNum() const +{ return m_folio_autonum; } @@ -647,7 +669,8 @@ void QETProject::removeFolioAutoNum(const QString& key) { If key is not found, return an empty numerotation context @param key */ -NumerotationContext QETProject::conductorAutoNum (const QString &key) const { +NumerotationContext QETProject::conductorAutoNum (const QString &key) const +{ if (m_conductor_autonum.contains(key)) return m_conductor_autonum[key]; else return NumerotationContext(); } @@ -669,7 +692,8 @@ NumerotationContext QETProject::elementAutoNum (const QString &key) { If key is not found, return an empty numerotation context @param key */ -NumerotationContext QETProject::folioAutoNum (const QString &key) const { +NumerotationContext QETProject::folioAutoNum (const QString &key) const +{ if (m_folio_autonum.contains(key)) return m_folio_autonum[key]; else return NumerotationContext(); } @@ -704,7 +728,8 @@ void QETProject::freezeNewConductorLabel(bool freeze, int from, int to) { @brief QETProject::isFreezeNewConductors @return freeze new conductors Project Wide status */ -bool QETProject::isFreezeNewConductors() { +bool QETProject::isFreezeNewConductors() +{ return m_freeze_new_conductors; } @@ -746,7 +771,8 @@ void QETProject::freezeNewElementLabel(bool freeze, int from, int to) { @brief QETProject::freezeNewElements @return freeze new elements Project Wide status */ -bool QETProject::isFreezeNewElements() { +bool QETProject::isFreezeNewElements() +{ return m_freeze_new_elements; } @@ -785,7 +811,8 @@ void QETProject::setAutoConductor(bool ac) emit Signal to add new Diagram with autonum properties */ -void QETProject::autoFolioNumberingNewFolios(){ +void QETProject::autoFolioNumberingNewFolios() +{ emit addAutoNumDiagram(); } @@ -821,7 +848,8 @@ void QETProject::autoFolioNumberingSelectedFolios(int from, @brief QETProject::toXml @return un document XML representant le projet */ -QDomDocument QETProject::toXml() { +QDomDocument QETProject::toXml() +{ // racine du projet QDomDocument xml_doc; QDomElement project_root = xml_doc.createElement("project"); @@ -877,7 +905,8 @@ QDomDocument QETProject::toXml() { /** Ferme le projet */ -bool QETProject::close() { +bool QETProject::close() +{ return(true); } @@ -921,7 +950,8 @@ QETResult QETProject::write() @brief QETProject::isReadOnly @return true si le projet est en mode readonly, false sinon */ -bool QETProject::isReadOnly() const { +bool QETProject::isReadOnly() const +{ return(m_read_only && read_only_file_path_ == m_file_path); } @@ -947,7 +977,8 @@ void QETProject::setReadOnly(bool read_only) - soit avec uniquement des schemas consideres comme vides - soit avec un titre de projet */ -bool QETProject::isEmpty() const { +bool QETProject::isEmpty() const +{ // si le projet a un titre, on considere qu'il n'est pas vide if (!project_title_.isEmpty()) return(false); @@ -1614,7 +1645,8 @@ void QETProject::addDiagram(Diagram *diagram, int pos) @return La liste des noms a utiliser pour la categorie dediee aux elements integres automatiquement dans le projet. */ -NamesList QETProject::namesListForIntegrationCategory() { +NamesList QETProject::namesListForIntegrationCategory() +{ NamesList names; const QChar russian_data[24] = { 0x0418, 0x043C, 0x043F, 0x043E, 0x0440, 0x0442, 0x0438, 0x0440, 0x043E, 0x0432, 0x0430, 0x043D, 0x043D, 0x044B, 0x0435, 0x0020, 0x044D, 0x043B, 0x0435, 0x043C, 0x0435, 0x043D, 0x0442, 0x044B }; @@ -1657,7 +1689,8 @@ void QETProject::writeBackup() @return true if project options (title, project-wide properties, settings for new diagrams, diagrams order...) were modified, false otherwise. */ -bool QETProject::projectOptionsWereModified() { +bool QETProject::projectOptionsWereModified() +{ // unlike similar methods, this method does not compare the content against // expected values; instead, we just check whether we have been set as modified. return(m_modified); @@ -1666,7 +1699,8 @@ bool QETProject::projectOptionsWereModified() { /** @return the project-wide properties made available to child diagrams. */ -DiagramContext QETProject::projectProperties() { +DiagramContext QETProject::projectProperties() +{ return(m_project_properties); } @@ -1687,7 +1721,8 @@ void QETProject::setProjectProperties(const DiagramContext &context) { collection embarquee ne doivent avoir ete modifies. @see diagramsWereModified(), embeddedCollectionWasModified() */ -bool QETProject::projectWasModified() { +bool QETProject::projectWasModified() +{ if ( projectOptionsWereModified() || !m_undo_stack -> isClean() || diff --git a/sources/qetregexpvalidator.cpp b/sources/qetregexpvalidator.cpp index 759cadd14..d6c01b3fb 100644 --- a/sources/qetregexpvalidator.cpp +++ b/sources/qetregexpvalidator.cpp @@ -35,7 +35,8 @@ QETRegExpValidator::QETRegExpValidator(const QRegExp ®exp, QObject *parent) : /** Destructeur */ -QETRegExpValidator::~QETRegExpValidator() { +QETRegExpValidator::~QETRegExpValidator() +{ } /** @@ -43,7 +44,8 @@ QETRegExpValidator::~QETRegExpValidator() { @see validationFailed() Emet le signal validationFailed si la validation echoue */ -QValidator::State QETRegExpValidator::validate(QString &input, int &pos) const { +QValidator::State QETRegExpValidator::validate(QString &input, int &pos) const +{ QValidator::State result = QRegExpValidator::validate(input, pos); if (result == QValidator::Invalid) emit(validationFailed()); return(result); diff --git a/sources/qetresult.cpp b/sources/qetresult.cpp index b05e1317a..0c2b4a5d0 100644 --- a/sources/qetresult.cpp +++ b/sources/qetresult.cpp @@ -38,13 +38,15 @@ QETResult::QETResult(const QString &error_message, bool result) : /** Destructor */ -QETResult::~QETResult() { +QETResult::~QETResult() +{ } /** @return the boolean value embedded within this result. */ -bool QETResult::isOk() const { +bool QETResult::isOk() const +{ return(result_); } @@ -58,7 +60,8 @@ void QETResult::setResult(bool result) { /** @return the error message embedded within this result. */ -QString QETResult::errorMessage() const { +QString QETResult::errorMessage() const +{ return(error_message_); } diff --git a/sources/qetxml.cpp b/sources/qetxml.cpp index 93f77c7a1..a2b15443f 100644 --- a/sources/qetxml.cpp +++ b/sources/qetxml.cpp @@ -94,8 +94,8 @@ QPen QETXML::penFromXml(const QDomElement &element) @return A QDomElement with the attribute stored. The tagName of QDomeElement is "brush". */ -QDomElement QETXML::brushToXml(QDomDocument &parent_document, - const QBrush& brush) +QDomElement QETXML::brushToXml( + QDomDocument &parent_document, const QBrush& brush) { QDomElement element = parent_document.createElement("brush"); @@ -172,9 +172,8 @@ QBrush QETXML::brushFromXml(const QDomElement &element) ready to be inserted into a XmlElementCollection. If the QDomElement can't be created, return a null QDomElement. */ -QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, - const QDir &dir, - const QString& rename) +QDomElement QETXML::fileSystemDirToXmlCollectionDir( + QDomDocument &document, const QDir &dir, const QString& rename) { if (!dir.exists()) return QDomElement(); @@ -218,9 +217,7 @@ QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, If the QDomElement can't be created, return a null QDomElement */ QDomElement QETXML::fileSystemElementToXmlCollectionElement( - QDomDocument &document, - QFile &file, - const QString& rename) + QDomDocument &document, QFile &file, const QString& rename) { if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -254,9 +251,10 @@ QDomElement QETXML::fileSystemElementToXmlCollectionElement( explaining what happened when this function returns false. @return false if an error occurred, true otherwise */ -bool QETXML::writeXmlFile(const QDomDocument &xml_document, - const QString &file_path, - QString *error_message) +bool QETXML::writeXmlFile( + const QDomDocument &xml_document, + const QString &file_path, + QString *error_message) { QFile file(file_path); @@ -293,9 +291,10 @@ bool QETXML::writeXmlFile(const QDomDocument &xml_document, @param value @return a QDomElement, created from document */ -QDomElement QETXML::textToDomElement(QDomDocument &document, - const QString& tag_name, - const QString& value) +QDomElement QETXML::textToDomElement( + QDomDocument &document, + const QString& tag_name, + const QString& value) { QDomElement element = document.createElement(tag_name); QDomText text = document.createTextNode(value); @@ -310,8 +309,8 @@ QDomElement QETXML::textToDomElement(QDomDocument &document, @param tag_name @return All direct child of element with the tag name tag_name */ -QVector QETXML::directChild(const QDomElement &element, - const QString &tag_name) +QVector QETXML::directChild( + const QDomElement &element, const QString &tag_name) { QVector return_list; for ( @@ -338,9 +337,10 @@ QVector QETXML::directChild(const QDomElement &element, nested in the parent dom elements tagged parent_tag_name, themselves children of the dom element element. */ -QVector QETXML::subChild(const QDomElement &element, - const QString parent_tag_name, - const QString &children_tag_name) +QVector QETXML::subChild( + const QDomElement &element, + const QString parent_tag_name, + const QString &children_tag_name) { QVector return_list; @@ -498,8 +498,8 @@ QDomElement QETXML::modelHeaderDataToXml( @param element @param model */ -void QETXML::modelHeaderDataFromXml(const QDomElement &element, - QAbstractItemModel *model) +void QETXML::modelHeaderDataFromXml( + const QDomElement &element, QAbstractItemModel *model) { if (element.tagName() != "header_data") return; diff --git a/sources/qetxml.h b/sources/qetxml.h index 72ff046b1..51218d718 100644 --- a/sources/qetxml.h +++ b/sources/qetxml.h @@ -34,45 +34,58 @@ namespace QETXML QDomElement penToXml(QDomDocument &parent_document, const QPen& pen); QPen penFromXml (const QDomElement &element); - QDomElement brushToXml (QDomDocument &parent_document, - const QBrush& brush); + QDomElement brushToXml ( + QDomDocument &parent_document, + const QBrush& brush); + QBrush brushFromXml (const QDomElement &element); QDomElement fileSystemDirToXmlCollectionDir ( QDomDocument &document, const QDir &dir, const QString& rename = QString()); + QDomElement fileSystemElementToXmlCollectionElement ( QDomDocument &document, QFile &file, const QString& rename = QString()); - bool writeXmlFile(const QDomDocument &xml_document, - const QString &file_path, - QString *error_message = nullptr); + bool writeXmlFile( + const QDomDocument &xml_document, + const QString &file_path, + QString *error_message = nullptr); - QDomElement textToDomElement (QDomDocument &document, - const QString& tag_name, - const QString& value); + QDomElement textToDomElement ( + QDomDocument &document, + const QString& tag_name, + const QString& value); - QVector directChild(const QDomElement &element, - const QString &tag_name); - QVector subChild(const QDomElement &element, - const QString parent_tag_name, - const QString &children_tag_name); + QVector directChild( + const QDomElement &element, + const QString &tag_name); + + QVector subChild( + const QDomElement &element, + const QString parent_tag_name, + const QString &children_tag_name); + + QDomElement marginsToXml ( + QDomDocument &parent_document, + const QMargins &margins); - QDomElement marginsToXml (QDomDocument &parent_document, - const QMargins &margins); QMargins marginsFromXml(const QDomElement &element); - QDomElement modelHeaderDataToXml(QDomDocument &parent_document, - const QAbstractItemModel *model, - QHash> horizontal_section_role, - QHash> vertical_section_role); - void modelHeaderDataFromXml(const QDomElement &element, - QAbstractItemModel *model); + QDomElement modelHeaderDataToXml( + QDomDocument &parent_document, + const QAbstractItemModel *model, + QHash> horizontal_section_role, + QHash> vertical_section_role); + + void modelHeaderDataFromXml( + const QDomElement &element, + QAbstractItemModel *model); } #endif // QETXML_H diff --git a/sources/qfilenameedit.cpp b/sources/qfilenameedit.cpp index 059276cb6..918329713 100644 --- a/sources/qfilenameedit.cpp +++ b/sources/qfilenameedit.cpp @@ -44,27 +44,31 @@ QFileNameEdit::QFileNameEdit(const QString &contents, QWidget *parent) : QLineEd /** Destructeur */ -QFileNameEdit::~QFileNameEdit() { +QFileNameEdit::~QFileNameEdit() +{ } /** @return true si le champ de texte est vide, false sinon */ -bool QFileNameEdit::isEmpty() { +bool QFileNameEdit::isEmpty() +{ return(text().isEmpty()); } /** @return true si le champ de texte n'est pas vide et est valide */ -bool QFileNameEdit::isValid() { +bool QFileNameEdit::isValid() +{ return(regexp_.exactMatch(text())); } /** Construit l'objet */ -void QFileNameEdit::init() { +void QFileNameEdit::init() +{ regexp_ = QRegExp("^[0-9a-z_\\-\\.]+$", Qt::CaseSensitive); validator_ = new QETRegExpValidator(regexp_, this); setValidator(validator_); @@ -83,7 +87,8 @@ void QFileNameEdit::init() { /** Affiche l'info-bulle informant l'utilisateur des caracteres autorises. */ -void QFileNameEdit::displayToolTip() { +void QFileNameEdit::displayToolTip() +{ QToolTip::showText( mapToGlobal(QPoint(x() + width(), 0)), tooltip_text_, @@ -95,6 +100,7 @@ void QFileNameEdit::displayToolTip() { /** Gere le fait que la validation du champ de texte ait echoue. */ -void QFileNameEdit::validationFailed() { +void QFileNameEdit::validationFailed() +{ displayToolTip(); } diff --git a/sources/qgimanager.cpp b/sources/qgimanager.cpp index f2be7f8b1..10d0bc6bd 100644 --- a/sources/qgimanager.cpp +++ b/sources/qgimanager.cpp @@ -34,7 +34,8 @@ QGIManager::QGIManager(QGraphicsScene *sc) : change avec la methode setDestroyQGIOnDelete @see setDestroyQGIOnDelete */ -QGIManager::~QGIManager(){ +QGIManager::~QGIManager() +{ if (!destroy_qgi_on_delete) return; foreach(QGraphicsItem *qgi, qgi_manager.keys()) { if (!scene -> items().contains(qgi)) delete qgi; @@ -98,6 +99,7 @@ void QGIManager::setDestroyQGIOnDelete(bool b) { @param qgi QGraphicsItem dont il faut verifier la presence @return true si l'item est gere, false sinon */ -bool QGIManager::manages(QGraphicsItem *qgi) const { +bool QGIManager::manages(QGraphicsItem *qgi) const +{ return(qgi_manager.contains(qgi)); } diff --git a/sources/qtextorientationspinboxwidget.cpp b/sources/qtextorientationspinboxwidget.cpp index 23bbd548d..39ea4bdb8 100644 --- a/sources/qtextorientationspinboxwidget.cpp +++ b/sources/qtextorientationspinboxwidget.cpp @@ -30,27 +30,31 @@ QTextOrientationSpinBoxWidget::QTextOrientationSpinBoxWidget(QWidget *parent) : /** Destructeur */ -QTextOrientationSpinBoxWidget::~QTextOrientationSpinBoxWidget() { +QTextOrientationSpinBoxWidget::~QTextOrientationSpinBoxWidget() +{ } /** @return un pointeur vers le QTextOrientationWidget */ -QTextOrientationWidget *QTextOrientationSpinBoxWidget::orientationWidget() const { +QTextOrientationWidget *QTextOrientationSpinBoxWidget::orientationWidget() const +{ return(orientation_widget_); } /** @return un pointeur vers le QSpinBox */ -QDoubleSpinBox *QTextOrientationSpinBoxWidget::spinBox() const { +QDoubleSpinBox *QTextOrientationSpinBoxWidget::spinBox() const +{ return(spin_box_); } /** @return l'orientation en cours */ -double QTextOrientationSpinBoxWidget::orientation() const { +double QTextOrientationSpinBoxWidget::orientation() const +{ return(orientation_widget_ -> orientation()); } @@ -59,21 +63,24 @@ double QTextOrientationSpinBoxWidget::orientation() const { @return l'orientation en cours @see orientation() */ -double QTextOrientationSpinBoxWidget::value() const { +double QTextOrientationSpinBoxWidget::value() const +{ return(orientation()); } /** @return true si le widget est en mode "lecture seule", false sinon */ -bool QTextOrientationSpinBoxWidget::isReadOnly() const { +bool QTextOrientationSpinBoxWidget::isReadOnly() const +{ return(orientation_widget_ -> isReadOnly()); } /** @param value Nouvelle valeur de l'orientation a afficher */ -void QTextOrientationSpinBoxWidget::setOrientation(const double &value) { +void QTextOrientationSpinBoxWidget::setOrientation(const double &value) +{ orientation_widget_ -> setOrientation(value); spin_box_ -> setValue(value); } @@ -83,14 +90,16 @@ void QTextOrientationSpinBoxWidget::setOrientation(const double &value) { @param value Nouvelle valeur de l'orientation a afficher @see setOrientation */ -void QTextOrientationSpinBoxWidget::setValue(const double &value) { +void QTextOrientationSpinBoxWidget::setValue(const double &value) +{ setOrientation(value); } /** @param ro true pour passer le widget en mode "lecture seule", false sinon */ -void QTextOrientationSpinBoxWidget::setReadOnly(bool ro) { +void QTextOrientationSpinBoxWidget::setReadOnly(bool ro) +{ orientation_widget_ -> setReadOnly(ro); spin_box_ -> setReadOnly(ro); } @@ -98,7 +107,8 @@ void QTextOrientationSpinBoxWidget::setReadOnly(bool ro) { /** Construit le widget */ -void QTextOrientationSpinBoxWidget::build() { +void QTextOrientationSpinBoxWidget::build() +{ orientation_widget_ = new QTextOrientationWidget(); orientation_widget_ -> setMinimumSize(90.0, 90.0); @@ -107,14 +117,25 @@ void QTextOrientationSpinBoxWidget::build() { spin_box_ -> setSuffix("°"); // met en place les relations entre le SpinBox et le QTextOrientationWidget - connect(spin_box_, SIGNAL(valueChanged(double)), orientation_widget_, SLOT(setOrientation(double))); - connect(orientation_widget_, SIGNAL(orientationChanged(double)), spin_box_, SLOT(setValue(double))); + connect(spin_box_, + SIGNAL(valueChanged(double)), + orientation_widget_, + SLOT(setOrientation(double))); + connect(orientation_widget_, + SIGNAL(orientationChanged(double)), + spin_box_, + SLOT(setValue(double))); // cliquer sur un des carres du QTextOrientationWidget revient a finir une saisie dans le SpinBox - connect(orientation_widget_, SIGNAL(orientationChanged(double)), spin_box_, SIGNAL(editingFinished())); + connect(orientation_widget_, + SIGNAL(orientationChanged(double)), + spin_box_, + SIGNAL(editingFinished())); - // lorsque l'utilisateur a change l'orientation, on emet un signal avec la valeur de la nouvelle orientation - connect(spin_box_, SIGNAL(editingFinished()), this, SLOT(emitChangeSignals())); + // lorsque l'utilisateur a change l'orientation, + // on emet un signal avec la valeur de la nouvelle orientation + connect(spin_box_, SIGNAL(editingFinished()), + this, SLOT(emitChangeSignals())); // dispose les widgets : le QTextOrientationWidget a gauche, le SpinBox a droite QHBoxLayout *main_layout = new QHBoxLayout(); @@ -128,7 +149,8 @@ void QTextOrientationSpinBoxWidget::build() { /** Emet le signal orientationEditingFinished avec la valeur de l'orientation en cours */ -void QTextOrientationSpinBoxWidget::emitChangeSignals() { +void QTextOrientationSpinBoxWidget::emitChangeSignals() +{ emit(editingFinished(orientation())); emit(editingFinished()); } diff --git a/sources/qtextorientationwidget.cpp b/sources/qtextorientationwidget.cpp index 171dccb28..3fd8b65a6 100644 --- a/sources/qtextorientationwidget.cpp +++ b/sources/qtextorientationwidget.cpp @@ -52,7 +52,8 @@ QTextOrientationWidget::QTextOrientationWidget(QWidget *parent) : /** Destructeur */ -QTextOrientationWidget::~QTextOrientationWidget() { +QTextOrientationWidget::~QTextOrientationWidget() +{ } /** @@ -70,7 +71,8 @@ void QTextOrientationWidget::setOrientation(const double &angle) { 0 degre correspond a un texte horizontal, de gauche a droite 90 degres correspondent a un texte vertical de haut en bas */ -double QTextOrientationWidget::orientation() const { +double QTextOrientationWidget::orientation() const +{ return(current_orientation_); } @@ -90,7 +92,8 @@ void QTextOrientationWidget::setFont(const QFont &font) { /** @return la police utilisee pour le texte affiche */ -QFont QTextOrientationWidget::font() const { +QFont QTextOrientationWidget::font() const +{ return(text_font_); } @@ -104,7 +107,8 @@ void QTextOrientationWidget::setDisplayText(bool display_text) { /** @return la police utilisee pour le texte affiche */ -bool QTextOrientationWidget::textDisplayed() const { +bool QTextOrientationWidget::textDisplayed() const +{ return(display_text_); } @@ -137,14 +141,16 @@ void QTextOrientationWidget::setUsableTexts(const QStringList &texts_list) { /** @return la liste des chaines dont le widget dispose pour afficher un texte */ -QStringList QTextOrientationWidget::usableTexts() const { +QStringList QTextOrientationWidget::usableTexts() const +{ return(text_size_hash_.keys()); } /** @return true si le widget est en mode "lecture seule", false sinon */ -bool QTextOrientationWidget::isReadOnly() const { +bool QTextOrientationWidget::isReadOnly() const +{ return(read_only_); } @@ -158,7 +164,8 @@ void QTextOrientationWidget::setReadOnly(bool ro) { /** @return la taille recommandee pour ce widget */ -QSize QTextOrientationWidget::sizeHint() const { +QSize QTextOrientationWidget::sizeHint() const +{ return(QSize(50, 50)); } @@ -167,7 +174,8 @@ QSize QTextOrientationWidget::sizeHint() const { @return la hauteur preferee pour une largeur donnee Pour ce widget : retourne la largeur fournie afin de maintenir le widget carre */ -int QTextOrientationWidget::heightForWidth(int w) const { +int QTextOrientationWidget::heightForWidth(int w) const +{ return(w); } @@ -306,7 +314,8 @@ QString QTextOrientationWidget::getMostUsableStringForRadius(const qreal &radius S'assure que le hash associant les textes utilisables a leur taille soit correctement rempli. */ -void QTextOrientationWidget::generateTextSizeHash() { +void QTextOrientationWidget::generateTextSizeHash() +{ QFontMetrics font_metrics(text_font_); foreach(QString text, text_size_hash_.keys()) { if (text_size_hash_[text] == -1) { diff --git a/sources/recentfiles.cpp b/sources/recentfiles.cpp index ad9cc3139..58f2bc936 100644 --- a/sources/recentfiles.cpp +++ b/sources/recentfiles.cpp @@ -43,21 +43,24 @@ RecentFiles::RecentFiles(const QString &identifier, int size, QObject *parent) : Destructeur @todo determiner s'il faut detruire ou non le menu */ -RecentFiles::~RecentFiles() { +RecentFiles::~RecentFiles() +{ delete menu_; } /** @return le nombre de fichiers a retenir */ -int RecentFiles::size() const { +int RecentFiles::size() const +{ return(size_); } /** @return un menu listant les derniers fichiers ouverts */ -QMenu *RecentFiles::menu() const { +QMenu *RecentFiles::menu() const +{ return(menu_); } @@ -65,7 +68,8 @@ QMenu *RecentFiles::menu() const { @return l'icone affichee a cote de chaque fichier, ou une QIcon nulle si aucune icone n'est utilisee. */ -QIcon RecentFiles::iconForFiles() const { +QIcon RecentFiles::iconForFiles() const +{ return(files_icon_); } @@ -82,7 +86,8 @@ void RecentFiles::setIconForFiles(const QIcon &icon) { /** Oublie les fichiers recents */ -void RecentFiles::clear() { +void RecentFiles::clear() +{ list_.clear(); buildMenu(); } @@ -90,7 +95,8 @@ void RecentFiles::clear() { /** Sauvegarde les fichiers recents dans la configuration */ -void RecentFiles::save() { +void RecentFiles::save() +{ saveFilesToSettings(); } @@ -164,7 +170,8 @@ void RecentFiles::saveFilesToSettings() /** Construit le menu */ -void RecentFiles::buildMenu() { +void RecentFiles::buildMenu() +{ // reinitialise le menu if (!menu_) { menu_ = new QMenu; diff --git a/sources/richtext/richtexteditor.cpp b/sources/richtext/richtexteditor.cpp index 2cb0b8b85..048773eb4 100644 --- a/sources/richtext/richtexteditor.cpp +++ b/sources/richtext/richtexteditor.cpp @@ -92,9 +92,10 @@ namespace qdesigner_internal { } // Richtext simplification filter helpers: Filter attributes of elements - static inline void filterAttributes(const QStringRef &name, - QXmlStreamAttributes *atts, - bool *paragraphAlignmentFound) + static inline void filterAttributes( + const QStringRef &name, + QXmlStreamAttributes *atts, + bool *paragraphAlignmentFound) { typedef QXmlStreamAttributes::iterator AttributeIt; @@ -172,7 +173,7 @@ namespace qdesigner_internal { } // Check for plain text (no spans, just

) if (isPlainTextPtr) - *isPlainTextPtr = !paragraphAlignmentFound && elementCount == 4u; // + *isPlainTextPtr = !paragraphAlignmentFound && elementCount == 4u; return out; } @@ -813,7 +814,8 @@ RichTextEditorDialog::~RichTextEditorDialog() /** @brief RichTextEditorDialog::on_buttonBox_accepted */ -void RichTextEditorDialog::on_buttonBox_accepted() { +void RichTextEditorDialog::on_buttonBox_accepted() +{ emit applyEditText( text(Qt::RichText) ); this->close(); } diff --git a/sources/titleblock/dimension.cpp b/sources/titleblock/dimension.cpp index fbee8d464..5c8b90bcb 100644 --- a/sources/titleblock/dimension.cpp +++ b/sources/titleblock/dimension.cpp @@ -31,7 +31,8 @@ TitleBlockDimension::TitleBlockDimension(int v, QET::TitleBlockColumnLength t) : /** @return a string describing this dimension in a human-readable format. */ -QString TitleBlockDimension::toString() const { +QString TitleBlockDimension::toString() const +{ QString dim_str; if (type == QET::Absolute) { dim_str = QObject::tr("%1px", "titleblock: absolute width"); @@ -46,7 +47,8 @@ QString TitleBlockDimension::toString() const { /** @return a string describing this dimension in a short format. */ -QString TitleBlockDimension::toShortString() const { +QString TitleBlockDimension::toShortString() const +{ QString short_string; if (type == QET::RelativeToTotalLength) { short_string = "t"; diff --git a/sources/titleblock/dimensionwidget.cpp b/sources/titleblock/dimensionwidget.cpp index b0728a339..bcb5b1d06 100644 --- a/sources/titleblock/dimensionwidget.cpp +++ b/sources/titleblock/dimensionwidget.cpp @@ -36,13 +36,15 @@ TitleBlockDimensionWidget::TitleBlockDimensionWidget(bool complete, QWidget *par /** Destructor */ -TitleBlockDimensionWidget::~TitleBlockDimensionWidget() { +TitleBlockDimensionWidget::~TitleBlockDimensionWidget() +{ } /** @return true if this dialog shows the optional radio buttons */ -bool TitleBlockDimensionWidget::isComplete() const { +bool TitleBlockDimensionWidget::isComplete() const +{ return(complete_); } @@ -50,7 +52,8 @@ bool TitleBlockDimensionWidget::isComplete() const { @return a pointer to the label displayed right before the spinbox. Useful to specify a custom text. */ -QLabel *TitleBlockDimensionWidget::label() const { +QLabel *TitleBlockDimensionWidget::label() const +{ return(spinbox_label_); } @@ -58,14 +61,16 @@ QLabel *TitleBlockDimensionWidget::label() const { @return a pointer to the spinbox Useful to specify custom parameters, such as the minimum value */ -QSpinBox *TitleBlockDimensionWidget::spinbox() const { +QSpinBox *TitleBlockDimensionWidget::spinbox() const +{ return(spinbox_); } /** @return The dimension as currently shown by the dialog */ -TitleBlockDimension TitleBlockDimensionWidget::value() const { +TitleBlockDimension TitleBlockDimensionWidget::value() const +{ QET::TitleBlockColumnLength type = QET::Absolute; if (complete_) { type = static_cast(dimension_type_ -> checkedId()); @@ -90,7 +95,8 @@ void TitleBlockDimensionWidget::setValue(const TitleBlockDimension &dim) { @return Whether or not this widget should allow edition of the displayed dimension. */ -bool TitleBlockDimensionWidget::isReadOnly() const { +bool TitleBlockDimensionWidget::isReadOnly() const +{ return(read_only_); } @@ -113,7 +119,8 @@ void TitleBlockDimensionWidget::setReadOnly(bool read_only) { /** Initialize the widgets composing the dialog. */ -void TitleBlockDimensionWidget::initWidgets() { +void TitleBlockDimensionWidget::initWidgets() +{ // basic widgets: label + spinbox spinbox_label_ = new QLabel(tr("Largeur :", "default dialog label")); @@ -122,9 +129,15 @@ void TitleBlockDimensionWidget::initWidgets() { // extra widgets, for the user to specify whether the value is absolute, relative, etc. if (complete_) { - absolute_button_ = new QRadioButton(tr("Absolu", "a traditional, absolute measure")); - relative_button_ = new QRadioButton(tr("Relatif au total", "a percentage of the total width")); - remaining_button_ = new QRadioButton(tr("Relatif au restant", "a percentage of what remains from the total width")); + absolute_button_ = new QRadioButton( + tr("Absolu", + "a traditional, absolute measure")); + relative_button_ = new QRadioButton( + tr("Relatif au total", + "a percentage of the total width")); + remaining_button_ = new QRadioButton( + tr("Relatif au restant", + "a percentage of what remains from the total width")); dimension_type_ = new QButtonGroup(this); dimension_type_ -> addButton(absolute_button_, QET::Absolute); dimension_type_ -> addButton(relative_button_, QET::RelativeToTotalLength); @@ -144,7 +157,8 @@ void TitleBlockDimensionWidget::initWidgets() { /** Initialize the layout of the dialog. */ -void TitleBlockDimensionWidget::initLayouts() { +void TitleBlockDimensionWidget::initLayouts() +{ QHBoxLayout *hlayout0 = new QHBoxLayout(); hlayout0 -> addWidget(spinbox_label_); hlayout0 -> addWidget(spinbox_); @@ -162,7 +176,8 @@ void TitleBlockDimensionWidget::initLayouts() { /** Ensure the suffix displayed by the spinbox matches the selected kind of length. */ -void TitleBlockDimensionWidget::updateSpinBoxSuffix() { +void TitleBlockDimensionWidget::updateSpinBoxSuffix() +{ if (complete_ && dimension_type_ -> checkedId() != QET::Absolute) { spinbox_ -> setSuffix(tr("%", "spinbox suffix when changing the dimension of a row/column")); spinbox_ -> setMinimum(1); diff --git a/sources/titleblock/gridlayoutanimation.cpp b/sources/titleblock/gridlayoutanimation.cpp index b333eccd1..2e32d4371 100644 --- a/sources/titleblock/gridlayoutanimation.cpp +++ b/sources/titleblock/gridlayoutanimation.cpp @@ -31,13 +31,15 @@ GridLayoutAnimation::GridLayoutAnimation(QGraphicsGridLayout *grid, QObject *par /** Destructor */ -GridLayoutAnimation::~GridLayoutAnimation() { +GridLayoutAnimation::~GridLayoutAnimation() +{ } /** @return the animated grid */ -QGraphicsGridLayout *GridLayoutAnimation::grid() { +QGraphicsGridLayout *GridLayoutAnimation::grid() +{ return(grid_); } @@ -51,7 +53,8 @@ void GridLayoutAnimation::setGrid(QGraphicsGridLayout *grid) { /** @return the index of the row/column to be animated */ -int GridLayoutAnimation::index() const { +int GridLayoutAnimation::index() const +{ return(index_); } @@ -65,7 +68,8 @@ void GridLayoutAnimation::setIndex(int index) { /** @return true if this object acts on a row, false if it acts on a column. */ -bool GridLayoutAnimation::actsOnRows() const { +bool GridLayoutAnimation::actsOnRows() const +{ return(row_); } diff --git a/sources/titleblock/helpercell.cpp b/sources/titleblock/helpercell.cpp index 45b46bca7..eb62d6355 100644 --- a/sources/titleblock/helpercell.cpp +++ b/sources/titleblock/helpercell.cpp @@ -37,7 +37,8 @@ HelperCell::HelperCell(QGraphicsItem *parent) : /** Destructor */ -HelperCell::~HelperCell() { +HelperCell::~HelperCell() +{ } /** @@ -56,7 +57,8 @@ void HelperCell::setGeometry(const QRectF &g) { @param constraint New value for the size hint @return the size hint for \a which using the width or height of \a constraint */ -QSizeF HelperCell::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { +QSizeF HelperCell::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ Q_UNUSED(which); return(constraint); } @@ -64,7 +66,8 @@ QSizeF HelperCell::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const /** @return the bounding rect of this helper cell */ -QRectF HelperCell::boundingRect() const { +QRectF HelperCell::boundingRect() const +{ return QRectF(QPointF(0,0), geometry().size()); } @@ -114,7 +117,8 @@ void HelperCell::setActions(const QList &actions) { /** @return the list of actions displayed by the context menu of this helper cell. */ -QList HelperCell::actions() const { +QList HelperCell::actions() const +{ return actions_; } diff --git a/sources/titleblock/integrationmovetemplateshandler.cpp b/sources/titleblock/integrationmovetemplateshandler.cpp index 81f7c3ebd..e2d17fdac 100644 --- a/sources/titleblock/integrationmovetemplateshandler.cpp +++ b/sources/titleblock/integrationmovetemplateshandler.cpp @@ -33,7 +33,8 @@ IntegrationMoveTitleBlockTemplatesHandler::IntegrationMoveTitleBlockTemplatesHan /** Destructor */ -IntegrationMoveTitleBlockTemplatesHandler::~IntegrationMoveTitleBlockTemplatesHandler() { +IntegrationMoveTitleBlockTemplatesHandler::~IntegrationMoveTitleBlockTemplatesHandler() +{ } /** @@ -95,14 +96,16 @@ QET::Action IntegrationMoveTitleBlockTemplatesHandler::errorWithATemplate(const @return the name to be used when this object returns QET::Rename @see QET::Action */ -QString IntegrationMoveTitleBlockTemplatesHandler::nameForRenamingOperation() { +QString IntegrationMoveTitleBlockTemplatesHandler::nameForRenamingOperation() +{ return(rename_); } /** @return the current date with a filename-friendly format */ -QString IntegrationMoveTitleBlockTemplatesHandler::dateString() const { +QString IntegrationMoveTitleBlockTemplatesHandler::dateString() const +{ return(QDateTime::currentDateTime().toString("yyyyMMddhhmmss")); } @@ -142,7 +145,8 @@ QET::Action IntegrationMoveTitleBlockTemplatesHandler::askUser(const TitleBlockT /** Initialize the user dialog. */ -void IntegrationMoveTitleBlockTemplatesHandler::initDialog() { +void IntegrationMoveTitleBlockTemplatesHandler::initDialog() +{ if (integ_dialog_) return; integ_dialog_ = new QDialog(parent_widget_); integ_dialog_ -> setWindowTitle(tr("Intégration d'un modèle de cartouche")); @@ -238,7 +242,8 @@ void IntegrationMoveTitleBlockTemplatesHandler::radioButtonleftMargin(QRadioButt /** Ensure the dialog remains consistent. */ -void IntegrationMoveTitleBlockTemplatesHandler::correctRadioButtons() { +void IntegrationMoveTitleBlockTemplatesHandler::correctRadioButtons() +{ erase_template_ -> setEnabled(integrate_new_template_ -> isChecked()); integrate_both_ -> setEnabled(integrate_new_template_ -> isChecked()); } diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 77aefa42c..f6cb218cd 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -51,13 +51,14 @@ QETTitleBlockTemplateEditor::QETTitleBlockTemplateEditor(QWidget *parent) : /** Destructor */ -QETTitleBlockTemplateEditor::~QETTitleBlockTemplateEditor() { -} +QETTitleBlockTemplateEditor::~QETTitleBlockTemplateEditor() +{} /** @return the location of the currently edited template */ -TitleBlockTemplateLocation QETTitleBlockTemplateEditor::location() const { +TitleBlockTemplateLocation QETTitleBlockTemplateEditor::location() const +{ return(location_); } @@ -65,7 +66,8 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::location() const { @return true if the provided filepath matches the currently edited template. @param filepath path of a title block template on the filesystem */ -bool QETTitleBlockTemplateEditor::isEditing(const QString &filepath) { +bool QETTitleBlockTemplateEditor::isEditing(const QString &filepath) +{ QString current_filepath; if (opened_from_file_) { current_filepath = filepath_; @@ -87,7 +89,8 @@ bool QETTitleBlockTemplateEditor::isEditing(const QString &filepath) { new template name as soon as the window appears in order to duplicate the edited one. */ -void QETTitleBlockTemplateEditor::setOpenForDuplication(bool duplicate) { +void QETTitleBlockTemplateEditor::setOpenForDuplication(bool duplicate) +{ duplicate_ = duplicate; } @@ -95,7 +98,8 @@ void QETTitleBlockTemplateEditor::setOpenForDuplication(bool duplicate) { @return true if this editor will prompt the user for a new template name as soon as the window appears in order to duplicate the edited one. */ -bool QETTitleBlockTemplateEditor::openForDuplication() const { +bool QETTitleBlockTemplateEditor::openForDuplication() const +{ return(duplicate_); } @@ -104,7 +108,8 @@ bool QETTitleBlockTemplateEditor::openForDuplication() const { closed if it has not been modified. If the template has been modified, this method asks the user what he wants to do. */ -bool QETTitleBlockTemplateEditor::canClose() { +bool QETTitleBlockTemplateEditor::canClose() +{ if (undo_stack_ -> isClean()) return(true); // ask the user whether he wants to save the current template QMessageBox::StandardButton answer = QET::QetMessageBox::question( @@ -131,7 +136,8 @@ bool QETTitleBlockTemplateEditor::canClose() { /** @param event Object describing the received event. */ -void QETTitleBlockTemplateEditor::firstActivation(QEvent *event) { +void QETTitleBlockTemplateEditor::firstActivation(QEvent *event) +{ Q_UNUSED(event) if (duplicate_ && !opened_from_file_ && location_.parentCollection()) { // this editor is supposed to duplicate its current location @@ -143,7 +149,8 @@ void QETTitleBlockTemplateEditor::firstActivation(QEvent *event) { Handle the closing of the main window @param qce The QCloseEvent event */ -void QETTitleBlockTemplateEditor::closeEvent(QCloseEvent *qce) { +void QETTitleBlockTemplateEditor::closeEvent(QCloseEvent *qce) +{ if (canClose()) { writeSettings(); setAttribute(Qt::WA_DeleteOnClose); @@ -155,13 +162,15 @@ void QETTitleBlockTemplateEditor::closeEvent(QCloseEvent *qce) { Ask the user for a new template name in order to duplicate the currently edited template. */ -void QETTitleBlockTemplateEditor::duplicateCurrentLocation() { +void QETTitleBlockTemplateEditor::duplicateCurrentLocation() +{ // this method does not work for templates edited from the filesystem if (opened_from_file_) return; QString proposed_name; if (location_.name().isEmpty()) { - proposed_name = tr("nouveau_modele", "template name suggestion when duplicating the default one"); + proposed_name = tr("nouveau_modele", + "template name suggestion when duplicating the default one"); } else { proposed_name = QString("%1_copy").arg(location_.name()); } @@ -170,13 +179,16 @@ void QETTitleBlockTemplateEditor::duplicateCurrentLocation() { QString new_template_name = QInputDialog::getText( this, tr("Dupliquer un modèle de cartouche", "input dialog title"), - tr("Pour dupliquer ce modèle, entrez le nom voulu pour sa copie", "input dialog text"), + tr("Pour dupliquer ce modèle, entrez le nom voulu pour sa copie", + "input dialog text"), QLineEdit::Normal, proposed_name, &accepted ); if (accepted) { - TitleBlockTemplateLocation new_template_location(new_template_name, location_.parentCollection()); + TitleBlockTemplateLocation new_template_location( + new_template_name, + location_.parentCollection()); saveAs(new_template_location); } } @@ -184,7 +196,9 @@ void QETTitleBlockTemplateEditor::duplicateCurrentLocation() { /** @param location Location of the tile block template to be edited. */ -bool QETTitleBlockTemplateEditor::edit(const TitleBlockTemplateLocation &location) { +bool QETTitleBlockTemplateEditor::edit( + const TitleBlockTemplateLocation &location) +{ // the template name may be empty to create a new one const TitleBlockTemplate *tb_template_orig; if (location.name().isEmpty()) { @@ -212,7 +226,8 @@ bool QETTitleBlockTemplateEditor::edit(const TitleBlockTemplateLocation &locatio @param template_name Name of the template to edit within its parent project. @return true if this editor was able to edit the given template, false otherwise */ -bool QETTitleBlockTemplateEditor::edit(QETProject *project, const QString &template_name) +bool QETTitleBlockTemplateEditor::edit( + QETProject *project, const QString &template_name) { // we require a project we will rattach templates to if (!project) return(false); @@ -246,7 +261,8 @@ bool QETTitleBlockTemplateEditor::edit(QETProject *project, const QString &templ @param file_path Path of the template file to edit. @return false if a problem occurred while opening the template, true otherwise. */ -bool QETTitleBlockTemplateEditor::edit(const QString &file_path) { +bool QETTitleBlockTemplateEditor::edit(const QString &file_path) +{ // get title block template object from the file, edit it TitleBlockTemplate *tbt = new TitleBlockTemplate(); bool loading = tbt -> loadFromXmlFile(file_path); @@ -272,7 +288,8 @@ bool QETTitleBlockTemplateEditor::edit(const QString &file_path) { @param tbt Title block template to be edited @return false if a problem occurred while opening the template, true otherwise. */ -bool QETTitleBlockTemplateEditor::editCopyOf(const TitleBlockTemplate *tbt) { +bool QETTitleBlockTemplateEditor::editCopyOf(const TitleBlockTemplate *tbt) +{ if (!tbt) return(false); return(edit(tbt -> clone())); } @@ -281,7 +298,8 @@ bool QETTitleBlockTemplateEditor::editCopyOf(const TitleBlockTemplate *tbt) { @param tbt Title block template to be directly edited @return false if a problem occurred while opening the template, true otherwise. */ -bool QETTitleBlockTemplateEditor::edit(TitleBlockTemplate *tbt) { +bool QETTitleBlockTemplateEditor::edit(TitleBlockTemplate *tbt) +{ if (!tbt) return(false); tb_template_ = tbt; template_edition_area_view_ -> setTitleBlockTemplate(tb_template_); @@ -294,7 +312,8 @@ bool QETTitleBlockTemplateEditor::edit(TitleBlockTemplate *tbt) { Launches the logo manager widget, which allows the user to manage the logos embedded within the edited template. */ -void QETTitleBlockTemplateEditor::editLogos() { +void QETTitleBlockTemplateEditor::editLogos() +{ if (tb_template_) { if (!logo_manager_) { initLogoManager(); @@ -321,7 +340,8 @@ void QETTitleBlockTemplateEditor::editLogos() { /** Launch a new title block template editor. */ -void QETTitleBlockTemplateEditor::newTemplate() { +void QETTitleBlockTemplateEditor::newTemplate() +{ QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor(); qet_template_editor -> edit(TitleBlockTemplateLocation()); qet_template_editor -> show(); @@ -330,7 +350,8 @@ void QETTitleBlockTemplateEditor::newTemplate() { /** Initialize the various actions. */ -void QETTitleBlockTemplateEditor::initActions() { +void QETTitleBlockTemplateEditor::initActions() +{ new_ = new QAction(QET::Icons::DocumentNew, tr("&Nouveau", "menu entry"), this); open_ = new QAction(QET::Icons::DocumentOpen, tr("&Ouvrir", "menu entry"), this); open_from_file_ = new QAction(QET::Icons::DocumentOpen, tr("Ouvrir depuis un fichier", "menu entry"), this); @@ -402,10 +423,11 @@ void QETTitleBlockTemplateEditor::initActions() { /** Initialize the various menus. */ -void QETTitleBlockTemplateEditor::initMenus() { - file_menu_ = new QMenu(tr("&Fichier", "menu title"), this); - edit_menu_ = new QMenu(tr("&Édition", "menu title"), this); - display_menu_ = new QMenu(tr("Afficha&ge", "menu title"), this); +void QETTitleBlockTemplateEditor::initMenus() +{ + file_menu_ = new QMenu(tr("&Fichier", "menu title"), this); + edit_menu_ = new QMenu(tr("&Édition", "menu title"), this); + display_menu_ = new QMenu(tr("Afficha&ge", "menu title"), this); file_menu_ -> addAction(new_); file_menu_ -> addAction(open_); @@ -443,7 +465,8 @@ void QETTitleBlockTemplateEditor::initMenus() { /** Initalize toolbars. */ -void QETTitleBlockTemplateEditor::initToolbars() { +void QETTitleBlockTemplateEditor::initToolbars() +{ QToolBar *main_toolbar = new QToolBar(tr("Outils", "toolbar title"), this); main_toolbar -> setObjectName("tbt_main_toolbar"); main_toolbar -> addAction(new_); @@ -516,7 +539,8 @@ void QETTitleBlockTemplateEditor::initWidgets() this, SLOT(selectedCellsChanged(QList)) ); - connect(template_cell_editor_widget_, SIGNAL(logoEditionRequested()), this, SLOT(editLogos())); + connect(template_cell_editor_widget_, SIGNAL(logoEditionRequested()), + this, SLOT(editLogos())); connect( template_cell_editor_widget_, SIGNAL(cellModified(ModifyTitleBlockCellCommand *)), @@ -535,14 +559,17 @@ void QETTitleBlockTemplateEditor::initWidgets() this, SLOT(savePreviewWidthToApplicationSettings(int, int)) ); - connect(undo_stack_, SIGNAL(cleanChanged(bool)), this, SLOT(updateEditorTitle())); - connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(updateActions())); + connect(undo_stack_, SIGNAL(cleanChanged(bool)), + this, SLOT(updateEditorTitle())); + connect(QApplication::clipboard(), SIGNAL(dataChanged()), + this, SLOT(updateActions())); } /** Initialize the logo manager */ -void QETTitleBlockTemplateEditor::initLogoManager() { +void QETTitleBlockTemplateEditor::initLogoManager() +{ logo_manager_ = new TitleBlockTemplateLogoManager(tb_template_, this); logo_manager_ -> setReadOnly(read_only_); connect( @@ -557,7 +584,8 @@ void QETTitleBlockTemplateEditor::initLogoManager() { @return a string describing what is being edited, along with [Changed] or [Read only] tags. Useful to compose the window title. */ -QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const { +QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const +{ QString titleblock_title; if (opened_from_file_) { titleblock_title = filepath_; @@ -617,7 +645,9 @@ void QETTitleBlockTemplateEditor::writeSettings() Update various things when user changes the selected cells. @param selected_cells List of selected cells. */ -void QETTitleBlockTemplateEditor::selectedCellsChanged(const QList& selected_cells) { +void QETTitleBlockTemplateEditor::selectedCellsChanged( + const QList& selected_cells) +{ if (selected_cells.count() == 1) { template_cell_editor_widget_ -> edit(selected_cells.at(0)); template_cell_editor_widget_ -> setVisible(true); @@ -631,7 +661,9 @@ void QETTitleBlockTemplateEditor::selectedCellsChanged(const QList setView(template_edition_area_view_); pushUndoCommand(command); } @@ -640,7 +672,9 @@ void QETTitleBlockTemplateEditor::pushCellUndoCommand(ModifyTitleBlockCellComman Add an undo Command to the undo stack. @param command QUndoCommand to be added to the undo stack */ -void QETTitleBlockTemplateEditor::pushGridUndoCommand(TitleBlockTemplateCommand *command) { +void QETTitleBlockTemplateEditor::pushGridUndoCommand( + TitleBlockTemplateCommand *command) +{ pushUndoCommand(command); } @@ -655,7 +689,8 @@ void QETTitleBlockTemplateEditor::pushUndoCommand(QUndoCommand *command) { /** Set the title of this editor. */ -void QETTitleBlockTemplateEditor::updateEditorTitle() { +void QETTitleBlockTemplateEditor::updateEditorTitle() +{ // base title QString min_title( tr( @@ -686,7 +721,8 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() { Ensure the user interface remains consistent by enabling or disabling adequate actions. */ -void QETTitleBlockTemplateEditor::updateActions() { +void QETTitleBlockTemplateEditor::updateActions() +{ save_ -> setEnabled(!read_only_); bool can_merge = true; @@ -748,7 +784,8 @@ bool QETTitleBlockTemplateEditor::saveAs(const QString &filepath) { Ask the user to choose a title block template from the known collections then open it for edition. */ -void QETTitleBlockTemplateEditor::open() { +void QETTitleBlockTemplateEditor::open() +{ TitleBlockTemplateLocation location = getTitleBlockTemplateLocationFromUser( tr("Ouvrir un modèle", "File > open dialog window title"), true @@ -762,9 +799,12 @@ void QETTitleBlockTemplateEditor::open() { Ask the user to choose a file supposed to contain a title block template, then open it for edition. */ -void QETTitleBlockTemplateEditor::openFromFile() { +void QETTitleBlockTemplateEditor::openFromFile() +{ // directory to show - QString initial_dir = filepath_.isEmpty() ? QETApp::customTitleBlockTemplatesDir() : QDir(filepath_).absolutePath(); + QString initial_dir = filepath_.isEmpty() + ? QETApp::customTitleBlockTemplatesDir() + : QDir(filepath_).absolutePath(); // ask the user to choose a filepath QString user_filepath = QFileDialog::getOpenFileName( @@ -775,7 +815,8 @@ void QETTitleBlockTemplateEditor::openFromFile() { "Modèles de cartouches QElectroTech (*%1);;" "Fichiers XML (*.xml);;" "Tous les fichiers (*)", - "filetypes allowed when opening a title block template file - %1 is the .titleblock extension" + "filetypes allowed when opening a title block template file" + " - %1 is the .titleblock extension" ).arg(QString(TITLEBLOCKS_FILE_EXTENSION)) ); @@ -786,7 +827,8 @@ void QETTitleBlockTemplateEditor::openFromFile() { /** Save the currently edited title block template back to its parent project. */ -bool QETTitleBlockTemplateEditor::save() { +bool QETTitleBlockTemplateEditor::save() +{ if (opened_from_file_) { if (!filepath_.isEmpty()) { QFileInfo file_path_info(filepath_); @@ -808,7 +850,8 @@ bool QETTitleBlockTemplateEditor::save() { /** Ask the user where he wishes to save the currently edited template. */ -bool QETTitleBlockTemplateEditor::saveAs() { +bool QETTitleBlockTemplateEditor::saveAs() +{ TitleBlockTemplateLocation location = getTitleBlockTemplateLocationFromUser( tr("Enregistrer le modèle sous", "dialog window title"), false @@ -822,9 +865,12 @@ bool QETTitleBlockTemplateEditor::saveAs() { /** Ask the user where on the filesystem he wishes to save the currently edited template. */ -bool QETTitleBlockTemplateEditor::saveAsFile() { +bool QETTitleBlockTemplateEditor::saveAsFile() +{ // directory to show - QString initial_dir = filepath_.isEmpty() ? QETApp::customTitleBlockTemplatesDir() : QDir(filepath_).absolutePath(); + QString initial_dir = filepath_.isEmpty() + ? QETApp::customTitleBlockTemplatesDir() + : QDir(filepath_).absolutePath(); // ask the user to choose a target file QString filepath = QFileDialog::getSaveFileName( @@ -875,14 +921,17 @@ void QETTitleBlockTemplateEditor::setReadOnly(bool read_only) { @return The location chosen by the user, or an empty TitleBlockTemplateLocation if the user cancelled the dialog */ -TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLocationFromUser(const QString &title, bool existing_only) { +TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLocationFromUser( + const QString &title, bool existing_only) +{ TitleBlockTemplateLocationChooser *widget; if (existing_only) { widget = new TitleBlockTemplateLocationChooser(location()); } else { widget = new TitleBlockTemplateLocationSaver(location()); } - QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + QDialogButtonBox *buttons = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel); QVBoxLayout *dialog_layout = new QVBoxLayout(); dialog_layout -> addWidget(widget); @@ -904,7 +953,8 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLoc /** Close the current editor. */ -void QETTitleBlockTemplateEditor::quit() { +void QETTitleBlockTemplateEditor::quit() +{ close(); } @@ -914,7 +964,8 @@ void QETTitleBlockTemplateEditor::quit() { @param former_preview_width : former_preview_width Unused, former preview width @param new_preview_width : new_preview_width New preview width */ -void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings(int former_preview_width, int new_preview_width) +void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings( + int former_preview_width, int new_preview_width) { Q_UNUSED(former_preview_width) QSettings settings; @@ -924,7 +975,8 @@ void QETTitleBlockTemplateEditor::savePreviewWidthToApplicationSettings(int form /** Edit extra information attached to the template. */ -void QETTitleBlockTemplateEditor::editTemplateInformation() { +void QETTitleBlockTemplateEditor::editTemplateInformation() +{ if (!tb_template_) return; QDialog dialog_author(this); @@ -950,16 +1002,25 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() { dialog_layout -> addWidget(text_field); // add two buttons to the dialog - QDialogButtonBox *dialog_buttons = new QDialogButtonBox(read_only_ ? QDialogButtonBox::Ok : QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + QDialogButtonBox *dialog_buttons = new QDialogButtonBox( + read_only_ + ? QDialogButtonBox::Ok + : QDialogButtonBox::Ok + | QDialogButtonBox::Cancel); dialog_layout -> addWidget(dialog_buttons); - connect(dialog_buttons, SIGNAL(accepted()), &dialog_author, SLOT(accept())); - connect(dialog_buttons, SIGNAL(rejected()), &dialog_author, SLOT(reject())); + connect(dialog_buttons, SIGNAL(accepted()), + &dialog_author, SLOT(accept())); + connect(dialog_buttons, SIGNAL(rejected()), + &dialog_author, SLOT(reject())); // run the dialog if (dialog_author.exec() == QDialog::Accepted && !read_only_) { QString new_info = text_field -> toPlainText().remove(QChar(13)); // CR-less text if (new_info != tb_template_ -> information()) { - pushUndoCommand(new ChangeTemplateInformationsCommand(tb_template_, tb_template_ -> information(), new_info)); + pushUndoCommand(new ChangeTemplateInformationsCommand( + tb_template_, + tb_template_ -> information(), + new_info)); } } } diff --git a/sources/titleblock/splittedhelpercell.cpp b/sources/titleblock/splittedhelpercell.cpp index 8069c2496..dc25f89b6 100644 --- a/sources/titleblock/splittedhelpercell.cpp +++ b/sources/titleblock/splittedhelpercell.cpp @@ -32,7 +32,8 @@ SplittedHelperCell::SplittedHelperCell(QGraphicsItem *parent) : /** Destructor */ -SplittedHelperCell::~SplittedHelperCell() { +SplittedHelperCell::~SplittedHelperCell() +{ } /** diff --git a/sources/titleblock/templatecellsset.cpp b/sources/titleblock/templatecellsset.cpp index 3908ded3a..ed76cdcdc 100644 --- a/sources/titleblock/templatecellsset.cpp +++ b/sources/titleblock/templatecellsset.cpp @@ -35,13 +35,15 @@ TitleBlockTemplateCellsSet::TitleBlockTemplateCellsSet(const TitleBlockTemplateV /** Destructor */ -TitleBlockTemplateCellsSet::~TitleBlockTemplateCellsSet() { +TitleBlockTemplateCellsSet::~TitleBlockTemplateCellsSet() +{ } /** @return a QPainterPath composed of the rectangles from cells within this set */ -QPainterPath TitleBlockTemplateCellsSet::painterPath() const { +QPainterPath TitleBlockTemplateCellsSet::painterPath() const +{ QPainterPath cells_path; foreach (TitleBlockTemplateVisualCell *cell, *this) { cells_path.addRect(cell -> geometry()); @@ -53,7 +55,8 @@ QPainterPath TitleBlockTemplateCellsSet::painterPath() const { @return true if the cells within this set are composing a rectangle shape, false otherwise. */ -bool TitleBlockTemplateCellsSet::isRectangle() const { +bool TitleBlockTemplateCellsSet::isRectangle() const +{ if (!count()) return(false); if (count() == 1) return(true); @@ -66,7 +69,8 @@ bool TitleBlockTemplateCellsSet::isRectangle() const { /** @return true if all cells within this set are selected */ -bool TitleBlockTemplateCellsSet::allCellsAreSelected() const { +bool TitleBlockTemplateCellsSet::allCellsAreSelected() const +{ foreach (TitleBlockTemplateVisualCell *cell, *this) { if (!cell -> isSelected()) { return(false); @@ -79,7 +83,8 @@ bool TitleBlockTemplateCellsSet::allCellsAreSelected() const { @return true if this set includes at least one cell which is spanned by a cell not present in this set, false otherwise. */ -bool TitleBlockTemplateCellsSet::hasExternalSpan() const { +bool TitleBlockTemplateCellsSet::hasExternalSpan() const +{ // fetches all cells concerned by this set QSet all_cells = cells(true); @@ -95,7 +100,8 @@ bool TitleBlockTemplateCellsSet::hasExternalSpan() const { /** @return the top left cell within this set, or 0 if this set is empty */ -TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::topLeftCell() const { +TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::topLeftCell() const +{ if (empty()) return(nullptr); if (count() == 1) return(first()); @@ -126,7 +132,8 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::topLeftCell() const { /** @return the bottom right cell within this set, or 0 if this set is empty */ -TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::bottomRightCell() const { +TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::bottomRightCell() const +{ if (empty()) return(nullptr); if (count() == 1) return(first()); @@ -155,7 +162,8 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::bottomRightCell() cons @return the merge area, i.e. the rectangle delimited by the top left cell and the bottom right cell within this cells set. */ -QRectF TitleBlockTemplateCellsSet::mergeAreaRect() const { +QRectF TitleBlockTemplateCellsSet::mergeAreaRect() const +{ QRectF merge_area; if (!parent_view_) return(merge_area); @@ -174,7 +182,8 @@ QRectF TitleBlockTemplateCellsSet::mergeAreaRect() const { provided, this method will use mergeAreaRect(). @return the cells contained in the merge area of this cells set */ -TitleBlockTemplateCellsSet TitleBlockTemplateCellsSet::mergeArea(const QRectF &rect) const { +TitleBlockTemplateCellsSet TitleBlockTemplateCellsSet::mergeArea(const QRectF &rect) const +{ TitleBlockTemplateCellsSet merge_area(parent_view_); if (!parent_view_) return(merge_area); @@ -188,7 +197,8 @@ TitleBlockTemplateCellsSet TitleBlockTemplateCellsSet::mergeArea(const QRectF &r @return the list of cells rendered by the current selection @param include_spanned whether to include spanned cells or not */ -QSet TitleBlockTemplateCellsSet::cells(bool include_spanned) const { +QSet TitleBlockTemplateCellsSet::cells(bool include_spanned) const +{ QSet set; foreach (TitleBlockTemplateVisualCell *cell_view, *this) { if (TitleBlockCell *cell = cell_view -> cell()) { diff --git a/sources/titleblock/templatecellwidget.cpp b/sources/titleblock/templatecellwidget.cpp index e82602337..b85b5b7c1 100644 --- a/sources/titleblock/templatecellwidget.cpp +++ b/sources/titleblock/templatecellwidget.cpp @@ -44,13 +44,15 @@ TitleBlockTemplateCellWidget::TitleBlockTemplateCellWidget( /** Destructor */ -TitleBlockTemplateCellWidget::~TitleBlockTemplateCellWidget() { +TitleBlockTemplateCellWidget::~TitleBlockTemplateCellWidget() +{ } /** Initialize layout and widgets. */ -void TitleBlockTemplateCellWidget::initWidgets() { +void TitleBlockTemplateCellWidget::initWidgets() +{ // type combo box: always displayed cell_type_label_ = new QLabel(tr("Type de cellule :")); cell_type_input_ = new QComboBox(); @@ -83,9 +85,9 @@ void TitleBlockTemplateCellWidget::initWidgets() { align_label_ = new QLabel(tr("Alignement :")); horiz_align_label_ = new QLabel(tr("horizontal :")); horiz_align_input_ = new QComboBox(); - horiz_align_input_ -> addItem(tr("Gauche"), Qt::AlignLeft); - horiz_align_input_ -> addItem(tr("Centré"), Qt::AlignHCenter); - horiz_align_input_ -> addItem(tr("Droite"), Qt::AlignRight); + horiz_align_input_ -> addItem(tr("Gauche"), Qt::AlignLeft); + horiz_align_input_ -> addItem(tr("Centré"), Qt::AlignHCenter); + horiz_align_input_ -> addItem(tr("Droite"), Qt::AlignRight); horiz_align_indexes_.insert(Qt::AlignLeft, 0); horiz_align_indexes_.insert(Qt::AlignHCenter, 1); horiz_align_indexes_.insert(Qt::AlignRight, 2); @@ -225,7 +227,8 @@ void TitleBlockTemplateCellWidget::edit(TitleBlockCell *cell) { Emit a type modification command. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editType() { +void TitleBlockTemplateCellWidget::editType() +{ emitModification("type", cell_type_input_ -> itemData(cell_type_input_ -> currentIndex())); } @@ -233,7 +236,8 @@ void TitleBlockTemplateCellWidget::editType() { Emit a name modification command. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editName() { +void TitleBlockTemplateCellWidget::editName() +{ emitModification("name", name_input_ -> text()); } @@ -241,7 +245,8 @@ void TitleBlockTemplateCellWidget::editName() { Emit a modification command stating whether the label should be displayed or not. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editLabelDisplayed() { +void TitleBlockTemplateCellWidget::editLabelDisplayed() +{ emitModification("displaylabel", label_checkbox_ -> isChecked()); } @@ -249,7 +254,8 @@ void TitleBlockTemplateCellWidget::editLabelDisplayed() { Emit a label modification command. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editLabel() { +void TitleBlockTemplateCellWidget::editLabel() +{ if (!edited_cell_) return; editTranslatableValue(edited_cell_ -> label, "label", tr("Label de cette cellule")); label_input_ -> setText(edited_cell_ -> label.name()); @@ -259,7 +265,8 @@ void TitleBlockTemplateCellWidget::editLabel() { Emit a value modification command. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editValue() { +void TitleBlockTemplateCellWidget::editValue() +{ if (!edited_cell_) return; editTranslatableValue(edited_cell_ -> value, "value", tr("Valeur de cette cellule")); value_input_ -> setText(edited_cell_ -> value.name()); @@ -269,7 +276,8 @@ void TitleBlockTemplateCellWidget::editValue() { Emit an alignment modification command. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editAlignment() { +void TitleBlockTemplateCellWidget::editAlignment() +{ emitModification("alignment", alignment()); } @@ -277,7 +285,8 @@ void TitleBlockTemplateCellWidget::editAlignment() { Emit a font size modification command. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editFontSize() { +void TitleBlockTemplateCellWidget::editFontSize() +{ emitModification("fontsize", font_size_input_ -> value()); } @@ -285,7 +294,8 @@ void TitleBlockTemplateCellWidget::editFontSize() { Emit a modification command stating whether the text should be adjusted if needed. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editAdjust() { +void TitleBlockTemplateCellWidget::editAdjust() +{ emitModification("horizontal_adjust", font_adjust_input_ -> isChecked()); } @@ -293,7 +303,8 @@ void TitleBlockTemplateCellWidget::editAdjust() { Emit a logo modification command. @see ModifyTitleBlockCellCommand */ -void TitleBlockTemplateCellWidget::editLogo() { +void TitleBlockTemplateCellWidget::editLogo() +{ emitModification("logo", logo_input_ -> currentText()); } @@ -346,7 +357,8 @@ void TitleBlockTemplateCellWidget::setReadOnly(bool read_only) { Emit a horizontal alignment modification command. @see ModifyTitleBlockCellCommand */ -int TitleBlockTemplateCellWidget::horizontalAlignment() const { +int TitleBlockTemplateCellWidget::horizontalAlignment() const +{ return(horiz_align_indexes_.key(horiz_align_input_ -> currentIndex())); } @@ -354,21 +366,24 @@ int TitleBlockTemplateCellWidget::horizontalAlignment() const { Emit a vertical alignment modification command. @see ModifyTitleBlockCellCommand */ -int TitleBlockTemplateCellWidget::verticalAlignment() const { +int TitleBlockTemplateCellWidget::verticalAlignment() const +{ return(vert_align_indexes_.key(vert_align_input_ -> currentIndex())); } /** @return the currently selected alignment. */ -int TitleBlockTemplateCellWidget::alignment() const { +int TitleBlockTemplateCellWidget::alignment() const +{ return(horizontalAlignment() | verticalAlignment()); } /** @return whether this edition widget is read only */ -bool TitleBlockTemplateCellWidget::isReadOnly() const { +bool TitleBlockTemplateCellWidget::isReadOnly() const +{ return(read_only_); } @@ -404,7 +419,8 @@ void TitleBlockTemplateCellWidget::editTranslatableValue(NamesList &names, const @param attribute Modified cell attribute @param new_value New value for the modified cell attribute */ -void TitleBlockTemplateCellWidget::emitModification(const QString &attribute, const QVariant &new_value) const { +void TitleBlockTemplateCellWidget::emitModification(const QString &attribute, const QVariant &new_value) const +{ if (!edited_cell_) return; // avoid creating a QUndoCommand object when no modification was actually done @@ -423,7 +439,8 @@ void TitleBlockTemplateCellWidget::emitModification(const QString &attribute, co @return a string describing the various variables provided by default by the application. */ -QString TitleBlockTemplateCellWidget::defaultVariablesString() const { +QString TitleBlockTemplateCellWidget::defaultVariablesString() const +{ QString def_var_string = tr( "Par défaut, les variables suivantes sont disponibles :" "

    " @@ -455,7 +472,8 @@ QString TitleBlockTemplateCellWidget::defaultVariablesString() const { /** @return a string describing what the user may enter as cell label / value. */ -QString TitleBlockTemplateCellWidget::labelValueInformationString() const { +QString TitleBlockTemplateCellWidget::labelValueInformationString() const +{ QString lab_val_inf_string = tr( "Chaque cellule d'un cartouche affiche une valeur, optionnellement " "précédée d'un label. Tous deux peuvent être traduits en " diff --git a/sources/titleblock/templatecellwidget.h b/sources/titleblock/templatecellwidget.h index 5a1f7762e..7e63749d3 100644 --- a/sources/titleblock/templatecellwidget.h +++ b/sources/titleblock/templatecellwidget.h @@ -34,8 +34,9 @@ class TitleBlockTemplateCellWidget : public QWidget { // constructor, destructor public: - TitleBlockTemplateCellWidget(TitleBlockTemplate * = nullptr, - QWidget * = nullptr); + TitleBlockTemplateCellWidget( + TitleBlockTemplate * = nullptr, + QWidget * = nullptr); ~TitleBlockTemplateCellWidget() override; private: TitleBlockTemplateCellWidget( diff --git a/sources/titleblock/templatecommands.cpp b/sources/titleblock/templatecommands.cpp index 7218e5678..ee146bf2a 100644 --- a/sources/titleblock/templatecommands.cpp +++ b/sources/titleblock/templatecommands.cpp @@ -38,14 +38,16 @@ ModifyTitleBlockCellCommand::ModifyTitleBlockCellCommand(TitleBlockCell *cell, Q /** Destructor */ -ModifyTitleBlockCellCommand::~ModifyTitleBlockCellCommand() { +ModifyTitleBlockCellCommand::~ModifyTitleBlockCellCommand() +{ } /** @see QUndoCommand::id() @return the ID of this command. */ -int ModifyTitleBlockCellCommand::id() const { +int ModifyTitleBlockCellCommand::id() const +{ return(MODIFY_TITLE_BLOCK_CELL_COMMAND_ID); } @@ -70,7 +72,8 @@ bool ModifyTitleBlockCellCommand::mergeWith(const QUndoCommand *command) { /** Undo the change. */ -void ModifyTitleBlockCellCommand::undo() { +void ModifyTitleBlockCellCommand::undo() +{ if (!modified_cell_) return; foreach (QString attribute, old_values_.keys()) { modified_cell_ -> setAttribute(attribute, old_values_[attribute]); @@ -81,7 +84,8 @@ void ModifyTitleBlockCellCommand::undo() { /** Redo the change. */ -void ModifyTitleBlockCellCommand::redo() { +void ModifyTitleBlockCellCommand::redo() +{ if (!modified_cell_) return; foreach (QString attribute, new_values_.keys()) { modified_cell_ -> setAttribute(attribute, new_values_[attribute]); @@ -92,7 +96,8 @@ void ModifyTitleBlockCellCommand::redo() { /** @return the cell modified by this command */ -TitleBlockCell *ModifyTitleBlockCellCommand::cell() const { +TitleBlockCell *ModifyTitleBlockCellCommand::cell() const +{ return(modified_cell_); } @@ -107,7 +112,8 @@ void ModifyTitleBlockCellCommand::setCell(TitleBlockCell *modified_cell) { /** @return the view to be updated after the cell modification */ -TitleBlockTemplateView *ModifyTitleBlockCellCommand::view() const { +TitleBlockTemplateView *ModifyTitleBlockCellCommand::view() const +{ return(view_); } @@ -122,7 +128,8 @@ void ModifyTitleBlockCellCommand::setView(TitleBlockTemplateView *view) { /** Erase the known old/new values. */ -void ModifyTitleBlockCellCommand::clear() { +void ModifyTitleBlockCellCommand::clear() +{ old_values_.clear(); new_values_.clear(); } @@ -166,13 +173,15 @@ TitleBlockTemplateCommand::TitleBlockTemplateCommand(TitleBlockTemplate *tbtempl /** Destructor */ -TitleBlockTemplateCommand::~TitleBlockTemplateCommand() { +TitleBlockTemplateCommand::~TitleBlockTemplateCommand() +{ } /** @return the modified title block template. */ -TitleBlockTemplate *TitleBlockTemplateCommand::titleBlockTemplate() const { +TitleBlockTemplate *TitleBlockTemplateCommand::titleBlockTemplate() const +{ return(tbtemplate_); } @@ -187,7 +196,8 @@ void TitleBlockTemplateCommand::setTitleBlockTemplate(TitleBlockTemplate *tbtemp /** @return the view to be updated after the template modification */ -TitleBlockTemplateView *TitleBlockTemplateCommand::view() const { +TitleBlockTemplateView *TitleBlockTemplateCommand::view() const +{ return(view_); } @@ -202,7 +212,8 @@ void TitleBlockTemplateCommand::setView(TitleBlockTemplateView *view) { /** Refresh the view, if any. */ -void TitleBlockTemplateCommand::refreshView() { +void TitleBlockTemplateCommand::refreshView() +{ if (!view_) return; view_ -> refresh(); } @@ -210,7 +221,8 @@ void TitleBlockTemplateCommand::refreshView() { /** Refresh the view, including layout reloading, if any. */ -void TitleBlockTemplateCommand::refreshLayout() { +void TitleBlockTemplateCommand::refreshLayout() +{ if (!view_) return; view_ -> updateLayout(); } @@ -313,13 +325,15 @@ ModifyTemplateGridCommand::ModifyTemplateGridCommand(TitleBlockTemplate *tbtempl /** Destructor */ -ModifyTemplateGridCommand::~ModifyTemplateGridCommand() { +ModifyTemplateGridCommand::~ModifyTemplateGridCommand() +{ } /** @return the index of the inserted/deleted row/column */ -int ModifyTemplateGridCommand::index() const { +int ModifyTemplateGridCommand::index() const +{ return(index_); } @@ -334,7 +348,8 @@ void ModifyTemplateGridCommand::setIndex(int index) { /** @return a list of pointers to cells composing the inserted/deleted row/column. */ -QList ModifyTemplateGridCommand::cells() const { +QList ModifyTemplateGridCommand::cells() const +{ return(cells_); } @@ -349,7 +364,8 @@ void ModifyTemplateGridCommand::setCells(const QList &cells) { /** @return the dimension of the inserted/deleted row/column. */ -TitleBlockDimension ModifyTemplateGridCommand::dimension() const { +TitleBlockDimension ModifyTemplateGridCommand::dimension() const +{ return dimension_; } @@ -364,7 +380,8 @@ void ModifyTemplateGridCommand::setDimension(const TitleBlockDimension &dimensio /** @return true if this object is about inserting/deleting a row, false for a column. */ -int ModifyTemplateGridCommand::type() const { +int ModifyTemplateGridCommand::type() const +{ return(type_); } @@ -380,7 +397,8 @@ void ModifyTemplateGridCommand::setType(bool type) { /** @return true if the row/column is inserted, false if it is deleted */ -bool ModifyTemplateGridCommand::isInsertion() const { +bool ModifyTemplateGridCommand::isInsertion() const +{ return(insertion_); } @@ -395,21 +413,24 @@ void ModifyTemplateGridCommand::setInsertion(bool insertion) { /** Undo the change. */ -void ModifyTemplateGridCommand::undo() { +void ModifyTemplateGridCommand::undo() +{ apply(true); } /** Redo the change. */ -void ModifyTemplateGridCommand::redo() { +void ModifyTemplateGridCommand::redo() +{ apply(false); } /** Update the text describing what the command does. */ -void ModifyTemplateGridCommand::updateText() { +void ModifyTemplateGridCommand::updateText() +{ if (type_) { if (insertion_) { setText(QObject::tr("Insertion d'une ligne", "label used in the title block template editor undo list")); @@ -472,13 +493,15 @@ ModifyTemplateDimension::ModifyTemplateDimension(TitleBlockTemplate *tbtemplate, /** Destructor */ -ModifyTemplateDimension::~ModifyTemplateDimension() { +ModifyTemplateDimension::~ModifyTemplateDimension() +{ } /** @return the index of the resized row/column */ -int ModifyTemplateDimension::index() const { +int ModifyTemplateDimension::index() const +{ return(index_); } @@ -493,7 +516,8 @@ void ModifyTemplateDimension::setIndex(int index) { /** @return true if this object is about resizing a row, false for a column. */ -int ModifyTemplateDimension::type() const { +int ModifyTemplateDimension::type() const +{ return type_; } @@ -509,7 +533,8 @@ void ModifyTemplateDimension::setType(bool type) { /** @return the dimension of the row/column before it is resized */ -TitleBlockDimension ModifyTemplateDimension::dimensionBefore() const { +TitleBlockDimension ModifyTemplateDimension::dimensionBefore() const +{ return(before_); } @@ -523,7 +548,8 @@ void ModifyTemplateDimension::setDimensionBefore(const TitleBlockDimension &dime /** @return the dimension of the row/column after it is resized */ -TitleBlockDimension ModifyTemplateDimension::dimensionAfter() const { +TitleBlockDimension ModifyTemplateDimension::dimensionAfter() const +{ return(after_); } @@ -537,21 +563,24 @@ void ModifyTemplateDimension::setDimensionAfter(const TitleBlockDimension &dimen /** Restore the previous size of the row/column. */ -void ModifyTemplateDimension::undo() { +void ModifyTemplateDimension::undo() +{ apply(before_); } /** Resize the row/column. */ -void ModifyTemplateDimension::redo() { +void ModifyTemplateDimension::redo() +{ apply(after_); } /** Update the text describing what the command does. */ -void ModifyTemplateDimension::updateText() { +void ModifyTemplateDimension::updateText() +{ if (type_) { setText(QObject::tr("Modification d'une ligne", "label used in the title block template editor undo list")); } else { @@ -631,7 +660,8 @@ MergeCellsCommand::MergeCellsCommand(const TitleBlockTemplateCellsSet &merged_ce /** Destructor */ -MergeCellsCommand::~MergeCellsCommand() { +MergeCellsCommand::~MergeCellsCommand() +{ } /** @@ -658,7 +688,8 @@ bool MergeCellsCommand::canMerge(const TitleBlockTemplateCellsSet &merged_cells, /** @return true if this command object is valid and usable, false otherwise. */ -bool MergeCellsCommand::isValid() const { +bool MergeCellsCommand::isValid() const +{ // we consider having a non-zero spanning cell and positive spans makes a MergeCellsCommand valid return(spanning_cell_ && row_span_after_ != -1 && col_span_after_ != -1); } @@ -666,7 +697,8 @@ bool MergeCellsCommand::isValid() const { /** Undo the merge operation. */ -void MergeCellsCommand::undo() { +void MergeCellsCommand::undo() +{ if (!isValid()) return; // restore the original spanning_cell attribute of all impacted cells @@ -687,7 +719,8 @@ void MergeCellsCommand::undo() { /** Apply the merge operation */ -void MergeCellsCommand::redo() { +void MergeCellsCommand::redo() +{ if (!isValid()) return; // set the spanning_cell attributes of spanned cells to the spanning cell @@ -771,7 +804,8 @@ SplitCellsCommand::SplitCellsCommand(const TitleBlockTemplateCellsSet &splitted_ /** Destructor */ -SplitCellsCommand::~SplitCellsCommand() { +SplitCellsCommand::~SplitCellsCommand() +{ } /** @@ -798,7 +832,8 @@ bool SplitCellsCommand::canSplit(const TitleBlockTemplateCellsSet &splitted_cell /** @return true if this command object is valid and usable, false otherwise. */ -bool SplitCellsCommand::isValid() const { +bool SplitCellsCommand::isValid() const +{ // we consider having a non-zero spanning cell and at least one spanned cell makes a SplitCellsCommand valid return(spanning_cell_ && spanned_cells_.count()); } @@ -806,7 +841,8 @@ bool SplitCellsCommand::isValid() const { /** Undo the split operation */ -void SplitCellsCommand::undo() { +void SplitCellsCommand::undo() +{ if (!isValid()) return; // the spanned cells are spanned again @@ -827,7 +863,8 @@ void SplitCellsCommand::undo() { /** Apply the split operation */ -void SplitCellsCommand::redo() { +void SplitCellsCommand::redo() +{ if (!isValid()) return; // the spanned cells are not spanned anymore @@ -862,13 +899,15 @@ ChangeTemplateInformationsCommand::ChangeTemplateInformationsCommand(TitleBlockT /** Destructor */ -ChangeTemplateInformationsCommand::~ChangeTemplateInformationsCommand() { +ChangeTemplateInformationsCommand::~ChangeTemplateInformationsCommand() +{ } /** Undo the information change */ -void ChangeTemplateInformationsCommand::undo() { +void ChangeTemplateInformationsCommand::undo() +{ if (!tbtemplate_) return; tbtemplate_ -> setInformation(old_information_); } @@ -876,7 +915,8 @@ void ChangeTemplateInformationsCommand::undo() { /** Redo the information change */ -void ChangeTemplateInformationsCommand::redo() { +void ChangeTemplateInformationsCommand::redo() +{ tbtemplate_ -> setInformation(new_information_); } @@ -891,13 +931,15 @@ CutTemplateCellsCommand::CutTemplateCellsCommand(TitleBlockTemplate *tb_template /** Destructor */ -CutTemplateCellsCommand::~CutTemplateCellsCommand() { +CutTemplateCellsCommand::~CutTemplateCellsCommand() +{ } /** Undo a cut operation */ -void CutTemplateCellsCommand::undo() { +void CutTemplateCellsCommand::undo() +{ foreach (TitleBlockCell *cell, cut_cells_.keys()) { cell -> cell_type = cut_cells_.value(cell); } @@ -907,7 +949,8 @@ void CutTemplateCellsCommand::undo() { /** Redo a cut operation */ -void CutTemplateCellsCommand::redo() { +void CutTemplateCellsCommand::redo() +{ foreach (TitleBlockCell *cell, cut_cells_.keys()) { cell -> cell_type = TitleBlockCell::EmptyCell; } @@ -924,7 +967,8 @@ void CutTemplateCellsCommand::setCutCells(const QList &cells) /** Update the label describing this command */ -void CutTemplateCellsCommand::updateText() { +void CutTemplateCellsCommand::updateText() +{ setText(QObject::tr("Couper %n cellule(s)", "undo caption", cut_cells_.count())); } @@ -942,20 +986,23 @@ PasteTemplateCellsCommand::PasteTemplateCellsCommand(TitleBlockTemplate *tb_temp /** Destructor */ -PasteTemplateCellsCommand::~PasteTemplateCellsCommand() { +PasteTemplateCellsCommand::~PasteTemplateCellsCommand() +{ } /** Update the label describing this command */ -void PasteTemplateCellsCommand::updateText() { +void PasteTemplateCellsCommand::updateText() +{ setText(QObject::tr("Coller %n cellule(s)", "undo caption", erased_cells_.count())); } /** Undo a paste action. */ -void PasteTemplateCellsCommand::undo() { +void PasteTemplateCellsCommand::undo() +{ bool span_management = erased_cells_.count() > 1; foreach (TitleBlockCell *cell, erased_cells_.keys()) { cell -> loadContentFromCell(erased_cells_.value(cell)); @@ -973,7 +1020,8 @@ void PasteTemplateCellsCommand::undo() { /** Redo a paste action. */ -void PasteTemplateCellsCommand::redo() { +void PasteTemplateCellsCommand::redo() +{ // we only play with spans when pasting more than one cell. bool span_management = erased_cells_.count() > 1; diff --git a/sources/titleblock/templatedeleter.cpp b/sources/titleblock/templatedeleter.cpp index 1d1484efa..489458c62 100644 --- a/sources/titleblock/templatedeleter.cpp +++ b/sources/titleblock/templatedeleter.cpp @@ -32,7 +32,8 @@ TitleBlockTemplateDeleter::TitleBlockTemplateDeleter(const TitleBlockTemplateLoc /** Destructor */ -TitleBlockTemplateDeleter::~TitleBlockTemplateDeleter() { +TitleBlockTemplateDeleter::~TitleBlockTemplateDeleter() +{ } /** @@ -41,7 +42,8 @@ TitleBlockTemplateDeleter::~TitleBlockTemplateDeleter() { actually proceeding to the deletion. @return true if the deletion succeeded, false otherwise. */ -bool TitleBlockTemplateDeleter::exec() { +bool TitleBlockTemplateDeleter::exec() +{ if (!template_location_.isValid()) return(false); QString name = template_location_.name(); diff --git a/sources/titleblock/templatelocation.cpp b/sources/titleblock/templatelocation.cpp index bfc300ed2..95c40a717 100644 --- a/sources/titleblock/templatelocation.cpp +++ b/sources/titleblock/templatelocation.cpp @@ -38,7 +38,8 @@ TitleBlockTemplateLocation::TitleBlockTemplateLocation( /** Destructor */ -TitleBlockTemplateLocation::~TitleBlockTemplateLocation() { +TitleBlockTemplateLocation::~TitleBlockTemplateLocation() +{ } /** @@ -54,7 +55,8 @@ TitleBlockTemplateLocation TitleBlockTemplateLocation::locationFromString( /** @return the parent collection of the template, or 0 if none was defined */ -TitleBlockTemplatesCollection *TitleBlockTemplateLocation::parentCollection() const { +TitleBlockTemplatesCollection *TitleBlockTemplateLocation::parentCollection() const +{ return(collection_); } @@ -70,7 +72,8 @@ void TitleBlockTemplateLocation::setParentCollection( /** @return the name of this template within its parent project or collection. */ -QString TitleBlockTemplateLocation::name() const { +QString TitleBlockTemplateLocation::name() const +{ return(name_); } @@ -84,7 +87,8 @@ void TitleBlockTemplateLocation::setName(const QString &name) { /** @return true if this location is null, false otherwise */ -bool TitleBlockTemplateLocation::isValid() const { +bool TitleBlockTemplateLocation::isValid() const +{ return(!name_.isEmpty()); } @@ -105,7 +109,8 @@ void TitleBlockTemplateLocation::fromString(const QString &loc_str) { /** @return A string representation of the location */ -QString TitleBlockTemplateLocation::toString() const { +QString TitleBlockTemplateLocation::toString() const +{ return(protocol() + QString("://") + name_); } @@ -113,7 +118,8 @@ QString TitleBlockTemplateLocation::toString() const { This is a convenience method equivalent to parentCollection() -> parentProject(). */ -QETProject *TitleBlockTemplateLocation::parentProject() const { +QETProject *TitleBlockTemplateLocation::parentProject() const +{ if (collection_) { return(collection_ -> parentProject()); } @@ -124,7 +130,8 @@ QETProject *TitleBlockTemplateLocation::parentProject() const { This is a convenience method equivalent to parentCollection() -> protocol(). */ -QString TitleBlockTemplateLocation::protocol() const { +QString TitleBlockTemplateLocation::protocol() const +{ if (collection_) { return(collection_ -> protocol()); } @@ -135,7 +142,8 @@ QString TitleBlockTemplateLocation::protocol() const { This is a convenience method equivalent to parentCollection() -> getTemplateXmlDescription */ -QDomElement TitleBlockTemplateLocation::getTemplateXmlDescription() const { +QDomElement TitleBlockTemplateLocation::getTemplateXmlDescription() const +{ if (!collection_ || name_.isEmpty()) return(QDomElement()); return(collection_ -> getTemplateXmlDescription(name_)); } @@ -144,7 +152,8 @@ QDomElement TitleBlockTemplateLocation::getTemplateXmlDescription() const { This is a convenience method equivalent to parentCollection() -> getTemplate(...). */ -TitleBlockTemplate *TitleBlockTemplateLocation::getTemplate() const { +TitleBlockTemplate *TitleBlockTemplateLocation::getTemplate() const +{ if (!collection_ || name_.isEmpty()) return(nullptr); return(collection_ -> getTemplate(name_)); } @@ -153,7 +162,8 @@ TitleBlockTemplate *TitleBlockTemplateLocation::getTemplate() const { This is a convenience method equivalent to parentCollection() -> isReadOnly(name()) */ -bool TitleBlockTemplateLocation::isReadOnly() const { +bool TitleBlockTemplateLocation::isReadOnly() const +{ if (!collection_) return(false); return(collection_ -> isReadOnly(name_)); } @@ -163,7 +173,8 @@ bool TitleBlockTemplateLocation::isReadOnly() const { @return true if locations are equal, false otherwise */ bool TitleBlockTemplateLocation::operator==( - const TitleBlockTemplateLocation &location) const { + const TitleBlockTemplateLocation &location) const +{ return(location.collection_ == collection_ && location.name_ == name_); } diff --git a/sources/titleblock/templatelocationchooser.cpp b/sources/titleblock/templatelocationchooser.cpp index a1eba25a7..6f809f750 100644 --- a/sources/titleblock/templatelocationchooser.cpp +++ b/sources/titleblock/templatelocationchooser.cpp @@ -39,27 +39,31 @@ TitleBlockTemplateLocationChooser::TitleBlockTemplateLocationChooser( /** Destructor */ -TitleBlockTemplateLocationChooser::~TitleBlockTemplateLocationChooser() { +TitleBlockTemplateLocationChooser::~TitleBlockTemplateLocationChooser() +{ } /** @return the current location */ -TitleBlockTemplateLocation TitleBlockTemplateLocationChooser::location() const { +TitleBlockTemplateLocation TitleBlockTemplateLocationChooser::location() const +{ return(TitleBlockTemplateLocation(name(), collection())); } /** @return the currently selected collection */ -TitleBlockTemplatesCollection *TitleBlockTemplateLocationChooser::collection() const { +TitleBlockTemplatesCollection *TitleBlockTemplateLocationChooser::collection() const +{ return(collections_index_[collections_ -> currentIndex()]); } /** @return the currently selected/entered name */ -QString TitleBlockTemplateLocationChooser::name() const { +QString TitleBlockTemplateLocationChooser::name() const +{ int template_index = templates_ -> currentIndex(); return(template_index != -1 ? templates_ -> currentText() : QString()); } @@ -87,7 +91,8 @@ void TitleBlockTemplateLocationChooser::setLocation( Initialize this widget. @param location Initial location displayed by the widget */ -void TitleBlockTemplateLocationChooser::init() { +void TitleBlockTemplateLocationChooser::init() +{ collections_ = new QComboBox(); templates_ = new QComboBox(); @@ -96,10 +101,12 @@ void TitleBlockTemplateLocationChooser::init() { this, SLOT(updateTemplates())); form_layout_ = new QFormLayout(); - form_layout_ -> addRow(tr("Collection parente","used in save as form"), - collections_); - form_layout_ -> addRow(tr("Modèle existant","used in save as form"), - templates_); + form_layout_ -> addRow( + tr("Collection parente","used in save as form"), + collections_); + form_layout_ -> addRow( + tr("Modèle existant","used in save as form"), + templates_); setLayout(form_layout_); } @@ -111,7 +118,8 @@ void TitleBlockTemplateLocationChooser::init() { or the index of \a coll */ int TitleBlockTemplateLocationChooser::indexForCollection( - TitleBlockTemplatesCollection *coll) const { + TitleBlockTemplatesCollection *coll) const +{ QList indexes = collections_index_.keys(coll); if (indexes.count()) return(indexes.first()); return(-1); @@ -120,7 +128,8 @@ int TitleBlockTemplateLocationChooser::indexForCollection( /** Update the collections list */ -void TitleBlockTemplateLocationChooser::updateCollections() { +void TitleBlockTemplateLocationChooser::updateCollections() +{ collections_ -> clear(); collections_index_.clear(); @@ -138,7 +147,8 @@ void TitleBlockTemplateLocationChooser::updateCollections() { /** Update the templates list according to the selected collection. */ -void TitleBlockTemplateLocationChooser::updateTemplates() { +void TitleBlockTemplateLocationChooser::updateTemplates() +{ TitleBlockTemplatesCollection *current_collection = collection(); if (!current_collection) return; diff --git a/sources/titleblock/templatelocationsaver.cpp b/sources/titleblock/templatelocationsaver.cpp index 673998112..20ef826fb 100644 --- a/sources/titleblock/templatelocationsaver.cpp +++ b/sources/titleblock/templatelocationsaver.cpp @@ -39,13 +39,15 @@ TitleBlockTemplateLocationSaver::TitleBlockTemplateLocationSaver( /** Destructor */ -TitleBlockTemplateLocationSaver::~TitleBlockTemplateLocationSaver() { +TitleBlockTemplateLocationSaver::~TitleBlockTemplateLocationSaver() +{ } /** @return the currently selected/entered name */ -QString TitleBlockTemplateLocationSaver::name() const { +QString TitleBlockTemplateLocationSaver::name() const +{ int template_index = templates_ -> currentIndex(); return(template_index ? templates_ -> currentText() : new_name_ -> text()); } @@ -74,17 +76,19 @@ void TitleBlockTemplateLocationSaver::setLocation(const TitleBlockTemplateLocati Initialize this widget. @param location Initial location displayed by the widget */ -void TitleBlockTemplateLocationSaver::init() { +void TitleBlockTemplateLocationSaver::init() +{ new_name_ = new QLineEdit(); connect(templates_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateNewName())); - form_layout_ -> addRow(tr("ou nouveau nom", "used in save as form"), new_name_); + form_layout_ -> addRow(tr("ou nouveau nom", "used in save as form"), new_name_); updateTemplates(); } /** Update the templates list according to the selected collection. */ -void TitleBlockTemplateLocationSaver::updateTemplates() { +void TitleBlockTemplateLocationSaver::updateTemplates() +{ TitleBlockTemplatesCollection *current_collection = collection(); if (!current_collection) return; @@ -99,7 +103,8 @@ void TitleBlockTemplateLocationSaver::updateTemplates() { Enable or diable the "new name" text field depending of the selected template. */ -void TitleBlockTemplateLocationSaver::updateNewName() { +void TitleBlockTemplateLocationSaver::updateNewName() +{ int template_index = templates_ -> currentIndex(); new_name_ -> setEnabled(!template_index); } diff --git a/sources/titleblock/templatelogomanager.cpp b/sources/titleblock/templatelogomanager.cpp index 42cb303df..828324621 100644 --- a/sources/titleblock/templatelogomanager.cpp +++ b/sources/titleblock/templatelogomanager.cpp @@ -37,14 +37,16 @@ TitleBlockTemplateLogoManager::TitleBlockTemplateLogoManager(TitleBlockTemplate /** Destructor */ -TitleBlockTemplateLogoManager::~TitleBlockTemplateLogoManager() { +TitleBlockTemplateLogoManager::~TitleBlockTemplateLogoManager() +{ } /** @return the name of the currently selected logo, or a null QString if none is selected. */ -QString TitleBlockTemplateLogoManager::currentLogo() const { +QString TitleBlockTemplateLogoManager::currentLogo() const +{ if (!managed_template_) return QString(); QListWidgetItem *current_item = logos_view_ -> currentItem(); @@ -57,21 +59,24 @@ QString TitleBlockTemplateLogoManager::currentLogo() const { @return Whether this logo manager should allow logo edition (renaming, addition, deletion). */ -bool TitleBlockTemplateLogoManager::isReadOnly() const { +bool TitleBlockTemplateLogoManager::isReadOnly() const +{ return(read_only_); } /** Emit the logosChanged() signal. */ -void TitleBlockTemplateLogoManager::emitLogosChangedSignal() { +void TitleBlockTemplateLogoManager::emitLogosChangedSignal() +{ emit(logosChanged(const_cast(managed_template_))); } /** Initialize widgets composing the Logo manager */ -void TitleBlockTemplateLogoManager::initWidgets() { +void TitleBlockTemplateLogoManager::initWidgets() +{ open_dialog_dir_.setPath(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)); setWindowTitle(tr("Gestionnaire de logos")); @@ -133,7 +138,8 @@ void TitleBlockTemplateLogoManager::initWidgets() { /** Update the logos display. */ -void TitleBlockTemplateLogoManager::fillView() { +void TitleBlockTemplateLogoManager::fillView() +{ if (!managed_template_) return; logos_view_ -> clear(); @@ -167,7 +173,8 @@ void TitleBlockTemplateLogoManager::fillView() { @return the icon size to display the logos embedded within the managed template. */ -QSize TitleBlockTemplateLogoManager::iconsize() const { +QSize TitleBlockTemplateLogoManager::iconsize() const +{ return(QSize(80, 80)); } @@ -261,7 +268,8 @@ void TitleBlockTemplateLogoManager::updateLogoInformations(QListWidgetItem *curr Ask the user for a filepath, and add it as a new logo in the managed template. */ -void TitleBlockTemplateLogoManager::addLogo() { +void TitleBlockTemplateLogoManager::addLogo() +{ if (!managed_template_) return; QString filepath = QFileDialog::getOpenFileName( @@ -293,7 +301,8 @@ void TitleBlockTemplateLogoManager::addLogo() { /** Export the currently selected logo */ -void TitleBlockTemplateLogoManager::exportLogo() { +void TitleBlockTemplateLogoManager::exportLogo() +{ QString current_logo = currentLogo(); if (current_logo.isNull()) return; @@ -316,7 +325,8 @@ void TitleBlockTemplateLogoManager::exportLogo() { /** Delete the currently selected logo. */ -void TitleBlockTemplateLogoManager::removeLogo() { +void TitleBlockTemplateLogoManager::removeLogo() +{ QString current_logo = currentLogo(); if (current_logo.isNull()) return; @@ -329,7 +339,8 @@ void TitleBlockTemplateLogoManager::removeLogo() { /** Rename currently selected logo. */ -void TitleBlockTemplateLogoManager::renameLogo() { +void TitleBlockTemplateLogoManager::renameLogo() +{ QString current_logo = currentLogo(); if (current_logo.isNull()) return; diff --git a/sources/titleblock/templatescollection.cpp b/sources/titleblock/templatescollection.cpp index 92648b29e..001b08945 100644 --- a/sources/titleblock/templatescollection.cpp +++ b/sources/titleblock/templatescollection.cpp @@ -33,13 +33,15 @@ TitleBlockTemplatesCollection::TitleBlockTemplatesCollection(QObject *parent) : /** Destructor */ -TitleBlockTemplatesCollection::~TitleBlockTemplatesCollection() { +TitleBlockTemplatesCollection::~TitleBlockTemplatesCollection() +{ } /** @return the title of this collection */ -QString TitleBlockTemplatesCollection::title() const { +QString TitleBlockTemplatesCollection::title() const +{ return(title_); } @@ -55,7 +57,8 @@ void TitleBlockTemplatesCollection::setTitle(const QString &title) { @return the protocol used by this collection ; examples: commontbt, customtbt, embedtbt, ... */ -QString TitleBlockTemplatesCollection::protocol() const { +QString TitleBlockTemplatesCollection::protocol() const +{ return(protocol_); } @@ -71,7 +74,8 @@ void TitleBlockTemplatesCollection::setProtocol(const QString &protocol) { @brief TitleBlockTemplatesCollection::collection @return the collection where is stored this collection. */ -QET::QetCollection TitleBlockTemplatesCollection::collection() const { +QET::QetCollection TitleBlockTemplatesCollection::collection() const +{ return m_collection; } @@ -88,7 +92,8 @@ void TitleBlockTemplatesCollection::setCollection(QET::QetCollection c) { @return the project this collection is affiliated to, or 0 if this collection is not related to any project. */ -QETProject *TitleBlockTemplatesCollection::parentProject() { +QETProject *TitleBlockTemplatesCollection::parentProject() +{ return(nullptr); } @@ -97,7 +102,8 @@ QETProject *TitleBlockTemplatesCollection::parentProject() { objects. @see templates() */ -QList TitleBlockTemplatesCollection::templatesLocations() { +QList TitleBlockTemplatesCollection::templatesLocations() +{ QList locations; foreach (QString template_name, templates()) { locations << location(template_name); @@ -120,13 +126,15 @@ TitleBlockTemplatesProjectCollection::TitleBlockTemplatesProjectCollection(QETPr /** Destructor */ -TitleBlockTemplatesProjectCollection::~TitleBlockTemplatesProjectCollection() { +TitleBlockTemplatesProjectCollection::~TitleBlockTemplatesProjectCollection() +{ } /** @return a human readable title for this collection */ -QString TitleBlockTemplatesProjectCollection::title() const { +QString TitleBlockTemplatesProjectCollection::title() const +{ if (!title_.isEmpty()) return(title_); // if the title attribute is empty, we generate a suitable one using the @@ -158,7 +166,8 @@ QString TitleBlockTemplatesProjectCollection::title() const { /** @return the protocol used to mention this collection */ -QString TitleBlockTemplatesProjectCollection::protocol() const { +QString TitleBlockTemplatesProjectCollection::protocol() const +{ if (project_) { int project_id = QETApp::projectId(project_); if (project_id != -1) { @@ -172,14 +181,16 @@ QString TitleBlockTemplatesProjectCollection::protocol() const { /** @return the parent project of this project collection */ -QETProject *TitleBlockTemplatesProjectCollection::parentProject() { +QETProject *TitleBlockTemplatesProjectCollection::parentProject() +{ return(project_); } /** @return the list of title block templates embedded within the project. */ -QStringList TitleBlockTemplatesProjectCollection::templates() { +QStringList TitleBlockTemplatesProjectCollection::templates() +{ return(titleblock_templates_xml_.keys()); } @@ -292,7 +303,8 @@ TitleBlockTemplateLocation TitleBlockTemplatesProjectCollection::location(const @return always false since a project collection is not stored on any filesystem. */ -bool TitleBlockTemplatesProjectCollection::hasFilePath() { +bool TitleBlockTemplatesProjectCollection::hasFilePath() +{ return(false); } @@ -300,7 +312,8 @@ bool TitleBlockTemplatesProjectCollection::hasFilePath() { @return always an empty string since a project collection is not stored on any filesystem. */ -QString TitleBlockTemplatesProjectCollection::filePath() { +QString TitleBlockTemplatesProjectCollection::filePath() +{ return(QString()); } @@ -309,7 +322,8 @@ QString TitleBlockTemplatesProjectCollection::filePath() { itself is read only, or a specific template name. @return true if the specified template is read only, false otherwise */ -bool TitleBlockTemplatesProjectCollection::isReadOnly(const QString &template_name) const { +bool TitleBlockTemplatesProjectCollection::isReadOnly(const QString &template_name) const +{ Q_UNUSED(template_name) if (project_) { return(project_ -> isReadOnly()); @@ -338,7 +352,8 @@ void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_elemen /** Delete all title block templates not used within the parent project */ -void TitleBlockTemplatesProjectCollection::deleteUnusedTitleBlocKTemplates() { +void TitleBlockTemplatesProjectCollection::deleteUnusedTitleBlocKTemplates() +{ if (!project_) return; foreach (QString template_name, templates()) { @@ -371,13 +386,15 @@ TitleBlockTemplatesFilesCollection::TitleBlockTemplatesFilesCollection(const QSt /** Destructor */ -TitleBlockTemplatesFilesCollection::~TitleBlockTemplatesFilesCollection() { +TitleBlockTemplatesFilesCollection::~TitleBlockTemplatesFilesCollection() +{ } /** @return the canonical path of the directory hosting this collection. */ -QString TitleBlockTemplatesFilesCollection::path(const QString &template_name) const { +QString TitleBlockTemplatesFilesCollection::path(const QString &template_name) const +{ if (template_name.isEmpty()) { return(dir_.canonicalPath()); } else { @@ -388,7 +405,8 @@ QString TitleBlockTemplatesFilesCollection::path(const QString &template_name) c /** @return the list of templates contained in this collection */ -QStringList TitleBlockTemplatesFilesCollection::templates() { +QStringList TitleBlockTemplatesFilesCollection::templates() +{ QStringList templates_names; QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION)); foreach(QString name, dir_.entryList()) { @@ -492,14 +510,16 @@ TitleBlockTemplateLocation TitleBlockTemplatesFilesCollection::location(const QS @return always true since a files collection is always stored on a filesystem. */ -bool TitleBlockTemplatesFilesCollection::hasFilePath() { +bool TitleBlockTemplatesFilesCollection::hasFilePath() +{ return(true); } /** @return The filesystem path where this files collection is actually stored. */ -QString TitleBlockTemplatesFilesCollection::filePath() { +QString TitleBlockTemplatesFilesCollection::filePath() +{ return(dir_.canonicalPath()); } @@ -508,7 +528,8 @@ QString TitleBlockTemplatesFilesCollection::filePath() { itself is read only, or a specific template name. @return true if the specified template is read only, false otherwise */ -bool TitleBlockTemplatesFilesCollection::isReadOnly(const QString &template_name) const { +bool TitleBlockTemplatesFilesCollection::isReadOnly(const QString &template_name) const +{ if (template_name.isEmpty()) { QFileInfo info(dir_.canonicalPath()); return(!info.isWritable()); diff --git a/sources/titleblock/templateview.cpp b/sources/titleblock/templateview.cpp index 31c024ebb..fd8546f73 100644 --- a/sources/titleblock/templateview.cpp +++ b/sources/titleblock/templateview.cpp @@ -56,8 +56,8 @@ TitleBlockTemplateView::TitleBlockTemplateView(QWidget *parent) : @param scene @param parent Parent QWidget. */ -TitleBlockTemplateView::TitleBlockTemplateView(QGraphicsScene *scene, - QWidget *parent) : +TitleBlockTemplateView::TitleBlockTemplateView( + QGraphicsScene *scene,QWidget *parent) : QGraphicsView(scene, parent), tbtemplate_(nullptr), tbgrid_(nullptr), @@ -73,7 +73,8 @@ TitleBlockTemplateView::TitleBlockTemplateView(QGraphicsScene *scene, /** Destructor */ -TitleBlockTemplateView::~TitleBlockTemplateView() { +TitleBlockTemplateView::~TitleBlockTemplateView() +{ } /** @@ -88,14 +89,16 @@ void TitleBlockTemplateView::setTitleBlockTemplate(TitleBlockTemplate *tbtemplat /** @return The title block template object rendered by this view. */ -TitleBlockTemplate *TitleBlockTemplateView::titleBlockTemplate() const { +TitleBlockTemplate *TitleBlockTemplateView::titleBlockTemplate() const +{ return(tbtemplate_); } /** Emits the selectedCellsChanged() signal with the currently selected cells. */ -void TitleBlockTemplateView::selectionChanged() { +void TitleBlockTemplateView::selectionChanged() +{ emit(selectedCellsChanged(selectedCells())); } @@ -103,7 +106,8 @@ void TitleBlockTemplateView::selectionChanged() { Zoom in by zoomFactor(). @see zoomFactor() */ -void TitleBlockTemplateView::zoomIn() { +void TitleBlockTemplateView::zoomIn() +{ scale(zoomFactor(), zoomFactor()); } @@ -111,7 +115,8 @@ void TitleBlockTemplateView::zoomIn() { Zoom out by zoomFactor(). @see zoomFactor() */ -void TitleBlockTemplateView::zoomOut() { +void TitleBlockTemplateView::zoomOut() +{ qreal zoom_factor = 1.0/zoomFactor(); scale(zoom_factor, zoom_factor); } @@ -119,7 +124,8 @@ void TitleBlockTemplateView::zoomOut() { /** Fit the rendered title block template in this view. */ -void TitleBlockTemplateView::zoomFit() { +void TitleBlockTemplateView::zoomFit() +{ adjustSceneRect(); fitInView(scene() -> sceneRect(), Qt::KeepAspectRatio); } @@ -127,7 +133,8 @@ void TitleBlockTemplateView::zoomFit() { /** Reset the zoom level. */ -void TitleBlockTemplateView::zoomReset() { +void TitleBlockTemplateView::zoomReset() +{ adjustSceneRect(); resetTransform(); } @@ -137,7 +144,8 @@ void TitleBlockTemplateView::zoomReset() { empty. @return the list of cells copied to the clipboard */ -QList TitleBlockTemplateView::cut() { +QList TitleBlockTemplateView::cut() +{ if (!tbtemplate_) return(QList()); QList copied_cells = copy(); @@ -153,7 +161,8 @@ QList TitleBlockTemplateView::cut() { Export currently selected cells to the clipboard. @return the list of cells copied to the clipboard */ -QList TitleBlockTemplateView::copy() { +QList TitleBlockTemplateView::copy() +{ if (!tbtemplate_) return(QList()); QList copied_cells = selectedCells(); @@ -177,7 +186,8 @@ QList TitleBlockTemplateView::copy() { /** @return true if the content of the clipboard looks interesting */ -bool TitleBlockTemplateView::mayPaste() { +bool TitleBlockTemplateView::mayPaste() +{ // retrieve the clipboard content QClipboard *clipboard = QApplication::clipboard(); return(clipboard -> text().contains(" TitleBlockTemplateView::pastedCells() { +QList TitleBlockTemplateView::pastedCells() +{ QList pasted_cells; // retrieve the clipboard content and parse it as XML @@ -235,7 +246,8 @@ QList TitleBlockTemplateView::pastedCells() { /** Import the cells described in the clipboard. */ -void TitleBlockTemplateView::paste() { +void TitleBlockTemplateView::paste() +{ if (!tbtemplate_) return; QList pasted_cells = pastedCells(); if (!pasted_cells.count()) return; @@ -262,7 +274,8 @@ void TitleBlockTemplateView::paste() { /** Add a column right after the last one. */ -void TitleBlockTemplateView::addColumnAtEnd() { +void TitleBlockTemplateView::addColumnAtEnd() +{ if (read_only_) return; requestGridModification(ModifyTemplateGridCommand::addColumn(tbtemplate_, tbtemplate_ -> columnsCount())); } @@ -270,7 +283,8 @@ void TitleBlockTemplateView::addColumnAtEnd() { /** Add a row right after the last one. */ -void TitleBlockTemplateView::addRowAtEnd() { +void TitleBlockTemplateView::addRowAtEnd() +{ if (read_only_) return; requestGridModification(ModifyTemplateGridCommand::addRow(tbtemplate_, tbtemplate_ -> rowsCount())); } @@ -279,7 +293,8 @@ void TitleBlockTemplateView::addRowAtEnd() { Add a column right before the last index selected when calling the context menu. */ -void TitleBlockTemplateView::addColumnBefore() { +void TitleBlockTemplateView::addColumnBefore() +{ if (read_only_) return; int index = lastContextMenuCellIndex(); if (index == -1) return; @@ -290,7 +305,8 @@ void TitleBlockTemplateView::addColumnBefore() { Add a row right before the last index selected when calling the context menu. */ -void TitleBlockTemplateView::addRowBefore() { +void TitleBlockTemplateView::addRowBefore() +{ if (read_only_) return; int index = lastContextMenuCellIndex(); if (index == -1) return; @@ -301,7 +317,8 @@ void TitleBlockTemplateView::addRowBefore() { Add a column right after the last index selected when calling the context menu. */ -void TitleBlockTemplateView::addColumnAfter() { +void TitleBlockTemplateView::addColumnAfter() +{ if (read_only_) return; int index = lastContextMenuCellIndex(); if (index == -1) return; @@ -312,7 +329,8 @@ void TitleBlockTemplateView::addColumnAfter() { Add a row right after the last index selected when calling the context menu. */ -void TitleBlockTemplateView::addRowAfter() { +void TitleBlockTemplateView::addRowAfter() +{ if (read_only_) return; int index = lastContextMenuCellIndex(); if (index == -1) return; @@ -374,7 +392,8 @@ void TitleBlockTemplateView::editRow(HelperCell *cell) { /** Remove the column at the last index selected when calling the context menu. */ -void TitleBlockTemplateView::deleteColumn() { +void TitleBlockTemplateView::deleteColumn() +{ int index = lastContextMenuCellIndex(); if (index == -1) return; requestGridModification(ModifyTemplateGridCommand::deleteColumn(tbtemplate_, index)); @@ -383,7 +402,8 @@ void TitleBlockTemplateView::deleteColumn() { /** Remove the row at the last index selected when calling the context menu. */ -void TitleBlockTemplateView::deleteRow() { +void TitleBlockTemplateView::deleteRow() +{ int index = lastContextMenuCellIndex(); if (index == -1) return; requestGridModification(ModifyTemplateGridCommand::deleteRow(tbtemplate_, index)); @@ -392,7 +412,8 @@ void TitleBlockTemplateView::deleteRow() { /** Merge the selected cells. */ -void TitleBlockTemplateView::mergeSelectedCells() { +void TitleBlockTemplateView::mergeSelectedCells() +{ // retrieve the selected cells TitleBlockTemplateCellsSet selected_cells = selectedCellsSet(); @@ -403,7 +424,8 @@ void TitleBlockTemplateView::mergeSelectedCells() { /** Split the selected cell. */ -void TitleBlockTemplateView::splitSelectedCell() { +void TitleBlockTemplateView::splitSelectedCell() +{ // retrieve the selected cells TitleBlockTemplateCellsSet selected_cells = selectedCellsSet(); @@ -423,14 +445,16 @@ void TitleBlockTemplateView::drawBackground(QPainter *painter, const QRectF &rec /** @return the selected logical cells, not including the spanned ones. */ -QList TitleBlockTemplateView::selectedCells() const { +QList TitleBlockTemplateView::selectedCells() const +{ return(selectedCellsSet().cells(false).values()); } /** @return the selected visual cells. */ -TitleBlockTemplateCellsSet TitleBlockTemplateView::selectedCellsSet() const { +TitleBlockTemplateCellsSet TitleBlockTemplateView::selectedCellsSet() const +{ return(makeCellsSetFromGraphicsItems(scene() -> selectedItems())); } @@ -439,7 +463,8 @@ TitleBlockTemplateCellsSet TitleBlockTemplateView::selectedCellsSet() const { @param rect Rectangle in the coordinates of the QGraphicsWidget representing the title block template. */ -TitleBlockTemplateCellsSet TitleBlockTemplateView::cells(const QRectF &rect) const { +TitleBlockTemplateCellsSet TitleBlockTemplateView::cells(const QRectF &rect) const +{ QPolygonF mapped_rect(form_ -> mapToScene(rect)); QList items = scene() -> items(mapped_rect, Qt::IntersectsItemShape); return(makeCellsSetFromGraphicsItems(items)); @@ -482,14 +507,16 @@ void TitleBlockTemplateView::analyzeSelectedCells(bool *can_merge, /** @return the current size of the rendered title block template */ -QSizeF TitleBlockTemplateView::templateSize() const { +QSizeF TitleBlockTemplateView::templateSize() const +{ return(QSizeF(templateWidth(), templateHeight())); } /** @return the current width of the rendered title block template */ -qreal TitleBlockTemplateView::templateWidth() const { +qreal TitleBlockTemplateView::templateWidth() const +{ if (!tbtemplate_) return(0); qreal width = DEFAULT_ROWS_HELPER_CELLS_WIDTH; @@ -502,7 +529,8 @@ qreal TitleBlockTemplateView::templateWidth() const { /** @return the current height of the rendered title block template */ -qreal TitleBlockTemplateView::templateHeight() const { +qreal TitleBlockTemplateView::templateHeight() const +{ if (!tbtemplate_) return(0); qreal height = DEFAULT_PREVIEW_HELPER_CELL_HEIGHT; @@ -532,14 +560,16 @@ void TitleBlockTemplateView::wheelEvent(QWheelEvent *e) { /** @return the zoom factor used by zoomIn() and zoomOut(). */ -qreal TitleBlockTemplateView::zoomFactor() const { +qreal TitleBlockTemplateView::zoomFactor() const +{ return(1.1); } /** Initialize this view (actions, signals/slots connections, etc.) */ -void TitleBlockTemplateView::init() { +void TitleBlockTemplateView::init() +{ add_column_before_ = new QAction(QET::Icons::EditTableInsertColumnLeft, tr("Ajouter une colonne (avant)", "context menu"), this); add_row_before_ = new QAction(QET::Icons::EditTableInsertRowAbove, tr("Ajouter une ligne (avant)", "context menu"), this); add_column_after_ = new QAction(QET::Icons::EditTableInsertColumnRight, tr("Ajouter une colonne (après)", "context menu"), this); @@ -669,7 +699,8 @@ void TitleBlockTemplateView::applyRowsHeights(bool animate) { /** Update the content (type and value) of rows helper cells. */ -void TitleBlockTemplateView::updateRowsHelperCells() { +void TitleBlockTemplateView::updateRowsHelperCells() +{ int row_count = tbtemplate_ -> rowsCount(); QList heights = tbtemplate_ -> rowsHeights(); for (int i = 0 ; i < row_count ; ++ i) { @@ -684,7 +715,8 @@ void TitleBlockTemplateView::updateRowsHelperCells() { /** Update the content (type and value) of columns helper cells. */ -void TitleBlockTemplateView::updateColumnsHelperCells() { +void TitleBlockTemplateView::updateColumnsHelperCells() +{ int col_count = tbtemplate_ -> columnsCount(); for (int i = 0 ; i < col_count ; ++ i) { TitleBlockDimension current_col_dim = tbtemplate_ -> columnDimension(i); @@ -700,7 +732,8 @@ void TitleBlockTemplateView::updateColumnsHelperCells() { Add the cells (both helper cells and regular visual cells) to the scene to get a visual representation of the edited title block template. */ -void TitleBlockTemplateView::addCells() { +void TitleBlockTemplateView::addCells() +{ int col_count = tbtemplate_ -> columnsCount(); int row_count = tbtemplate_ -> rowsCount(); @@ -710,8 +743,10 @@ void TitleBlockTemplateView::addCells() { updateTotalWidthLabel(); total_width_helper_cell_ -> orientation = Qt::Horizontal; total_width_helper_cell_ -> setActions(QList() << change_preview_width_); - connect(total_width_helper_cell_, SIGNAL(contextMenuTriggered(HelperCell *)), this, SLOT(updateLastContextMenuCell(HelperCell *))); - connect(total_width_helper_cell_, SIGNAL(doubleClicked(HelperCell*)), this, SLOT(changePreviewWidth())); + connect(total_width_helper_cell_, SIGNAL(contextMenuTriggered(HelperCell *)), + this, SLOT(updateLastContextMenuCell(HelperCell *))); + connect(total_width_helper_cell_, SIGNAL(doubleClicked(HelperCell*)), + this, SLOT(changePreviewWidth())); tbgrid_ -> addItem(total_width_helper_cell_, 0, COL_OFFSET, 1, col_count); // we also initialize an extra helper cells that shows the preview width is @@ -728,8 +763,10 @@ void TitleBlockTemplateView::addCells() { current_col_cell -> setActions(columnsActions()); current_col_cell -> orientation = Qt::Horizontal; current_col_cell -> index = i; - connect(current_col_cell, SIGNAL(contextMenuTriggered(HelperCell *)), this, SLOT(updateLastContextMenuCell(HelperCell *))); - connect(current_col_cell, SIGNAL(doubleClicked(HelperCell*)), this, SLOT(editColumn(HelperCell *))); + connect(current_col_cell, SIGNAL(contextMenuTriggered(HelperCell *)), + this, SLOT(updateLastContextMenuCell(HelperCell *))); + connect(current_col_cell, SIGNAL(doubleClicked(HelperCell*)), + this, SLOT(editColumn(HelperCell *))); tbgrid_ -> addItem(current_col_cell, 1, COL_OFFSET + i, 1, 1); } @@ -742,8 +779,10 @@ void TitleBlockTemplateView::addCells() { current_row_cell -> orientation = Qt::Vertical; current_row_cell -> index = i; current_row_cell -> setActions(rowsActions()); - connect(current_row_cell, SIGNAL(contextMenuTriggered(HelperCell *)), this, SLOT(updateLastContextMenuCell(HelperCell *))); - connect(current_row_cell, SIGNAL(doubleClicked(HelperCell*)), this, SLOT(editRow(HelperCell *))); + connect(current_row_cell, SIGNAL(contextMenuTriggered(HelperCell *)), + this, SLOT(updateLastContextMenuCell(HelperCell *))); + connect(current_row_cell, SIGNAL(doubleClicked(HelperCell*)), + this, SLOT(editRow(HelperCell *))); tbgrid_ -> addItem(current_row_cell, ROW_OFFSET + i, 0, 1, 1); } @@ -768,7 +807,8 @@ void TitleBlockTemplateView::addCells() { /** Refresh the regular cells. */ -void TitleBlockTemplateView::refresh() { +void TitleBlockTemplateView::refresh() +{ int col_count = tbtemplate_ -> columnsCount(); int row_count = tbtemplate_ -> rowsCount(); if (row_count < 1 || col_count < 1) return; @@ -787,7 +827,8 @@ void TitleBlockTemplateView::refresh() { /** Ask the user a new width for the preview */ -void TitleBlockTemplateView::changePreviewWidth() { +void TitleBlockTemplateView::changePreviewWidth() +{ TitleBlockDimensionWidget dialog(false, this); dialog.setWindowTitle(tr("Changer la largeur de l'aperçu")); dialog.label() -> setText(tr("Largeur de l'aperçu :")); @@ -800,7 +841,8 @@ void TitleBlockTemplateView::changePreviewWidth() { /** Fill the layout with empty cells where needed. */ -void TitleBlockTemplateView::fillWithEmptyCells() { +void TitleBlockTemplateView::fillWithEmptyCells() +{ int col_count = tbtemplate_ -> columnsCount(); int row_count = tbtemplate_ -> rowsCount(); if (row_count < 1 || col_count < 1) return; @@ -840,7 +882,8 @@ bool TitleBlockTemplateView::event(QEvent *event) { void TitleBlockTemplateView::normalizeCells( QList &cells, int x, - int y) const { + int y) const +{ if (!cells.count()) return; int min_row = cells.at(0).num_row; @@ -896,14 +939,16 @@ void TitleBlockTemplateView::loadTemplate(TitleBlockTemplate *tbt) { /** @return the list of rows-specific actions. */ -QList TitleBlockTemplateView::rowsActions() const { +QList TitleBlockTemplateView::rowsActions() const +{ return QList() << add_row_before_<< edit_row_dim_ << add_row_after_ << delete_row_; } /** @return the list of columns-specific actions. */ -QList TitleBlockTemplateView::columnsActions() const { +QList TitleBlockTemplateView::columnsActions() const +{ return QList() << add_column_before_ << edit_column_dim_ << add_column_after_ << delete_column_; } @@ -912,7 +957,8 @@ QList TitleBlockTemplateView::columnsActions() const { after the rendered title block template has been "deeply" modified, e.g. rows/columns have been added/modified or cells were merged/splitted. */ -void TitleBlockTemplateView::updateLayout() { +void TitleBlockTemplateView::updateLayout() +{ // TODO we should try to update the grid instead of deleting-and-reloading it loadTemplate(tbtemplate_); } @@ -921,7 +967,8 @@ void TitleBlockTemplateView::updateLayout() { Update the displayed layout. Call this function when the dimensions of rows changed. */ -void TitleBlockTemplateView::rowsDimensionsChanged() { +void TitleBlockTemplateView::rowsDimensionsChanged() +{ applyRowsHeights(); } @@ -929,7 +976,8 @@ void TitleBlockTemplateView::rowsDimensionsChanged() { Update the displayed layout. Call this function when the dimensions of columns changed. */ -void TitleBlockTemplateView::columnsDimensionsChanged() { +void TitleBlockTemplateView::columnsDimensionsChanged() +{ applyColumnsWidths(); } @@ -937,7 +985,8 @@ void TitleBlockTemplateView::columnsDimensionsChanged() { Update the tooltip that displays the minimum and/or maximum width of the template. */ -void TitleBlockTemplateView::updateDisplayedMinMaxWidth() { +void TitleBlockTemplateView::updateDisplayedMinMaxWidth() +{ if (!tbtemplate_) return; int min_width = tbtemplate_ -> minimumWidth(); int max_width = tbtemplate_ -> maximumWidth(); @@ -1004,7 +1053,8 @@ void TitleBlockTemplateView::setPreviewWidth(int width) { /** Update the label of the helper cell that indicates the preview width. */ -void TitleBlockTemplateView::updateTotalWidthLabel() { +void TitleBlockTemplateView::updateTotalWidthLabel() +{ if (!total_width_helper_cell_) return; total_width_helper_cell_ -> label = QString( tr( @@ -1030,7 +1080,8 @@ void TitleBlockTemplateView::requestGridModification(TitleBlockTemplateCommand * @return the last index selected when triggering the context menu. @see updateLastContextMenuCell */ -int TitleBlockTemplateView::lastContextMenuCellIndex() const { +int TitleBlockTemplateView::lastContextMenuCellIndex() const +{ if (last_context_menu_cell_) { return(last_context_menu_cell_ -> index); } @@ -1071,7 +1122,8 @@ void TitleBlockTemplateView::removeItem(QGraphicsLayoutItem *item) { @return the corresponding TitleBlockTemplateCellsSet */ TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems( - const QList &items) const { + const QList &items) const +{ TitleBlockTemplateCellsSet set(this); foreach (QGraphicsItem *item, items) { if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast(item)) { @@ -1109,7 +1161,8 @@ void TitleBlockTemplateView::updateLastContextMenuCell(HelperCell *last_context_ /** Adjusts the bounding rect of the scene. */ -void TitleBlockTemplateView::adjustSceneRect() { +void TitleBlockTemplateView::adjustSceneRect() +{ QRectF old_scene_rect = scene() -> sceneRect(); // rectangle including everything on the scene diff --git a/sources/titleblock/templateview.h b/sources/titleblock/templateview.h index 7862f2a13..36edf14c6 100644 --- a/sources/titleblock/templateview.h +++ b/sources/titleblock/templateview.h @@ -100,9 +100,8 @@ class TitleBlockTemplateView : public QGraphicsView { virtual qreal zoomFactor() const; virtual void fillWithEmptyCells(); bool event(QEvent *) override; - virtual void normalizeCells(QList &, - int x = 0, - int y = 0) const; + virtual void normalizeCells( + QList &, int x = 0, int y = 0) const; signals: void selectedCellsChanged(QList); diff --git a/sources/titleblock/templatevisualcell.cpp b/sources/titleblock/templatevisualcell.cpp index 7bbb20758..80e525111 100644 --- a/sources/titleblock/templatevisualcell.cpp +++ b/sources/titleblock/templatevisualcell.cpp @@ -37,7 +37,8 @@ TitleBlockTemplateVisualCell::TitleBlockTemplateVisualCell(QGraphicsItem *parent /** Destructor */ -TitleBlockTemplateVisualCell::~TitleBlockTemplateVisualCell() { +TitleBlockTemplateVisualCell::~TitleBlockTemplateVisualCell() +{ } /** @@ -56,7 +57,8 @@ void TitleBlockTemplateVisualCell::setGeometry(const QRectF &g) { @param constraint New value for the size hint @return the size hint for \a which using the width or height of \a constraint */ -QSizeF TitleBlockTemplateVisualCell::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { +QSizeF TitleBlockTemplateVisualCell::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ Q_UNUSED(which); return constraint; } @@ -64,7 +66,8 @@ QSizeF TitleBlockTemplateVisualCell::sizeHint(Qt::SizeHint which, const QSizeF & /** @return the bounding rect of this helper cell */ -QRectF TitleBlockTemplateVisualCell::boundingRect() const { +QRectF TitleBlockTemplateVisualCell::boundingRect() const +{ return QRectF(QPointF(0,0), geometry().size()); } @@ -74,7 +77,11 @@ QRectF TitleBlockTemplateVisualCell::boundingRect() const { @param option Rendering options @param widget QWidget being painted, if any */ -void TitleBlockTemplateVisualCell::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { +void TitleBlockTemplateVisualCell::paint( + QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ Q_UNUSED(option); Q_UNUSED(widget); @@ -99,7 +106,9 @@ void TitleBlockTemplateVisualCell::paint(QPainter *painter, const QStyleOptionGr @param tbt Parent title block template of the previewed cell @param cell Previewed cell */ -void TitleBlockTemplateVisualCell::setTemplateCell(TitleBlockTemplate *tbt, TitleBlockCell *cell) { +void TitleBlockTemplateVisualCell::setTemplateCell( + TitleBlockTemplate *tbt, TitleBlockCell *cell) +{ template_ = tbt; cell_ = cell; } @@ -107,14 +116,16 @@ void TitleBlockTemplateVisualCell::setTemplateCell(TitleBlockTemplate *tbt, Titl /** @return the parent title block template of the previewed cell */ -TitleBlockTemplate *TitleBlockTemplateVisualCell::titleBlockTemplate() const { +TitleBlockTemplate *TitleBlockTemplateVisualCell::titleBlockTemplate() const +{ return(template_); } /** @return the previewed title block cell */ -TitleBlockCell *TitleBlockTemplateVisualCell::cell() const { +TitleBlockCell *TitleBlockTemplateVisualCell::cell() const +{ return(cell_); } @@ -122,7 +133,8 @@ TitleBlockCell *TitleBlockTemplateVisualCell::cell() const { @return the title block cell previewed by this object, plus the cells it spans over, if any */ -QSet TitleBlockTemplateVisualCell::cells() const { +QSet TitleBlockTemplateVisualCell::cells() const +{ QSet set; if (cell_) { if (template_) { diff --git a/sources/titleblockcell.cpp b/sources/titleblockcell.cpp index 9459128ea..92fad0d8a 100644 --- a/sources/titleblockcell.cpp +++ b/sources/titleblockcell.cpp @@ -3,7 +3,8 @@ /** Constructor */ -TitleBlockCell::TitleBlockCell() { +TitleBlockCell::TitleBlockCell() +{ cell_type = TitleBlockCell::EmptyCell; num_row = num_col = -1; row_span = col_span = 0; @@ -20,27 +21,31 @@ TitleBlockCell::TitleBlockCell() { /** Destructor */ -TitleBlockCell::~TitleBlockCell() { +TitleBlockCell::~TitleBlockCell() +{ } /** @return the type of this cell */ -TitleBlockCell::TemplateCellType TitleBlockCell::type() const { +TitleBlockCell::TemplateCellType TitleBlockCell::type() const +{ return(cell_type); } /** @return the horizontal alignment of this cell */ -int TitleBlockCell::horizontalAlign() const { +int TitleBlockCell::horizontalAlign() const +{ return(alignment & Qt::AlignHorizontal_Mask); } /** @return the vertical alignment of this cell */ -int TitleBlockCell::verticalAlign() const { +int TitleBlockCell::verticalAlign() const +{ return(alignment & Qt::AlignVertical_Mask); } @@ -131,7 +136,8 @@ QString TitleBlockCell::attributeName(const QString &attribute) { /** @return true if this cell spans over other cells, false otherwise. */ -bool TitleBlockCell::spans() const { +bool TitleBlockCell::spans() const +{ return(row_span || col_span); } diff --git a/sources/titleblockproperties.cpp b/sources/titleblockproperties.cpp index 642b758f7..9ecc4a1b2 100644 --- a/sources/titleblockproperties.cpp +++ b/sources/titleblockproperties.cpp @@ -34,7 +34,8 @@ TitleBlockProperties::TitleBlockProperties() : /** Destructeur */ -TitleBlockProperties::~TitleBlockProperties() { +TitleBlockProperties::~TitleBlockProperties() +{ } /** @@ -73,7 +74,8 @@ bool TitleBlockProperties::operator!=(const TitleBlockProperties &ip) { Exporte le cartouche sous formes d'attributs XML ajoutes a l'element e. @param e Element XML auquel seront ajoutes des attributs */ -void TitleBlockProperties::toXml(QDomElement &e) const { +void TitleBlockProperties::toXml(QDomElement &e) const +{ e.setAttribute("author", author); e.setAttribute("title", title); e.setAttribute("filename", filename); @@ -136,7 +138,8 @@ void TitleBlockProperties::fromXml(const QDomElement &e) { @param settings : setting to use @param prefix : name to use as prefix for this property */ -void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const { +void TitleBlockProperties::toSettings(QSettings &settings, const QString &prefix) const +{ settings.setValue(prefix + "title", title); settings.setValue(prefix + "author", author); settings.setValue(prefix + "filename", filename); @@ -192,7 +195,8 @@ TitleBlockProperties TitleBlockProperties::defaultProperties() /** @return La date a utiliser */ -QDate TitleBlockProperties::finalDate() const { +QDate TitleBlockProperties::finalDate() const +{ if (useDate == UseDateValue) { return(date); } else { @@ -207,7 +211,8 @@ QDate TitleBlockProperties::finalDate() const { * now pour afficher la date courante (a la creation du schema) * une date au format yyyyMMdd pour utiliser une date fixe */ -QString TitleBlockProperties::exportDate() const { +QString TitleBlockProperties::exportDate() const +{ QString date_setting_value; if (useDate == UseDateValue) { if (date.isNull()) date_setting_value = "null"; diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 5323af7a9..479c57c52 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -37,7 +37,8 @@ TitleBlockTemplate::TitleBlockTemplate(QObject *parent) : @brief TitleBlockTemplate::~TitleBlockTemplate Destructor */ -TitleBlockTemplate::~TitleBlockTemplate() { +TitleBlockTemplate::~TitleBlockTemplate() +{ loadLogos(QDomElement(), true); qDeleteAll(registered_cells_); } @@ -158,7 +159,8 @@ bool TitleBlockTemplate::saveToXmlFile(const QString &filepath) { The XML element this title block template should be saved to. @return true if the export succeeds, false otherwise */ -bool TitleBlockTemplate::saveToXmlElement(QDomElement &xml_element) const { +bool TitleBlockTemplate::saveToXmlElement(QDomElement &xml_element) const +{ // we are supposed to have at least a name if (name_.isEmpty()) return(false); @@ -177,7 +179,8 @@ bool TitleBlockTemplate::saveToXmlElement(QDomElement &xml_element) const { Parent XML element to be used when exporting \a cell */ void TitleBlockTemplate::exportCellToXml(TitleBlockCell *cell, - QDomElement &xml_element) const { + QDomElement &xml_element) const +{ saveCell(cell, xml_element, true); } @@ -187,7 +190,8 @@ void TitleBlockTemplate::exportCellToXml(TitleBlockCell *cell, (i.e. title block cells are duplicated too and associated with their parent template). */ -TitleBlockTemplate *TitleBlockTemplate::clone() const { +TitleBlockTemplate *TitleBlockTemplate::clone() const +{ TitleBlockTemplate *copy = new TitleBlockTemplate(); copy -> name_ = name_; copy -> information_ = information_; @@ -500,7 +504,8 @@ void TitleBlockTemplate::loadCell(const QDomElement &cell_element) { @param xml_element : XML element under which extra informations will be attached */ -void TitleBlockTemplate::saveInformation(QDomElement &xml_element) const { +void TitleBlockTemplate::saveInformation(QDomElement &xml_element) const +{ QDomNode information_text_node = xml_element.ownerDocument().createTextNode(information()); @@ -516,7 +521,8 @@ void TitleBlockTemplate::saveInformation(QDomElement &xml_element) const { @param xml_element : XML Element under which the \ element will be attached */ -void TitleBlockTemplate::saveLogos(QDomElement &xml_element) const { +void TitleBlockTemplate::saveLogos(QDomElement &xml_element) const +{ QDomElement logos_element = xml_element.ownerDocument().createElement("logos"); foreach(QString logo_name, type_logos_.keys()) { @@ -535,7 +541,8 @@ void TitleBlockTemplate::saveLogos(QDomElement &xml_element) const { @param xml_element : XML element in which the logo will be exported */ void TitleBlockTemplate::saveLogo(const QString &logo_name, - QDomElement &xml_element) const { + QDomElement &xml_element) const +{ if (!type_logos_.contains(logo_name)) return; xml_element.setAttribute("name", logo_name); @@ -564,7 +571,8 @@ void TitleBlockTemplate::saveLogo(const QString &logo_name, @param xml_element : XML element under which the \ element will be attached */ -void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const { +void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const +{ QDomElement grid_element = xml_element.ownerDocument().createElement("grid"); @@ -588,7 +596,8 @@ void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const { @param xml_element : XML element under which the \ elements will be attached */ -void TitleBlockTemplate::saveCells(QDomElement &xml_element) const { +void TitleBlockTemplate::saveCells(QDomElement &xml_element) const +{ for (int j = 0 ; j < rows_heights_.count() ; ++ j) { for (int i = 0 ; i < columns_width_.count() ; ++ i) { if (cells_[i][j] -> cell_type @@ -610,7 +619,8 @@ void TitleBlockTemplate::saveCells(QDomElement &xml_element) const { */ void TitleBlockTemplate::saveCell(TitleBlockCell *cell, QDomElement &xml_element, - bool save_empty) const { + bool save_empty) const +{ if (!cell) return; if (cell -> spanner_cell) return; if (!save_empty && cell -> cell_type == TitleBlockCell::EmptyCell) @@ -706,7 +716,8 @@ bool TitleBlockTemplate::checkCell(const QDomElement &xml_element, Note that this method does nothing if one of the internal lists columns_width_ and rows_heights_ is empty. */ -void TitleBlockTemplate::initCells() { +void TitleBlockTemplate::initCells() +{ if (columns_width_.count() < 1 || rows_heights_.count() < 1) return; cells_.clear(); @@ -724,7 +735,8 @@ void TitleBlockTemplate::initCells() { @brief TitleBlockTemplate::name @return the name of this template */ -QString TitleBlockTemplate::name() const { +QString TitleBlockTemplate::name() const +{ return(name_); } @@ -732,7 +744,8 @@ QString TitleBlockTemplate::name() const { @brief TitleBlockTemplate::information @return the information field attached to this template */ -QString TitleBlockTemplate::information() const { +QString TitleBlockTemplate::information() const +{ return(information_); } @@ -803,7 +816,8 @@ void TitleBlockTemplate::setColumnDimension( @brief TitleBlockTemplate::columnsCount @return the number of columns in this template */ -int TitleBlockTemplate::columnsCount() const { +int TitleBlockTemplate::columnsCount() const +{ return(columns_width_.count()); } @@ -811,7 +825,8 @@ int TitleBlockTemplate::columnsCount() const { @brief TitleBlockTemplate::rowsCount @return the number of rows in this template */ -int TitleBlockTemplate::rowsCount() const { +int TitleBlockTemplate::rowsCount() const +{ return(rows_heights_.count()); } @@ -820,7 +835,8 @@ int TitleBlockTemplate::rowsCount() const { @param total_width : The total width of the titleblock to render @return the list of the columns widths for this rendering */ -QList TitleBlockTemplate::columnsWidth(int total_width) const { +QList TitleBlockTemplate::columnsWidth(int total_width) const +{ if (total_width < 0) return(QList()); // we first iter to determine the absolute and total-width-related widths @@ -890,7 +906,8 @@ QList TitleBlockTemplate::columnsWidth(int total_width) const { @brief TitleBlockTemplate::rowsHeights @return the heights of all the rows in this template */ -QList TitleBlockTemplate::rowsHeights() const { +QList TitleBlockTemplate::rowsHeights() const +{ return(rows_heights_); } @@ -929,7 +946,8 @@ int TitleBlockTemplate::columnTypeTotal(QET::TitleBlockColumnLength type) { /** @return the minimum width for this template */ -int TitleBlockTemplate::minimumWidth() { +int TitleBlockTemplate::minimumWidth() +{ // Abbreviations: ABS: absolute, RTT: relative to total, RTR: // relative to remaining, // TOT: total diagram/TBT width (variable). @@ -954,7 +972,8 @@ int TitleBlockTemplate::minimumWidth() { @return the maximum width for this template, or -1 if it does not have any. */ -int TitleBlockTemplate::maximumWidth() { +int TitleBlockTemplate::maximumWidth() +{ if (columnTypeCount(QET::Absolute) == columns_width_.count()) { // The template is composed of absolute widths only, // therefore it may not extend beyond their sum. @@ -980,7 +999,8 @@ int TitleBlockTemplate::width(int total_width) { @brief TitleBlockTemplate::height @return the total height of this template */ -int TitleBlockTemplate::height() const { +int TitleBlockTemplate::height() const +{ int height = 0; foreach(int row_height, rows_heights_) { height += row_height; @@ -1061,7 +1081,8 @@ QList TitleBlockTemplate::takeRow(int i) { @brief TitleBlockTemplate::createRow @return a new row that fits the current grid */ -QList TitleBlockTemplate::createRow() { +QList TitleBlockTemplate::createRow() +{ return(createCellsList(columns_width_.count())); } @@ -1130,7 +1151,8 @@ QList TitleBlockTemplate::takeColumn(int i) { @brief TitleBlockTemplate::createColumn @return a new column that fits the current grid */ -QList TitleBlockTemplate::createColumn() { +QList TitleBlockTemplate::createColumn() +{ return(createCellsList(rows_heights_.count())); } @@ -1140,7 +1162,8 @@ QList TitleBlockTemplate::createColumn() { @param col : A column number (starting from 0) @return the cell located at (row, col) */ -TitleBlockCell *TitleBlockTemplate::cell(int row, int col) const { +TitleBlockCell *TitleBlockTemplate::cell(int row, int col) const +{ if (row >= rows_heights_.count()) return(nullptr); if (col >= columns_width_.count()) return(nullptr); @@ -1160,7 +1183,8 @@ TitleBlockCell *TitleBlockTemplate::cell(int row, int col) const { */ QSet TitleBlockTemplate::spannedCells( const TitleBlockCell *given_cell, - bool ignore_span_state) const { + bool ignore_span_state) const +{ QSet set; if (!given_cell) return(set); if (!ignore_span_state && given_cell -> span_state @@ -1197,7 +1221,8 @@ QSet TitleBlockTemplate::spannedCells( @return */ QHash > TitleBlockTemplate::getAllSpans( - ) const { + ) const +{ QHash > spans; for (int j = 0 ; j < rows_heights_.count() ; ++ j) { for (int i = 0 ; i < columns_width_.count() ; ++ i) { @@ -1402,7 +1427,8 @@ void TitleBlockTemplate::setLogoStorage(const QString &logo_name, @brief TitleBlockTemplate::logos @return The names of logos embedded within this title block template. */ -QList TitleBlockTemplate::logos() const { +QList TitleBlockTemplate::logos() const +{ return(data_logos_.keys()); } @@ -1413,7 +1439,8 @@ QList TitleBlockTemplate::logos() const { @return the kind of storage used for the required logo, or a null QString if no such logo was found in this template. */ -QString TitleBlockTemplate::logoType(const QString &logo_name) const { +QString TitleBlockTemplate::logoType(const QString &logo_name) const +{ if (type_logos_.contains(logo_name)) { return type_logos_[logo_name]; } @@ -1427,7 +1454,8 @@ QString TitleBlockTemplate::logoType(const QString &logo_name) const { @return the rendering object for the required vector logo, or 0 if no such vector logo was found in this template. */ -QSvgRenderer *TitleBlockTemplate::vectorLogo(const QString &logo_name) const { +QSvgRenderer *TitleBlockTemplate::vectorLogo(const QString &logo_name) const +{ if (vector_logos_.contains(logo_name)) { return vector_logos_[logo_name]; } @@ -1441,7 +1469,8 @@ QSvgRenderer *TitleBlockTemplate::vectorLogo(const QString &logo_name) const { @return the pixmap for the required bitmap logo, or a null pixmap if no such bitmap logo was found in this template. */ -QPixmap TitleBlockTemplate::bitmapLogo(const QString &logo_name) const { +QPixmap TitleBlockTemplate::bitmapLogo(const QString &logo_name) const +{ if (bitmap_logos_.contains(logo_name)) { return bitmap_logos_[logo_name]; } @@ -1460,7 +1489,8 @@ QPixmap TitleBlockTemplate::bitmapLogo(const QString &logo_name) const { */ void TitleBlockTemplate::render(QPainter &painter, const DiagramContext &diagram_context, - int titleblock_width) const { + int titleblock_width) const +{ QList widths = columnsWidth(titleblock_width); int titleblock_height = height(); @@ -1524,7 +1554,8 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect, const DiagramContext &diagram_context, int titleblock_width, QString &file_path, - int color) const { + int color) const +{ QList widths = columnsWidth(titleblock_width); // draw the titleblock border @@ -1609,7 +1640,8 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect, void TitleBlockTemplate::renderCell(QPainter &painter, const TitleBlockCell &cell, const DiagramContext &diagram_context, - const QRect &cell_rect) const { + const QRect &cell_rect) const +{ // draw the border rect of the current cell QPen pen(QBrush(), 0.0, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin); pen.setColor(Qt::black); @@ -1659,7 +1691,8 @@ void TitleBlockTemplate::renderCell(QPainter &painter, */ QString TitleBlockTemplate::finalTextForCell( const TitleBlockCell &cell, - const DiagramContext &diagram_context) const { + const DiagramContext &diagram_context) const +{ QString cell_text = cell.value.name(); QString cell_label = cell.label.name(); @@ -1685,7 +1718,8 @@ QString TitleBlockTemplate::finalTextForCell( */ QString TitleBlockTemplate::interpreteVariables( const QString &string, - const DiagramContext &diagram_context) const { + const DiagramContext &diagram_context) const +{ QString interpreted_string = string; foreach (QString key, diagram_context.keys(DiagramContext::DecreasingLength)) { @@ -1702,7 +1736,8 @@ QString TitleBlockTemplate::interpreteVariables( Get list of variables @return The list of string with variables */ -QStringList TitleBlockTemplate::listOfVariables() { +QStringList TitleBlockTemplate::listOfVariables() +{ QStringList list; // run through each individual cell for (int j = 0 ; j < rows_heights_.count() ; ++ j) { @@ -1738,7 +1773,8 @@ QStringList TitleBlockTemplate::listOfVariables() { void TitleBlockTemplate::renderTextCell(QPainter &painter, const QString &text, const TitleBlockCell &cell, - const QRectF &cell_rect) const { + const QRectF &cell_rect) const +{ if (text.isEmpty()) return; QFont text_font = TitleBlockTemplate::fontForCell(cell); painter.setFont(text_font); @@ -1796,7 +1832,8 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path, qreal y, qreal w, qreal h, - int color) const { + int color) const +{ if (text.isEmpty()) return; QFont text_font = TitleBlockTemplate::fontForCell(cell); double textHeight = text_font.pointSizeF(); @@ -1865,7 +1902,8 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path, @brief TitleBlockTemplate::forgetSpanning Set the spanner_cell attribute of every cell to 0. */ -void TitleBlockTemplate::forgetSpanning() { +void TitleBlockTemplate::forgetSpanning() +{ for (int i = 0 ; i < columns_width_.count() ; ++ i) { for (int j = 0 ; j < rows_heights_.count() ; ++ j) { cells_[i][j] -> spanner_cell = nullptr; @@ -1902,7 +1940,8 @@ void TitleBlockTemplate::forgetSpanning(TitleBlockCell *spanning_cell, Forget any previously applied span, then apply again all spans defined by existing cells. */ -void TitleBlockTemplate::applyCellSpans() { +void TitleBlockTemplate::applyCellSpans() +{ forgetSpanning(); for (int i = 0 ; i < columns_width_.count() ; ++ i) { for (int j = 0 ; j < rows_heights_.count() ; ++ j) { @@ -2013,7 +2052,8 @@ void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell) { @brief TitleBlockTemplate::applyRowColNums Ensure all cells have the right col+row numbers. */ -void TitleBlockTemplate::applyRowColNums() { +void TitleBlockTemplate::applyRowColNums() +{ for (int i = 0 ; i < columns_width_.count() ; ++ i) { for (int j = 0 ; j < rows_heights_.count() ; ++ j) { cells_[i][j] -> num_col = i; @@ -2027,7 +2067,8 @@ void TitleBlockTemplate::applyRowColNums() { Take care of consistency and span-related problematics when adding/moving/deleting rows and columns. */ -void TitleBlockTemplate::rowColsChanged() { +void TitleBlockTemplate::rowColsChanged() +{ applyRowColNums(); applyCellSpans(); } @@ -2041,9 +2082,9 @@ void TitleBlockTemplate::rowColsChanged() { @param lengths_list : @return the width between two borders */ -int TitleBlockTemplate::lengthRange(int start, - int end, - const QList &lengths_list) const { +int TitleBlockTemplate::lengthRange( + int start, int end, const QList &lengths_list) const +{ if (start > end || start >= lengths_list.count() || end > lengths_list.count()) { diff --git a/sources/titleblocktemplate.h b/sources/titleblocktemplate.h index 2ecc78889..d68a26fcf 100644 --- a/sources/titleblocktemplate.h +++ b/sources/titleblocktemplate.h @@ -85,14 +85,15 @@ class TitleBlockTemplate : public QObject { QList createColumn(); TitleBlockCell *cell(int, int) const; - QSet spannedCells(const TitleBlockCell *, - bool = false) const; + QSet spannedCells( + const TitleBlockCell *, bool = false) const; QHash > getAllSpans() const; void setAllSpans(const QHash > &); - bool addLogo(const QString &, - QByteArray *, - const QString & = "svg", - const QString & = "xml"); + bool addLogo( + const QString &, + QByteArray *, + const QString & = "svg", + const QString & = "xml"); bool addLogoFromFile(const QString &, const QString & = QString()); bool saveLogoToFile(const QString &, const QString &); bool removeLogo(const QString &); @@ -104,11 +105,12 @@ class TitleBlockTemplate : public QObject { QPixmap bitmapLogo(const QString &) const; void render(QPainter &, const DiagramContext &, int) const; - void renderDxf(QRectF &, - const DiagramContext &, - int, - QString &, - int) const; + void renderDxf( + QRectF &, + const DiagramContext &, + int, + QString &, + int) const; void renderCell(QPainter &, const TitleBlockCell &, const DiagramContext &, @@ -144,22 +146,26 @@ class TitleBlockTemplate : public QObject { void flushCells(); void initCells(); int lengthRange(int, int, const QList &) const; - QString finalTextForCell(const TitleBlockCell &, - const DiagramContext &) const; - QString interpreteVariables(const QString &, - const DiagramContext &) const; - void renderTextCell(QPainter &, - const QString &, - const TitleBlockCell &, - const QRectF &) const; - void renderTextCellDxf(QString &, - const QString &, - const TitleBlockCell &, - qreal, - qreal, - qreal, - qreal, - int) const; + QString finalTextForCell( + const TitleBlockCell &, + const DiagramContext &) const; + QString interpreteVariables( + const QString &, + const DiagramContext &) const; + void renderTextCell( + QPainter &, + const QString &, + const TitleBlockCell &, + const QRectF &) const; + void renderTextCellDxf( + QString &, + const QString &, + const TitleBlockCell &, + qreal, + qreal, + qreal, + qreal, + int) const; // attributes private: diff --git a/sources/titleblocktemplaterenderer.cpp b/sources/titleblocktemplaterenderer.cpp index e1ab13d51..fa11fa4d3 100644 --- a/sources/titleblocktemplaterenderer.cpp +++ b/sources/titleblocktemplaterenderer.cpp @@ -18,14 +18,16 @@ TitleBlockTemplateRenderer::TitleBlockTemplateRenderer(QObject *parent) : @brief TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer Destructor */ -TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer() { +TitleBlockTemplateRenderer::~TitleBlockTemplateRenderer() +{ } /** @brief TitleBlockTemplateRenderer::titleBlockTemplate @return the titleblock template used for the rendering */ -const TitleBlockTemplate *TitleBlockTemplateRenderer::titleBlockTemplate() const { +const TitleBlockTemplate *TitleBlockTemplateRenderer::titleBlockTemplate() const +{ return(m_titleblock_template); } @@ -54,7 +56,8 @@ void TitleBlockTemplateRenderer::setContext(const DiagramContext &context) { @brief TitleBlockTemplateRenderer::context @return the current diagram context use when render the titleblock */ -DiagramContext TitleBlockTemplateRenderer::context() const { +DiagramContext TitleBlockTemplateRenderer::context() const +{ return m_context; } @@ -65,7 +68,8 @@ DiagramContext TitleBlockTemplateRenderer::context() const { set for this renderer. @see TitleBlockTemplate::height() */ -int TitleBlockTemplateRenderer::height() const { +int TitleBlockTemplateRenderer::height() const +{ if (!m_titleblock_template) return(-1); return(m_titleblock_template -> height()); } @@ -137,7 +141,8 @@ void TitleBlockTemplateRenderer::renderToQPicture(int titleblock_width) { Invalidates the previous rendering of the template by resetting the internal QPicture. */ -void TitleBlockTemplateRenderer::invalidateRenderedTemplate() { +void TitleBlockTemplateRenderer::invalidateRenderedTemplate() +{ m_rendered_template = QPicture(); } @@ -155,7 +160,8 @@ void TitleBlockTemplateRenderer::setUseCache(bool use_cache) { @return true if this renderer uses its QPicture-based cache, false otherwise. */ -bool TitleBlockTemplateRenderer::useCache() const { +bool TitleBlockTemplateRenderer::useCache() const +{ return(m_use_cache); } diff --git a/sources/ui/aboutqetdialog.h b/sources/ui/aboutqetdialog.h index efefb9759..78c337441 100644 --- a/sources/ui/aboutqetdialog.h +++ b/sources/ui/aboutqetdialog.h @@ -47,10 +47,11 @@ class AboutQETDialog : public QDialog void setLibraries(); void setLicence(); void setLoginfo(); - void addAuthor(QLabel *label, - const QString &name, - const QString &email, - const QString &work); + void addAuthor( + QLabel *label, + const QString &name, + const QString &email, + const QString &work); void addLibrary(QLabel *label, const QString &name, const QString &link); diff --git a/sources/ui/borderpropertieswidget.cpp b/sources/ui/borderpropertieswidget.cpp index 46f27b943..5479d3254 100644 --- a/sources/ui/borderpropertieswidget.cpp +++ b/sources/ui/borderpropertieswidget.cpp @@ -47,7 +47,8 @@ BorderPropertiesWidget::~BorderPropertiesWidget() Set the current properties to edit @param bp properties to edit */ -void BorderPropertiesWidget::setProperties(const BorderProperties &bp) { +void BorderPropertiesWidget::setProperties(const BorderProperties &bp) +{ m_properties = bp; ui -> m_colums_count_sp ->setValue (m_properties.columns_count); ui -> m_columns_width_sp ->setValue (m_properties.columns_width); @@ -61,7 +62,8 @@ void BorderPropertiesWidget::setProperties(const BorderProperties &bp) { @brief BorderPropertiesWidget::properties @return the edited border properties */ -const BorderProperties &BorderPropertiesWidget::properties () { +const BorderProperties &BorderPropertiesWidget::properties () +{ m_properties.columns_count = ui -> m_colums_count_sp -> value(); m_properties.columns_width = ui -> m_columns_width_sp -> value(); m_properties.display_columns = ui -> m_display_columns_cb -> isChecked(); @@ -76,6 +78,7 @@ const BorderProperties &BorderPropertiesWidget::properties () { Enable or disable this widget @param ro true-disable / false-enable */ -void BorderPropertiesWidget::setReadOnly(const bool &ro) { +void BorderPropertiesWidget::setReadOnly(const bool &ro) +{ ui->border_gb->setDisabled(ro); } diff --git a/sources/ui/compositetexteditdialog.cpp b/sources/ui/compositetexteditdialog.cpp index 69d2e1600..2332ddbe9 100644 --- a/sources/ui/compositetexteditdialog.cpp +++ b/sources/ui/compositetexteditdialog.cpp @@ -30,7 +30,8 @@ CompositeTextEditDialog::CompositeTextEditDialog(QString text, QWidget *parent) setUpComboBox(); } -CompositeTextEditDialog::~CompositeTextEditDialog() { +CompositeTextEditDialog::~CompositeTextEditDialog() +{ delete ui; } @@ -38,7 +39,8 @@ CompositeTextEditDialog::~CompositeTextEditDialog() { @brief CompositeTextEditDialog::plainText @return The edited text */ -QString CompositeTextEditDialog::plainText() const { +QString CompositeTextEditDialog::plainText() const +{ return ui->m_plain_text_edit->toPlainText(); } diff --git a/sources/ui/conductorpropertiesdialog.cpp b/sources/ui/conductorpropertiesdialog.cpp index cbc7e0ac2..1f09f111e 100644 --- a/sources/ui/conductorpropertiesdialog.cpp +++ b/sources/ui/conductorpropertiesdialog.cpp @@ -29,8 +29,8 @@ @param conductor : conductor to edit propertie @param parent : parent widget */ -ConductorPropertiesDialog::ConductorPropertiesDialog(Conductor *conductor, - QWidget *parent) : +ConductorPropertiesDialog::ConductorPropertiesDialog( + Conductor *conductor, QWidget *parent) : QDialog(parent), ui(new Ui::ConductorPropertiesDialog) { @@ -92,7 +92,8 @@ void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, @brief ConductorPropertiesDialog::properties @return the edited properties */ -ConductorProperties ConductorPropertiesDialog::properties() const { +ConductorProperties ConductorPropertiesDialog::properties() const +{ return m_cpw -> properties(); } @@ -102,6 +103,7 @@ ConductorProperties ConductorPropertiesDialog::properties() const { true -> must apply the propertie to all conductor at the same potential false -> must apply properties only for the edited conductor */ -bool ConductorPropertiesDialog::applyAll() const { +bool ConductorPropertiesDialog::applyAll() const +{ return ui -> m_apply_all_cb -> isChecked(); } diff --git a/sources/ui/conductorpropertiesdialog.h b/sources/ui/conductorpropertiesdialog.h index c046e37a7..248fa5e6f 100644 --- a/sources/ui/conductorpropertiesdialog.h +++ b/sources/ui/conductorpropertiesdialog.h @@ -34,10 +34,10 @@ class ConductorPropertiesDialog : public QDialog Q_OBJECT public: - explicit ConductorPropertiesDialog (Conductor *conductor, - QWidget *parent = nullptr); - static void PropertiesDialog (Conductor *conductor, - QWidget *parent = nullptr); + explicit ConductorPropertiesDialog ( + Conductor *conductor, QWidget *parent = nullptr); + static void PropertiesDialog ( + Conductor *conductor, QWidget *parent = nullptr); ~ConductorPropertiesDialog() override; ConductorProperties properties() const; diff --git a/sources/ui/conductorpropertieswidget.cpp b/sources/ui/conductorpropertieswidget.cpp index 1851ec632..e8684d263 100644 --- a/sources/ui/conductorpropertieswidget.cpp +++ b/sources/ui/conductorpropertieswidget.cpp @@ -219,7 +219,8 @@ QPushButton *ConductorPropertiesWidget::editAutonumPushButton() const /** @brief ConductorPropertiesWidget::initWidget */ -void ConductorPropertiesWidget::initWidget() { +void ConductorPropertiesWidget::initWidget() +{ m_verti_select = QETApp::createTextOrientationSpinBoxWidget(); ui -> m_text_angle_gl -> addWidget(m_verti_select, 2, 0, Qt::AlignHCenter); m_horiz_select = QETApp::createTextOrientationSpinBoxWidget(); @@ -308,6 +309,7 @@ void ConductorPropertiesWidget::on_m_neutral_cb_toggled(bool checked) { to centralize signal from various widget to edit single ligne properties, for update the preview */ -void ConductorPropertiesWidget::on_m_update_preview_pb_clicked() { +void ConductorPropertiesWidget::on_m_update_preview_pb_clicked() +{ updatePreview(); } diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp index adbd8294e..9b6745bc8 100644 --- a/sources/ui/configpage/generalconfigurationpage.cpp +++ b/sources/ui/configpage/generalconfigurationpage.cpp @@ -234,7 +234,8 @@ void GeneralConfigurationPage::applyConf() @brief GeneralConfigurationPage::title @return The title of this page */ -QString GeneralConfigurationPage::title() const { +QString GeneralConfigurationPage::title() const +{ return(tr("Général", "configuration page title")); } @@ -242,7 +243,8 @@ QString GeneralConfigurationPage::title() const { @brief GeneralConfigurationPage::icon @return The icon of this page */ -QIcon GeneralConfigurationPage::icon() const { +QIcon GeneralConfigurationPage::icon() const +{ return(QET::Icons::Settings); } @@ -252,33 +254,33 @@ QIcon GeneralConfigurationPage::icon() const { */ void GeneralConfigurationPage::fillLang() { - ui->m_lang_cb->addItem(QET::Icons::translation, tr("Système"), "system"); + ui->m_lang_cb->addItem(QET::Icons::translation, tr("Système"), "system"); ui->m_lang_cb->insertSeparator(1); // all lang available on lang directory - ui->m_lang_cb->addItem(QET::Icons::ar, tr("Arabe"), "ar"); - ui->m_lang_cb->addItem(QET::Icons::br, tr("Brézilien"), "pt_br"); - ui->m_lang_cb->addItem(QET::Icons::catalonia, tr("Catalan"), "ca"); - ui->m_lang_cb->addItem(QET::Icons::cs, tr("Tchèque"), "cs"); - ui->m_lang_cb->addItem(QET::Icons::de, tr("Allemand"), "de"); - ui->m_lang_cb->addItem(QET::Icons::da, tr("Danois"), "da"); - ui->m_lang_cb->addItem(QET::Icons::gr, tr("Grec"), "el"); - ui->m_lang_cb->addItem(QET::Icons::en, tr("Anglais"), "en"); - ui->m_lang_cb->addItem(QET::Icons::es, tr("Espagnol"), "es"); - ui->m_lang_cb->addItem(QET::Icons::fr, tr("Français"), "fr"); - ui->m_lang_cb->addItem(QET::Icons::hr, tr("Croate"), "hr"); - ui->m_lang_cb->addItem(QET::Icons::it, tr("Italien"), "it"); - ui->m_lang_cb->addItem(QET::Icons::jp, tr("Japonais"), "ja"); - ui->m_lang_cb->addItem(QET::Icons::pl, tr("Polonais"), "pl"); - ui->m_lang_cb->addItem(QET::Icons::pt, tr("Portugais"), "pt"); - ui->m_lang_cb->addItem(QET::Icons::ro, tr("Roumains"), "ro"); - ui->m_lang_cb->addItem(QET::Icons::ru, tr("Russe"), "ru"); - ui->m_lang_cb->addItem(QET::Icons::sl, tr("Slovène"), "sl"); - ui->m_lang_cb->addItem(QET::Icons::nl, tr("Pays-Bas"), "nl"); - ui->m_lang_cb->addItem(QET::Icons::no, tr("Norvege"), "nb"); - ui->m_lang_cb->addItem(QET::Icons::be, tr("Belgique-Flemish"), "be"); - ui->m_lang_cb->addItem(QET::Icons::tr, tr("Turc"), "tr"); - ui->m_lang_cb->addItem(QET::Icons::hu, tr("Hongrois"), "hu"); + ui->m_lang_cb->addItem(QET::Icons::ar, tr("Arabe"), "ar"); + ui->m_lang_cb->addItem(QET::Icons::br, tr("Brézilien"), "pt_br"); + ui->m_lang_cb->addItem(QET::Icons::catalonia, tr("Catalan"), "ca"); + ui->m_lang_cb->addItem(QET::Icons::cs, tr("Tchèque"), "cs"); + ui->m_lang_cb->addItem(QET::Icons::de, tr("Allemand"), "de"); + ui->m_lang_cb->addItem(QET::Icons::da, tr("Danois"), "da"); + ui->m_lang_cb->addItem(QET::Icons::gr, tr("Grec"), "el"); + ui->m_lang_cb->addItem(QET::Icons::en, tr("Anglais"), "en"); + ui->m_lang_cb->addItem(QET::Icons::es, tr("Espagnol"), "es"); + ui->m_lang_cb->addItem(QET::Icons::fr, tr("Français"), "fr"); + ui->m_lang_cb->addItem(QET::Icons::hr, tr("Croate"), "hr"); + ui->m_lang_cb->addItem(QET::Icons::it, tr("Italien"), "it"); + ui->m_lang_cb->addItem(QET::Icons::jp, tr("Japonais"), "ja"); + ui->m_lang_cb->addItem(QET::Icons::pl, tr("Polonais"), "pl"); + ui->m_lang_cb->addItem(QET::Icons::pt, tr("Portugais"), "pt"); + ui->m_lang_cb->addItem(QET::Icons::ro, tr("Roumains"), "ro"); + ui->m_lang_cb->addItem(QET::Icons::ru, tr("Russe"), "ru"); + ui->m_lang_cb->addItem(QET::Icons::sl, tr("Slovène"), "sl"); + ui->m_lang_cb->addItem(QET::Icons::nl, tr("Pays-Bas"), "nl"); + ui->m_lang_cb->addItem(QET::Icons::no, tr("Norvege"), "nb"); + ui->m_lang_cb->addItem(QET::Icons::be, tr("Belgique-Flemish"), "be"); + ui->m_lang_cb->addItem(QET::Icons::tr, tr("Turc"), "tr"); + ui->m_lang_cb->addItem(QET::Icons::hu, tr("Hongrois"), "hu"); //set current index to the lang found in setting file //if lang doesn't exist set to system diff --git a/sources/ui/configsaveloaderwidget.cpp b/sources/ui/configsaveloaderwidget.cpp index cb9631eb6..098beb7f3 100644 --- a/sources/ui/configsaveloaderwidget.cpp +++ b/sources/ui/configsaveloaderwidget.cpp @@ -30,11 +30,13 @@ ConfigSaveLoaderWidget::~ConfigSaveLoaderWidget() delete ui; } -QString ConfigSaveLoaderWidget::selectedText() const { +QString ConfigSaveLoaderWidget::selectedText() const +{ return ui->m_combo_box->currentText(); } -QString ConfigSaveLoaderWidget::text() const { +QString ConfigSaveLoaderWidget::text() const +{ return ui->m_line_edit->text(); } @@ -42,10 +44,12 @@ void ConfigSaveLoaderWidget::addItem(QString text) { ui->m_combo_box->addItem(text); } -void ConfigSaveLoaderWidget::on_m_load_pb_clicked() { +void ConfigSaveLoaderWidget::on_m_load_pb_clicked() +{ emit loadClicked(); } -void ConfigSaveLoaderWidget::on_m_save_pb_clicked() { +void ConfigSaveLoaderWidget::on_m_save_pb_clicked() +{ emit saveClicked(); } diff --git a/sources/ui/diagrampropertiesdialog.cpp b/sources/ui/diagrampropertiesdialog.cpp index 0b1ab5257..186782eba 100644 --- a/sources/ui/diagrampropertiesdialog.cpp +++ b/sources/ui/diagrampropertiesdialog.cpp @@ -147,7 +147,8 @@ void DiagramPropertiesDialog::editAutonum() @brief DiagramPropertiesDialog::editAutonum Open folio autonum editor */ -void DiagramPropertiesDialog::editAutoFolioNum () { +void DiagramPropertiesDialog::editAutoFolioNum () +{ ProjectPropertiesDialog ppd (m_diagram->project(), this); ppd.setCurrentPage(ProjectPropertiesDialog::Autonum); ppd.changeToFolio(); diff --git a/sources/ui/diagrampropertiesdialog.h b/sources/ui/diagrampropertiesdialog.h index 612bb474c..420b1640e 100644 --- a/sources/ui/diagrampropertiesdialog.h +++ b/sources/ui/diagrampropertiesdialog.h @@ -40,7 +40,7 @@ class DiagramPropertiesDialog : public QDialog { void editAutoFolioNum (); private: - Diagram *m_diagram; + Diagram *m_diagram; ConductorPropertiesWidget *m_cpw; }; diff --git a/sources/ui/diagrampropertieseditordockwidget.cpp b/sources/ui/diagrampropertieseditordockwidget.cpp index aa45faeb8..4c9c9f3e9 100644 --- a/sources/ui/diagrampropertieseditordockwidget.cpp +++ b/sources/ui/diagrampropertieseditordockwidget.cpp @@ -44,15 +44,19 @@ void DiagramPropertiesEditorDockWidget::setDiagram(Diagram *diagram) if (m_diagram) { - disconnect(m_diagram, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); - disconnect(m_diagram, SIGNAL(destroyed()), this, SLOT(diagramWasDeleted())); + disconnect(m_diagram, SIGNAL(selectionChanged()), + this, SLOT(selectionChanged())); + disconnect(m_diagram, SIGNAL(destroyed()), + this, SLOT(diagramWasDeleted())); } if (diagram) { m_diagram = diagram; - connect(m_diagram, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()), Qt::QueuedConnection); - connect(m_diagram, SIGNAL(destroyed()), this, SLOT(diagramWasDeleted())); + connect(m_diagram, SIGNAL(selectionChanged()), + this, SLOT(selectionChanged()), Qt::QueuedConnection); + connect(m_diagram, SIGNAL(destroyed()), + this, SLOT(diagramWasDeleted())); selectionChanged(); } else @@ -74,7 +78,10 @@ void DiagramPropertiesEditorDockWidget::selectionChanged() return; } - auto editor_ = PropertiesEditorFactory::propertiesEditor(m_diagram->selectedItems(), editors().count()? editors().first() : nullptr, this); + auto editor_ = PropertiesEditorFactory::propertiesEditor( + m_diagram->selectedItems(), + editors().count() ? editors().first() : nullptr, + this); if (!editor_) { clear(); return; diff --git a/sources/ui/diagramselection.cpp b/sources/ui/diagramselection.cpp index 42b3a5d15..97d747e42 100644 --- a/sources/ui/diagramselection.cpp +++ b/sources/ui/diagramselection.cpp @@ -33,14 +33,16 @@ diagramselection::diagramselection(QETProject *prj, QWidget *parent) : load_TableDiagram(); } -diagramselection::~diagramselection() { +diagramselection::~diagramselection() +{ delete ui; } /** @brief load all Diagrams of project in table */ -void diagramselection::load_TableDiagram() { +void diagramselection::load_TableDiagram() +{ // Clear all items ui -> tableDiagram -> clear(); for (int i=ui -> tableDiagram -> rowCount()-1; i >= 0; --i) { @@ -84,7 +86,8 @@ void diagramselection::load_TableDiagram() { @brief get list of Diagrams is selected @return this list of Diagrams */ -QList diagramselection::list_of_DiagramSelected() { +QList diagramselection::list_of_DiagramSelected() +{ QList listDiag; for(int i=0; i tableDiagram -> rowCount();i++){ if(ui -> tableDiagram -> item(i, 0)->checkState()){ diff --git a/sources/ui/dialogwaiting.cpp b/sources/ui/dialogwaiting.cpp index 8b00c1333..dc4100e3a 100644 --- a/sources/ui/dialogwaiting.cpp +++ b/sources/ui/dialogwaiting.cpp @@ -38,7 +38,8 @@ DialogWaiting::DialogWaiting(QWidget *parent) : /** @brief DialogWaiting::~DialogWaiting */ -DialogWaiting::~DialogWaiting() { +DialogWaiting::~DialogWaiting() +{ delete ui; } @@ -54,7 +55,8 @@ void DialogWaiting::setProgressBar(int val){ /** @brief DialogWaiting::setProgressReset, clear progressBar and reset */ -void DialogWaiting::setProgressReset(){ +void DialogWaiting::setProgressReset() +{ ui->progressBar->reset(); } diff --git a/sources/ui/dynamicelementtextmodel.h b/sources/ui/dynamicelementtextmodel.h index 4bccc5723..4684c28fd 100644 --- a/sources/ui/dynamicelementtextmodel.h +++ b/sources/ui/dynamicelementtextmodel.h @@ -79,16 +79,18 @@ class DynamicElementTextModel : public QStandardItemModel bool indexIsText(const QModelIndex &index) const; bool indexIsGroup(const QModelIndex &index) const; - 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; + 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; QMimeData *mimeData(const QModelIndexList &indexes) const override; QStringList mimeTypes() const override; @@ -101,12 +103,14 @@ class DynamicElementTextModel : public QStandardItemModel void removeText(DynamicElementTextItem *deti); void addGroup(ElementTextItemGroup *group); void removeGroup(ElementTextItemGroup *group); - void addTextToGroup(DynamicElementTextItem *deti, - ElementTextItemGroup *group); + void addTextToGroup( + DynamicElementTextItem *deti, + ElementTextItemGroup *group); void removeTextFromGroup(DynamicElementTextItem *deti, ElementTextItemGroup *group); - void enableSourceText(DynamicElementTextItem *deti, - DynamicElementTextItem::TextFrom tf ); + void enableSourceText( + DynamicElementTextItem *deti, + DynamicElementTextItem::TextFrom tf ); void enableGroupRotationAndPos(ElementTextItemGroup *group); void itemDataChanged(QStandardItem *qsi); void setConnection(DynamicElementTextItem *deti, bool set); @@ -134,12 +138,14 @@ class DynamicTextItemDelegate : public QStyledItemDelegate public: DynamicTextItemDelegate(QObject *parent = Q_NULLPTR); - QWidget *createEditor(QWidget *parent, - const QStyleOptionViewItem &option, - const QModelIndex &index) const override; - void setModelData(QWidget *editor, - QAbstractItemModel *model, - const QModelIndex &index) const override; + QWidget *createEditor( + QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + void setModelData( + QWidget *editor, + QAbstractItemModel *model, + const QModelIndex &index) const override; protected: bool eventFilter(QObject *object, QEvent *event) override; diff --git a/sources/ui/elementinfopartwidget.cpp b/sources/ui/elementinfopartwidget.cpp index c9b49d0cd..f407c7990 100644 --- a/sources/ui/elementinfopartwidget.cpp +++ b/sources/ui/elementinfopartwidget.cpp @@ -30,9 +30,10 @@ typedef SearchAndReplaceWorker sarw; @param translated_key the string key translated @param parent parent widget */ -ElementInfoPartWidget::ElementInfoPartWidget(QString key, - const QString& translated_key, - QWidget *parent): +ElementInfoPartWidget::ElementInfoPartWidget( + QString key, + const QString& translated_key, + QWidget *parent): QWidget(parent), ui(new Ui::ElementInfoPartWidget), key_(std::move(key)) diff --git a/sources/ui/elementinfopartwidget.h b/sources/ui/elementinfopartwidget.h index a63c27109..aed80c6c3 100644 --- a/sources/ui/elementinfopartwidget.h +++ b/sources/ui/elementinfopartwidget.h @@ -35,12 +35,14 @@ class ElementInfoPartWidget : public QWidget //METHODS public: - explicit ElementInfoPartWidget(QString key, - const QString& translated_key, - QWidget *parent = nullptr); + explicit ElementInfoPartWidget( + QString key, + const QString& translated_key, + QWidget *parent = nullptr); ~ElementInfoPartWidget() override; - QString key () const {return key_;} + QString key () const +{return key_;} QString text () const; void setText (const QString &); void setPlaceHolderText (const QString &text); diff --git a/sources/ui/elementinfowidget.cpp b/sources/ui/elementinfowidget.cpp index e9d3c422a..b2deb78e4 100644 --- a/sources/ui/elementinfowidget.cpp +++ b/sources/ui/elementinfowidget.cpp @@ -254,7 +254,8 @@ DiagramContext ElementInfoWidget::currentInfo() const Slot activated when this widget is show. Set the focus to the first line edit provided by this widget */ -void ElementInfoWidget::firstActivated() { +void ElementInfoWidget::firstActivated() +{ m_eipw_list.first() -> setFocusTolineEdit(); } diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp index d61a84a60..6e42bc1a3 100644 --- a/sources/ui/elementpropertieswidget.cpp +++ b/sources/ui/elementpropertieswidget.cpp @@ -207,7 +207,8 @@ void ElementPropertiesWidget::apply() @brief ElementPropertiesWidget::reset Reset the edited properties */ -void ElementPropertiesWidget::reset() { +void ElementPropertiesWidget::reset() +{ foreach (PropertiesEditorWidget *pew, m_list_editor) pew->reset(); } diff --git a/sources/ui/imagepropertieswidget.cpp b/sources/ui/imagepropertieswidget.cpp index 239e1e1f9..c65d41e96 100644 --- a/sources/ui/imagepropertieswidget.cpp +++ b/sources/ui/imagepropertieswidget.cpp @@ -41,7 +41,8 @@ ImagePropertiesWidget::ImagePropertiesWidget(DiagramImageItem *image, QWidget *p @brief ImagePropertiesWidget::~ImagePropertiesWidget Destructor */ -ImagePropertiesWidget::~ImagePropertiesWidget() { +ImagePropertiesWidget::~ImagePropertiesWidget() +{ delete ui; } @@ -168,6 +169,7 @@ void ImagePropertiesWidget::on_m_scale_slider_valueChanged(int value) @brief ImagePropertiesWidget::on_m_lock_pos_cb_clicked Set movable or not the image according to corresponding check box */ -void ImagePropertiesWidget::on_m_lock_pos_cb_clicked() { +void ImagePropertiesWidget::on_m_lock_pos_cb_clicked() +{ m_image->setMovable(!ui->m_lock_pos_cb->isChecked()); } diff --git a/sources/ui/importelementtextpatterndialog.cpp b/sources/ui/importelementtextpatterndialog.cpp index 95b5049f2..31a44d5a3 100644 --- a/sources/ui/importelementtextpatterndialog.cpp +++ b/sources/ui/importelementtextpatterndialog.cpp @@ -69,6 +69,7 @@ void ImportElementTextPatternDialog::setComboBoxItems(const QStringList &items) ui->m_combo_box->addItems(items); } -QString ImportElementTextPatternDialog::textValue() const { +QString ImportElementTextPatternDialog::textValue() const +{ return ui->m_combo_box->currentText(); } diff --git a/sources/ui/inditextpropertieswidget.cpp b/sources/ui/inditextpropertieswidget.cpp index faab33ad5..fd651cd8b 100644 --- a/sources/ui/inditextpropertieswidget.cpp +++ b/sources/ui/inditextpropertieswidget.cpp @@ -57,7 +57,8 @@ IndiTextPropertiesWidget::IndiTextPropertiesWidget( /** @brief IndiTextPropertiesWidget::~IndiTextPropertiesWidget */ -IndiTextPropertiesWidget::~IndiTextPropertiesWidget() { +IndiTextPropertiesWidget::~IndiTextPropertiesWidget() +{ delete ui; } @@ -421,7 +422,8 @@ void IndiTextPropertiesWidget::updateUi() /** @brief IndiTextPropertiesWidget::on_m_advanced_editor_pb_clicked */ -void IndiTextPropertiesWidget::on_m_advanced_editor_pb_clicked() { +void IndiTextPropertiesWidget::on_m_advanced_editor_pb_clicked() +{ if (m_text) { m_text->edit(); } diff --git a/sources/ui/marginseditdialog.cpp b/sources/ui/marginseditdialog.cpp index ab64241ef..c1726b768 100644 --- a/sources/ui/marginseditdialog.cpp +++ b/sources/ui/marginseditdialog.cpp @@ -36,7 +36,8 @@ MarginsEditDialog::~MarginsEditDialog() delete ui; } -QMargins MarginsEditDialog::margins() const { +QMargins MarginsEditDialog::margins() const +{ return QMargins(ui->m_left_sb->value(), ui->m_top_sb->value(), ui->m_right_sb->value(), @@ -51,9 +52,8 @@ QMargins MarginsEditDialog::margins() const { @return The a margins with the edited value if dialog is accepted or a default constructed QMargins() if dialog is rejected */ -QMargins MarginsEditDialog::getMargins(QMargins margins, - bool *accepted, - QWidget *parent) +QMargins MarginsEditDialog::getMargins( + QMargins margins, bool *accepted, QWidget *parent) { QScopedPointer d( new MarginsEditDialog(margins, parent)); diff --git a/sources/ui/masterpropertieswidget.cpp b/sources/ui/masterpropertieswidget.cpp index fedadc13c..aed09dd9c 100644 --- a/sources/ui/masterpropertieswidget.cpp +++ b/sources/ui/masterpropertieswidget.cpp @@ -169,7 +169,8 @@ void MasterPropertiesWidget::setElement(Element *element) Return true if link change, else false @note is void no Return ??? */ -void MasterPropertiesWidget::apply() { +void MasterPropertiesWidget::apply() +{ if (QUndoCommand *undo = associatedUndo()) m_element -> diagram() -> undoStack().push(undo); } @@ -409,7 +410,8 @@ void MasterPropertiesWidget::showElementFromTWI(QTreeWidgetItem *qtwi, int colum @brief MasterPropertiesWidget::showedElementWasDeleted Set to nullptr the current showed element when he was deleted */ -void MasterPropertiesWidget::showedElementWasDeleted() { +void MasterPropertiesWidget::showedElementWasDeleted() +{ m_showed_element = nullptr; } diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index fd9fa7c45..716d8f236 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -32,7 +32,7 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *p ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project); m_properties_dialog = new ConfigDialog (parent); m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title")); - m_properties_dialog -> addPage(new ProjectMainConfigPage (project)); + m_properties_dialog -> addPage(new ProjectMainConfigPage(project)); m_properties_dialog -> addPage(newDiagramPage); m_properties_dialog -> addPage(projectAutoNumConfigPage); connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString))); @@ -44,7 +44,8 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *p /** @brief ProjectPropertiesDialog::~ProjectPropertiesDialog */ -ProjectPropertiesDialog::~ProjectPropertiesDialog () { +ProjectPropertiesDialog::~ProjectPropertiesDialog () +{ delete m_properties_dialog; } @@ -52,7 +53,8 @@ ProjectPropertiesDialog::~ProjectPropertiesDialog () { @brief ProjectPropertiesDialog::exec execute this dialog. */ -void ProjectPropertiesDialog::exec() { +void ProjectPropertiesDialog::exec() +{ m_properties_dialog->setWindowModality(Qt::WindowModal); m_properties_dialog -> exec(); } @@ -70,7 +72,8 @@ void ProjectPropertiesDialog::setCurrentPage(ProjectPropertiesDialog::Page p) { @brief ProjectPropertiesDialog::changeToFolio Change the current displayed tab to folio tab. */ -void ProjectPropertiesDialog::changeToFolio() { +void ProjectPropertiesDialog::changeToFolio() +{ ProjectAutoNumConfigPage *autoNumPage = static_cast ( m_properties_dialog->pages.at(2)); diff --git a/sources/ui/reportpropertiewidget.cpp b/sources/ui/reportpropertiewidget.cpp index 4491827c1..8c46541d9 100644 --- a/sources/ui/reportpropertiewidget.cpp +++ b/sources/ui/reportpropertiewidget.cpp @@ -39,6 +39,7 @@ void ReportPropertieWidget::setReportProperties(const QString& label) { ui->line_edit->setText(label); } -QString ReportPropertieWidget::ReportProperties() const { +QString ReportPropertieWidget::ReportProperties() const +{ return ui->line_edit->text(); } diff --git a/sources/ui/shapegraphicsitempropertieswidget.cpp b/sources/ui/shapegraphicsitempropertieswidget.cpp index 51fec738d..6a0519f33 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.cpp +++ b/sources/ui/shapegraphicsitempropertieswidget.cpp @@ -154,7 +154,8 @@ void ShapeGraphicsItemPropertiesWidget::apply() @brief ShapeGraphicsItemPropertiesWidget::reset Reset the change */ -void ShapeGraphicsItemPropertiesWidget::reset() { +void ShapeGraphicsItemPropertiesWidget::reset() +{ updateUi(); } diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index d5765423f..21c5fb1cf 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -167,7 +167,8 @@ void TitleBlockPropertiesWidget::setProperties( @brief TitleBlockPropertiesWidget::properties @return the edited properties */ -TitleBlockProperties TitleBlockPropertiesWidget::properties() const { +TitleBlockProperties TitleBlockPropertiesWidget::properties() const +{ TitleBlockProperties prop; prop.title = ui -> m_title_le -> text(); prop.author = ui -> m_author_le -> text(); @@ -209,7 +210,8 @@ TitleBlockProperties TitleBlockPropertiesWidget::properties() const { @return return properties to enable folio autonum */ TitleBlockProperties TitleBlockPropertiesWidget::propertiesAutoNum( - QString autoNum) const { + QString autoNum) const +{ TitleBlockProperties prop; prop.title = ui -> m_title_le -> text(); prop.author = ui -> m_author_le -> text(); @@ -265,7 +267,8 @@ TitleBlockTemplateLocation TitleBlockPropertiesWidget::currentTitleBlockLocation if true, title block template combo box and menu button is visible */ void TitleBlockPropertiesWidget::setTitleBlockTemplatesVisible( - const bool &visible) { + const bool &visible) +{ ui -> m_tbt_label -> setVisible(visible); ui -> m_tbt_cb -> setVisible(visible); ui -> m_tbt_pb -> setVisible(visible); @@ -283,7 +286,8 @@ void TitleBlockPropertiesWidget::setReadOnly(const bool &ro) { @brief TitleBlockPropertiesWidget::currentTitleBlockTemplateName @return the current title block name */ -QString TitleBlockPropertiesWidget::currentTitleBlockTemplateName() const { +QString TitleBlockPropertiesWidget::currentTitleBlockTemplateName() const +{ int index = ui -> m_tbt_cb -> currentIndex(); if(index != -1) return (ui -> m_tbt_cb -> itemData(index).toString()); @@ -298,7 +302,8 @@ QString TitleBlockPropertiesWidget::currentTitleBlockTemplateName() const { void TitleBlockPropertiesWidget::addCollection( TitleBlockTemplatesCollection *tbt_collection) { - if (!tbt_collection || m_tbt_collection_list.contains(tbt_collection)) return; + if (!tbt_collection || m_tbt_collection_list.contains(tbt_collection)) + return; m_tbt_collection_list << tbt_collection; } @@ -308,8 +313,9 @@ void TitleBlockPropertiesWidget::addCollection( @param current_date : true for display current date radio button @param project */ -void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date, - QETProject *project) { +void TitleBlockPropertiesWidget::initDialog( + const bool ¤t_date,QETProject *project) +{ m_dcw = new DiagramContextWidget(); ui -> m_tab2_vlayout -> addWidget(m_dcw); @@ -374,11 +380,13 @@ int TitleBlockPropertiesWidget::getIndexFor( return -1; } -void TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate() { +void TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate() +{ QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), false); } -void TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate() { +void TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate() +{ QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), true); } @@ -455,7 +463,8 @@ void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index) @brief TitleBlockPropertiesWidget::on_m_date_now_pb_clicked Set the date to current date */ -void TitleBlockPropertiesWidget::on_m_date_now_pb_clicked() { +void TitleBlockPropertiesWidget::on_m_date_now_pb_clicked() +{ ui -> m_date_edit -> setDate(QDate::currentDate()); } @@ -463,7 +472,8 @@ void TitleBlockPropertiesWidget::on_m_date_now_pb_clicked() { @brief TitleBlockPropertiesWidget::on_m_edit_autofolionum_pb_clicked Open Auto Folio Num dialog */ -void TitleBlockPropertiesWidget::on_m_edit_autofolionum_pb_clicked() { +void TitleBlockPropertiesWidget::on_m_edit_autofolionum_pb_clicked() +{ emit openAutoNumFolioEditor(ui->auto_page_cb->currentText()); if (ui->auto_page_cb->currentText()!=tr("Créer un Folio Numérotation Auto")) { diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index 65ad18082..c14b75a1c 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -69,7 +69,8 @@ void XRefPropertiesWidget::setProperties(const QHash XRefPropertiesWidget::properties(){ +QHash XRefPropertiesWidget::properties() +{ saveProperties(ui->m_type_cb->currentIndex()); return m_properties; } @@ -150,7 +151,8 @@ void XRefPropertiesWidget::saveProperties(int index) { @brief XRefPropertiesWidget::updateDisplay Update display with the curent displayed type. */ -void XRefPropertiesWidget::updateDisplay() { +void XRefPropertiesWidget::updateDisplay() +{ QString type = ui->m_type_cb->itemData(ui->m_type_cb->currentIndex()).toString(); XRefProperties xrp = m_properties[type]; @@ -197,7 +199,8 @@ void XRefPropertiesWidget::updateDisplay() { manage the save of the current properties, when the combo box of type change. */ -void XRefPropertiesWidget::typeChanged() { +void XRefPropertiesWidget::typeChanged() +{ //save the properties of the previous xref type saveProperties(m_previous_type_index); //update display with the current xref type diff --git a/sources/undocommand/changeelementinformationcommand.cpp b/sources/undocommand/changeelementinformationcommand.cpp index 4971e6d33..1bfd32cd3 100644 --- a/sources/undocommand/changeelementinformationcommand.cpp +++ b/sources/undocommand/changeelementinformationcommand.cpp @@ -55,7 +55,8 @@ bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other) /** @brief ChangeElementInformationCommand::undo */ -void ChangeElementInformationCommand::undo() { +void ChangeElementInformationCommand::undo() +{ m_element -> setElementInformations(m_old_info); updateProjectDB(); } @@ -63,7 +64,8 @@ void ChangeElementInformationCommand::undo() { /** @brief ChangeElementInformationCommand::redo */ -void ChangeElementInformationCommand::redo() { +void ChangeElementInformationCommand::redo() +{ m_element -> setElementInformations(m_new_info); updateProjectDB(); } diff --git a/sources/undocommand/changeelementinformationcommand.h b/sources/undocommand/changeelementinformationcommand.h index d70dc8afb..968a626b5 100644 --- a/sources/undocommand/changeelementinformationcommand.h +++ b/sources/undocommand/changeelementinformationcommand.h @@ -46,8 +46,7 @@ class ChangeElementInformationCommand : public QUndoCommand private: Element *m_element; - DiagramContext m_old_info, - m_new_info; + DiagramContext m_old_info, m_new_info; }; #endif // CHANGEELEMENTINFORMATIONCOMMAND_H diff --git a/sources/undocommand/changetitleblockcommand.cpp b/sources/undocommand/changetitleblockcommand.cpp index 5ea323484..fac92c5c1 100644 --- a/sources/undocommand/changetitleblockcommand.cpp +++ b/sources/undocommand/changetitleblockcommand.cpp @@ -38,7 +38,8 @@ ChangeTitleBlockCommand::ChangeTitleBlockCommand( new_titleblock(new_ip) {} -ChangeTitleBlockCommand::~ChangeTitleBlockCommand() {} +ChangeTitleBlockCommand::~ChangeTitleBlockCommand() +{} void ChangeTitleBlockCommand::undo() { diff --git a/sources/undocommand/deleteqgraphicsitemcommand.cpp b/sources/undocommand/deleteqgraphicsitemcommand.cpp index 62a495320..a5381ce64 100644 --- a/sources/undocommand/deleteqgraphicsitemcommand.cpp +++ b/sources/undocommand/deleteqgraphicsitemcommand.cpp @@ -109,7 +109,8 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand( m_diagram->qgiManager().manage(m_removed_contents.items(DiagramContent::All)); } -DeleteQGraphicsItemCommand::~DeleteQGraphicsItemCommand() { +DeleteQGraphicsItemCommand::~DeleteQGraphicsItemCommand() +{ m_diagram->qgiManager().release(m_removed_contents.items(DiagramContent::All)); } diff --git a/sources/undocommand/itemmodelcommand.cpp b/sources/undocommand/itemmodelcommand.cpp index 7446d6a9e..31b6d550b 100644 --- a/sources/undocommand/itemmodelcommand.cpp +++ b/sources/undocommand/itemmodelcommand.cpp @@ -50,7 +50,8 @@ void ModelIndexCommand::setData(const QVariant &value, int role) @brief ModelIndexCommand::redo Reimplemented from QUndoCommand */ -void ModelIndexCommand::redo() { +void ModelIndexCommand::redo() +{ if (m_model && m_index.isValid()) { m_model->setData(m_index, m_new_value, m_role); } @@ -60,7 +61,8 @@ void ModelIndexCommand::redo() { @brief ModelIndexCommand::undo Reimplemented from QUndoCommand */ -void ModelIndexCommand::undo() { +void ModelIndexCommand::undo() +{ if (m_model && m_index.isValid()) { m_model->setData(m_index, m_old_value, m_role); } diff --git a/sources/undocommand/linkelementcommand.cpp b/sources/undocommand/linkelementcommand.cpp index 3e2ec5f0c..8b361fc88 100644 --- a/sources/undocommand/linkelementcommand.cpp +++ b/sources/undocommand/linkelementcommand.cpp @@ -163,7 +163,8 @@ void LinkElementCommand::unlink(QList element_list) @brief LinkElementCommand::unlinkAll Unlink all element of the edited element */ -void LinkElementCommand::unlinkAll() { +void LinkElementCommand::unlinkAll() +{ m_linked_after.clear(); } @@ -230,11 +231,11 @@ void LinkElementCommand::redo() @param element_list @param already_link */ -void LinkElementCommand::setUpNewLink(const QList &element_list, - bool already_link) +void LinkElementCommand::setUpNewLink( + const QList &element_list, bool already_link) { - //m_element is a master we can connect several element to it - //if m_element isn't master (may be a report or slave) we can connect only one element + //m_element is a master we can connect several element to it + //if m_element isn't master (may be a report or slave) we can connect only one element if (m_element->linkType() == Element::Master || element_list.size() == 1) { foreach(Element *elmt, element_list)