mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +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 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
|
||||
if (!hasNeutral && !hasGround && !phases) return;
|
||||
|
||||
@@ -116,7 +118,10 @@ void SingleLineProperties::draw(QPainter *painter, QET::ConductorSegmentType dir
|
||||
@param center centre 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();
|
||||
|
||||
// prepare le QPainter
|
||||
@@ -148,7 +153,10 @@ void SingleLineProperties::drawGround(QPainter *painter, QET::ConductorSegmentTy
|
||||
@param center centre 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);
|
||||
painter -> save();
|
||||
|
||||
@@ -172,7 +180,10 @@ void SingleLineProperties::drawNeutral(QPainter *painter, QET::ConductorSegmentT
|
||||
center, using a size hint of \a size.
|
||||
@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 -> setBrush(Qt::white);
|
||||
@@ -822,7 +833,8 @@ int SingleLineProperties::operator!=(const SingleLineProperties &other) const {
|
||||
@param settings Parametres a ecrire
|
||||
@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 + "hasNeutral", hasNeutral);
|
||||
settings.setValue(prefix + "phases", phases);
|
||||
@@ -833,7 +845,8 @@ void SingleLineProperties::toSettings(QSettings &settings, const QString &prefix
|
||||
@param settings Parametres a lire
|
||||
@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();
|
||||
hasNeutral = settings.value(prefix + "hasNeutral", true).toBool();
|
||||
phases = settings.value(prefix + "phases", 1).toInt();
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
else edit the properties by default of QElectroTech
|
||||
@param parent, parent widget
|
||||
*/
|
||||
NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectPropertiesDialog *ppd) :
|
||||
NewDiagramPage::NewDiagramPage(QETProject *project,
|
||||
QWidget *parent,
|
||||
ProjectPropertiesDialog *ppd) :
|
||||
ConfigPage (parent),
|
||||
ppd_ (ppd),
|
||||
m_project (project)
|
||||
@@ -50,9 +52,15 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp
|
||||
bpw = new BorderPropertiesWidget(BorderProperties::defaultProperties());
|
||||
// default titleblock properties
|
||||
QList <TitleBlockTemplatesCollection *> c;
|
||||
c << QETApp::commonTitleBlockTemplatesCollection() << QETApp::customTitleBlockTemplatesCollection();
|
||||
c << QETApp::commonTitleBlockTemplatesCollection()
|
||||
<< QETApp::customTitleBlockTemplatesCollection();
|
||||
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
|
||||
m_cpw = new ConductorPropertiesWidget(ConductorProperties::defaultProperties());
|
||||
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 (m_project) {
|
||||
bpw -> setProperties (m_project -> defaultBorderProperties());
|
||||
m_cpw -> setProperties (m_project -> defaultConductorProperties());
|
||||
ipw -> setProperties (m_project -> defaultTitleBlockProperties());
|
||||
rpw -> setReportProperties (m_project -> defaultReportProperties());
|
||||
xrefpw -> setProperties (m_project -> defaultXRefProperties());
|
||||
bpw -> setProperties (m_project -> defaultBorderProperties());
|
||||
m_cpw -> setProperties (m_project -> defaultConductorProperties());
|
||||
ipw -> setProperties (m_project -> defaultTitleBlockProperties());
|
||||
rpw -> setReportProperties (m_project -> defaultReportProperties());
|
||||
xrefpw -> setProperties (m_project -> defaultXRefProperties());
|
||||
}
|
||||
|
||||
connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab()));
|
||||
|
||||
@@ -39,7 +39,9 @@ class NewDiagramPage : public ConfigPage {
|
||||
Q_OBJECT
|
||||
// constructors, destructor
|
||||
public:
|
||||
NewDiagramPage(QETProject *project = nullptr, QWidget * = nullptr, ProjectPropertiesDialog *teste = nullptr);
|
||||
NewDiagramPage(QETProject *project = nullptr,
|
||||
QWidget * = nullptr,
|
||||
ProjectPropertiesDialog *teste = nullptr);
|
||||
~NewDiagramPage() override;
|
||||
private:
|
||||
NewDiagramPage(const NewDiagramPage &);
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
* la zone exportee est le schema avec son cadre et son cartouche
|
||||
*/
|
||||
ExportProperties::ExportProperties() :
|
||||
destination_directory(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)),
|
||||
destination_directory(
|
||||
QStandardPaths::writableLocation(
|
||||
QStandardPaths::DesktopLocation)),
|
||||
format("PNG"),
|
||||
draw_grid(false),
|
||||
draw_border(true),
|
||||
@@ -50,15 +52,25 @@ ExportProperties::~ExportProperties() {
|
||||
@param settings Parametres a ecrire
|
||||
@param prefix prefixe a ajouter devant les noms des parametres
|
||||
*/
|
||||
void ExportProperties::toSettings(QSettings &settings, const QString &prefix) const {
|
||||
settings.setValue(prefix + "path", QDir::toNativeSeparators(destination_directory.absolutePath()));
|
||||
settings.setValue(prefix + "format", format);
|
||||
settings.setValue(prefix + "drawgrid", 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));
|
||||
void ExportProperties::toSettings(QSettings &settings,
|
||||
const QString &prefix) const {
|
||||
settings.setValue(prefix + "path",
|
||||
QDir::toNativeSeparators(
|
||||
destination_directory.absolutePath()));
|
||||
settings.setValue(prefix + "format",
|
||||
format);
|
||||
settings.setValue(prefix + "drawgrid",
|
||||
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 prefix prefixe a ajouter devant les noms des parametres
|
||||
*/
|
||||
void ExportProperties::fromSettings(QSettings &settings, const QString &prefix) {
|
||||
QString desktop_path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||
destination_directory.setPath(settings.value(prefix + "path", desktop_path).toString());
|
||||
if (!destination_directory.exists()) destination_directory.setPath(desktop_path);
|
||||
|
||||
void ExportProperties::fromSettings(QSettings &settings,
|
||||
const QString &prefix) {
|
||||
QString desktop_path = QStandardPaths::writableLocation(
|
||||
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();
|
||||
|
||||
draw_grid = settings.value(prefix + "drawgrid", false).toBool();
|
||||
draw_border = settings.value(prefix + "drawborder", true ).toBool();
|
||||
draw_titleblock = settings.value(prefix + "drawtitleblock", true ).toBool();
|
||||
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());
|
||||
|
||||
draw_grid = settings.value(prefix + "drawgrid",
|
||||
false).toBool();
|
||||
draw_border = settings.value(prefix + "drawborder",
|
||||
true ).toBool();
|
||||
draw_titleblock = settings.value(prefix + "drawtitleblock",
|
||||
true ).toBool();
|
||||
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
|
||||
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'
|
||||
QLineF line_normal_vector(line.normalVector());
|
||||
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
|
||||
QPointF intersection_point;
|
||||
#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
|
||||
#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
|
||||
|
||||
// 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
|
||||
@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
|
||||
if (!e.hasAttribute(nom_attribut)) return(false);
|
||||
// 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
|
||||
@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
|
||||
if (!e.hasAttribute(nom_attribut)) return(false);
|
||||
// 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
|
||||
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;
|
||||
if (elements_count) {
|
||||
@@ -331,7 +345,9 @@ QList<QDomElement> QET::findInDomElement(const QDomElement &e, const QString &ta
|
||||
@param children tag XML a rechercher
|
||||
@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;
|
||||
|
||||
// parcours des elements parents
|
||||
|
||||
Reference in New Issue
Block a user