mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Improve code style, Wrap code for better readability
This commit is contained in:
@@ -352,7 +352,9 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
|
|||||||
ou non
|
ou non
|
||||||
@param options Options de rendu
|
@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.";
|
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
#ifdef Q_OS_WIN
|
#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 qp QPainter a utiliser (deja initialise sur printer)
|
||||||
@param printer Imprimante a utiliser
|
@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();
|
//qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title();
|
||||||
// l'imprimante utilise-t-elle toute la feuille ?
|
// l'imprimante utilise-t-elle toute la feuille ?
|
||||||
bool full_page = printer -> fullPage();
|
bool full_page = printer -> fullPage();
|
||||||
|
|||||||
@@ -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 keep_aspect_ratio True pour conserver le ratio, false sinon
|
||||||
@param io_device Peripherique de sortie pour le code DXF (souvent : un fichier)
|
@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);
|
saveReloadDiagramParameters(diagram, true);
|
||||||
|
|
||||||
width -= 2*Diagram::margin;
|
width -= 2*Diagram::margin;
|
||||||
@@ -414,9 +418,19 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
if (epw -> exportProperties().draw_border) {
|
if (epw -> exportProperties().draw_border) {
|
||||||
double bx0 = Diagram::margin * Createdxf::xScale;
|
double bx0 = Diagram::margin * Createdxf::xScale;
|
||||||
double by0 = Diagram::margin * Createdxf::yScale;
|
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.
|
// Build the lists of elements.
|
||||||
QList<Element *> list_elements;
|
QList<Element *> list_elements;
|
||||||
@@ -651,7 +665,11 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
saveReloadDiagramParameters(diagram, false);
|
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;
|
angle *= -3.14159265 / 180;
|
||||||
|
|
||||||
|
|||||||
@@ -1279,13 +1279,13 @@ namespace pugi
|
|||||||
bool operator!() const;
|
bool operator!() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// C4275 can be ignored in Visual C++ if you are deriving
|
// C4275 can be ignored in Visual C++ if you are deriving
|
||||||
// from a type in the Standard C++ Library
|
// from a type in the Standard C++ Library
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable: 4275)
|
#pragma warning(disable: 4275)
|
||||||
#endif
|
#endif
|
||||||
// XPath exception class
|
// XPath exception class
|
||||||
class PUGIXML_CLASS xpath_exception: public std::exception
|
class PUGIXML_CLASS xpath_exception: public std::exception
|
||||||
{
|
{
|
||||||
@@ -1302,10 +1302,10 @@ namespace pugi
|
|||||||
// Get parse result
|
// Get parse result
|
||||||
const xpath_parse_result& result() const;
|
const xpath_parse_result& result() const;
|
||||||
};
|
};
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// XPath node class (either xml_node or xml_attribute)
|
// XPath node class (either xml_node or xml_attribute)
|
||||||
class PUGIXML_CLASS xpath_node
|
class PUGIXML_CLASS xpath_node
|
||||||
|
|||||||
@@ -46,8 +46,8 @@
|
|||||||
/**
|
/**
|
||||||
@brief QETDiagramEditor::QETDiagramEditor
|
@brief QETDiagramEditor::QETDiagramEditor
|
||||||
Constructor
|
Constructor
|
||||||
@param files, list of files to open
|
@param files : list of files to open
|
||||||
@param parent, parent widget
|
@param parent : parent widget
|
||||||
*/
|
*/
|
||||||
QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||||
QETMainWindow(parent),
|
QETMainWindow(parent),
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ class QETDiagramEditor : public QETMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QETDiagramEditor(const QStringList & = QStringList(), QWidget * = nullptr);
|
QETDiagramEditor(const QStringList & = QStringList(),
|
||||||
|
QWidget * = nullptr);
|
||||||
~QETDiagramEditor() override;
|
~QETDiagramEditor() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -874,13 +874,15 @@ QETResult QETProject::write()
|
|||||||
if (m_file_path.isEmpty())
|
if (m_file_path.isEmpty())
|
||||||
return(QString("unable to save project to file: no filepath was specified"));
|
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())
|
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));
|
return(QString("the file %1 was opened read-only and thus will not be written").arg(m_file_path));
|
||||||
|
|
||||||
QDomDocument xml_project(toXml());
|
QDomDocument xml_project(toXml());
|
||||||
QString error_message;
|
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.
|
//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));
|
m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate));
|
||||||
|
|||||||
Reference in New Issue
Block a user