QElectroTech  0.70
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
DiagramPrintDialog Class Reference

#include <diagramprintdialog.h>

Public Member Functions

 DiagramPrintDialog (QETProject *, QWidget *=nullptr)
 
 ~DiagramPrintDialog () override
 
void setFileName (const QString &)
 
QString fileName () const
 
void setDocName (const QString &)
 
QString docName () const
 
QRect diagramRect (Diagram *, const ExportProperties &) const
 
int pagesCount (Diagram *, const ExportProperties &, bool=false) const
 
int horizontalPagesCount (Diagram *, const ExportProperties &, bool=false) const
 
int verticalPagesCount (Diagram *, const ExportProperties &, bool=false) const
 
void exec ()
 

Private Slots

void print (const QList< Diagram *> &, bool, const ExportProperties &)
 
void printDiagram (Diagram *, bool, const ExportProperties &, QPainter *, QPrinter *=nullptr)
 
void updatePrintTypeDialog ()
 
void acceptPrintTypeDialog ()
 
void browseFilePrintTypeDialog ()
 

Private Member Functions

 DiagramPrintDialog (const DiagramPrintDialog &)
 
void buildPrintTypeDialog ()
 
void buildDialog ()
 
void saveReloadDiagramParameters (Diagram *, const ExportProperties &, bool)
 
void savePageSetupForCurrentPrinter ()
 
void loadPageSetupForCurrentPrinter ()
 
QString settingsSectionName (const QPrinter *)
 

Private Attributes

QETProjectproject_
 
QPrinter * printer_
 
QString doc_name_
 
QString file_name_
 
QDialog * dialog_
 
QLabel * printtype_label_
 
QGridLayout * glayout0_
 
QVBoxLayout * vlayout0_
 
QHBoxLayout * hlayout0_
 
QLabel * printer_icon_
 
QLabel * pdf_icon_
 
QButtonGroup * printtype_choice_
 
QRadioButton * printer_choice_
 
QRadioButton * pdf_choice_
 
QLineEdit * filepath_field_
 
QPushButton * browse_button_
 
QDialogButtonBox * buttons_
 
QColor backup_diagram_background_color
 

Detailed Description

This class implements both the dialog allowing users to configure the printing of a project file and the printing itself.

Definition at line 32 of file diagramprintdialog.h.

Constructor & Destructor Documentation

◆ DiagramPrintDialog() [1/2]

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

Constructeur

Parameters
projectSchema a imprimer
parentWidget parent du dialogue

Definition at line 34 of file diagramprintdialog.cpp.

References Diagram::background_color, backup_diagram_background_color, and printer_.

◆ ~DiagramPrintDialog()

DiagramPrintDialog::~DiagramPrintDialog ( )
override

Destructeur

Definition at line 51 of file diagramprintdialog.cpp.

References Diagram::background_color, backup_diagram_background_color, dialog_, and printer_.

◆ DiagramPrintDialog() [2/2]

DiagramPrintDialog::DiagramPrintDialog ( const DiagramPrintDialog )
private

Member Function Documentation

◆ acceptPrintTypeDialog

void DiagramPrintDialog::acceptPrintTypeDialog ( )
privateslot

Verifie l'etat du dialogue permettant le choix du type d'impression lorsque l'utilisateur le valide.

Definition at line 303 of file diagramprintdialog.cpp.

References dialog_, filepath_field_, QET::QetMessageBox::information(), printer_choice_, and QET::Icons::tr.

Referenced by buildPrintTypeDialog().

◆ browseFilePrintTypeDialog

void DiagramPrintDialog::browseFilePrintTypeDialog ( )
privateslot

Permet a l'utilisateur de choisir un fichier

Definition at line 324 of file diagramprintdialog.cpp.

References filepath_field_, pdf_choice_, printer_choice_, and QET::Icons::tr.

Referenced by buildPrintTypeDialog().

◆ buildDialog()

void DiagramPrintDialog::buildDialog ( )
private

◆ buildPrintTypeDialog()

void DiagramPrintDialog::buildPrintTypeDialog ( )
private

Construit un dialogue non standard pour demander a l'utilisateur quelle type d'impression il souhaite effectuer : PDF, PS ou imprimante physique

Definition at line 214 of file diagramprintdialog.cpp.

References acceptPrintTypeDialog(), browse_button_, browseFilePrintTypeDialog(), buttons_, QET::Icons::Cancel, dialog_, file_name_, filepath_field_, glayout0_, hlayout0_, QET::Icons::PDF, pdf_choice_, pdf_icon_, QET::Icons::Printer, printer_choice_, printer_icon_, printtype_choice_, printtype_label_, QET::Icons::tr, updatePrintTypeDialog(), and vlayout0_.

Referenced by exec().

◆ diagramRect()

QRect DiagramPrintDialog::diagramRect ( Diagram diagram,
const ExportProperties options 
) const
Parameters
diagramDiagram to be printed
include_titleblock(Optional, defaults to true) Whether the diagram titleblock should be printed.
Returns
the rectangle to be printed

Definition at line 91 of file diagramprintdialog.cpp.

References ExportProperties::draw_titleblock.

Referenced by horizontalPagesCount(), printDiagram(), and verticalPagesCount().

◆ docName()

QString DiagramPrintDialog::docName ( ) const
Returns
le nom du document

Definition at line 81 of file diagramprintdialog.cpp.

References doc_name_.

◆ exec()

void DiagramPrintDialog::exec ( )

◆ fileName()

QString DiagramPrintDialog::fileName ( ) const
Returns
le nom du PDF

Definition at line 67 of file diagramprintdialog.cpp.

References file_name_.

◆ horizontalPagesCount()

int DiagramPrintDialog::horizontalPagesCount ( Diagram diagram,
const ExportProperties options,
bool  fullpage = false 
) const
Parameters
diagramSchema a imprimer
optionsRendering options
fullpagetrue pour utiliser toute la feuille dans le calcul
Returns
La largeur du "poster" en nombre de pages pour imprimer le schema avec l'orientation et le format papier utilise dans l'imprimante en cours.

Definition at line 185 of file diagramprintdialog.cpp.

References diagramRect(), and printer_.

Referenced by pagesCount(), and printDiagram().

◆ loadPageSetupForCurrentPrinter()

void DiagramPrintDialog::loadPageSetupForCurrentPrinter ( )
private

Load parameters previously set in the "page setup" dialog for the current printer, if any.

Definition at line 572 of file diagramprintdialog.cpp.

References QET::Custom, printer_, and settingsSectionName().

Referenced by exec().

◆ pagesCount()

int DiagramPrintDialog::pagesCount ( Diagram diagram,
const ExportProperties options,
bool  fullpage = false 
) const
Parameters
diagramSchema a imprimer
optionsRendering options
fullpagetrue pour utiliser toute la feuille dans le calcul
Returns
Le nombre de pages necessaires pour imprimer le schema avec l'orientation et le format papier utilise dans l'imprimante en cours.

Definition at line 174 of file diagramprintdialog.cpp.

References horizontalPagesCount(), and verticalPagesCount().

◆ print

void DiagramPrintDialog::print ( const QList< Diagram *> &  diagrams,
bool  fit_page,
const ExportProperties options 
)
privateslot

Effectue l'impression elle-meme

Parameters
diagramsSchemas a imprimer
fit_pageBooleen indiquant s'il faut adapter les schemas aux pages ou non
optionsOptions de rendu

Definition at line 355 of file diagramprintdialog.cpp.

References printDiagram(), and printer_.

Referenced by exec().

◆ printDiagram

void DiagramPrintDialog::printDiagram ( Diagram diagram,
bool  fit_page,
const ExportProperties options,
QPainter *  qp,
QPrinter *  printer = nullptr 
)
privateslot

Imprime un schema

Parameters
diagramSchema a imprimer
fit_pageTrue pour adapter les schemas aux pages, false sinon
optionsOptions de rendu a appliquer pour l'impression
qpQPainter a utiliser (deja initialise sur printer)
printerImprimante a utiliser

Definition at line 402 of file diagramprintdialog.cpp.

References diagramRect(), horizontalPagesCount(), saveReloadDiagramParameters(), and verticalPagesCount().

Referenced by print().

◆ savePageSetupForCurrentPrinter()

void DiagramPrintDialog::savePageSetupForCurrentPrinter ( )
private

Save parameters set in the "page setup" dialog into the QElectroTech configuration. Key/values pairs are associated to the printer for which they have been set.

Definition at line 536 of file diagramprintdialog.cpp.

References QET::Custom, printer_, and settingsSectionName().

Referenced by exec().

◆ saveReloadDiagramParameters()

void DiagramPrintDialog::saveReloadDiagramParameters ( Diagram diagram,
const ExportProperties options,
bool  save 
)
private

Sauve ou restaure les parametres du schema

