QElectroTech  0.8-dev
exportdialog.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef EXPORTDIALOG_H
19 #define EXPORTDIALOG_H
20 #include <QtWidgets>
21 #include "diagram.h"
22 #include "qetproject.h"
23 class QSvgGenerator;
30 class ExportDialog : public QDialog {
31  Q_OBJECT
32 
33  // constructors, destructor
34  public:
35  ExportDialog(QETProject *, QWidget * = nullptr);
36  ~ExportDialog() override;
37 
38  private:
40 
41  // methods
42  public:
43  int diagramsToExportCount() const;
44  static QPointF rotation_transformed(qreal, qreal, qreal, qreal, qreal);
45 
46  private:
48  public:
49  ExportDiagramLine(Diagram *, QSize);
50  virtual ~ExportDiagramLine();
51  QBoxLayout *sizeLayout();
53  QCheckBox *must_export;
54  QLabel *title_label;
55  QLineEdit *file_name;
56  QSpinBox *width;
57  QLabel *x_label;
58  QSpinBox *height;
59  QPushButton *keep_ratio;
60  QPushButton *reset_size;
61  QPushButton *preview;
62  QPushButton *clipboard;
63  };
64 
65  // attributes
66  private:
67  QHash<int, ExportDialog::ExportDiagramLine *> diagram_lines_;
68  // visual items
69  QGridLayout *diagrams_list_layout_;
71  QDialogButtonBox *buttons;
72 
73  QPushButton *selectAll;
74  QPushButton *deSelectAll;
75 
76  // mappers
77  QSignalMapper *preview_mapper_;
78  QSignalMapper *width_mapper_;
79  QSignalMapper *height_mapper_;
80  QSignalMapper *ratio_mapper_;
81  QSignalMapper *reset_mapper_;
82  QSignalMapper *clipboard_mapper_;
83 
84  // project whose diagrams are to be exported
86 
87  // methods
88  private:
89  QWidget *initDiagramsListPart();
90  void saveReloadDiagramParameters(Diagram *, bool = true);
91  void generateSvg(Diagram *, int, int, bool, QIODevice &);
92  void generateDxf(Diagram *, int, int, bool, QString &);
93  QImage generateImage(Diagram *, int, int, bool);
95  qreal diagramRatio(Diagram *);
96  QSize diagramSize(Diagram *);
97 
98  public slots:
99  void slot_correctWidth(int);
100  void slot_correctHeight(int);
101  void slot_keepRatioChanged(int);
102  void slot_resetSize(int);
103  void slot_export();
104  void slot_changeUseBorder();
106  void slot_changeFilesExtension(bool = false);
107  void slot_previewDiagram(int);
108  void slot_exportToClipBoard(int);
109  void slot_selectAllClicked();
111 };
112 #endif
ExportDialog::diagramsToExportCount
int diagramsToExportCount() const
Definition: exportdialog.cpp:113
Createdxf::sheetHeight
static const double sheetHeight
Definition: createdxf.h:112
ExportDialog::ExportDiagramLine::keep_ratio
QPushButton * keep_ratio
Definition: exportdialog.h:59
ExportDialog::ratio_mapper_
QSignalMapper * ratio_mapper_
Definition: exportdialog.h:80
ExportDialog::ExportDiagramLine::ExportDiagramLine
ExportDiagramLine(Diagram *, QSize)
Definition: exportdialog.cpp:973
QET::Icons::IC_CopyFile
QIcon IC_CopyFile
Definition: qeticons.cpp:40
ExportPropertiesWidget
Definition: exportpropertieswidget.h:27
exportpropertieswidget.h
DynamicElementTextItem
The DynamicElementTextItem class This class provide a simple text field of element who can be added o...
Definition: dynamicelementtextitem.h:39
Createdxf::yScale
static double yScale
Definition: createdxf.h:114
ExportDialog::ExportDialog
ExportDialog(QETProject *, QWidget *=nullptr)
Definition: exportdialog.cpp:45
ExportDialog::height_mapper_
QSignalMapper * height_mapper_
Definition: exportdialog.h:79
elementpicturefactory.h
exportdialog.h
ExportDialog::ExportDiagramLine::clipboard
QPushButton * clipboard
Definition: exportdialog.h:62
conductor.h
ExportDialog::slot_export
void slot_export()
Definition: exportdialog.cpp:695
ExportDialog::deSelectAll
QPushButton * deSelectAll
Definition: exportdialog.h:74
ExportDialog::ExportDiagramLine::x_label
QLabel * x_label
Definition: exportdialog.h:57
ExportDialog::ExportDialog
ExportDialog(const ExportDialog &)
ExportDialog::ExportDiagramLine::title_label
QLabel * title_label
Definition: exportdialog.h:54
conductortextitem.h
ExportDialog::generateSvg
void generateSvg(Diagram *, int, int, bool, QIODevice &)
Definition: exportdialog.cpp:372
ExportDialog::slot_resetSize
void slot_resetSize(int)
Definition: exportdialog.cpp:305
ExportDialog::slot_previewDiagram
void slot_previewDiagram(int)
Definition: exportdialog.cpp:884
qetmessagebox.h
ExportDialog::slot_correctWidth
void slot_correctWidth(int)
Definition: exportdialog.cpp:237
ExportProperties::format
QString format
Image format of generated files.
Definition: exportproperties.h:44
ExportDialog::buttons
QDialogButtonBox * buttons
Definition: exportdialog.h:71
ExportProperties::destination_directory
QDir destination_directory
Target directory for generated files.
Definition: exportproperties.h:43
ExportDialog::slot_keepRatioChanged
void slot_keepRatioChanged(int)
Definition: exportdialog.cpp:282
ExportDialog::generateImage
QImage generateImage(Diagram *, int, int, bool)
Definition: exportdialog.cpp:330
ExportDialog::ExportDiagramLine::reset_size
QPushButton * reset_size
Definition: exportdialog.h:60
ElementPictureFactory::primitives
Definition: elementpicturefactory.h:41
ExportDialog::reset_mapper_
QSignalMapper * reset_mapper_
Definition: exportdialog.h:81
ExportDialog::~ExportDialog
~ExportDialog() override
Definition: exportdialog.cpp:107
DiagramImageItem
Definition: diagramimageitem.h:31
QetShapeItem::toDXF
virtual bool toDXF(const QString &filepath, const QPen &pen)
QetShapeItem::toDXF Draw this element to the dxf document.
Definition: qetshapeitem.cpp:967
ExportDialog::exportDiagram
void exportDiagram(ExportDiagramLine *)
Definition: exportdialog.cpp:752
ExportDialog::clipboard_mapper_
QSignalMapper * clipboard_mapper_
Definition: exportdialog.h:82
Createdxf::dxfBegin
static void dxfBegin(const QString &)
Definition: createdxf.cpp:42
ExportDialog::project_
QETProject * project_
Definition: exportdialog.h:85
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
qeticons.h
ConductorSegment
Definition: conductorsegment.h:25
QET::stringToFileName
QString stringToFileName(const QString &)
Definition: qet.cpp:414
ExportDialog::slot_correctHeight
void slot_correctHeight(int)
Definition: exportdialog.cpp:260
ExportDialog::ExportDiagramLine::diagram
Diagram * diagram
Definition: exportdialog.h:52
ElementPictureFactory::getPrimitives
ElementPictureFactory::primitives getPrimitives(const ElementsLocation &location)
ElementPictureFactory::getPrimitives.
Definition: elementpicturefactory.cpp:120
ExportDialog::diagramRatio
qreal diagramRatio(Diagram *)
Definition: exportdialog.cpp:206
Createdxf::dxfEnd
static void dxfEnd(const QString &)
Definition: createdxf.cpp:232
Element::location
ElementsLocation location() const
Definition: element.cpp:1760
ExportDialog::slot_exportToClipBoard
void slot_exportToClipBoard(int)
Definition: exportdialog.cpp:933
ExportDialog::ExportDiagramLine::height
QSpinBox * height
Definition: exportdialog.h:58
QET::BorderArea
@ BorderArea
Export the diagram along with its border and title block.
Definition: qet.h:140
ExportDialog::slot_checkDiagramsCount
void slot_checkDiagramsCount()
Definition: exportdialog.cpp:840
Createdxf::drawLine
static void drawLine(const QString &filapath, double, double, double, double, const int &clorcode)
Definition: createdxf.cpp:290
ExportDialog::slot_selectAllClicked
void slot_selectAllClicked()
Definition: exportdialog.cpp:188
element.h
Conductor::pos
QPointF pos
Definition: conductor.h:46
ExportDialog::epw
ExportPropertiesWidget * epw
Definition: exportdialog.h:70
ExportDialog::slot_changeFilesExtension
void slot_changeFilesExtension(bool=false)
Definition: exportdialog.cpp:850
Element
Definition: element.h:41
ExportDialog::ExportDiagramLine::must_export
QCheckBox * must_export
Definition: exportdialog.h:53
Createdxf::drawCircle
static void drawCircle(const QString &, double, double, double, int)
Definition: createdxf.cpp:256
ExportDialog::initDiagramsListPart
QWidget * initDiagramsListPart()
Definition: exportdialog.cpp:125
qetproject.h
ElementPictureFactory::instance
static ElementPictureFactory * instance()
instance
Definition: elementpicturefactory.h:55
Createdxf::drawRectangle
static void drawRectangle(const QString &filepath, double, double, double, double, const int &colorcode)
Definition: createdxf.cpp:565
Createdxf::drawText
static void drawText(const QString &, const QString &, double, double, double, double, int)
Createdxf::drawText draw simple text in dxf format without any alignment specified.
Definition: createdxf.cpp:736
Diagram::margin
static const qreal margin
margin around the diagram
Definition: diagram.h:97
ExportDialog::generateDxf
void generateDxf(Diagram *, int, int, bool, QString &)
Definition: exportdialog.cpp:402
Createdxf::xScale
static double xScale
Definition: createdxf.h:113
independenttextitem.h
DiagramTextItem
Definition: diagramtextitem.h:34
QET::Icons::ZoomOriginal
QIcon ZoomOriginal
Definition: qeticons.cpp:180
QETProject
Definition: qetproject.h:51
ExportDialog::preview_mapper_
QSignalMapper * preview_mapper_
Definition: exportdialog.h:77
ExportDialog::ExportDiagramLine
Definition: exportdialog.h:47
Createdxf::sheetWidth
static const double sheetWidth
Definition: createdxf.h:111
ExportDialog::selectAll
QPushButton * selectAll
Definition: exportdialog.h:73
ExportDialog::ExportDiagramLine::sizeLayout
QBoxLayout * sizeLayout()
Definition: exportdialog.cpp:1034
ExportDialog::width_mapper_
QSignalMapper * width_mapper_
Definition: exportdialog.h:78
QET::Icons::ObjectLocked
QIcon ObjectLocked
Definition: qeticons.cpp:123
ExportDialog::diagramSize
QSize diagramSize(Diagram *)
Definition: exportdialog.cpp:217
QET::QetMessageBox::warning
QMessageBox::StandardButton warning(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
Definition: qetmessagebox.cpp:68
ExportDialog::ExportDiagramLine::width
QSpinBox * width
Definition: exportdialog.h:56
ExportDialog::ExportDiagramLine::preview
QPushButton * preview
Definition: exportdialog.h:61
diagramtextitem.h
Createdxf::drawArcEllipse
static void drawArcEllipse(const QString &file_path, qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal spanAngle, qreal hotspot_x, qreal hotspot_y, qreal rotation_angle, const int &colorcode)
Definition: createdxf.cpp:426
ExportPropertiesWidget::format
QComboBox * format
Definition: exportpropertieswidget.h:60
ExportDialog::slot_changeUseBorder
void slot_changeUseBorder()
Definition: exportdialog.cpp:822
IndependentTextItem
Definition: independenttextitem.h:28
QetShapeItem
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
Definition: qetshapeitem.h:36
ExportProperties::defaultExportProperties
static ExportProperties defaultExportProperties()
ExportProperties::defaultProperties.
Definition: exportproperties.cpp:116
ExportDialog::slot_deSelectAllClicked
void slot_deSelectAllClicked()
Definition: exportdialog.cpp:194
qetshapeitem.h
ExportProperties
Definition: exportproperties.h:27
QET::Horizontal
@ Horizontal
Horizontal segment.
Definition: qet.h:89
QET::QetMessageBox::critical
QMessageBox::StandardButton critical(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
Definition: qetmessagebox.cpp:23
dynamicelementtextitem.h
QET::Icons::Start
QIcon Start
Definition: qeticons.cpp:162
QET::Icons::ObjectUnlocked
QIcon ObjectUnlocked
Definition: qeticons.cpp:125
ExportDialog::ExportDiagramLine::~ExportDiagramLine
virtual ~ExportDiagramLine()
Definition: exportdialog.cpp:1027
ExportDialog::diagrams_list_layout_
QGridLayout * diagrams_list_layout_
Definition: exportdialog.h:69
createdxf.h
ExportDialog::ExportDiagramLine::file_name
QLineEdit * file_name
Definition: exportdialog.h:55
Conductor
Definition: conductor.h:43
ConductorTextItem
Definition: conductortextitem.h:30
ExportDialog
Definition: exportdialog.h:30
QetShapeItem::pen
QPen pen
Definition: qetshapeitem.h:39
ExportDialog::saveReloadDiagramParameters
void saveReloadDiagramParameters(Diagram *, bool=true)
Definition: exportdialog.cpp:352
diagramimageitem.h
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
ExportDialog::rotation_transformed
static QPointF rotation_transformed(qreal, qreal, qreal, qreal, qreal)
Definition: exportdialog.cpp:668
QET::Icons::Cancel
QIcon Cancel
Definition: qeticons.cpp:34
diagram.h
ExportDialog::diagram_lines_
QHash< int, ExportDialog::ExportDiagramLine * > diagram_lines_
Definition: exportdialog.h:67
conductorsegment.h