QElectroTech  0.70
Classes | Public Slots | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ExportDialog Class Reference

#include <exportdialog.h>

Classes

class  ExportDiagramLine
 

Public Slots

void slot_correctWidth (int)
 
void slot_correctHeight (int)
 
void slot_keepRatioChanged (int)
 
void slot_resetSize (int)
 
void slot_export ()
 
void slot_changeUseBorder ()
 
void slot_checkDiagramsCount ()
 
void slot_changeFilesExtension (bool=false)
 
void slot_previewDiagram (int)
 
void slot_exportToClipBoard (int)
 
void slot_selectAllClicked ()
 
void slot_deSelectAllClicked ()
 

Public Member Functions

 ExportDialog (QETProject *, QWidget *=nullptr)
 
 ~ExportDialog () override
 
int diagramsToExportCount () const
 

Static Public Member Functions

static QPointF rotation_transformed (qreal, qreal, qreal, qreal, qreal)
 

Private Member Functions

 ExportDialog (const ExportDialog &)
 
QWidget * initDiagramsListPart ()
 
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 *)
 
QSize diagramSize (Diagram *)
 

Private Attributes

QHash< int, ExportDialog::ExportDiagramLine * > diagram_lines_
 
QGridLayout * diagrams_list_layout_
 
ExportPropertiesWidgetepw
 
QDialogButtonBox * buttons
 
QPushButton * selectAll
 
QPushButton * deSelectAll
 
QSignalMapper * preview_mapper_
 
QSignalMapper * width_mapper_
 
QSignalMapper * height_mapper_
 
QSignalMapper * ratio_mapper_
 
QSignalMapper * reset_mapper_
 
QSignalMapper * clipboard_mapper_
 
QETProjectproject_
 

Detailed Description

This class provides a dialog enabling users to export 1 to n diagrams from a project as image files, with features like preview, copy to clipboard, resize, etc.

Definition at line 30 of file exportdialog.h.

Constructor & Destructor Documentation

◆ ExportDialog() [1/2]

ExportDialog::ExportDialog ( QETProject project,
QWidget *  parent = nullptr 
)

◆ ~ExportDialog()

ExportDialog::~ExportDialog ( )
override

Destructeur - ne fait rien

Definition at line 108 of file exportdialog.cpp.

◆ ExportDialog() [2/2]

ExportDialog::ExportDialog ( const ExportDialog )
private

Member Function Documentation

◆ diagramRatio()

qreal ExportDialog::diagramRatio ( Diagram diagram)
private
Parameters
diagramUn schema
Returns
le rapport largeur / hauteur du schema

Definition at line 207 of file exportdialog.cpp.

References diagramSize().

Referenced by slot_correctHeight(), and slot_correctWidth().

◆ diagramSize()

QSize ExportDialog::diagramSize ( Diagram diagram)
private
Parameters
diagramUn schema
Returns
les dimensions du schema, en tenant compte du type d'export : cadre ou elements

Definition at line 218 of file exportdialog.cpp.

References QET::BorderArea, and epw.

Referenced by diagramRatio(), initDiagramsListPart(), and slot_resetSize().

◆ diagramsToExportCount()

int ExportDialog::diagramsToExportCount ( ) const
Returns
le nombre de schemas coches (donc a exporter)

Definition at line 114 of file exportdialog.cpp.

References diagram_lines_.

Referenced by slot_checkDiagramsCount().

◆ exportDiagram()

void ExportDialog::exportDiagram ( ExportDiagramLine diagram_line)
private

Exporte un schema

Parameters
diagram_lineLa ligne decrivant le schema a exporter et la maniere de l'exporter

Definition at line 810 of file exportdialog.cpp.

References QET::QetMessageBox::critical(), ExportProperties::destination_directory, epw, ExportProperties::format, generateDxf(), generateImage(), generateSvg(), and QET::Icons::tr.

Referenced by slot_export().

◆ fillRow()

void ExportDialog::fillRow ( const QString &  file_path,
const QRectF &  row_rect,
QString  author,
const QString &  title,
QString  folio,
QString  date 
)
private

◆ generateDxf()

void ExportDialog::generateDxf ( Diagram diagram,
int  width,
int  height,
bool  keep_aspect_ratio,
QString &  file_path 
)
private

Exporte le schema en DXF

Parameters
diagramSchema a exporter en DXF
widthLargeur de l'export DXF
heightHauteur de l'export DXF
keep_aspect_ratioTrue pour conserver le ratio, false sinon
io_devicePeripherique de sortie pour le code DXF (souvent : un fichier)

Definition at line 403 of file exportdialog.cpp.

