diff --git a/sources/diagramfoliolist.cpp b/sources/diagramfoliolist.cpp
deleted file mode 100644
index 4120fc240..000000000
--- a/sources/diagramfoliolist.cpp
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- Copyright 2006-2020 The QElectroTech Team
- This file is part of QElectroTech.
-
- QElectroTech is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- QElectroTech is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with QElectroTech. If not, see .
-*/
-#include "diagramfoliolist.h"
-#include
-#include "qetapp.h"
-
-qreal DiagramFolioList::colWidths[7] = {0.05, 0.50, 0.10, 0.10, 0.05, 0.10, 0.10};
-
-/**
- * @brief DiagramFolioList::DiagramFolioList
- * Constructor
- * @param project : The project of this diagram and also parent QObject
- */
-DiagramFolioList::DiagramFolioList( QETProject *project) :
- Diagram(project)
-{
- id = project -> getFolioSheetsQuantity();
-}
-
-/**
- * @brief DiagramFolioList::~DiagramFolioList
- * Destructor
- */
-DiagramFolioList::~DiagramFolioList()
-{
- qDeleteAll (list_lines_);
- qDeleteAll (list_rectangles_);
- int folioSheetQty = project() -> getFolioSheetsQuantity();
- if (folioSheetQty > 0)
- project() -> setFolioSheetsQuantity(folioSheetQty-1);
-}
-
-/**
- * @brief DiagramFolioList::drawBackground
- * Draw background, and call method to draw the folio list (grid)
- * @param p painter to use
- * @param r rectangle where we paint
- */
-void DiagramFolioList::drawBackground(QPainter *p, const QRectF &r)
-{
- p -> save();
- QSettings settings;
- // disable all antialiasing, except for the texts
- p -> setRenderHint(QPainter::Antialiasing, false);
- p -> setRenderHint(QPainter::TextAntialiasing, true);
- p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
-
- // draw white background
- p -> setPen(Qt::NoPen);
- p -> setBrush(Diagram::background_color);
- p -> drawRect(r);
- p -> setPen(Qt::black);
-
- qreal width = border_and_titleblock.columnsTotalWidth();
- qreal height = border_and_titleblock.rowsTotalHeight();
-
- //top left corner of drawable area
- qreal x0 = border_and_titleblock.rowsHeaderWidth();
- qreal y0 = border_and_titleblock.columnsHeaderHeight();
- QRectF row_RectBorder(x0, y0, width, height);
-
- buildGrid(p, row_RectBorder,30,1,colWidths);
-
- x0 = list_rectangles_[0] -> topLeft().x();
- y0 = list_rectangles_[0] -> topLeft().y();
-
- qreal rowHeight = (list_rectangles_[0] -> height())/30;
- QRectF row_RectF(x0, y0, list_rectangles_[0] -> width(), rowHeight);
-
- fillHeader(p, row_RectF);
- QList diagram_list = project() -> diagrams();
-
- int startDiagram = id * 29;
- for (int i = startDiagram; i < startDiagram+29 && i < diagram_list.size(); ++i) {
- y0 += rowHeight;
- QRectF row_rect(x0, y0, list_rectangles_[0] -> width(), rowHeight);
- if (settings.value("genericpanel/folio", true).toBool()){
- fillRow(p, row_rect, diagram_list[i] -> border_and_titleblock.author(),
- diagram_list[i] -> title(),
- diagram_list[i] -> border_and_titleblock.finalfolio(),
- diagram_list[i] -> border_and_titleblock.plant(),
- diagram_list[i] -> border_and_titleblock.locmach(),
- diagram_list[i] -> border_and_titleblock.indexrev(),
- diagram_list[i] -> border_and_titleblock.date().toString(Qt::SystemLocaleShortDate));
- }else{
- fillRow(p, row_rect, diagram_list[i] -> border_and_titleblock.author(),
- diagram_list[i] -> title(),
- QString::number(diagram_list[i] ->folioIndex()+1),
- diagram_list[i] -> border_and_titleblock.plant(),
- diagram_list[i] -> border_and_titleblock.locmach(),
- diagram_list[i] -> border_and_titleblock.indexrev(),
- diagram_list[i] -> border_and_titleblock.date().toString(Qt::SystemLocaleShortDate));
- }
-
- }
-
- border_and_titleblock.draw(p);
- p -> restore();
-}
-
-/**
- * @brief DiagramFolioList::fillRow
- * Add new row and fill it with the given information.
- * @param qp Qpainter to use
- * @param row_rect rectangle where we must draw the new row
- */
-void DiagramFolioList::fillRow(QPainter *qp, const QRectF &row_rect, const QString& author, const QString& title,
- const QString& folio, const QString& plant, const QString& loc, const QString& indexrev, const QString& date)
-{
- qreal x = row_rect.topLeft().x();
- qreal y = row_rect.topLeft().y();
- QSettings settings;
-
-
- QFontMetrics origFontMetrics(QETApp::foliolistTextsFont());
- qreal origFontSize = QETApp::foliolistTextsFont().pointSizeF();
- QFont workingFont(QETApp::foliolistTextsFont());
-
- if (settings.value("genericpanel/folio", true).toBool()){
- // reduce the font size if the text entry is long
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(folio) > 0.95*colWidths[0]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[0]*row_rect.width() / origFontMetrics.width(folio));
-#else
- if (origFontMetrics.horizontalAdvance(folio) > 0.95*colWidths[0]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[0]*row_rect.width() / origFontMetrics.horizontalAdvance(folio));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- qp -> drawText(QRectF(x, y, colWidths[0]*row_rect.width(), row_rect.height()), Qt::AlignCenter, folio);
-
- x += colWidths[0]*row_rect.width();
- }else{
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(folio) > 0.95*colWidths[0]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[0]*row_rect.width() / origFontMetrics.width(folio));
-#else
- if (origFontMetrics.horizontalAdvance(folio) > 0.95*colWidths[0]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[0]*row_rect.width() / origFontMetrics.horizontalAdvance(folio));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- qp -> drawText(QRectF(x, y, colWidths[0]*row_rect.width(), row_rect.height()), Qt::AlignCenter, folio);
- x += colWidths[0]*row_rect.width();
- }
-
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(title) > 0.95*colWidths[1]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[1]*row_rect.width() / origFontMetrics.width(title));
-#else
- if (origFontMetrics.horizontalAdvance(title) > 0.95*colWidths[1]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[1]*row_rect.width() / origFontMetrics.horizontalAdvance(title));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- QString heading = QObject::tr("Titre");
- if (title == heading)
- qp -> drawText(QRectF(x, y, colWidths[1]*row_rect.width(),row_rect.height()), Qt::AlignCenter, title);
- else
- qp -> drawText(QRectF(x+0.01*row_rect.width(), y, colWidths[1]*row_rect.width()*10.2,
- row_rect.height()), Qt::AlignLeft | Qt::AlignVCenter, title);
- x += colWidths[1]*row_rect.width();
-
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(plant) > 0.95*colWidths[2]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[2]*row_rect.width() / origFontMetrics.width(plant));
-#else
- if (origFontMetrics.horizontalAdvance(plant) > 0.95*colWidths[2]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[2]*row_rect.width() / origFontMetrics.horizontalAdvance(plant));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- qp -> drawText(QRectF(x, y, colWidths[3]*row_rect.width(), row_rect.height()), Qt::AlignCenter, plant);
- x += colWidths[2]*row_rect.width();
-
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(loc) > 0.95*colWidths[3]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[3]*row_rect.width() / origFontMetrics.width(loc));
-#else
- if (origFontMetrics.horizontalAdvance(loc) > 0.95*colWidths[3]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[3]*row_rect.width() / origFontMetrics.horizontalAdvance(loc));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- qp -> drawText(QRectF(x, y, colWidths[3]*row_rect.width(), row_rect.height()), Qt::AlignCenter, loc);
- x += colWidths[3]*row_rect.width();
-
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(indexrev) > 0.95*colWidths[4]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[4]*row_rect.width() / origFontMetrics.width(indexrev));
-#else
- if (origFontMetrics.horizontalAdvance(indexrev) > 0.95*colWidths[4]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[4]*row_rect.width() / origFontMetrics.horizontalAdvance(indexrev));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- qp -> drawText(QRectF(x, y, colWidths[4]*row_rect.width(), row_rect.height()), Qt::AlignCenter, indexrev);
- x += colWidths[4]*row_rect.width();
-
-
-
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(author) > 0.95*colWidths[5]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[5]*row_rect.width() / origFontMetrics.width(author));
-#else
- if (origFontMetrics.horizontalAdvance(author) > 0.95*colWidths[5]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[5]*row_rect.width() / origFontMetrics.horizontalAdvance(author));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- qp -> drawText(QRectF(x, y, colWidths[6]*row_rect.width(), row_rect.height()), Qt::AlignCenter, author);
- x += colWidths[5]*row_rect.width();
-
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) // ### Qt 6: remove
- if (origFontMetrics.width(date) > 0.95*colWidths[6]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[6]*row_rect.width() / origFontMetrics.width(date));
-#else
- if (origFontMetrics.horizontalAdvance(date) > 0.95*colWidths[6]*row_rect.width())
- workingFont.setPointSizeF(origFontSize * 0.95*colWidths[6]*row_rect.width() / origFontMetrics.horizontalAdvance(date));
-#endif
- else
- workingFont.setPointSizeF(origFontSize);
- qp -> setFont(workingFont);
- qp -> drawText(QRectF(x, y, colWidths[6]*row_rect.width(), row_rect.height()), Qt::AlignCenter, date);
-}
-
-void DiagramFolioList::buildGrid(QPainter *qp, const QRectF &rect, int rows, int tables, qreal colWidths[])
-{
- qDeleteAll (list_lines_);
- list_lines_.clear();
- qDeleteAll (list_rectangles_);
- list_rectangles_.clear();
-
- qreal sum = 0;
- for (int i = 0; i < 7; i++ )
- sum += colWidths[i];
- if ( sum < 0.99 || sum > 1.01 ) {
- qDebug() << "Invalid input: Column widths do not sum to 1";
- return;
- }
-
- qreal tablesSpacing = rect.height() * 0.02;
- qreal tableWidth = (rect.width() - tablesSpacing*(tables+1) ) / tables;
- qreal rowHeight = (rect.height() - 2*tablesSpacing) / rows;
- int cols = 7;//colWidths.size();
-
- qreal x0 = tablesSpacing + rect.topLeft().x();
- qreal y0 = tablesSpacing + rect.topLeft().y();
-
- for (int i = 0; i < tables; ++i) {
- QRectF *tableRect = new QRectF(x0, y0, tableWidth, rect.height() - 2*tablesSpacing);
- qp->drawRect(*tableRect);
- list_rectangles_.push_back(tableRect);
- for (int j = 1; j < rows; ++j) {
- QLineF *line = new QLineF(x0, y0 + j*rowHeight, x0 + tableWidth,y0 + j*rowHeight);
- qp->drawLine(*line);
- list_lines_.push_back(line);
- }
- for (int j = 0; j < cols-1; ++j) {
- QLineF *line = new QLineF(x0 + colWidths[j]*tableWidth, y0, x0 + colWidths[j]*tableWidth,y0 + rows*rowHeight);
- qp->drawLine(*line);
- list_lines_.push_back(line);
- x0 += colWidths[j]*tableWidth;
- }
- x0 += colWidths[cols-1]*tableWidth + tablesSpacing;
- }
-}
-
-/**
- * @brief DiagramFolioList::fillHeader
- * Fill the header with bigger font
- * @param qp the painter to use
- * @param row_RectF rectangle of header
- */
-void DiagramFolioList::fillHeader(QPainter *qp, const QRectF &row_RectF) {
- QString authorTranslatable(QObject::tr("Auteur"));
- QString titleTranslatable(QObject::tr("Titre"));
- QString folioTranslatable(QObject::tr("Folio"));
- QString plantTranslatable(QObject::tr("Installation"));
- QString locTranslatable(QObject::tr("Localisation"));
- QString indexrevTranslatable(QObject::tr("Rev"));
- QString dateTranslatable(QObject::tr("Date"));
-
- qp->save();
- qp->setFont(QETApp::diagramTextsFont(13));
- fillRow(qp, row_RectF, authorTranslatable, titleTranslatable, folioTranslatable, plantTranslatable, locTranslatable, indexrevTranslatable, dateTranslatable);
- qp->restore();
-}
diff --git a/sources/diagramfoliolist.h b/sources/diagramfoliolist.h
deleted file mode 100644
index e7dc018b8..000000000
--- a/sources/diagramfoliolist.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Copyright 2006-2020 The QElectroTech Team
- This file is part of QElectroTech.
-
- QElectroTech is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- QElectroTech is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with QElectroTech. If not, see .
-*/
-#ifndef DIAGRAMFOLIOLIST_H
-#define DIAGRAMFOLIOLIST_H
-
-#include "diagram.h"
-#include "qetgraphicsitem/independenttextitem.h"
-
-class DiagramFolioList : public Diagram
-{
- public:
- DiagramFolioList(QETProject *project);
- ~DiagramFolioList() override;
- virtual QList lines() const {return list_lines_;}
- virtual QList rectangles() const {return list_rectangles_;}
- void setId(int i) {id = i;}
- int getId() const {return id;}
-
- static qreal colWidths[7];
-
- protected:
- void drawBackground(QPainter *, const QRectF &) override;
-
- private:
- void fillRow(QPainter *, const QRectF &, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&);
- void buildGrid(QPainter *, const QRectF &, int, int, qreal[]);
- void fillHeader(QPainter *, const QRectF &);
-
-
- QList list_lines_;
- QList list_rectangles_;
- QRectF sheetRectangle;
- int id;
-
-};
-
-#endif // DIAGRAMFOLIOLIST_H
diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp
index 12c8c442b..759d66531 100644
--- a/sources/exportdialog.cpp
+++ b/sources/exportdialog.cpp
@@ -31,7 +31,6 @@
#include "qetgraphicsitem/independenttextitem.h"
#include "qetgraphicsitem/diagramimageitem.h"
#include "qetgraphicsitem/qetshapeitem.h"
-#include "diagramfoliolist.h"
#include "elementpicturefactory.h"
#include "element.h"
#include "dynamicelementtextitem.h"
@@ -427,62 +426,20 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
//QList list_ellipses;
QList list_shapes;
- DiagramFolioList *ptr = dynamic_cast(diagram);
- if (ptr) {
- list_lines = ptr -> lines();
- list_rectangles = ptr -> rectangles();
- QSettings settings;
-
- // fill the rows with text.
- QString authorTranslatable = tr("Auteur");
- QString titleTranslatable = tr("Titre");
- QString folioTranslatable = tr("Folio");
- QString dateTranslatable = tr("Date");
-
- qreal x0 = list_rectangles[0] -> topLeft().x();
- qreal y0 = list_rectangles[0] -> topLeft().y();
- qreal rowHeight = (list_rectangles[0] -> height())/30;
- QRectF row_RectF(x0, y0, list_rectangles[0] -> width(), rowHeight);
-
- fillRow(file_path, row_RectF, authorTranslatable, titleTranslatable, folioTranslatable, dateTranslatable);
- QList diagram_list = ptr -> project() -> diagrams();
-
- int startDiagram = (ptr -> getId()) *29;
-
- for (int i = startDiagram; i < startDiagram+29 && i < diagram_list.size(); ++i) {
- y0 += rowHeight;
- QRectF row_rect(x0, y0, list_rectangles[0] -> width(), rowHeight);
- if (settings.value("genericpanel/folio", true).toBool()){
- fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(),
- diagram_list[i] -> title(),
- diagram_list[i] -> border_and_titleblock.finalfolio(),
- diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yy"));
-
- }else{
- fillRow(file_path, row_rect, diagram_list[i] -> border_and_titleblock.author(),
- diagram_list[i] -> title(),
- QString::number(diagram_list[i] ->folioIndex()+1),
- diagram_list[i] -> border_and_titleblock.date().toString("dd/MM/yy"));
-
- }
-}
-
- } else {
- // Determine les elements a "XMLiser"
- foreach(QGraphicsItem *qgi, diagram -> items()) {
- if (Element *elmt = qgraphicsitem_cast(qgi)) {
- list_elements << elmt;
- } else if (Conductor *f = qgraphicsitem_cast(qgi)) {
- list_conductors << f;
- } else if (IndependentTextItem *iti = qgraphicsitem_cast(qgi)) {
- list_texts << iti;
- } else if (DiagramImageItem *dii = qgraphicsitem_cast(qgi)) {
- list_images << dii;
- } else if (QetShapeItem *dii = qgraphicsitem_cast(qgi)) {
- list_shapes << dii;
- } else if (DynamicElementTextItem *deti = qgraphicsitem_cast(qgi)) {
- list_texts << deti;
- }
+ // Determine les elements a "XMLiser"
+ foreach(QGraphicsItem *qgi, diagram -> items()) {
+ if (Element *elmt = qgraphicsitem_cast(qgi)) {
+ list_elements << elmt;
+ } else if (Conductor *f = qgraphicsitem_cast(qgi)) {
+ list_conductors << f;
+ } else if (IndependentTextItem *iti = qgraphicsitem_cast(qgi)) {
+ list_texts << iti;
+ } else if (DiagramImageItem *dii = qgraphicsitem_cast(qgi)) {
+ list_images << dii;
+ } else if (QetShapeItem *dii = qgraphicsitem_cast(qgi)) {
+ list_shapes << dii;
+ } else if (DynamicElementTextItem *deti = qgraphicsitem_cast(qgi)) {
+ list_texts << deti;
}
}
@@ -690,43 +647,6 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
saveReloadDiagramParameters(diagram, false);
}
-void ExportDialog::fillRow(const QString& file_path, const QRectF &row_rect, QString author, const QString& title,
- QString folio, QString date)
-{
- qreal x = row_rect.bottomLeft().x();
- qreal y = row_rect.bottomLeft().y();
-
- x *= Createdxf::xScale;
- y = Createdxf::sheetHeight - y * Createdxf::yScale;
- qreal height = row_rect.height() * Createdxf::yScale *0.7;
- y += height*0.2;
-
- Createdxf::drawTextAligned(file_path, std::move(folio),
- x + 0.02*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
- x + 0.95*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, 0);
-
- x += DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale;
- QString heading = tr("Titre");
- if (title == heading)
- Createdxf::drawTextAligned(file_path, title,
- x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
- x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0);
- else
- Createdxf::drawTextAligned(file_path, title,
- x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
- x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0, true);
-
- x += DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale;
- Createdxf::drawTextAligned(file_path, std::move(author),
- x + 0.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
- x + 3.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, 0);
-
- x += DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale;
- Createdxf::drawTextAligned(file_path, std::move(date),
- x + 0.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
- x + 5.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, 0);
-}
-
QPointF ExportDialog::rotation_transformed(qreal px, qreal py , qreal origin_x, qreal origin_y, qreal angle) {
angle *= -3.14159265 / 180;
diff --git a/sources/exportdialog.h b/sources/exportdialog.h
index 2252130b4..81ae6ad11 100644
--- a/sources/exportdialog.h
+++ b/sources/exportdialog.h
@@ -90,7 +90,6 @@ class ExportDialog : public QDialog {
void saveReloadDiagramParameters(Diagram *, bool = true);
void generateSvg(Diagram *, int, int, bool, QIODevice &);
void generateDxf(Diagram *, int, int, bool, QString &);
- void fillRow(const QString&, const QRectF &, QString, const QString&, QString, QString);
QImage generateImage(Diagram *, int, int, bool);
void exportDiagram(ExportDiagramLine *);
qreal diagramRatio(Diagram *);
diff --git a/sources/projectview.cpp b/sources/projectview.cpp
index f93b98310..6340bd0e3 100644
--- a/sources/projectview.cpp
+++ b/sources/projectview.cpp
@@ -29,7 +29,6 @@
#include "qeticons.h"
#include "qetmessagebox.h"
#include "qettemplateeditor.h"
-#include "diagramfoliolist.h"
#include "projectpropertiesdialog.h"
#include "xmlelementcollection.h"
#include "autoNum/assignvariables.h"
@@ -345,21 +344,6 @@ QETResult ProjectView::noProjectResult() const {
return(no_project);
}
-/**
- * @brief ProjectView::addNewDiagramFolioList
- * Add new diagram folio list to project
- */
-void ProjectView::addNewDiagramFolioList() {
- if (m_project -> isReadOnly()) return;
- QSettings settings;
- int i = (settings.value("projectview/foliolist_position").toInt() -1); //< Each new diagram is added to the end of the project.
- //< We use @i to move the folio list at second position in the project
- auto count = m_project->addNewDiagramFolioList().size();
- for (auto j=0 ; jtabBar()->moveTab(diagram_views().size()-1, i);
- }
-}
-
/**
* @brief ProjectView::removeDiagram
* Remove a diagram (folio) of the project
@@ -835,12 +819,6 @@ void ProjectView::loadDiagrams()
}
QSettings settings;
- // If project have the folios list, move it at the beginning of the project
- if (m_project -> getFolioSheetsQuantity()) {
- for (int i = 0; i < m_project->getFolioSheetsQuantity(); i++)
- m_tab -> tabBar() -> moveTab(diagram_views().size()-1, + (settings.value("projectview/foliolist_position").toInt() -1));
- m_project->setModified(false);
- }
}
/**
@@ -899,10 +877,6 @@ void ProjectView::diagramAdded(Diagram *diagram)
// signal diagram view was added
emit(diagramAdded(dv));
m_project->setModified(true);
-
- if (m_project->diagrams().size() % 58 == 1 && m_project->getFolioSheetsQuantity() != 0) {
- addNewDiagramFolioList();
- }
showDiagram(dv);
}
diff --git a/sources/projectview.h b/sources/projectview.h
index a6152f8c7..78381c5f4 100644
--- a/sources/projectview.h
+++ b/sources/projectview.h
@@ -98,7 +98,6 @@ class ProjectView : public QWidget
void changeLastTab();
public slots:
- void addNewDiagramFolioList();
void removeDiagram(DiagramView *);
void removeDiagram(Diagram *);
void showDiagram(DiagramView *);
diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp
index e06ca8abd..fa7b2589a 100644
--- a/sources/qetdiagrameditor.cpp
+++ b/sources/qetdiagrameditor.cpp
@@ -21,7 +21,6 @@
#include "recentfiles.h"
#include "qeticons.h"
#include "qetmessagebox.h"
-#include "diagramfoliolist.h"
#include "diagrampropertieseditordockwidget.h"
#include "diagrameventaddshape.h"
#include "diagrameventaddimage.h"
@@ -379,14 +378,7 @@ void QETDiagramEditor::setUpActions()
}
}
});
-
- //Add folio list to current project
- m_project_folio_list = new QAction(QET::Icons::TableOfContent, tr("Ajouter un sommaire"), this);
- connect(m_project_folio_list, &QAction::triggered, [this]() {
- if (ProjectView *current_project = currentProjectView()) {
- current_project->addNewDiagramFolioList();
- }
- });
+
//Export nomenclature to CSV
m_csv_export = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter au format CSV"), this);
connect(m_csv_export, &QAction::triggered, [this]() {
@@ -774,7 +766,6 @@ void QETDiagramEditor::setUpMenu() {
menu_project -> addAction(m_remove_diagram_from_project);
menu_project -> addAction(m_clean_project);
menu_project -> addSeparator();
- menu_project -> addAction(m_project_folio_list);
menu_project -> addAction(m_add_nomenclature);
menu_project -> addAction(m_add_summary);
menu_project -> addAction(m_csv_export);
@@ -1455,7 +1446,6 @@ void QETDiagramEditor::slot_updateActions()
m_project_add_diagram -> setEnabled(editable_project);
m_remove_diagram_from_project -> setEnabled(editable_project);
m_clean_project -> setEnabled(editable_project);
- m_project_folio_list -> setEnabled(editable_project);
m_add_nomenclature->setEnabled(editable_project);
m_add_summary->setEnabled(editable_project);
m_csv_export -> setEnabled(editable_project);
@@ -2122,35 +2112,11 @@ void QETDiagramEditor::reloadOldElementPanel() {
/**
Supprime le schema courant du projet courant
*/
-void QETDiagramEditor::removeDiagramFromProject() {
+void QETDiagramEditor::removeDiagramFromProject()
+{
if (ProjectView *current_project = currentProjectView()) {
if (DiagramView *current_diagram = current_project -> currentDiagram()) {
- bool isFolioList = false;
-
- // if diagram to remove is a "folio list sheet", then set a flag.
- if (dynamic_cast(current_diagram -> diagram()))
- isFolioList = true;
-
current_project -> removeDiagram(current_diagram);
-
- // if the removed diagram was a folio sheet, then delete all the remaining folio sheets also.
- if (isFolioList) {
- foreach (DiagramView *diag, current_project -> diagram_views()) {
- if (dynamic_cast(diag -> diagram())) {
- current_project -> removeDiagram(diag);
- }
- }
-
- // else if after diagram removal, the total diagram quantity becomes a factor of 58, then
- // remove one (last) folio sheet.
- } else if (current_project -> diagram_views().size() % 58 == 0) {
- foreach (DiagramView *diag, current_project -> diagram_views()) {
- DiagramFolioList *ptr = dynamic_cast(diag -> diagram());
- if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) {
- current_project -> removeDiagram(diag);
- }
- }
- }
}
}
}
diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp
index 6011da501..5aac79c12 100644
--- a/sources/qetproject.cpp
+++ b/sources/qetproject.cpp
@@ -17,7 +17,6 @@
*/
#include "qetproject.h"
#include "diagram.h"
-#include "diagramfoliolist.h"
#include "qetapp.h"
#include "qetresult.h"
#include "movetemplateshandler.h"
@@ -210,22 +209,6 @@ QETProject::ProjectState QETProject::state() const {
return(m_state);
}
-/**
- Get the folioSheetQuantity
- @return folio Sheets Quantity.
-*/
-int QETProject::getFolioSheetsQuantity() const {
- return(m_folio_sheets_quantity);
-}
-
-/**
- Set the folioSheetQuantity to quantity
- @param New value of quantity to be set.
-*/
-void QETProject::setFolioSheetsQuantity(int quantity) {
- m_folio_sheets_quantity = quantity;
-}
-
/**
@return la liste des schemas de ce projet
*/
@@ -834,9 +817,6 @@ QDomDocument QETProject::toXml() {
QDomElement project_root = xml_doc.createElement("project");
project_root.setAttribute("version", QET::version);
project_root.setAttribute("title", project_title_);
-
- // write the present value of folioSheetsQuantity to XML.
- project_root.setAttribute("folioSheetQuantity", QString::number(m_folio_sheets_quantity));
xml_doc.appendChild(project_root);
// titleblock templates, if any
@@ -866,17 +846,12 @@ QDomDocument QETProject::toXml() {
const QList diagrams_list = m_diagrams_list;
for(Diagram *diagram : diagrams_list)
{
- // Write the diagram to XML only if it is not of type DiagramFolioList.
- DiagramFolioList *ptr = dynamic_cast(diagram);
- if ( !ptr )
- {
- qDebug() << qPrintable(QString("QETProject::toXml() : exporting diagram \"%1\"").arg(diagram -> title())) << "[" << diagram << "]";
- QDomElement xml_diagram = diagram->toXml().documentElement();
- QDomNode xml_node = xml_doc.importNode(xml_diagram, true);
+ qDebug() << qPrintable(QString("QETProject::toXml() : exporting diagram \"%1\"").arg(diagram -> title())) << "[" << diagram << "]";
+ QDomElement xml_diagram = diagram->toXml().documentElement();
+ QDomNode xml_node = xml_doc.importNode(xml_diagram, true);
- QDomNode appended_diagram = project_root.appendChild(xml_node);
- appended_diagram.toElement().setAttribute("order", order_num ++);
- }
+ QDomNode appended_diagram = project_root.appendChild(xml_node);
+ appended_diagram.toElement().setAttribute("order", order_num ++);
}
//Write the elements collection.
@@ -1056,8 +1031,6 @@ ElementsLocation QETProject::importElement(ElementsLocation &location)
return loc;
}
}
-
- return ElementsLocation();
}
/**
@@ -1169,49 +1142,6 @@ Diagram *QETProject::addNewDiagram(int pos)
return(diagram);
}
-/**
- * @brief QETProject::addNewDiagramFolioList
- * Add new diagram folio list
- * @return the created diagram
- */
-QList QETProject::addNewDiagramFolioList()
-{
- // do nothing if project is read only or folio sheet is alredy created
- QList diagram_list;
-
- if (!isReadOnly() && getFolioSheetsQuantity() == 0) {
-
- //reset the number of folio sheet
- setFolioSheetsQuantity(0);
-
- int diagCount = diagrams().size();
- for (int i = 0; i <= diagCount/29; i++) {
-
- //create new diagram
- Diagram *diagram_folio_list = new DiagramFolioList(this);
-
- // setup default properties
- diagram_folio_list -> border_and_titleblock.importBorder(defaultBorderProperties());
- diagram_folio_list -> border_and_titleblock.importTitleBlock(defaultTitleBlockProperties());
- diagram_folio_list -> defaultConductorProperties = defaultConductorProperties();
-
- diagram_folio_list -> border_and_titleblock.setTitle(tr("Liste des Folios"));
- // no need to display rows and columns
- diagram_folio_list -> border_and_titleblock.displayRows(false);
- diagram_folio_list -> border_and_titleblock.displayColumns(false);
-
- addDiagram(diagram_folio_list);
- setFolioSheetsQuantity( getFolioSheetsQuantity()+1 );
- emit(diagramAdded(this, diagram_folio_list));
- diagram_list << diagram_folio_list;
- diagCount++;
- }
- }
-
- return(diagram_list);
-}
-
-
/**
* @brief QETProject::removeDiagram
* Remove @diagram from project
@@ -1324,11 +1254,6 @@ void QETProject::readProjectXml(QDomDocument &xml_project)
readElementsCollectionXml(xml_project);
//Load the diagrams
readDiagramsXml(xml_project);
-
- // if there is an attribute for folioSheetQuantity, then set it accordingly.
- // If not, then the value remains at the initial value of zero.
- if (root_elmt.attribute("folioSheetQuantity","0").toInt())
- addNewDiagramFolioList();
m_state = Ok;
}
diff --git a/sources/qetproject.h b/sources/qetproject.h
index e4f1fbc4f..af1f8b687 100644
--- a/sources/qetproject.h
+++ b/sources/qetproject.h
@@ -77,8 +77,6 @@ class QETProject : public QObject
QUuid uuid() const;
ProjectState state() const;
QList diagrams() const;
- int getFolioSheetsQuantity() const; /// get the folio sheets quantity for this project
- void setFolioSheetsQuantity(int); /// set the folio sheets quantity for this project
int folioIndex(const Diagram *) const;
XmlElementCollection *embeddedElementCollection()const;
TitleBlockTemplatesProjectCollection *embeddedTitleBlockTemplatesCollection();
@@ -169,7 +167,6 @@ class QETProject : public QObject
public slots:
Diagram *addNewDiagram(int pos = -1);
- QList addNewDiagramFolioList();
void removeDiagram(Diagram *);
void diagramOrderChanged(int, int);
void setModified(bool);
@@ -261,8 +258,6 @@ class QETProject : public QObject
/// Element Auto Numbering
QHash m_element_autonum; //Title and NumContext hash
QString m_current_element_autonum;
- /// Folio List Sheets quantity for this project.
- int m_folio_sheets_quantity = 0;
bool m_auto_conductor = true;
XmlElementCollection *m_elements_collection = nullptr;
bool m_freeze_new_elements = false;
diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp
index e684c2740..391e87b26 100644
--- a/sources/ui/configpage/generalconfigurationpage.cpp
+++ b/sources/ui/configpage/generalconfigurationpage.cpp
@@ -55,7 +55,6 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
ui->m_export_terminal->setChecked(settings.value("nomenclature-exportlist", true).toBool());
ui->m_border_0->setChecked(settings.value("border-columns_0", false).toBool());
ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
- ui->m_foliolist_sb->setValue(settings.value("projectview/foliolist_position", 2).toInt());
QString fontInfos = settings.value("diagramitemfont").toString() + " " +
settings.value("diagramitemsize").toString() + " (" +
@@ -175,7 +174,6 @@ void GeneralConfigurationPage::applyConf()
settings.setValue("diagrameditor/highlight-integrated-elements", ui->m_highlight_integrated_elements->isChecked());
settings.setValue("diagrameditor/zoom-out-beyond-of-folio", ui->m_zoom_out_beyond_folio->isChecked());
settings.setValue("diagrameditor/autosave-interval", ui->m_autosave_sb->value());
- settings.setValue("projectview/foliolist_position", ui->m_foliolist_sb->value());
//Grid step and key navigation
settings.setValue("diagrameditor/Xgrid", ui->DiagramEditor_xGrid_sb->value());
settings.setValue("diagrameditor/Ygrid", ui->DiagramEditor_yGrid_sb->value());
diff --git a/sources/ui/configpage/generalconfigurationpage.ui b/sources/ui/configpage/generalconfigurationpage.ui
index 6a5d51aa2..de0f03148 100644
--- a/sources/ui/configpage/generalconfigurationpage.ui
+++ b/sources/ui/configpage/generalconfigurationpage.ui
@@ -93,14 +93,7 @@
Projets
- -
-
-
- Ne pas conserver les labels des éléments lors des copier coller
-
-
-
- -
+
-
Qt::Horizontal
@@ -113,17 +106,17 @@
- -
+
-
Sauvegarde automatique des projets (appliqué au prochain lancement de QElectroTech)
- -
-
+
-
+
- Utiliser les numéros de folio à la place de leur position dans le projet
+ Ne pas conserver les labels des éléments lors des copier coller
@@ -134,7 +127,7 @@
- -
+
-
true
@@ -147,7 +140,14 @@
- -
+
-
+
+
+ Utiliser les numéros de folio à la place de leur position dans le projet
+
+
+
+ -
Qt::Vertical
@@ -167,29 +167,6 @@
- -
-
-
-
-
-
- 0
-
-
- 999
-
-
- 1
-
-
-
- -
-
-
- Position de la liste des folios dans le projet
-
-
-