mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Compare commits
4 Commits
XMLPropert
...
Fix_compil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cecacfc769 | ||
|
|
8c9b30acd6 | ||
|
|
6aa6d055ec | ||
|
|
495d9a5f51 |
@@ -3,5 +3,7 @@
|
||||
<name lang="fr">11- Schémas et plans d'installation, architecturaux et topographiques</name>
|
||||
<name lang="es">11- Dibujos y planos arquitectónicos y topográficos</name>
|
||||
<name lang="da">11- Bygningsmæssige og topografiske installationstegninger og -skemaer</name>
|
||||
<name lang="en">11- Installation, architectural and topographical diagrams and plans</name>
|
||||
<name lang="be">11- Installatie, bouwkundig en topografische schema's en plannen</name>
|
||||
</names>
|
||||
</qet-directory>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
- 17 columns of 60.0 px wide by 20.0px high
|
||||
- 8 lines of 80.0 px high by 20.0px wide
|
||||
|
||||
Initialise un objet BorderProperties avec les proprietes par
|
||||
\~French Initialise un objet BorderProperties avec les proprietes par
|
||||
defaut suivantes :
|
||||
- 17 colonnes affichees de 60.0 px de large pour 20.0px de haut
|
||||
- 8 lignes affichees de 80.0 px de haut pour 20.0px de large
|
||||
@@ -53,12 +53,11 @@ BorderProperties::~BorderProperties() {
|
||||
|
||||
/**
|
||||
@brief BorderProperties::operator ==
|
||||
@param bp :
|
||||
- other BorderProperties container/class
|
||||
- autre conteneur BorderProperties
|
||||
@return
|
||||
- true if it and this container are identical, false otherwise
|
||||
- true si ip et ce conteneur sont identiques, false sinon
|
||||
|
||||
\~ @param bp : Other BorderProperties container/class.
|
||||
\~French Autre conteneur BorderProperties
|
||||
\~ @return True if it and this container are identical, false otherwise.
|
||||
\~French True si ip et ce conteneur sont identiques, false sinon
|
||||
*/
|
||||
bool BorderProperties::operator==(const BorderProperties &bp) {
|
||||
return(
|
||||
@@ -75,12 +74,13 @@ bool BorderProperties::operator==(const BorderProperties &bp) {
|
||||
|
||||
/**
|
||||
@brief BorderProperties::operator !=
|
||||
@param bp :
|
||||
- other BorderProperties container/class
|
||||
- autre conteneur BorderProperties
|
||||
@return
|
||||
- false if it and this container are identical, true otherwise
|
||||
- false si bp et ce conteneur sont identiques, true sinon
|
||||
|
||||
\~ @param bp :
|
||||
Other BorderProperties container/class.
|
||||
\~French Autre conteneur BorderProperties
|
||||
\~ @return
|
||||
False if it and this container are identical, true otherwise.
|
||||
\~French False si bp et ce conteneur sont identiques, true sinon
|
||||
*/
|
||||
bool BorderProperties::operator!=(const BorderProperties &bp) {
|
||||
return(!(*this == bp));
|
||||
@@ -88,11 +88,12 @@ bool BorderProperties::operator!=(const BorderProperties &bp) {
|
||||
|
||||
/**
|
||||
@brief BorderProperties::toXml
|
||||
- Exports dimensions as XML attributes added to element e.
|
||||
- Exporte les dimensions sous formes d'attributs XML ajoutes a l'element e.
|
||||
@param e :
|
||||
- XML element to which attributes will be added
|
||||
- Element XML auquel seront ajoutes des attributs
|
||||
Exports dimensions as XML attributes added to element e.
|
||||
\~French Exporte les dimensions sous formes d'attributs XML ajoutes a l'element e.
|
||||
|
||||
\~ @param e :
|
||||
XML element to which attributes will be added
|
||||
\~French Element XML auquel seront ajoutes des attributs
|
||||
*/
|
||||
void BorderProperties::toXml(QDomElement &e) const {
|
||||
e.setAttribute("cols", columns_count);
|
||||
@@ -105,11 +106,12 @@ void BorderProperties::toXml(QDomElement &e) const {
|
||||
|
||||
/**
|
||||
@brief BorderProperties::fromXml
|
||||
- Import dimensions from XML attributes of element e
|
||||
- Importe les dimensions a partir des attributs XML de l'element e
|
||||
@param e :
|
||||
- XML element whose attributes will be read
|
||||
- Element XML dont les attributs seront lus
|
||||
Import dimensions from XML attributes of element e
|
||||
\~French Importe les dimensions a partir des attributs XML de l'element e
|
||||
|
||||
\~ @param e :
|
||||
XML element whose attributes will be read
|
||||
\~French Element XML dont les attributs seront lus
|
||||
*/
|
||||
void BorderProperties::fromXml(QDomElement &e) {
|
||||
if (e.hasAttribute("cols")) columns_count = e.attribute("cols").toInt();
|
||||
@@ -122,14 +124,15 @@ void BorderProperties::fromXml(QDomElement &e) {
|
||||
|
||||
/**
|
||||
@brief BorderProperties::toSettings
|
||||
- Export dimensions in a QSettings object.
|
||||
- Exporte les dimensions dans une configuration.
|
||||
@param settings :
|
||||
- QSettings object to write
|
||||
- Parametres a ecrire
|
||||
@param prefix :
|
||||
- prefix to be added before the names of the parameters
|
||||
- prefixe a ajouter devant les noms des parametres
|
||||
Export dimensions in a QSettings object.
|
||||
\~French Exporte les dimensions dans une configuration.
|
||||
|
||||
\~ @param settings :
|
||||
QSettings object to write
|
||||
\~French Parametres a ecrire
|
||||
\~ @param prefix :
|
||||
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 {
|
||||
settings.setValue(prefix + "cols", columns_count);
|
||||
@@ -142,14 +145,12 @@ void BorderProperties::toSettings(QSettings &settings, const QString &prefix) co
|
||||
|
||||
/**
|
||||
@brief BorderProperties::fromSettings
|
||||
- Import dimensions from a QSettings object.
|
||||
- Importe les dimensions depuis une configuration.
|
||||
@param settings :
|
||||
- QSettings object to read
|
||||
- Parametres a lire
|
||||
@param prefix :
|
||||
- prefix to be added before the names of the parameters
|
||||
- prefixe a ajouter devant les noms des parametres
|
||||
Import dimensions from a QSettings object.
|
||||
\~French Importe les dimensions depuis une configuration.
|
||||
\~ @param settings : QSettings object to read
|
||||
\~French Parametres a lire
|
||||
\~ @param prefix : prefix to be added before the names of the parameters
|
||||
\~French prefixe a ajouter devant les noms des parametres
|
||||
*/
|
||||
void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) {
|
||||
columns_count = settings.value(prefix + "cols", columns_count).toInt();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,7 @@ class DiagramPosition;
|
||||
class TitleBlockTemplate;
|
||||
class TitleBlockTemplateRenderer;
|
||||
/**
|
||||
@brief The BorderTitleBlock class
|
||||
This class represents the border and the titleblock which frame a
|
||||
particular electric diagram.
|
||||
*/
|
||||
@@ -50,30 +51,43 @@ class BorderTitleBlock : public QObject
|
||||
|
||||
//METHODS TO GET DIMENSION
|
||||
//COLUMNS
|
||||
/// @return the number of columns
|
||||
/// @return the number of columns
|
||||
int columnsCount() const { return(columns_count_); }
|
||||
/// @return the columns width, in pixels
|
||||
/// @return the columns width, in pixels
|
||||
qreal columnsWidth() const { return(columns_width_); }
|
||||
/// @return the total width of all columns, headers excluded
|
||||
qreal columnsTotalWidth() const { return(columns_count_ * columns_width_); }
|
||||
/// @return the column headers height, in pixels
|
||||
qreal columnsHeaderHeight() const { return(columns_header_height_); }
|
||||
/// @return the total width of all columns, headers excluded
|
||||
qreal columnsTotalWidth() const {
|
||||
return(columns_count_ * columns_width_); }
|
||||
/// @return the column headers height, in pixels
|
||||
qreal columnsHeaderHeight() const {
|
||||
return(columns_header_height_); }
|
||||
|
||||
//ROWS
|
||||
/// @return the number of rows
|
||||
/// @return the number of rows
|
||||
int rowsCount() const { return(rows_count_); }
|
||||
/// @return the rows height, in pixels
|
||||
/// @return the rows height, in pixels
|
||||
qreal rowsHeight() const { return(rows_height_); }
|
||||
/// @return the total height of all rows, headers excluded
|
||||
qreal rowsTotalHeight() const { return(rows_count_ * rows_height_); }
|
||||
/// @return la rows header width, in pixels
|
||||
/// @return the total height of all rows, headers excluded
|
||||
qreal rowsTotalHeight() const {
|
||||
return(rows_count_ * rows_height_); }
|
||||
/// @return la rows header width, in pixels
|
||||
qreal rowsHeaderWidth() const { return(rows_header_width_); }
|
||||
|
||||
// border - title block = diagram
|
||||
/// @return the diagram width, i.e. the width of the border without title block
|
||||
qreal diagramWidth() const { return(columnsTotalWidth() + rowsHeaderWidth()); }
|
||||
/// @return the diagram height, i.e. the height of the border without title block
|
||||
qreal diagramHeight() const { return(rowsTotalHeight() + columnsHeaderHeight()); }
|
||||
/**
|
||||
@brief diagramWidth
|
||||
@return the diagram width,
|
||||
i.e. the width of the border without title block
|
||||
*/
|
||||
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 {
|
||||
return(rowsTotalHeight() + columnsHeaderHeight()); }
|
||||
|
||||
QRectF titleBlockRect () const;
|
||||
|
||||
@@ -88,45 +102,49 @@ class BorderTitleBlock : public QObject
|
||||
QRectF outsideBorderRect() const;
|
||||
QRectF insideBorderRect() const;
|
||||
|
||||
// methods to get title block basic data
|
||||
/// @return the value of the title block "Author" field
|
||||
// methods to get title block basic data
|
||||
/// @return the value of the title block "Author" field
|
||||
QString author() const { return(btb_author_); }
|
||||
/// @return the value of the title block "Date" field
|
||||
/// @return the value of the title block "Date" field
|
||||
QDate date() const { return(btb_date_); }
|
||||
/// @return the value of the title block "Title" field
|
||||
/// @return the value of the title block "Title" field
|
||||
QString title() const { return(btb_title_); }
|
||||
/// @return the value of the title block "Folio" field
|
||||
/// @return the value of the title block "Folio" field
|
||||
QString folio() const { return(btb_folio_); }
|
||||
/// @return the value of the title block "Folio" field as displayed
|
||||
/// @return the value of the title block "Folio" field as displayed
|
||||
QString finalfolio() const { return(btb_final_folio_); }
|
||||
/// @return the value of the title block "Plant" field
|
||||
/// @return the value of the title block "Plant" field
|
||||
QString plant() const { return(btb_plant_); }
|
||||
/// @return the value of the title block "Locmach" field
|
||||
/// @return the value of the title block "Locmach" field
|
||||
QString locmach() const { return(btb_locmach_); }
|
||||
/// @return the value of the revision index block "Folio" field
|
||||
/// @return the value of the revision index block "Folio" field
|
||||
QString indexrev() const { return(btb_indexrev_); }
|
||||
/// @return the value of the title block "File" field
|
||||
/// @return the value of the title block "File" field
|
||||
QString fileName() const { return(btb_filename_); }
|
||||
/// @return the value of the title block Additional Fields
|
||||
/// @return the value of the title block Additional Fields
|
||||
QString version() const { return(btb_version_); }
|
||||
/// @return the value of the title block Additional Fields
|
||||
DiagramContext additionalFields() const { return (additional_fields_); }
|
||||
/// @return the value of the title block
|
||||
/// @return the value of the title block Additional Fields
|
||||
DiagramContext additionalFields() const {
|
||||
return (additional_fields_); }
|
||||
/// @return the value of the title block
|
||||
QString autoPageNum() const { return(btb_auto_page_num_); }
|
||||
/// @return the value of the total number of folios
|
||||
/// @return the value of the total number of folios
|
||||
int folioTotal() const { return(folio_total_);}
|
||||
|
||||
// methods to get display options
|
||||
/// @return true si le cartouche est affiche, false sinon
|
||||
bool titleBlockIsDisplayed() const { return(display_titleblock_); }
|
||||
/// @return true si les entetes des colonnes sont affiches, false sinon
|
||||
// methods to get display options
|
||||
/// @return true si le cartouche est affiche, false sinon
|
||||
bool titleBlockIsDisplayed() const {
|
||||
return(display_titleblock_); }
|
||||
/// @return true si les entetes des colonnes sont affiches,
|
||||
/// false sinon
|
||||
bool columnsAreDisplayed() const { return(display_columns_); }
|
||||
/// @return true si les entetes des lignes sont affiches, false sinon
|
||||
/// @return true si les entetes des lignes sont affiches,
|
||||
/// false sinon
|
||||
bool rowsAreDisplayed() const { return(display_rows_); }
|
||||
/// @return true si la bordure est affichee, false sinon
|
||||
/// @return true si la bordure est affichee, false sinon
|
||||
bool borderIsDisplayed() const { return(display_border_); }
|
||||
|
||||
// methods to set dimensions
|
||||
// methods to set dimensions
|
||||
void setColumnsCount(int);
|
||||
void setRowsCount(int);
|
||||
void setColumnsWidth(const qreal &);
|
||||
@@ -137,12 +155,13 @@ class BorderTitleBlock : public QObject
|
||||
|
||||
DiagramPosition convertPosition(const QPointF &);
|
||||
|
||||
// methods to set title block basic data
|
||||
// methods to set title block basic data
|
||||
void setAuthor(const QString &author);
|
||||
void setDate(const QDate &date);
|
||||
void setTitle(const QString &title);
|
||||
void setFolio(const QString &folio);
|
||||
void setFolioData(int, int, const QString& = nullptr, const DiagramContext & = DiagramContext());
|
||||
void setFolioData(int, int, const QString& = nullptr,
|
||||
const DiagramContext & = DiagramContext());
|
||||
void setPlant(const QString &plant);
|
||||
void setLocMach(const QString &locmach);
|
||||
void setIndicerev(const QString &indexrev);
|
||||
@@ -168,9 +187,11 @@ class BorderTitleBlock : public QObject
|
||||
|
||||
public slots:
|
||||
void titleBlockTemplateChanged(const QString &);
|
||||
void titleBlockTemplateRemoved(const QString &, const TitleBlockTemplate * = nullptr);
|
||||
void titleBlockTemplateRemoved(
|
||||
const QString &,
|
||||
const TitleBlockTemplate * = nullptr);
|
||||
|
||||
// methods to set display options
|
||||
// methods to set display options
|
||||
void displayTitleBlock(bool);
|
||||
void displayColumns(bool);
|
||||
void displayRows(bool);
|
||||
@@ -179,77 +200,86 @@ class BorderTitleBlock : public QObject
|
||||
|
||||
private:
|
||||
void updateRectangles();
|
||||
void updateDiagramContextForTitleBlock(const DiagramContext & = DiagramContext());
|
||||
void updateDiagramContextForTitleBlock(
|
||||
const DiagramContext & = DiagramContext());
|
||||
QString incrementLetters(const QString &);
|
||||
|
||||
signals:
|
||||
/**
|
||||
Signal emitted after the border has changed
|
||||
@param old_border Former border
|
||||
@param new_border New border
|
||||
*/
|
||||
/**
|
||||
@brief borderChanged
|
||||
Signal emitted after the border has changed
|
||||
@param old_border Former border
|
||||
@param new_border New border
|
||||
*/
|
||||
void borderChanged(QRectF old_border, QRectF new_border);
|
||||
/**
|
||||
Signal emitted after display options have changed
|
||||
*/
|
||||
/**
|
||||
@brief displayChanged
|
||||
Signal emitted after display options have changed
|
||||
*/
|
||||
void displayChanged();
|
||||
/**
|
||||
Signal emitted after the title has changed
|
||||
*/
|
||||
/**
|
||||
@brief diagramTitleChanged
|
||||
Signal emitted after the title has changed
|
||||
*/
|
||||
void diagramTitleChanged(const QString &);
|
||||
/**
|
||||
@brief titleBlockFolioChanged
|
||||
Signal emitted after Folio has changed
|
||||
*/
|
||||
/**
|
||||
@brief titleBlockFolioChanged
|
||||
Signal emitted after Folio has changed
|
||||
*/
|
||||
void titleBlockFolioChanged(const QString &);
|
||||
/**
|
||||
Signal emitted when the title block requires its data to be updated in order
|
||||
to generate the folio field.
|
||||
*/
|
||||
/**
|
||||
@brief needFolioData
|
||||
Signal emitted when the title block
|
||||
requires its data to be updated
|
||||
in order to generate the folio field.
|
||||
*/
|
||||
void needFolioData();
|
||||
/**
|
||||
Signal emitted when this object needs to set a specific title block
|
||||
template. This object cannot handle the job since it does not know of
|
||||
its parent project.
|
||||
*/
|
||||
/**
|
||||
@brief needTitleBlockTemplate
|
||||
Signal emitted when this object needs to
|
||||
set a specific title block template.
|
||||
This object cannot handle the job
|
||||
since it does not know of its parent project.
|
||||
*/
|
||||
void needTitleBlockTemplate(const QString &);
|
||||
|
||||
// attributes
|
||||
// attributes
|
||||
private:
|
||||
// titleblock basic data
|
||||
QString btb_author_;
|
||||
QDate btb_date_;
|
||||
QString btb_title_;
|
||||
QString btb_folio_;
|
||||
QString btb_plant_;
|
||||
QString btb_locmach_;
|
||||
QString btb_indexrev_;
|
||||
QString btb_final_folio_;
|
||||
QString btb_auto_page_num_;
|
||||
int folio_index_;
|
||||
int folio_total_;
|
||||
QString btb_filename_;
|
||||
QString btb_version_;
|
||||
// titleblock basic data
|
||||
QString btb_author_; ///< titleblock author
|
||||
QDate btb_date_; ///< titleblock date
|
||||
QString btb_title_; ///< titleblock title
|
||||
QString btb_folio_; ///< titleblock folio
|
||||
QString btb_plant_; ///< titleblock plant
|
||||
QString btb_locmach_; ///< titleblock locmach
|
||||
QString btb_indexrev_; ///< titleblock index rev
|
||||
QString btb_final_folio_; ///< titleblock final folio
|
||||
QString btb_auto_page_num_; ///< titleblock auto page num
|
||||
int folio_index_; ///< titleblock index
|
||||
int folio_total_; ///< titleblock total
|
||||
QString btb_filename_; ///< titleblock filename
|
||||
QString btb_version_; ///< titleblock version
|
||||
/// titleblock additional fields
|
||||
DiagramContext additional_fields_;
|
||||
Qt::Edge m_edge;
|
||||
QString m_next_folio_num,
|
||||
m_previous_folio_num;
|
||||
Qt::Edge m_edge; ///< titleblock edge
|
||||
QString m_next_folio_num; ///< titleblock next folio num
|
||||
QString m_previous_folio_num; ///< titleblock previous folio num
|
||||
|
||||
// border dimensions (rows and columns)
|
||||
// columns: number and dimensions
|
||||
int columns_count_;
|
||||
qreal columns_width_;
|
||||
qreal columns_header_height_;
|
||||
// border dimensions (rows and columns)
|
||||
// columns: number and dimensions
|
||||
int columns_count_; ///< columns count
|
||||
qreal columns_width_; ///< columns width
|
||||
qreal columns_header_height_; ///< columns header height
|
||||
|
||||
// rows: number and dimensions
|
||||
int rows_count_;
|
||||
qreal rows_height_;
|
||||
qreal rows_header_width_;
|
||||
// rows: number and dimensions
|
||||
int rows_count_; ///< rows count
|
||||
qreal rows_height_; ///< rows height
|
||||
qreal rows_header_width_; ///< rows header width
|
||||
|
||||
// title block dimensions
|
||||
// title block dimensions
|
||||
qreal titleblock_height_;
|
||||
|
||||
// rectangles used for drawing operations
|
||||
// rectangles used for drawing operations
|
||||
QRectF diagram_rect_;
|
||||
|
||||
// display options
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2014 The QElectroTech team
|
||||
Copyright 2006-2020 The QElectroTech team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -26,16 +26,23 @@
|
||||
#include "assignvariables.h"
|
||||
|
||||
/**
|
||||
* @brief ConductorAutoNumerotation::ConductorAutoNumerotation
|
||||
* Constructor of autonum, after create a class, call numerate to apply the autonum.
|
||||
* When autonum is applyed, they do with an undo command added to the stack of diagram.
|
||||
* If you give a parent_undo at constructor, the undo command create in this class have parent_undo for parent,
|
||||
* and wasn't added to the stack of diagram (it's the responsabillty of the parent_undo)
|
||||
* @param conductor : the conductor to apply automatic numerotation
|
||||
* @param diagram : the diagram of conductor
|
||||
* @param parent_undo : parent undo command
|
||||
*/
|
||||
ConductorAutoNumerotation::ConductorAutoNumerotation(Conductor *conductor, Diagram *diagram, QUndoCommand *parent_undo) :
|
||||
@brief ConductorAutoNumerotation::ConductorAutoNumerotation
|
||||
Constructor of autonum, after create a class,
|
||||
call numerate to apply the autonum.
|
||||
When autonum is applyed,
|
||||
they do with an undo command added to the stack of diagram.
|
||||
If you give a parent_undo at constructor,
|
||||
the undo command create in this class have parent_undo for parent,
|
||||
and wasn't added to the stack of diagram
|
||||
(it's the responsabillty of the parent_undo)
|
||||
@param conductor : the conductor to apply automatic numerotation
|
||||
@param diagram : the diagram of conductor
|
||||
@param parent_undo : parent undo command
|
||||
*/
|
||||
ConductorAutoNumerotation::ConductorAutoNumerotation(
|
||||
Conductor *conductor,
|
||||
Diagram *diagram,
|
||||
QUndoCommand *parent_undo) :
|
||||
m_diagram (diagram),
|
||||
m_conductor (conductor),
|
||||
conductor_list (conductor -> relatedPotentialConductors().values()),
|
||||
@@ -43,19 +50,22 @@ ConductorAutoNumerotation::ConductorAutoNumerotation(Conductor *conductor, Diagr
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief ConductorAutoNumerotation::numerate
|
||||
* execute the automatic numerotation
|
||||
*/
|
||||
@brief ConductorAutoNumerotation::numerate
|
||||
execute the automatic numerotation
|
||||
*/
|
||||
void ConductorAutoNumerotation::numerate() {
|
||||
if (!m_conductor) return;
|
||||
if (conductor_list.size() >= 1 ) numeratePotential();
|
||||
else if (m_conductor -> properties().type == ConductorProperties::Multi) numerateNewConductor();
|
||||
else if (m_conductor -> properties().type == ConductorProperties::Multi)
|
||||
numerateNewConductor();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorAutoNumerotation::applyText
|
||||
* apply the text @t to @conductor_ and all conductors at the same potential
|
||||
*/
|
||||
@brief ConductorAutoNumerotation::applyText
|
||||
apply the text @t to @conductor_
|
||||
and all conductors at the same potential
|
||||
@param t : Conductor text
|
||||
*/
|
||||
void ConductorAutoNumerotation::applyText(const QString& t)
|
||||
{
|
||||
if (!m_conductor) return;
|
||||
@@ -70,20 +80,36 @@ void ConductorAutoNumerotation::applyText(const QString& t)
|
||||
|
||||
if (m_parent_undo)
|
||||
{
|
||||
new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, m_parent_undo);
|
||||
new QPropertyUndoCommand(
|
||||
m_conductor,
|
||||
"properties",
|
||||
old_value,
|
||||
new_value,
|
||||
m_parent_undo);
|
||||
undo = m_parent_undo;
|
||||
}
|
||||
else
|
||||
{
|
||||
undo = new QUndoCommand();
|
||||
new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, undo);
|
||||
undo->setText(QObject::tr("Modifier les propriétés d'un conducteur", "undo caption"));
|
||||
new QPropertyUndoCommand(
|
||||
m_conductor,
|
||||
"properties",
|
||||
old_value,
|
||||
new_value,
|
||||
undo);
|
||||
undo->setText(
|
||||
QObject::tr(
|
||||
"Modifier les propriétés d'un conducteur",
|
||||
"undo caption"));
|
||||
}
|
||||
|
||||
if (!conductor_list.isEmpty())
|
||||
{
|
||||
if (!m_parent_undo)
|
||||
undo->setText(QObject::tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
||||
undo->setText(
|
||||
QObject::tr(
|
||||
"Modifier les propriétés de plusieurs conducteurs",
|
||||
"undo caption"));
|
||||
|
||||
foreach (Conductor *cond, conductor_list)
|
||||
{
|
||||
@@ -91,7 +117,12 @@ void ConductorAutoNumerotation::applyText(const QString& t)
|
||||
old_value.setValue(cp2);
|
||||
cp2.text = t;
|
||||
new_value.setValue(cp2);
|
||||
new QPropertyUndoCommand(cond, "properties", old_value, new_value, undo);
|
||||
new QPropertyUndoCommand(
|
||||
cond,
|
||||
"properties",
|
||||
old_value,
|
||||
new_value,
|
||||
undo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,15 +131,19 @@ void ConductorAutoNumerotation::applyText(const QString& t)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorAutoNumerotation::newProperties
|
||||
* Create a new properties according to the current autonum rule of diagram
|
||||
* @param d
|
||||
* @param cp
|
||||
* @param seq
|
||||
*/
|
||||
void ConductorAutoNumerotation::newProperties(Diagram *diagram, ConductorProperties &cp, autonum::sequentialNumbers &seq)
|
||||
@brief ConductorAutoNumerotation::newProperties
|
||||
Create a new properties according to the current autonum rule of diagram
|
||||
@param diagram : Diagram class
|
||||
@param cp : ConductorProperties
|
||||
@param seq : sequentialNumbers
|
||||
*/
|
||||
void ConductorAutoNumerotation::newProperties(
|
||||
Diagram *diagram,
|
||||
ConductorProperties &cp,
|
||||
autonum::sequentialNumbers &seq)
|
||||
{
|
||||
NumerotationContext context = diagram->project()->conductorAutoNum(diagram->conductorsAutonumName());
|
||||
NumerotationContext context = diagram->project()->conductorAutoNum(
|
||||
diagram->conductorsAutonumName());
|
||||
if (context.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -124,9 +159,9 @@ void ConductorAutoNumerotation::newProperties(Diagram *diagram, ConductorPropert
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorAutoNumerotation::numeratePotential
|
||||
* Numerate a conductor on an existing potential
|
||||
*/
|
||||
@brief ConductorAutoNumerotation::numeratePotential
|
||||
Numerate a conductor on an existing potential
|
||||
*/
|
||||
void ConductorAutoNumerotation::numeratePotential()
|
||||
{
|
||||
ConductorProperties cp = conductor_list.first()->properties();
|
||||
@@ -136,7 +171,8 @@ void ConductorAutoNumerotation::numeratePotential()
|
||||
if (conductor->properties() != cp)
|
||||
properties_equal = false;
|
||||
}
|
||||
//Every properties of the potential is equal, so we apply it to m_conductor
|
||||
// Every properties of the potential is equal,
|
||||
// so we apply it to m_conductor
|
||||
if (properties_equal)
|
||||
{
|
||||
m_conductor->setProperties(cp);
|
||||
@@ -169,21 +205,25 @@ void ConductorAutoNumerotation::numeratePotential()
|
||||
//the texts isn't identicals
|
||||
else
|
||||
{
|
||||
PotentialSelectorDialog psd(m_conductor, m_parent_undo, m_conductor->diagramEditor());
|
||||
PotentialSelectorDialog psd(
|
||||
m_conductor,
|
||||
m_parent_undo,
|
||||
m_conductor->diagramEditor());
|
||||
psd.exec();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ConductorAutoNumerotation::numerateNewConductor
|
||||
* create and apply a new numerotation to @m_conductor
|
||||
*/
|
||||
@brief ConductorAutoNumerotation::numerateNewConductor
|
||||
create and apply a new numerotation to @m_conductor
|
||||
*/
|
||||
void ConductorAutoNumerotation::numerateNewConductor()
|
||||
{
|
||||
if (!m_conductor || m_diagram->conductorsAutonumName().isEmpty())
|
||||
return;
|
||||
|
||||
NumerotationContext context = m_diagram->project()->conductorAutoNum(m_diagram -> conductorsAutonumName());
|
||||
NumerotationContext context = m_diagram->project()->conductorAutoNum(
|
||||
m_diagram -> conductorsAutonumName());
|
||||
if (context.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -194,10 +234,17 @@ void ConductorAutoNumerotation::numerateNewConductor()
|
||||
cp.m_formula = formula;
|
||||
m_conductor->setProperties(cp);
|
||||
|
||||
autonum::setSequential(formula, m_conductor->rSequenceNum(), context, m_diagram, autoNum_name);
|
||||
autonum::setSequential(formula,
|
||||
m_conductor->rSequenceNum(),
|
||||
context,
|
||||
m_diagram,
|
||||
autoNum_name);
|
||||
|
||||
NumerotationContextCommands ncc (context, m_diagram);
|
||||
m_diagram->project()->addConductorAutoNum(autoNum_name, ncc.next());
|
||||
|
||||
applyText(autonum::AssignVariables::formulaToLabel(formula, m_conductor->rSequenceNum(), m_diagram));
|
||||
applyText(autonum::AssignVariables::formulaToLabel(
|
||||
formula,
|
||||
m_conductor->rSequenceNum(),
|
||||
m_diagram));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2006-2014 The QElectroTech team
|
||||
Copyright 2006-2020 The QElectroTech team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
@@ -26,19 +26,26 @@ class Conductor;
|
||||
class QUndoCommand;
|
||||
class ConductorProperties;
|
||||
|
||||
/**
|
||||
@brief The ConductorAutoNumerotation class
|
||||
*/
|
||||
class ConductorAutoNumerotation
|
||||
{
|
||||
public:
|
||||
//constructors & destructor
|
||||
ConductorAutoNumerotation (Conductor *conductor, Diagram *diagram, QUndoCommand *undo_parent = nullptr);
|
||||
ConductorAutoNumerotation (Conductor *conductor,
|
||||
Diagram *diagram,
|
||||
QUndoCommand *undo_parent = nullptr);
|
||||
|
||||
//methods
|
||||
//methods
|
||||
void numerate ();
|
||||
void applyText (const QString&);
|
||||
static void newProperties(Diagram *diagram, ConductorProperties &cp, autonum::sequentialNumbers &seq);
|
||||
static void newProperties(Diagram *diagram,
|
||||
ConductorProperties &cp,
|
||||
autonum::sequentialNumbers &seq);
|
||||
|
||||
private:
|
||||
//methods
|
||||
//methods
|
||||
void numeratePotential ();
|
||||
void numerateNewConductor ();
|
||||
|
||||
|
||||
@@ -20,3 +20,8 @@
|
||||
PropertiesInterface::PropertiesInterface()
|
||||
{
|
||||
}
|
||||
|
||||
PropertiesInterface::~PropertiesInterface()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class PropertiesInterface
|
||||
{
|
||||
public:
|
||||
PropertiesInterface();
|
||||
virtual ~PropertiesInterface();
|
||||
// Save/load properties to setting file. QString is use for prefix a word befor the name of each paramètre
|
||||
virtual void toSettings (QSettings &settings, const QString = QString()) const =0;
|
||||
virtual void fromSettings (const QSettings &settings, const QString = QString()) =0;
|
||||
|
||||
Reference in New Issue
Block a user