References Createdxf::drawArcEllipse(), Createdxf::drawCircle(), Createdxf::drawLine(), Createdxf::drawRectangle(), Createdxf::drawText(), Createdxf::dxfBegin(), Createdxf::dxfEnd(), epw, fillRow(), ElementPictureFactory::getPrimitives(), ElementPictureFactory::instance(), Element::location(), Diagram::margin, QetShapeItem::pen, rotation_transformed(), saveReloadDiagramParameters(), Createdxf::sheetHeight, Createdxf::sheetWidth, QetShapeItem::toDXF(), QET::Icons::tr, Createdxf::xScale, and Createdxf::yScale.

Referenced by exportDiagram().

◆ generateImage()

QImage ExportDialog::generateImage ( Diagram diagram,
int  width,
int  height,
bool  keep_aspect_ratio 
)
private

Genere l'image a exporter

Parameters
diagramSchema a exporter en SVG
widthLargeur de l'export
heightHauteur de l'export
keep_aspect_ratioTrue pour conserver le ratio, false sinon
Returns
l'image a exporter

Definition at line 331 of file exportdialog.cpp.

References saveReloadDiagramParameters().

Referenced by exportDiagram(), slot_exportToClipBoard(), and slot_previewDiagram().

◆ generateSvg()

void ExportDialog::generateSvg ( Diagram diagram,
int  width,
int  height,
bool  keep_aspect_ratio,
QIODevice &  io_device 
)
private

Exporte le schema en SVG

Parameters
diagramSchema a exporter en SVG
widthLargeur de l'export SVG
heightHauteur de l'export SVG
keep_aspect_ratioTrue pour conserver le ratio, false sinon
io_devicePeripherique de sortie pour le code SVG (souvent : un fichier)

Definition at line 373 of file exportdialog.cpp.

References saveReloadDiagramParameters().

Referenced by exportDiagram(), and slot_exportToClipBoard().

◆ initDiagramsListPart()

QWidget * ExportDialog::initDiagramsListPart ( )
private

◆ rotation_transformed()

QPointF ExportDialog::rotation_transformed ( qreal  px,
qreal  py,
qreal  origin_x,
qreal  origin_y,
qreal  angle 
)
static

Definition at line 730 of file exportdialog.cpp.

Referenced by Createdxf::drawArcEllipse(), and generateDxf().

◆ saveReloadDiagramParameters()

void ExportDialog::saveReloadDiagramParameters ( Diagram diagram,
bool  save = true 
)
private

Sauve ou restaure les parametres du schema

Parameters
diagramSchema dont on sauve ou restaure les parametres
savetrue pour memoriser les parametres du schema et appliquer ceux definis par le formulaire, false pour restaurer les parametres

Definition at line 353 of file exportdialog.cpp.

References epw.

Referenced by generateDxf(), generateImage(), and generateSvg().

◆ slot_changeFilesExtension

void ExportDialog::slot_changeFilesExtension ( bool  force_extension = false)
slot

Modifie les extensions des fichiers en fonction du format selectionne

Parameters
force_extensiontrue pour ajouter l'extension si elle n'est pas presente, false pour se contenter de la modifier si elle est incorrecte.

Definition at line 908 of file exportdialog.cpp.

References diagram_lines_, epw, and ExportPropertiesWidget::format.

Referenced by ExportDialog().

◆ slot_changeUseBorder

void ExportDialog::slot_changeUseBorder ( )
slot

Slot appele lorsque l'utilisateur change la zone du schema qui doit etre exportee. Il faut alors ajuster les dimensions des schemas.

Definition at line 880 of file exportdialog.cpp.

References diagram_lines_, and slot_correctHeight().

Referenced by ExportDialog().

◆ slot_checkDiagramsCount

void ExportDialog::slot_checkDiagramsCount ( )
slot

Ce slot est appele quand un schema a ete coche ou decoche. Il active ou desactive le bouton "Exporter" en fonction du nombre de schemas coches, et il garde au plus un schema coche si on exporte vers le presse-papier.

Definition at line 898 of file exportdialog.cpp.

References buttons, and diagramsToExportCount().

Referenced by initDiagramsListPart().

◆ slot_correctHeight

void ExportDialog::slot_correctHeight ( int  diagram_id)
slot

Cette methode ajuste la hauteur d'un des schemas a exporter en fonction de sa largeur si et seulement si l'option "Conserver les proportions" est activee pour ce schema.

Parameters
diagram_idnumero du schema concerne

Definition at line 261 of file exportdialog.cpp.

References diagram_lines_, and diagramRatio().

Referenced by initDiagramsListPart(), slot_changeUseBorder(), and slot_keepRatioChanged().

◆ slot_correctWidth

void ExportDialog::slot_correctWidth ( int  diagram_id)
slot

Cette methode ajuste la largeur d'un des schemas a exporter en fonction de sa hauteur si et seulement si l'option "Conserver les proportions" est activee pour ce schema.

Parameters
diagram_idnumero du schema concerne

Definition at line 238 of file exportdialog.cpp.

References diagram_lines_, and diagramRatio().

Referenced by initDiagramsListPart().

◆ slot_deSelectAllClicked

void ExportDialog::slot_deSelectAllClicked ( )
slot

Definition at line 195 of file exportdialog.cpp.

References diagram_lines_.

Referenced by ExportDialog().

◆ slot_export

void ExportDialog::slot_export ( )
slot

Slot effectuant les exports apres la validation du dialogue.

Definition at line 753 of file exportdialog.cpp.

References diagram_lines_, epw, exportDiagram(), QET::Icons::tr, and QET::QetMessageBox::warning().

Referenced by ExportDialog().

◆ slot_exportToClipBoard

void ExportDialog::slot_exportToClipBoard ( int  diagram_id)
slot

Cette methode exporte un schema vers le presse-papier

Parameters
diagram_idnumero du schema a previsualiser

Definition at line 991 of file exportdialog.cpp.

References diagram_lines_, epw, ExportPropertiesWidget::format, generateImage(), and generateSvg().

Referenced by initDiagramsListPart().

◆ slot_keepRatioChanged

void ExportDialog::slot_keepRatioChanged ( int  diagram_id)
slot

Prend en compte le fait qu'il faut desormais conserver ou non les proportions d'un des schemas

Parameters
diagram_idnumero du schema concerne

Definition at line 283 of file exportdialog.cpp.

References diagram_lines_, QET::Icons::ObjectLocked, QET::Icons::ObjectUnlocked, and slot_correctHeight().

Referenced by initDiagramsListPart().

◆ slot_previewDiagram

void ExportDialog::slot_previewDiagram ( int  diagram_id)
slot

Cette methode fait apparaitre un dialogue permettant de previsualiser un des schemas a exporter

Parameters
diagram_idnumero du schema a previsualiser

Definition at line 942 of file exportdialog.cpp.

References buttons, diagram_lines_, generateImage(), and QET::Icons::tr.

Referenced by initDiagramsListPart().

◆ slot_resetSize

void ExportDialog::slot_resetSize ( int  diagram_id)
slot

Reinitialise les dimensions d'un des schemas

Parameters
diagram_idnumero du schema concerne

Definition at line 306 of file exportdialog.cpp.

References diagram_lines_, and diagramSize().

Referenced by initDiagramsListPart().

◆ slot_selectAllClicked

void ExportDialog::slot_selectAllClicked ( )
slot

Definition at line 189 of file exportdialog.cpp.

References diagram_lines_.

Referenced by ExportDialog().

Member Data Documentation

◆ buttons

QDialogButtonBox* ExportDialog::buttons
private

Definition at line 71 of file exportdialog.h.

Referenced by ExportDialog(), slot_checkDiagramsCount(), and slot_previewDiagram().

◆ clipboard_mapper_

QSignalMapper* ExportDialog::clipboard_mapper_
private

Definition at line 82 of file exportdialog.h.

Referenced by initDiagramsListPart().

◆ deSelectAll

QPushButton* ExportDialog::deSelectAll
private

Definition at line 74 of file exportdialog.h.

Referenced by ExportDialog().

◆ diagram_lines_

QHash<int, ExportDialog::ExportDiagramLine *> ExportDialog::diagram_lines_
private

◆ diagrams_list_layout_

QGridLayout* ExportDialog::diagrams_list_layout_
private

Definition at line 69 of file exportdialog.h.

Referenced by initDiagramsListPart().

◆ epw

ExportPropertiesWidget* ExportDialog::epw
private

◆ height_mapper_

QSignalMapper* ExportDialog::height_mapper_
private

Definition at line 79 of file exportdialog.h.

Referenced by initDiagramsListPart().

◆ preview_mapper_

QSignalMapper* ExportDialog::preview_mapper_
private

Definition at line 77 of file exportdialog.h.

Referenced by initDiagramsListPart().

◆ project_

QETProject* ExportDialog::project_
private

Definition at line 85 of file exportdialog.h.

Referenced by ExportDialog(), and initDiagramsListPart().

◆ ratio_mapper_

QSignalMapper* ExportDialog::ratio_mapper_
private

Definition at line 80 of file exportdialog.h.

Referenced by initDiagramsListPart().

◆ reset_mapper_

QSignalMapper* ExportDialog::reset_mapper_
private

Definition at line 81 of file exportdialog.h.

Referenced by initDiagramsListPart().

◆ selectAll

QPushButton* ExportDialog::selectAll
private

Definition at line 73 of file exportdialog.h.

Referenced by ExportDialog().

◆ width_mapper_

QSignalMapper* ExportDialog::width_mapper_
private

Definition at line 78 of file exportdialog.h.

Referenced by initDiagramsListPart().


The documentation for this class was generated from the following files: