mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Wrap code for better readability
This commit is contained in:
@@ -62,7 +62,9 @@ bool SingleLineProperties::isPen() const {
|
|||||||
@param direction direction du segment sur lequel les symboles apparaitront
|
@param direction direction du segment sur lequel les symboles apparaitront
|
||||||
@param rect rectangle englobant le dessin ; utilise pour specifier a la fois la position et la taille du dessin
|
@param rect rectangle englobant le dessin ; utilise pour specifier a la fois la position et la taille du dessin
|
||||||
*/
|
*/
|
||||||
void SingleLineProperties::draw(QPainter *painter, QET::ConductorSegmentType direction, const QRectF &rect) {
|
void SingleLineProperties::draw(QPainter *painter,
|
||||||
|
QET::ConductorSegmentType direction,
|
||||||
|
const QRectF &rect) {
|
||||||
// s'il n'y a rien a dessiner, on retourne immediatement
|
// s'il n'y a rien a dessiner, on retourne immediatement
|
||||||
if (!hasNeutral && !hasGround && !phases) return;
|
if (!hasNeutral && !hasGround && !phases) return;
|
||||||
|
|
||||||
@@ -116,7 +118,10 @@ void SingleLineProperties::draw(QPainter *painter, QET::ConductorSegmentType dir
|
|||||||
@param center centre du segment
|
@param center centre du segment
|
||||||
@param size taille du segment
|
@param size taille du segment
|
||||||
*/
|
*/
|
||||||
void SingleLineProperties::drawGround(QPainter *painter, QET::ConductorSegmentType direction, QPointF center, qreal size) {
|
void SingleLineProperties::drawGround(QPainter *painter,
|
||||||
|
QET::ConductorSegmentType direction,
|
||||||
|
QPointF center,
|
||||||
|
qreal size) {
|
||||||
painter -> save();
|
painter -> save();
|
||||||
|
|
||||||
// prepare le QPainter
|
// prepare le QPainter
|
||||||
@@ -148,7 +153,10 @@ void SingleLineProperties::drawGround(QPainter *painter, QET::ConductorSegmentTy
|
|||||||
@param center centre du cercle
|
@param center centre du cercle
|
||||||
@param size diametre du cercle
|
@param size diametre du cercle
|
||||||
*/
|
*/
|
||||||
void SingleLineProperties::drawNeutral(QPainter *painter, QET::ConductorSegmentType direction, QPointF center, qreal size) {
|
void SingleLineProperties::drawNeutral(QPainter *painter,
|
||||||
|
QET::ConductorSegmentType direction,
|
||||||
|
QPointF center,
|
||||||
|
qreal size) {
|
||||||
Q_UNUSED(direction);
|
Q_UNUSED(direction);
|
||||||
painter -> save();
|
painter -> save();
|
||||||
|
|
||||||
@@ -172,7 +180,10 @@ void SingleLineProperties::drawNeutral(QPainter *painter, QET::ConductorSegmentT
|
|||||||
center, using a size hint of \a size.
|
center, using a size hint of \a size.
|
||||||
@param direction Indicate the direction of the underlying conductor segment
|
@param direction Indicate the direction of the underlying conductor segment
|
||||||
*/
|
*/
|
||||||
void SingleLineProperties::drawPen(QPainter *painter, QET::ConductorSegmentType direction, QPointF center, qreal size) {
|
void SingleLineProperties::drawPen(QPainter *painter,
|
||||||
|
QET::ConductorSegmentType direction,
|
||||||
|
QPointF center,
|
||||||
|
qreal size) {
|
||||||
painter -> save();
|
painter -> save();
|
||||||
|
|
||||||
//painter -> setBrush(Qt::white);
|
//painter -> setBrush(Qt::white);
|
||||||
@@ -822,7 +833,8 @@ int SingleLineProperties::operator!=(const SingleLineProperties &other) const {
|
|||||||
@param settings Parametres a ecrire
|
@param settings Parametres a ecrire
|
||||||
@param prefix prefix a ajouter devant les noms des parametres
|
@param prefix prefix a ajouter devant les noms des parametres
|
||||||
*/
|
*/
|
||||||
void SingleLineProperties::toSettings(QSettings &settings, const QString &prefix) const {
|
void SingleLineProperties::toSettings(QSettings &settings,
|
||||||
|
const QString &prefix) const {
|
||||||
settings.setValue(prefix + "hasGround", hasGround);
|
settings.setValue(prefix + "hasGround", hasGround);
|
||||||
settings.setValue(prefix + "hasNeutral", hasNeutral);
|
settings.setValue(prefix + "hasNeutral", hasNeutral);
|
||||||
settings.setValue(prefix + "phases", phases);
|
settings.setValue(prefix + "phases", phases);
|
||||||
@@ -833,7 +845,8 @@ void SingleLineProperties::toSettings(QSettings &settings, const QString &prefix
|
|||||||
@param settings Parametres a lire
|
@param settings Parametres a lire
|
||||||
@param prefix prefix a ajouter devant les noms des parametres
|
@param prefix prefix a ajouter devant les noms des parametres
|
||||||
*/
|
*/
|
||||||
void SingleLineProperties::fromSettings(QSettings &settings, const QString &prefix) {
|
void SingleLineProperties::fromSettings(QSettings &settings,
|
||||||
|
const QString &prefix) {
|
||||||
hasGround = settings.value(prefix + "hasGround", true).toBool();
|
hasGround = settings.value(prefix + "hasGround", true).toBool();
|
||||||
hasNeutral = settings.value(prefix + "hasNeutral", true).toBool();
|
hasNeutral = settings.value(prefix + "hasNeutral", true).toBool();
|
||||||
phases = settings.value(prefix + "phases", 1).toInt();
|
phases = settings.value(prefix + "phases", 1).toInt();
|
||||||
|
|||||||
@@ -39,7 +39,9 @@
|
|||||||
else edit the properties by default of QElectroTech
|
else edit the properties by default of QElectroTech
|
||||||
@param parent, parent widget
|
@param parent, parent widget
|
||||||
*/
|
*/
|
||||||
NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectPropertiesDialog *ppd) :
|
NewDiagramPage::NewDiagramPage(QETProject *project,
|
||||||
|
QWidget *parent,
|
||||||
|
ProjectPropertiesDialog *ppd) :
|
||||||
ConfigPage (parent),
|
ConfigPage (parent),
|
||||||
ppd_ (ppd),
|
ppd_ (ppd),
|
||||||
m_project (project)
|
m_project (project)
|
||||||
@@ -50,9 +52,15 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp
|
|||||||
bpw = new BorderPropertiesWidget(BorderProperties::defaultProperties());
|
bpw = new BorderPropertiesWidget(BorderProperties::defaultProperties());
|
||||||
// default titleblock properties
|
// default titleblock properties
|
||||||
QList <TitleBlockTemplatesCollection *> c;
|
QList <TitleBlockTemplatesCollection *> c;
|
||||||
c << QETApp::commonTitleBlockTemplatesCollection() << QETApp::customTitleBlockTemplatesCollection();
|
c << QETApp::commonTitleBlockTemplatesCollection()
|
||||||
|
<< QETApp::customTitleBlockTemplatesCollection();
|
||||||
if (m_project) c << m_project->embeddedTitleBlockTemplatesCollection();
|
if (m_project) c << m_project->embeddedTitleBlockTemplatesCollection();
|
||||||
ipw = new TitleBlockPropertiesWidget(c, TitleBlockProperties::defaultProperties(), true, project, parent);
|
ipw = new TitleBlockPropertiesWidget(
|
||||||
|
c,
|
||||||
|
TitleBlockProperties::defaultProperties(),
|
||||||
|
true,
|
||||||
|
project,
|
||||||
|
parent);
|
||||||
// default conductor properties
|
// default conductor properties
|
||||||
m_cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
|
m_cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
|
||||||
m_cpw->setHiddenAvailableAutonum(true);
|
m_cpw->setHiddenAvailableAutonum(true);
|
||||||
@@ -63,11 +71,11 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp
|
|||||||
|
|
||||||
//If there is a project, we edit his properties
|
//If there is a project, we edit his properties
|
||||||
if (m_project) {
|
if (m_project) {
|
||||||
bpw -> setProperties (m_project -> defaultBorderProperties());
|
bpw -> setProperties (m_project -> defaultBorderProperties());
|
||||||
m_cpw -> setProperties (m_project -> defaultConductorProperties());
|
m_cpw -> setProperties (m_project -> defaultConductorProperties());
|
||||||
ipw -> setProperties (m_project -> defaultTitleBlockProperties());
|
ipw -> setProperties (m_project -> defaultTitleBlockProperties());
|
||||||
rpw -> setReportProperties (m_project -> defaultReportProperties());
|
rpw -> setReportProperties (m_project -> defaultReportProperties());
|
||||||
xrefpw -> setProperties (m_project -> defaultXRefProperties());
|
xrefpw -> setProperties (m_project -> defaultXRefProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ class NewDiagramPage : public ConfigPage {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// constructors, destructor
|
// constructors, destructor
|
||||||
public:
|
public:
|
||||||
NewDiagramPage(QETProject *project = nullptr, QWidget * = nullptr, ProjectPropertiesDialog *teste = nullptr);
|
NewDiagramPage(QETProject *project = nullptr,
|
||||||
|
QWidget * = nullptr,
|
||||||
|
ProjectPropertiesDialog *teste = nullptr);
|
||||||
~NewDiagramPage() override;
|
~NewDiagramPage() override;
|
||||||
private:
|
private:
|
||||||
NewDiagramPage(const NewDiagramPage &);
|
NewDiagramPage(const NewDiagramPage &);
|
||||||
|
|||||||
@@ -28,7 +28,9 @@
|
|||||||
* la zone exportee est le schema avec son cadre et son cartouche
|
* la zone exportee est le schema avec son cadre et son cartouche
|
||||||
*/
|
*/
|
||||||
ExportProperties::ExportProperties() :
|
ExportProperties::ExportProperties() :
|
||||||
destination_directory(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)),
|
destination_directory(
|
||||||
|
QStandardPaths::writableLocation(
|
||||||
|
QStandardPaths::DesktopLocation)),
|
||||||
format("PNG"),
|
format("PNG"),
|
||||||
draw_grid(false),
|
draw_grid(false),
|
||||||
draw_border(true),
|
draw_border(true),
|
||||||
@@ -50,15 +52,25 @@ ExportProperties::~ExportProperties() {
|
|||||||
@param settings Parametres a ecrire
|
@param settings Parametres a ecrire
|
||||||
@param prefix prefixe a ajouter devant les noms des parametres
|
@param prefix prefixe a ajouter devant les noms des parametres
|
||||||
*/
|
*/
|
||||||
void ExportProperties::toSettings(QSettings &settings, const QString &prefix) const {
|
void ExportProperties::toSettings(QSettings &settings,
|
||||||
settings.setValue(prefix + "path", QDir::toNativeSeparators(destination_directory.absolutePath()));
|
const QString &prefix) const {
|
||||||
settings.setValue(prefix + "format", format);
|
settings.setValue(prefix + "path",
|
||||||
settings.setValue(prefix + "drawgrid", draw_grid);
|
QDir::toNativeSeparators(
|
||||||
settings.setValue(prefix + "drawborder", draw_border);
|
destination_directory.absolutePath()));
|
||||||
settings.setValue(prefix + "drawtitleblock", draw_titleblock);
|
settings.setValue(prefix + "format",
|
||||||
settings.setValue(prefix + "drawterminals", draw_terminals);
|
format);
|
||||||
settings.setValue(prefix + "drawcoloredconductors", draw_colored_conductors);
|
settings.setValue(prefix + "drawgrid",
|
||||||
settings.setValue(prefix + "area", QET::diagramAreaToString(exported_area));
|
draw_grid);
|
||||||
|
settings.setValue(prefix + "drawborder",
|
||||||
|
draw_border);
|
||||||
|
settings.setValue(prefix + "drawtitleblock",
|
||||||
|
draw_titleblock);
|
||||||
|
settings.setValue(prefix + "drawterminals",
|
||||||
|
draw_terminals);
|
||||||
|
settings.setValue(prefix + "drawcoloredconductors",
|
||||||
|
draw_colored_conductors);
|
||||||
|
settings.setValue(prefix + "area",
|
||||||
|
QET::diagramAreaToString(exported_area));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,20 +78,35 @@ void ExportProperties::toSettings(QSettings &settings, const QString &prefix) co
|
|||||||
@param settings Parametres a lire
|
@param settings Parametres a lire
|
||||||
@param prefix prefixe a ajouter devant les noms des parametres
|
@param prefix prefixe a ajouter devant les noms des parametres
|
||||||
*/
|
*/
|
||||||
void ExportProperties::fromSettings(QSettings &settings, const QString &prefix) {
|
void ExportProperties::fromSettings(QSettings &settings,
|
||||||
QString desktop_path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
const QString &prefix) {
|
||||||
destination_directory.setPath(settings.value(prefix + "path", desktop_path).toString());
|
QString desktop_path = QStandardPaths::writableLocation(
|
||||||
if (!destination_directory.exists()) destination_directory.setPath(desktop_path);
|
QStandardPaths::DesktopLocation);
|
||||||
|
destination_directory.setPath(
|
||||||
|
settings.value(
|
||||||
|
prefix + "path",
|
||||||
|
desktop_path).toString());
|
||||||
|
if (!destination_directory.exists())
|
||||||
|
destination_directory.setPath(desktop_path);
|
||||||
|
|
||||||
format = settings.value(prefix + "format").toString();
|
format = settings.value(prefix + "format").toString();
|
||||||
|
|
||||||
draw_grid = settings.value(prefix + "drawgrid", false).toBool();
|
draw_grid = settings.value(prefix + "drawgrid",
|
||||||
draw_border = settings.value(prefix + "drawborder", true ).toBool();
|
false).toBool();
|
||||||
draw_titleblock = settings.value(prefix + "drawtitleblock", true ).toBool();
|
draw_border = settings.value(prefix + "drawborder",
|
||||||
draw_terminals = settings.value(prefix + "drawterminals", false).toBool();
|
true ).toBool();
|
||||||
draw_colored_conductors = settings.value(prefix + "drawcoloredconductors", true ).toBool();
|
draw_titleblock = settings.value(prefix + "drawtitleblock",
|
||||||
|
true ).toBool();
|
||||||
exported_area = QET::diagramAreaFromString(settings.value(prefix + "area", "border").toString());
|
draw_terminals = settings.value(prefix + "drawterminals",
|
||||||
|
false).toBool();
|
||||||
|
draw_colored_conductors = settings.value(
|
||||||
|
prefix + "drawcoloredconductors",
|
||||||
|
true ).toBool();
|
||||||
|
|
||||||
|
exported_area = QET::diagramAreaFromString(
|
||||||
|
settings.value(
|
||||||
|
prefix + "area",
|
||||||
|
"border").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -163,7 +163,9 @@ bool QET::lineContainsPoint(const QLineF &line, const QPointF &point) {
|
|||||||
@return true si le projete orthogonal du point sur la droite appartient au
|
@return true si le projete orthogonal du point sur la droite appartient au
|
||||||
segment de droite.
|
segment de droite.
|
||||||
*/
|
*/
|
||||||
bool QET::orthogonalProjection(const QPointF &point, const QLineF &line, QPointF *intersection) {
|
bool QET::orthogonalProjection(const QPointF &point,
|
||||||
|
const QLineF &line,
|
||||||
|
QPointF *intersection) {
|
||||||
// recupere le vecteur normal de `line'
|
// recupere le vecteur normal de `line'
|
||||||
QLineF line_normal_vector(line.normalVector());
|
QLineF line_normal_vector(line.normalVector());
|
||||||
QPointF normal_vector(line_normal_vector.dx(), line_normal_vector.dy());
|
QPointF normal_vector(line_normal_vector.dx(), line_normal_vector.dy());
|
||||||
@@ -174,10 +176,12 @@ bool QET::orthogonalProjection(const QPointF &point, const QLineF &line, QPointF
|
|||||||
// determine le point d'intersection des deux droites = le projete orthogonal
|
// determine le point d'intersection des deux droites = le projete orthogonal
|
||||||
QPointF intersection_point;
|
QPointF intersection_point;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
QLineF::IntersectType it = line.intersect(perpendicular_line, &intersection_point); // ### Qt 6: remove
|
QLineF::IntersectType it = line.intersect(perpendicular_line,
|
||||||
|
&intersection_point); // ### Qt 6: remove
|
||||||
#else
|
#else
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QLineF::IntersectType it = line.intersects(perpendicular_line, &intersection_point);
|
QLineF::IntersectType it = line.intersects(perpendicular_line,
|
||||||
|
&intersection_point);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ne devrait pas arriver (mais bon...)
|
// ne devrait pas arriver (mais bon...)
|
||||||
@@ -203,7 +207,9 @@ bool QET::orthogonalProjection(const QPointF &point, const QLineF &line, QPointF
|
|||||||
@param entier Pointeur facultatif vers un entier
|
@param entier Pointeur facultatif vers un entier
|
||||||
@return true si l'attribut est bien un entier, false sinon
|
@return true si l'attribut est bien un entier, false sinon
|
||||||
*/
|
*/
|
||||||
bool QET::attributeIsAnInteger(const QDomElement &e, const QString& nom_attribut, int *entier) {
|
bool QET::attributeIsAnInteger(const QDomElement &e,
|
||||||
|
const QString& nom_attribut,
|
||||||
|
int *entier) {
|
||||||
// verifie la presence de l'attribut
|
// verifie la presence de l'attribut
|
||||||
if (!e.hasAttribute(nom_attribut)) return(false);
|
if (!e.hasAttribute(nom_attribut)) return(false);
|
||||||
// verifie la validite de l'attribut
|
// verifie la validite de l'attribut
|
||||||
@@ -222,7 +228,9 @@ bool QET::attributeIsAnInteger(const QDomElement &e, const QString& nom_attribut
|
|||||||
@param reel Pointeur facultatif vers un double
|
@param reel Pointeur facultatif vers un double
|
||||||
@return true si l'attribut est bien un reel, false sinon
|
@return true si l'attribut est bien un reel, false sinon
|
||||||
*/
|
*/
|
||||||
bool QET::attributeIsAReal(const QDomElement &e, const QString& nom_attribut, qreal *reel) {
|
bool QET::attributeIsAReal(const QDomElement &e,
|
||||||
|
const QString& nom_attribut,
|
||||||
|
qreal *reel) {
|
||||||
// verifie la presence de l'attribut
|
// verifie la presence de l'attribut
|
||||||
if (!e.hasAttribute(nom_attribut)) return(false);
|
if (!e.hasAttribute(nom_attribut)) return(false);
|
||||||
// verifie la validite de l'attribut
|
// verifie la validite de l'attribut
|
||||||
@@ -243,7 +251,13 @@ bool QET::attributeIsAReal(const QDomElement &e, const QString& nom_attribut, qr
|
|||||||
@return la proposition decrivant le nombre d'elements, de conducteurs et de
|
@return la proposition decrivant le nombre d'elements, de conducteurs et de
|
||||||
textes
|
textes
|
||||||
*/
|
*/
|
||||||
QString QET::ElementsAndConductorsSentence(int elements_count, int conductors_count, int texts_count, int images_count, int shapes_count, int element_text_count, int tables_count)
|
QString QET::ElementsAndConductorsSentence(int elements_count,
|
||||||
|
int conductors_count,
|
||||||
|
int texts_count,
|
||||||
|
int images_count,
|
||||||
|
int shapes_count,
|
||||||
|
int element_text_count,
|
||||||
|
int tables_count)
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
if (elements_count) {
|
if (elements_count) {
|
||||||
@@ -331,7 +345,9 @@ QList<QDomElement> QET::findInDomElement(const QDomElement &e, const QString &ta
|
|||||||
@param children tag XML a rechercher
|
@param children tag XML a rechercher
|
||||||
@return La liste des elements XML children
|
@return La liste des elements XML children
|
||||||
*/
|
*/
|
||||||
QList<QDomElement> QET::findInDomElement(const QDomElement &e, const QString &parent, const QString &children) {
|
QList<QDomElement> QET::findInDomElement(const QDomElement &e,
|
||||||
|
const QString &parent,
|
||||||
|
const QString &children) {
|
||||||
QList<QDomElement> return_list;
|
QList<QDomElement> return_list;
|
||||||
|
|
||||||
// parcours des elements parents
|
// parcours des elements parents
|
||||||
|
|||||||
Reference in New Issue
Block a user