Improve code style, Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-08-18 21:29:12 +02:00
parent 8e956df8d8
commit 566747eb2b
11 changed files with 81 additions and 43 deletions

View File

@@ -169,21 +169,24 @@ void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
switch (answer) {
//help dialog - not implemented yet -
case QDialogButtonBox::HelpRole:
QMessageBox::information (this, tr("Folio Autonumbering", "title window"),
tr("C'est ici que vous pouvez définir la manière dont seront numérotés les nouveaux folios.\n"
"-Une numérotation est composée d'une variable minimum.\n"
"-Vous pouvez ajouter ou supprimer une variable de numérotation par le biais des boutons - et +.\n"
"-Une variable de numérotation comprend : un type, une valeur et une incrémentation.\n"
QMessageBox::information (
this,
tr("Folio Autonumbering",
"title window"),
tr("C'est ici que vous pouvez définir la manière dont seront numérotés les nouveaux folios.\n"
"-Une numérotation est composée d'une variable minimum.\n"
"-Vous pouvez ajouter ou supprimer une variable de numérotation par le biais des boutons - et +.\n"
"-Une variable de numérotation comprend : un type, une valeur et une incrémentation.\n"
"\n-les types \"Chiffre 1\", \"Chiffre 01\" et \"Chiffre 001\", représentent un type numérique défini dans le champ \"Valeur\", "
"qui s'incrémente à chaque nouveau folio de la valeur du champ \"Incrémentation\".\n"
"-\"Chiffre 01\" et \"Chiffre 001\", sont respectivement représentés sur le schéma par deux et trois digits minimum.\n"
"Si le chiffre défini dans le champ Valeur possède moins de digits que le type choisi,"
"celui-ci sera précédé par un ou deux 0 afin de respecter son type.\n"
"\n-les types \"Chiffre 1\", \"Chiffre 01\" et \"Chiffre 001\", représentent un type numérique défini dans le champ \"Valeur\", "
"qui s'incrémente à chaque nouveau folio de la valeur du champ \"Incrémentation\".\n"
"-\"Chiffre 01\" et \"Chiffre 001\", sont respectivement représentés sur le schéma par deux et trois digits minimum.\n"
"Si le chiffre défini dans le champ Valeur possède moins de digits que le type choisi,"
"celui-ci sera précédé par un ou deux 0 afin de respecter son type.\n"
"\n-Le type \"Texte\", représente un texte fixe.\nLe champ \"Incrémentation\" n'est pas utilisé.\n",
"help dialog about the folio autonumerotation"
));
"\n-Le type \"Texte\", représente un texte fixe.\nLe champ \"Incrémentation\" n'est pas utilisé.\n",
"help dialog about the folio autonumerotation"
));
break;
case QDialogButtonBox::ApplyRole:
applyEnable(true);

View File

@@ -1007,7 +1007,9 @@ bool Conductor::fromXml(QDomElement &dom_element)
bornes dans le document XML et leur adresse en memoire
@return Un element XML representant le conducteur
*/
QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int> &table_adr_id) const
QDomElement Conductor::toXml(QDomDocument &dom_document,
QHash<Terminal *,
int> &table_adr_id) const
{
QDomElement dom_element = dom_document.createElement("conductor");

View File

@@ -84,7 +84,9 @@ class Conductor : public QGraphicsObject
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;
@@ -97,8 +99,10 @@ class Conductor : public QGraphicsObject
public:
static bool valideXml (QDomElement &);
bool fromXml (QDomElement &);
QDomElement toXml (QDomDocument &, QHash<Terminal *, int> &) const;
bool fromXml (QDomElement &);
QDomElement toXml (QDomDocument &,
QHash<Terminal *,
int> &) const;
private:
bool pathFromXml(const QDomElement &);
@@ -106,7 +110,8 @@ class Conductor : public QGraphicsObject
QVector <QPointF> handlerPoints() const;
const QList<ConductorSegment *> 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;
@@ -117,7 +122,9 @@ class Conductor : public QGraphicsObject
void calculateTextItemPosition();
virtual Highlight highlight() const;
virtual void setHighlighted(Highlight);
QSet<Conductor *> relatedPotentialConductors(const bool all_diagram = true, QList <Terminal *> *t_list=nullptr);
QSet<Conductor *> relatedPotentialConductors(
const bool all_diagram = true,
QList <Terminal *> *t_list=nullptr);
QETDiagramEditor* diagramEditor() const;
void editProperty ();

View File

@@ -77,8 +77,8 @@ class QetShapeItem : public QetGraphicsItem
ShapeType shapeType() const {return m_shapeType;}
virtual bool fromXml (const QDomElement &);
virtual QDomElement toXml (QDomDocument &document) const;
virtual bool toDXF (const QString &filepath,const QPen &pen);
virtual QDomElement toXml (QDomDocument &document) const;
virtual bool toDXF (const QString &filepath,const QPen &pen);
void editProperty() override;
QString name() const override;

View File

@@ -40,7 +40,9 @@ 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;
@@ -129,9 +131,13 @@ Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e) :
@param name of terminal
@param hiddenName hide or show the name
@param e Element auquel cette borne appartient
@param s Scene sur laquelle figure cette borne
*/
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)
@@ -242,9 +248,10 @@ void Terminal::removeConductor(Conductor *conductor)
Fonction de dessin des bornes
@param p Le QPainter a utiliser
@param options Les options de dessin
@param widget Le widget sur lequel on dessine
*/
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;

