Improve code style, Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-08-16 14:26:40 +02:00
parent c4bf492616
commit 41cef49453
16 changed files with 128 additions and 101 deletions

View File

@@ -352,7 +352,9 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
ou non
@param options Options de rendu
*/
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties& options) {
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams,
bool fit_page,
const ExportProperties& options) {
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#ifdef Q_OS_WIN
@@ -399,7 +401,11 @@ void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page,
@param qp QPainter a utiliser (deja initialise sur printer)
@param printer Imprimante a utiliser
*/
void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const ExportProperties &options, QPainter *qp, QPrinter *printer) {
void DiagramPrintDialog::printDiagram(Diagram *diagram,
bool fit_page,
const ExportProperties &options,
QPainter *qp,
QPrinter *printer) {
//qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title();
// l'imprimante utilise-t-elle toute la feuille ?
bool full_page = printer -> fullPage();

View File

@@ -399,7 +399,11 @@ void ExportDialog::generateSvg(Diagram *diagram, int width, int height, bool kee
@param keep_aspect_ratio True pour conserver le ratio, false sinon
@param io_device Peripherique de sortie pour le code DXF (souvent : un fichier)
*/
void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool keep_aspect_ratio, QString &file_path) {
void ExportDialog::generateDxf(Diagram *diagram,
int width,
int height,
bool keep_aspect_ratio,
QString &file_path) {
saveReloadDiagramParameters(diagram, true);
width -= 2*Diagram::margin;
@@ -414,9 +418,19 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
if (epw -> exportProperties().draw_border) {
double bx0 = Diagram::margin * Createdxf::xScale;
double by0 = Diagram::margin * Createdxf::yScale;
Createdxf::drawRectangle(file_path, bx0, -by0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0);
Createdxf::drawRectangle(
file_path,
bx0,
-by0,
double(width)*Createdxf::xScale,
double(height)*Createdxf::yScale,
0);
}
diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0);
diagram -> border_and_titleblock.drawDxf(width,
height,
keep_aspect_ratio,
file_path,
0);
// Build the lists of elements.
QList<Element *> list_elements;
@@ -651,7 +665,11 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
saveReloadDiagramParameters(diagram, false);
}
QPointF ExportDialog::rotation_transformed(qreal px, qreal py , qreal origin_x, qreal origin_y, qreal angle) {
QPointF ExportDialog::rotation_transformed(qreal px,
qreal py,
qreal origin_x,
qreal origin_y,
qreal angle) {
angle *= -3.14159265 / 180;

View File

@@ -46,8 +46,8 @@
/**
@brief QETDiagramEditor::QETDiagramEditor
Constructor
@param files, list of files to open
@param parent, parent widget
@param files : list of files to open
@param parent : parent widget
*/
QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
QETMainWindow(parent),

View File

@@ -52,7 +52,8 @@ class QETDiagramEditor : public QETMainWindow
Q_OBJECT
public:
QETDiagramEditor(const QStringList & = QStringList(), QWidget * = nullptr);
QETDiagramEditor(const QStringList & = QStringList(),
QWidget * = nullptr);
~QETDiagramEditor() override;
private:

View File

@@ -874,13 +874,15 @@ QETResult QETProject::write()
if (m_file_path.isEmpty())
return(QString("unable to save project to file: no filepath was specified"));
// if the project was opened read-only and the file is still non-writable, do not save the project
// if the project was opened read-only
// and the file is still non-writable, do not save the project
if (isReadOnly() && !QFileInfo(m_file_path).isWritable())
return(QString("the file %1 was opened read-only and thus will not be written").arg(m_file_path));
QDomDocument xml_project(toXml());
QString error_message;
if (!QET::writeXmlFile(xml_project, m_file_path, &error_message)) return(error_message);
if (!QET::writeXmlFile(xml_project, m_file_path, &error_message))
return(error_message);
//title block variables should be updated after file save dialog is confirmed, before file is saved.
m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate));