2008-02-24 20:13:45 +00:00
|
|
|
/*
|
2016-05-13 17:40:36 +00:00
|
|
|
Copyright 2006-2016 The QElectroTech Team
|
2008-02-24 20:13:45 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef DIAGRAM_PRINT_DIALOG_H
|
|
|
|
#define DIAGRAM_PRINT_DIALOG_H
|
2015-03-02 20:14:56 +00:00
|
|
|
#include <QtWidgets>
|
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
#include "qetproject.h"
|
2008-02-24 20:13:45 +00:00
|
|
|
#include "diagram.h"
|
2009-11-22 16:12:22 +00:00
|
|
|
#include "exportproperties.h"
|
2015-03-02 20:14:56 +00:00
|
|
|
|
|
|
|
class QPrinter;
|
|
|
|
|
2008-02-24 20:13:45 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class implements both the dialog allowing users to configure the printing
|
|
|
|
of a project file and the printing itself.
|
2008-02-24 20:13:45 +00:00
|
|
|
*/
|
2015-03-02 20:14:56 +00:00
|
|
|
class DiagramPrintDialog : public QWidget
|
|
|
|
{
|
2016-08-25 01:57:20 +00:00
|
|
|
|
2015-03-02 20:14:56 +00:00
|
|
|
|
2008-02-24 20:13:45 +00:00
|
|
|
Q_OBJECT
|
2012-11-09 21:09:24 +00:00
|
|
|
// Constructors, destructor
|
2008-02-24 20:13:45 +00:00
|
|
|
public:
|
2009-04-03 19:30:25 +00:00
|
|
|
DiagramPrintDialog(QETProject *, QWidget * = 0);
|
2008-02-24 20:13:45 +00:00
|
|
|
virtual ~DiagramPrintDialog();
|
|
|
|
private:
|
|
|
|
DiagramPrintDialog(const DiagramPrintDialog &);
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2008-02-24 20:13:45 +00:00
|
|
|
public:
|
2009-04-03 19:30:25 +00:00
|
|
|
void setFileName(const QString &);
|
|
|
|
QString fileName() const;
|
2008-08-17 16:16:44 +00:00
|
|
|
void setDocName(const QString &);
|
|
|
|
QString docName() const;
|
2012-04-09 02:42:31 +00:00
|
|
|
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;
|
2008-02-24 20:13:45 +00:00
|
|
|
void exec();
|
|
|
|
|
|
|
|
private:
|
2009-04-03 19:30:25 +00:00
|
|
|
void buildPrintTypeDialog();
|
2008-02-24 20:13:45 +00:00
|
|
|
void buildDialog();
|
2009-11-22 16:12:22 +00:00
|
|
|
void saveReloadDiagramParameters(Diagram *, const ExportProperties, bool);
|
2012-08-05 00:23:13 +00:00
|
|
|
void savePageSetupForCurrentPrinter();
|
|
|
|
void loadPageSetupForCurrentPrinter();
|
|
|
|
QString settingsSectionName(const QPrinter *);
|
2008-02-24 20:13:45 +00:00
|
|
|
|
|
|
|
private slots:
|
2009-11-22 16:12:22 +00:00
|
|
|
void print(const QList<Diagram *> &, bool, const ExportProperties);
|
2012-04-09 02:42:31 +00:00
|
|
|
void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter * = 0);
|
2009-04-03 19:30:25 +00:00
|
|
|
void updatePrintTypeDialog();
|
|
|
|
void acceptPrintTypeDialog();
|
|
|
|
void browseFilePrintTypeDialog();
|
2008-02-24 20:13:45 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2008-02-24 20:13:45 +00:00
|
|
|
private:
|
2009-04-03 19:30:25 +00:00
|
|
|
QETProject *project_;
|
|
|
|
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_;
|
2013-12-28 20:39:38 +00:00
|
|
|
QColor backup_diagram_background_color;
|
2008-02-24 20:13:45 +00:00
|
|
|
};
|
|
|
|
#endif
|