Add documentation + wrap code for better readability

This commit is contained in:
Simon De Backer
2020-07-16 21:02:34 +02:00
committed by Laurent Trinques
parent 70ef559874
commit 495d9a5f51
3 changed files with 573 additions and 324 deletions

View File

@@ -27,7 +27,7 @@
- 17 columns of 60.0 px wide by 20.0px high - 17 columns of 60.0 px wide by 20.0px high
- 8 lines of 80.0 px high by 20.0px wide - 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 : defaut suivantes :
- 17 colonnes affichees de 60.0 px de large pour 20.0px de haut - 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 - 8 lignes affichees de 80.0 px de haut pour 20.0px de large
@@ -53,12 +53,11 @@ BorderProperties::~BorderProperties() {
/** /**
@brief BorderProperties::operator == @brief BorderProperties::operator ==
@param bp :
- other BorderProperties container/class \~ @param bp : Other BorderProperties container/class.
- autre conteneur BorderProperties \~French Autre conteneur BorderProperties
@return \~ @return True if it and this container are identical, false otherwise.
- true if it and this container are identical, false otherwise \~French True si ip et ce conteneur sont identiques, false sinon
- true si ip et ce conteneur sont identiques, false sinon
*/ */
bool BorderProperties::operator==(const BorderProperties &bp) { bool BorderProperties::operator==(const BorderProperties &bp) {
return( return(
@@ -75,12 +74,13 @@ bool BorderProperties::operator==(const BorderProperties &bp) {
/** /**
@brief BorderProperties::operator != @brief BorderProperties::operator !=
@param bp :
- other BorderProperties container/class \~ @param bp :
- autre conteneur BorderProperties Other BorderProperties container/class.
@return \~French Autre conteneur BorderProperties
- false if it and this container are identical, true otherwise \~ @return
- false si bp et ce conteneur sont identiques, true sinon 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) { bool BorderProperties::operator!=(const BorderProperties &bp) {
return(!(*this == bp)); return(!(*this == bp));
@@ -88,11 +88,12 @@ bool BorderProperties::operator!=(const BorderProperties &bp) {
/** /**
@brief BorderProperties::toXml @brief BorderProperties::toXml
- Exports dimensions as XML attributes added to element e. Exports dimensions as XML attributes added to element e.
- Exporte les dimensions sous formes d'attributs XML ajoutes a l'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 \~ @param e :
- Element XML auquel seront ajoutes des attributs 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("cols", columns_count);
@@ -105,11 +106,12 @@ void BorderProperties::toXml(QDomElement &e) const {
/** /**
@brief BorderProperties::fromXml @brief BorderProperties::fromXml
- Import dimensions from XML attributes of element e Import dimensions from XML attributes of element e
- Importe les dimensions a partir des attributs XML de l'element e \~French Importe les dimensions a partir des attributs XML de l'element e
@param e :
- XML element whose attributes will be read \~ @param e :
- Element XML dont les attributs seront lus XML element whose attributes will be read
\~French Element XML dont les attributs seront lus
*/ */
void BorderProperties::fromXml(QDomElement &e) { void BorderProperties::fromXml(QDomElement &e) {
if (e.hasAttribute("cols")) columns_count = e.attribute("cols").toInt(); if (e.hasAttribute("cols")) columns_count = e.attribute("cols").toInt();
@@ -122,14 +124,15 @@ void BorderProperties::fromXml(QDomElement &e) {
/** /**
@brief BorderProperties::toSettings @brief BorderProperties::toSettings
- Export dimensions in a QSettings object. Export dimensions in a QSettings object.
- Exporte les dimensions dans une configuration. \~French Exporte les dimensions dans une configuration.
@param settings :
- QSettings object to write \~ @param settings :
- Parametres a ecrire QSettings object to write
@param prefix : \~French Parametres a ecrire
- prefix to be added before the names of the parameters \~ @param prefix :
- prefixe a ajouter devant les noms des parametres 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 + "cols", columns_count);
@@ -142,14 +145,12 @@ void BorderProperties::toSettings(QSettings &settings, const QString &prefix) co
/** /**
@brief BorderProperties::fromSettings @brief BorderProperties::fromSettings
- Import dimensions from a QSettings object. Import dimensions from a QSettings object.
- Importe les dimensions depuis une configuration. \~French Importe les dimensions depuis une configuration.
@param settings : \~ @param settings : QSettings object to read
- QSettings object to read \~French Parametres a lire
- Parametres a lire \~ @param prefix : prefix to be added before the names of the parameters
@param prefix : \~French prefixe a ajouter devant les noms des parametres
- prefix to be added before the names of the parameters
- prefixe a ajouter devant les noms des parametres
*/ */
void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) { void BorderProperties::fromSettings(QSettings &settings, const QString &prefix) {
columns_count = settings.value(prefix + "cols", columns_count).toInt(); columns_count = settings.value(prefix + "cols", columns_count).toInt();

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,7 @@ class DiagramPosition;
class TitleBlockTemplate; class TitleBlockTemplate;
class TitleBlockTemplateRenderer; class TitleBlockTemplateRenderer;
/** /**
@brief The BorderTitleBlock class
This class represents the border and the titleblock which frame a This class represents the border and the titleblock which frame a
particular electric diagram. particular electric diagram.
*/ */
@@ -55,9 +56,11 @@ class BorderTitleBlock : public QObject
/// @return the columns width, in pixels /// @return the columns width, in pixels
qreal columnsWidth() const { return(columns_width_); } qreal columnsWidth() const { return(columns_width_); }
/// @return the total width of all columns, headers excluded /// @return the total width of all columns, headers excluded
qreal columnsTotalWidth() const { return(columns_count_ * columns_width_); } qreal columnsTotalWidth() const {
return(columns_count_ * columns_width_); }
/// @return the column headers height, in pixels /// @return the column headers height, in pixels
qreal columnsHeaderHeight() const { return(columns_header_height_); } qreal columnsHeaderHeight() const {
return(columns_header_height_); }
//ROWS //ROWS
/// @return the number of rows /// @return the number of rows
@@ -65,15 +68,26 @@ class BorderTitleBlock : public QObject
/// @return the rows height, in pixels /// @return the rows height, in pixels
qreal rowsHeight() const { return(rows_height_); } qreal rowsHeight() const { return(rows_height_); }
/// @return the total height of all rows, headers excluded /// @return the total height of all rows, headers excluded
qreal rowsTotalHeight() const { return(rows_count_ * rows_height_); } qreal rowsTotalHeight() const {
return(rows_count_ * rows_height_); }
/// @return la rows header width, in pixels /// @return la rows header width, in pixels
qreal rowsHeaderWidth() const { return(rows_header_width_); } qreal rowsHeaderWidth() const { return(rows_header_width_); }
// border - title block = diagram // border - title block = diagram
/// @return the diagram width, i.e. the width of the border without title block /**
qreal diagramWidth() const { return(columnsTotalWidth() + rowsHeaderWidth()); } @brief diagramWidth
/// @return the diagram height, i.e. the height of the border without title block @return the diagram width,
qreal diagramHeight() const { return(rowsTotalHeight() + columnsHeaderHeight()); } 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; QRectF titleBlockRect () const;
@@ -110,7 +124,8 @@ class BorderTitleBlock : public QObject
/// @return the value of the title block Additional Fields /// @return the value of the title block Additional Fields
QString version() const { return(btb_version_); } QString version() const { return(btb_version_); }
/// @return the value of the title block Additional Fields /// @return the value of the title block Additional Fields
DiagramContext additionalFields() const { return (additional_fields_); } DiagramContext additionalFields() const {
return (additional_fields_); }
/// @return the value of the title block /// @return the value of the title block
QString autoPageNum() const { return(btb_auto_page_num_); } 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
@@ -118,10 +133,13 @@ class BorderTitleBlock : public QObject
// methods to get display options // methods to get display options
/// @return true si le cartouche est affiche, false sinon /// @return true si le cartouche est affiche, false sinon
bool titleBlockIsDisplayed() const { return(display_titleblock_); } bool titleBlockIsDisplayed() const {
/// @return true si les entetes des colonnes sont affiches, false sinon return(display_titleblock_); }
/// @return true si les entetes des colonnes sont affiches,
/// false sinon
bool columnsAreDisplayed() const { return(display_columns_); } 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_); } 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_); } bool borderIsDisplayed() const { return(display_border_); }
@@ -142,7 +160,8 @@ class BorderTitleBlock : public QObject
void setDate(const QDate &date); void setDate(const QDate &date);
void setTitle(const QString &title); void setTitle(const QString &title);
void setFolio(const QString &folio); 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 setPlant(const QString &plant);
void setLocMach(const QString &locmach); void setLocMach(const QString &locmach);
void setIndicerev(const QString &indexrev); void setIndicerev(const QString &indexrev);
@@ -168,7 +187,9 @@ class BorderTitleBlock : public QObject
public slots: public slots:
void titleBlockTemplateChanged(const QString &); 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 displayTitleBlock(bool);
@@ -179,21 +200,25 @@ class BorderTitleBlock : public QObject
private: private:
void updateRectangles(); void updateRectangles();
void updateDiagramContextForTitleBlock(const DiagramContext & = DiagramContext()); void updateDiagramContextForTitleBlock(
const DiagramContext & = DiagramContext());
QString incrementLetters(const QString &); QString incrementLetters(const QString &);
signals: signals:
/** /**
@brief borderChanged
Signal emitted after the border has changed Signal emitted after the border has changed
@param old_border Former border @param old_border Former border
@param new_border New border @param new_border New border
*/ */
void borderChanged(QRectF old_border, QRectF new_border); void borderChanged(QRectF old_border, QRectF new_border);
/** /**
@brief displayChanged
Signal emitted after display options have changed Signal emitted after display options have changed
*/ */
void displayChanged(); void displayChanged();
/** /**
@brief diagramTitleChanged
Signal emitted after the title has changed Signal emitted after the title has changed
*/ */
void diagramTitleChanged(const QString &); void diagramTitleChanged(const QString &);
@@ -203,48 +228,53 @@ class BorderTitleBlock : public QObject
*/ */
void titleBlockFolioChanged(const QString &); void titleBlockFolioChanged(const QString &);
/** /**
Signal emitted when the title block requires its data to be updated in order @brief needFolioData
to generate the folio field. Signal emitted when the title block
requires its data to be updated
in order to generate the folio field.
*/ */
void needFolioData(); void needFolioData();
/** /**
Signal emitted when this object needs to set a specific title block @brief needTitleBlockTemplate
template. This object cannot handle the job since it does not know of Signal emitted when this object needs to
its parent project. 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 &); void needTitleBlockTemplate(const QString &);
// attributes // attributes
private: private:
// titleblock basic data // titleblock basic data
QString btb_author_; QString btb_author_; ///< titleblock author
QDate btb_date_; QDate btb_date_; ///< titleblock date
QString btb_title_; QString btb_title_; ///< titleblock title
QString btb_folio_; QString btb_folio_; ///< titleblock folio
QString btb_plant_; QString btb_plant_; ///< titleblock plant
QString btb_locmach_; QString btb_locmach_; ///< titleblock locmach
QString btb_indexrev_; QString btb_indexrev_; ///< titleblock index rev
QString btb_final_folio_; QString btb_final_folio_; ///< titleblock final folio
QString btb_auto_page_num_; QString btb_auto_page_num_; ///< titleblock auto page num
int folio_index_; int folio_index_; ///< titleblock index
int folio_total_; int folio_total_; ///< titleblock total
QString btb_filename_; QString btb_filename_; ///< titleblock filename
QString btb_version_; QString btb_version_; ///< titleblock version
/// titleblock additional fields
DiagramContext additional_fields_; DiagramContext additional_fields_;
Qt::Edge m_edge; Qt::Edge m_edge; ///< titleblock edge
QString m_next_folio_num, QString m_next_folio_num; ///< titleblock next folio num
m_previous_folio_num; QString m_previous_folio_num; ///< titleblock previous folio num
// border dimensions (rows and columns) // border dimensions (rows and columns)
// columns: number and dimensions // columns: number and dimensions
int columns_count_; int columns_count_; ///< columns count
qreal columns_width_; qreal columns_width_; ///< columns width
qreal columns_header_height_; qreal columns_header_height_; ///< columns header height
// rows: number and dimensions // rows: number and dimensions
int rows_count_; int rows_count_; ///< rows count
qreal rows_height_; qreal rows_height_; ///< rows height
qreal rows_header_width_; qreal rows_header_width_; ///< rows header width
// title block dimensions // title block dimensions
qreal titleblock_height_; qreal titleblock_height_;