2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2017-01-20 10:55:49 +00:00
|
|
|
Copyright 2006-2017 The QElectroTech Team
|
2007-12-01 10:47:15 +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/>.
|
|
|
|
*/
|
2007-01-20 18:11:42 +00:00
|
|
|
#ifndef EXPORTDIALOG_H
|
2007-04-12 03:13:13 +00:00
|
|
|
#define EXPORTDIALOG_H
|
2015-03-02 20:14:56 +00:00
|
|
|
#include <QtWidgets>
|
2007-04-12 03:13:13 +00:00
|
|
|
#include "diagram.h"
|
2009-04-03 19:30:25 +00:00
|
|
|
#include "qetproject.h"
|
2007-10-05 12:06:39 +00:00
|
|
|
class QSvgGenerator;
|
2009-08-09 12:51:02 +00:00
|
|
|
class ExportPropertiesWidget;
|
2007-04-12 03:13:13 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
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.
|
2007-04-12 03:13:13 +00:00
|
|
|
*/
|
|
|
|
class ExportDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2007-04-12 03:13:13 +00:00
|
|
|
public:
|
2017-08-05 02:06:59 +00:00
|
|
|
ExportDialog(QETProject *, QWidget * = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~ExportDialog() override;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
ExportDialog(const ExportDialog &);
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
|
|
|
int diagramsToExportCount() const;
|
2014-06-14 16:04:34 +00:00
|
|
|
static QPointF rotation_transformed(qreal, qreal, qreal, qreal, qreal);
|
2009-04-03 19:30:25 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
class ExportDiagramLine {
|
|
|
|
public:
|
2009-08-20 20:39:38 +00:00
|
|
|
ExportDiagramLine(Diagram *, QSize);
|
2009-04-03 19:30:25 +00:00
|
|
|
virtual ~ExportDiagramLine();
|
|
|
|
QBoxLayout *sizeLayout();
|
|
|
|
Diagram *diagram;
|
|
|
|
QCheckBox *must_export;
|
|
|
|
QLabel *title_label;
|
|
|
|
QLineEdit *file_name;
|
|
|
|
QSpinBox *width;
|
|
|
|
QLabel *x_label;
|
|
|
|
QSpinBox *height;
|
|
|
|
QPushButton *keep_ratio;
|
|
|
|
QPushButton *reset_size;
|
|
|
|
QPushButton *preview;
|
2009-08-09 13:53:35 +00:00
|
|
|
QPushButton *clipboard;
|
2009-04-03 19:30:25 +00:00
|
|
|
};
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2007-04-12 03:13:13 +00:00
|
|
|
private:
|
2009-04-03 19:30:25 +00:00
|
|
|
QHash<int, ExportDialog::ExportDiagramLine *> diagram_lines_;
|
2012-11-09 21:09:24 +00:00
|
|
|
// visual items
|
2009-04-03 19:30:25 +00:00
|
|
|
QGridLayout *diagrams_list_layout_;
|
2009-08-09 12:51:02 +00:00
|
|
|
ExportPropertiesWidget *epw;
|
2007-04-12 03:13:13 +00:00
|
|
|
QDialogButtonBox *buttons;
|
2014-02-17 11:11:06 +00:00
|
|
|
|
|
|
|
QPushButton *selectAll;
|
|
|
|
QPushButton *deSelectAll;
|
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
// mappers
|
|
|
|
QSignalMapper *preview_mapper_;
|
|
|
|
QSignalMapper *width_mapper_;
|
|
|
|
QSignalMapper *height_mapper_;
|
|
|
|
QSignalMapper *ratio_mapper_;
|
|
|
|
QSignalMapper *reset_mapper_;
|
2009-08-09 13:53:35 +00:00
|
|
|
QSignalMapper *clipboard_mapper_;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// project whose diagrams are to be exported
|
2009-04-03 19:30:25 +00:00
|
|
|
QETProject *project_;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2007-04-12 03:13:13 +00:00
|
|
|
private:
|
2009-04-03 19:30:25 +00:00
|
|
|
QWidget *initDiagramsListPart();
|
|
|
|
void saveReloadDiagramParameters(Diagram *, bool = true);
|
2009-08-09 13:53:35 +00:00
|
|
|
void generateSvg(Diagram *, int, int, bool, QIODevice &);
|
2014-01-08 16:55:16 +00:00
|
|
|
void generateDxf(Diagram *, int, int, bool, QString &);
|
2018-07-19 14:14:31 +00:00
|
|
|
void fillRow(const QString&, const QRectF &, QString, const QString&, QString, QString);
|
2009-04-03 19:30:25 +00:00
|
|
|
QImage generateImage(Diagram *, int, int, bool);
|
|
|
|
void exportDiagram(ExportDiagramLine *);
|
|
|
|
qreal diagramRatio(Diagram *);
|
|
|
|
QSize diagramSize(Diagram *);
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
public slots:
|
2009-04-03 19:30:25 +00:00
|
|
|
void slot_correctWidth(int);
|
|
|
|
void slot_correctHeight(int);
|
|
|
|
void slot_keepRatioChanged(int);
|
|
|
|
void slot_resetSize(int);
|
|
|
|
void slot_export();
|
2007-04-12 03:13:13 +00:00
|
|
|
void slot_changeUseBorder();
|
2009-04-03 19:30:25 +00:00
|
|
|
void slot_checkDiagramsCount();
|
|
|
|
void slot_changeFilesExtension(bool = false);
|
|
|
|
void slot_previewDiagram(int);
|
2009-08-09 13:53:35 +00:00
|
|
|
void slot_exportToClipBoard(int);
|
2014-02-17 11:11:06 +00:00
|
|
|
void slot_selectAllClicked();
|
|
|
|
void slot_deSelectAllClicked();
|
2007-04-12 03:13:13 +00:00
|
|
|
};
|
2007-01-20 18:11:42 +00:00
|
|
|
#endif
|