QElectroTech  0.8-dev
diagramprintdialog.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 DIAGRAM_PRINT_DIALOG_H
19 #define DIAGRAM_PRINT_DIALOG_H
20 #include <QtWidgets>
21 
22 #include "qetproject.h"
23 #include "diagram.h"
24 #include "exportproperties.h"
25 
26 class QPrinter;
27 
33 class DiagramPrintDialog : public QWidget
34 {
35 
36 
37  Q_OBJECT
38  // Constructors, destructor
39  public:
40  DiagramPrintDialog(QETProject *, QWidget * = nullptr);
41  ~DiagramPrintDialog() override;
42  private:
44 
45  // methods
46  public:
47  void setFileName(const QString &);
48  QString fileName() const;
49  void setDocName(const QString &);
50  QString docName() const;
51  QRect diagramRect(Diagram *, const ExportProperties &) const;
52  int pagesCount(Diagram *,
53  const ExportProperties &,
54  bool = false) const;
56  const ExportProperties &,
57  bool = false) const;
59  const ExportProperties &,
60  bool = false) const;
61  void exec();
62 
63  private:
64  void buildPrintTypeDialog();
65  void buildDialog();
67  const ExportProperties&,
68  bool);
71  QString settingsSectionName(const QPrinter *);
72 
73  private slots:
74  void print(const QList<Diagram *> &, bool, const ExportProperties&);
75  void printDiagram(Diagram *,
76  bool,
77  const ExportProperties &,
78  QPainter *,
79  QPrinter * = nullptr);
80  void updatePrintTypeDialog();
81  void acceptPrintTypeDialog();
83 
84  // attributes
85  private:
87  QPrinter *printer_;
88  QString doc_name_;
89  QString file_name_;
90 
91  QDialog *dialog_;
93  QGridLayout *glayout0_;
94  QVBoxLayout *vlayout0_;
95  QHBoxLayout *hlayout0_;
96  QLabel *printer_icon_;
97  QLabel *pdf_icon_;
98  QButtonGroup *printtype_choice_;
99  QRadioButton *printer_choice_;
100  QRadioButton *pdf_choice_;
101  QLineEdit *filepath_field_;
102  QPushButton *browse_button_;
103  QDialogButtonBox *buttons_;
105 };
106 #endif
DiagramPrintDialog::horizontalPagesCount
int horizontalPagesCount(Diagram *, const ExportProperties &, bool=false) const
Definition: diagramprintdialog.cpp:186
Diagram::background_color
static QColor background_color
background color of diagram
Definition: diagram.h:99
DiagramPrintDialog::~DiagramPrintDialog
~DiagramPrintDialog() override
Definition: diagramprintdialog.cpp:51
DiagramPrintDialog::verticalPagesCount
int verticalPagesCount(Diagram *, const ExportProperties &, bool=false) const
Definition: diagramprintdialog.cpp:202
QETPrintPreviewDialog::exportProperties
ExportProperties exportProperties() const
Definition: qetprintpreviewdialog.cpp:73
QETPrintPreviewDialog::fitDiagramsToPages
bool fitDiagramsToPages() const
Definition: qetprintpreviewdialog.cpp:66
DiagramPrintDialog::setFileName
void setFileName(const QString &)
Definition: diagramprintdialog.cpp:60
QET::Custom
@ Custom
From user collection.
Definition: qet.h:154
DiagramPrintDialog::pdf_icon_
QLabel * pdf_icon_
Definition: diagramprintdialog.h:97
DiagramPrintDialog::doc_name_
QString doc_name_
Definition: diagramprintdialog.h:88
DiagramPrintDialog::diagramRect
QRect diagramRect(Diagram *, const ExportProperties &) const
DiagramPrintDialog::diagramRect.
Definition: diagramprintdialog.cpp:91
DiagramPrintDialog::DiagramPrintDialog
DiagramPrintDialog(const DiagramPrintDialog &)
DiagramPrintDialog::updatePrintTypeDialog
void updatePrintTypeDialog()
Definition: diagramprintdialog.cpp:276
DiagramPrintDialog::printer_icon_
QLabel * printer_icon_
Definition: diagramprintdialog.h:96
exportproperties.h
DiagramPrintDialog::setDocName
void setDocName(const QString &)
Definition: diagramprintdialog.cpp:74
DiagramPrintDialog::docName
QString docName() const
Definition: diagramprintdialog.cpp:81
DiagramPrintDialog::DiagramPrintDialog
DiagramPrintDialog(QETProject *, QWidget *=nullptr)
Definition: diagramprintdialog.cpp:34
DiagramPrintDialog::saveReloadDiagramParameters
void saveReloadDiagramParameters(Diagram *, const ExportProperties &, bool)
Definition: diagramprintdialog.cpp:526
qetmessagebox.h
DiagramPrintDialog::savePageSetupForCurrentPrinter
void savePageSetupForCurrentPrinter()
Definition: diagramprintdialog.cpp:543
DiagramPrintDialog::printer_
QPrinter * printer_
Definition: diagramprintdialog.h:87
DiagramPrintDialog::filepath_field_
QLineEdit * filepath_field_
Definition: diagramprintdialog.h:101
ExportProperties::draw_titleblock
bool draw_titleblock
Whether to render the title block.
Definition: exportproperties.h:47
DiagramPrintDialog::buttons_
QDialogButtonBox * buttons_
Definition: diagramprintdialog.h:103
DiagramPrintDialog::project_
QETProject * project_
Definition: diagramprintdialog.h:86
DiagramPrintDialog::pdf_choice_
QRadioButton * pdf_choice_
Definition: diagramprintdialog.h:100
DiagramPrintDialog::vlayout0_
QVBoxLayout * vlayout0_
Definition: diagramprintdialog.h:94
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
DiagramPrintDialog::printer_choice_
QRadioButton * printer_choice_
Definition: diagramprintdialog.h:99
qeticons.h
QETPrintPreviewDialog
Definition: qetprintpreviewdialog.h:34
QET::displayedVersion
const QString displayedVersion
QElectroTech displayed version.
Definition: qet.h:34
DiagramPrintDialog::loadPageSetupForCurrentPrinter
void loadPageSetupForCurrentPrinter()
Definition: diagramprintdialog.cpp:579
DiagramPrintDialog::browse_button_
QPushButton * browse_button_
Definition: diagramprintdialog.h:102
QET::QetMessageBox::information
QMessageBox::StandardButton information(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
Definition: qetmessagebox.cpp:38
diagramprintdialog.h
DiagramPrintDialog::backup_diagram_background_color
QColor backup_diagram_background_color
Definition: diagramprintdialog.h:104
DiagramPrintDialog::buildDialog
void buildDialog()
qetproject.h
DiagramPrintDialog::acceptPrintTypeDialog
void acceptPrintTypeDialog()
Definition: diagramprintdialog.cpp:304
QET::Icons::PDF
QIcon PDF
Definition: qeticons.cpp:136
DiagramPrintDialog::printtype_choice_
QButtonGroup * printtype_choice_
Definition: diagramprintdialog.h:98
QETProject
Definition: qetproject.h:51
DiagramPrintDialog::dialog_
QDialog * dialog_
Definition: diagramprintdialog.h:91
QETPrintPreviewDialog::diagramsChooser
DiagramsChooser * diagramsChooser()
Definition: qetprintpreviewdialog.cpp:59
DiagramPrintDialog::printDiagram
void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter *=nullptr)
Definition: diagramprintdialog.cpp:405
DiagramPrintDialog::buildPrintTypeDialog
void buildPrintTypeDialog()
Definition: diagramprintdialog.cpp:215
DiagramPrintDialog::fileName
QString fileName() const
Definition: diagramprintdialog.cpp:67
ExportProperties
Definition: exportproperties.h:27
DiagramPrintDialog::hlayout0_
QHBoxLayout * hlayout0_
Definition: diagramprintdialog.h:95
DiagramPrintDialog::glayout0_
QGridLayout * glayout0_
Definition: diagramprintdialog.h:93
DiagramPrintDialog::exec
void exec()
Definition: diagramprintdialog.cpp:110
QET::Icons::Printer
QIcon Printer
Definition: qeticons.cpp:139
DiagramPrintDialog::pagesCount
int pagesCount(Diagram *, const ExportProperties &, bool=false) const
Definition: diagramprintdialog.cpp:175
DiagramPrintDialog::printtype_label_
QLabel * printtype_label_
Definition: diagramprintdialog.h:92
DiagramPrintDialog::settingsSectionName
QString settingsSectionName(const QPrinter *)
Definition: diagramprintdialog.cpp:629
diagramschooser.h
DiagramsChooser
Definition: diagramschooser.h:27
DiagramPrintDialog::print
void print(const QList< Diagram * > &, bool, const ExportProperties &)
Definition: diagramprintdialog.cpp:356
DiagramPrintDialog::browseFilePrintTypeDialog
void browseFilePrintTypeDialog()
Definition: diagramprintdialog.cpp:325
DiagramPrintDialog
The DiagramPrintDialog class This class implements both the dialog allowing users to configure the pr...
Definition: diagramprintdialog.h:34
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
DiagramPrintDialog::file_name_
QString file_name_
Definition: diagramprintdialog.h:89
QET::Icons::Cancel
QIcon Cancel
Definition: qeticons.cpp:34
diagram.h
qetprintpreviewdialog.h