Parameters
diagramSchema dont on sauve ou restaure les parametres
optionsParametres a appliquer
savetrue pour memoriser les parametres du schema et appliquer ceux definis dans options, false pour restaurer les parametres

Definition at line 519 of file diagramprintdialog.cpp.

Referenced by printDiagram().

◆ setDocName()

void DiagramPrintDialog::setDocName ( const QString &  name)

Definit le nom du document

Definition at line 74 of file diagramprintdialog.cpp.

References doc_name_.

Referenced by exec(), and ProjectView::printProject().

◆ setFileName()

void DiagramPrintDialog::setFileName ( const QString &  name)

Definit le nom du PDF si l'utilisateur choisit une sortie vers un PDF

Definition at line 60 of file diagramprintdialog.cpp.

References file_name_.

Referenced by ProjectView::printProject().

◆ settingsSectionName()

QString DiagramPrintDialog::settingsSectionName ( const QPrinter *  printer)
private
Returns
a section name for use with QSettings in order to store parameters related to printer.

Definition at line 622 of file diagramprintdialog.cpp.

Referenced by loadPageSetupForCurrentPrinter(), and savePageSetupForCurrentPrinter().

◆ updatePrintTypeDialog

void DiagramPrintDialog::updatePrintTypeDialog ( )
privateslot

Assure la coherence du dialogue permettant le choix du type d'impression

Definition at line 275 of file diagramprintdialog.cpp.

References browse_button_, filepath_field_, pdf_choice_, and printer_choice_.

Referenced by buildPrintTypeDialog().

◆ verticalPagesCount()

int DiagramPrintDialog::verticalPagesCount ( Diagram diagram,
const ExportProperties options,
bool  fullpage = false 
) const
Parameters
diagramSchema a imprimer
optionsRendering options
fullpagetrue pour utiliser toute la feuille dans le calcul
Returns
La largeur du "poster" en nombre de pages pour imprimer le schema avec l'orientation et le format papier utilise dans l'imprimante en cours.

Definition at line 201 of file diagramprintdialog.cpp.

References diagramRect(), and printer_.

Referenced by pagesCount(), and printDiagram().

Member Data Documentation

◆ backup_diagram_background_color

QColor DiagramPrintDialog::backup_diagram_background_color
private

Definition at line 91 of file diagramprintdialog.h.

Referenced by DiagramPrintDialog(), and ~DiagramPrintDialog().

◆ browse_button_

QPushButton* DiagramPrintDialog::browse_button_
private

Definition at line 89 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog(), and updatePrintTypeDialog().

◆ buttons_

QDialogButtonBox* DiagramPrintDialog::buttons_
private

Definition at line 90 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().

◆ dialog_

QDialog* DiagramPrintDialog::dialog_
private

◆ doc_name_

QString DiagramPrintDialog::doc_name_
private

Definition at line 75 of file diagramprintdialog.h.

Referenced by docName(), exec(), and setDocName().

◆ file_name_

QString DiagramPrintDialog::file_name_
private

Definition at line 76 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog(), fileName(), and setFileName().

◆ filepath_field_

QLineEdit* DiagramPrintDialog::filepath_field_
private

◆ glayout0_

QGridLayout* DiagramPrintDialog::glayout0_
private

Definition at line 80 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().

◆ hlayout0_

QHBoxLayout* DiagramPrintDialog::hlayout0_
private

Definition at line 82 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().

◆ pdf_choice_

QRadioButton* DiagramPrintDialog::pdf_choice_
private

◆ pdf_icon_

QLabel* DiagramPrintDialog::pdf_icon_
private

Definition at line 84 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().

◆ printer_

QPrinter* DiagramPrintDialog::printer_
private

◆ printer_choice_

QRadioButton* DiagramPrintDialog::printer_choice_
private

◆ printer_icon_

QLabel* DiagramPrintDialog::printer_icon_
private

Definition at line 83 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().

◆ printtype_choice_

QButtonGroup* DiagramPrintDialog::printtype_choice_
private

Definition at line 85 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().

◆ printtype_label_

QLabel* DiagramPrintDialog::printtype_label_
private

Definition at line 79 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().

◆ project_

QETProject* DiagramPrintDialog::project_
private

Definition at line 73 of file diagramprintdialog.h.

Referenced by exec().

◆ vlayout0_

QVBoxLayout* DiagramPrintDialog::vlayout0_
private

Definition at line 81 of file diagramprintdialog.h.

Referenced by buildPrintTypeDialog().


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