View File

@@ -32,11 +32,11 @@
@param parent
*/
BOMExportDialog::BOMExportDialog(QETProject *project, QWidget *parent) :
QDialog(parent),
QDialog(parent),
ui(new Ui::BOMExportDialog),
m_project(project)
{
ui->setupUi(this);
ui->setupUi(this);
m_query_widget = new ElementQueryWidget(this);
ui->m_main_layout->insertWidget(0, m_query_widget);

View File

@@ -37,7 +37,8 @@
@param elmt
@param parent
*/
ElementPropertiesWidget::ElementPropertiesWidget(Element *elmt, QWidget *parent) :
ElementPropertiesWidget::ElementPropertiesWidget(Element *elmt,
QWidget *parent) :
AbstractElementPropertiesEditorWidget (parent),
m_diagram (elmt->diagram()),
m_tab (nullptr),
@@ -57,7 +58,8 @@ ElementPropertiesWidget::ElementPropertiesWidget(Element *elmt, QWidget *parent)
@param text
@param parent
*/
ElementPropertiesWidget::ElementPropertiesWidget(DynamicElementTextItem *text, QWidget *parent) :
ElementPropertiesWidget::ElementPropertiesWidget(DynamicElementTextItem *text,
QWidget *parent) :
AbstractElementPropertiesEditorWidget (parent),
m_tab (nullptr),
m_general_widget(nullptr)
@@ -80,7 +82,8 @@ ElementPropertiesWidget::ElementPropertiesWidget(DynamicElementTextItem *text, Q
@param group
@param parent
*/
ElementPropertiesWidget::ElementPropertiesWidget(ElementTextItemGroup *group, QWidget *parent) :
ElementPropertiesWidget::ElementPropertiesWidget(ElementTextItemGroup *group,
QWidget *parent) :
AbstractElementPropertiesEditorWidget (parent),
m_tab (nullptr),
m_general_widget(nullptr)

View File

@@ -44,7 +44,9 @@ IndiTextPropertiesWidget::IndiTextPropertiesWidget(IndependentTextItem *text, QW
@param text_list : a list of texts to edit
@param parent : the parent widget of this widget
*/
IndiTextPropertiesWidget::IndiTextPropertiesWidget(QList<IndependentTextItem *> text_list, QWidget *parent) :
IndiTextPropertiesWidget::IndiTextPropertiesWidget(
QList<IndependentTextItem *> text_list,
QWidget *parent) :
PropertiesEditorWidget (parent),
ui(new Ui::IndiTextPropertiesWidget)
{

View File

@@ -44,7 +44,8 @@ class LinkSingleElementWidget : public AbstractElementPropertiesEditorWidget
///Methods
public:
explicit LinkSingleElementWidget(Element *elmt, QWidget *parent = nullptr);
explicit LinkSingleElementWidget(Element *elmt,
QWidget *parent = nullptr);
~LinkSingleElementWidget() override;
void setElement (Element *element) override;

View File

@@ -34,7 +34,10 @@
@param content : content to remove
@param parent : parent undo
*/
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand *parent) :
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(
Diagram *diagram,
const DiagramContent &content,
QUndoCommand *parent) :
QUndoCommand(parent),
m_removed_contents(content),
m_diagram(diagram)
@@ -96,8 +99,12 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(Diagram *diagram, const D
}
}
setText(QString(QObject::tr("supprimer %1", "undo caption - %1 is a sentence listing the removed content")).arg(m_removed_contents.sentence(DiagramContent::All)));
//Table is now managed by @m_table_scene_hash, we clear the tables of m_removed_content
setText(QString(QObject::tr(
"supprimer %1",
"undo caption - %1 is a sentence listing the removed content"))
.arg(m_removed_contents.sentence(DiagramContent::All)));
//Table is now managed by m_table_scene_hash,
//we clear the tables of m_removed_content
m_removed_contents.m_tables.clear();
m_diagram->qgiManager().manage(m_removed_contents.items(DiagramContent::All));
}
@@ -195,14 +202,18 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
/**
@brief DeleteQGraphicsItemCommand::terminalInSamePotential
Return a terminal at the same potential of @terminal, by traveling through the conductors connected to @terminal
only if the owner element of the terminal is not delete by this undo command.
Return a terminal at the same potential of terminal,
by traveling through the conductors connected to terminal
only if the owner element of the terminal
is not delete by this undo command.
Return nullptr if a terminal can't be found.
@param terminal - terminal from search
@param conductor_to_exclude - a conductor to exlcude from search.
@return
*/
Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude)
Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential(
Terminal *terminal,
Conductor *conductor_to_exclude)
{
QList<Conductor *> conductor_list = terminal->conductors();
conductor_list.removeAll(conductor_to_exclude);

View File

@@ -223,13 +223,15 @@ void LinkElementCommand::redo()
/**
@brief LinkElementCommand::setUpNewLink
Update the content of m_link_after with the content of @element_list.
Each linkable element (know via the static method isLinkable) is added to m_linked_after
@already_link is used for the static method isLinkable.
Update the content of m_link_after with the content of element_list.
Each linkable element (know via the static method isLinkable)
is added to m_linked_after
already_link is used for the static method isLinkable.
@param element_list
@param already_link
*/
void LinkElementCommand::setUpNewLink(const QList<Element *> &element_list, bool already_link)
void LinkElementCommand::setUpNewLink(const QList<Element *> &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