2007-12-01 10:47:15 +00:00
|
|
|
/*
|
|
|
|
Copyright 2006-2007 Xavier Guerrin
|
|
|
|
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
|
|
|
|
#include <QtGui>
|
|
|
|
#include "diagram.h"
|
2007-10-05 12:06:39 +00:00
|
|
|
class QSvgGenerator;
|
2007-04-12 03:13:13 +00:00
|
|
|
/**
|
|
|
|
Cette classe represente le dialogue permettant d'exporter un schema
|
|
|
|
sous forme d'image selon les desirs de l'utilisateur
|
|
|
|
*/
|
|
|
|
class ExportDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
// constructeurs, destructeur
|
|
|
|
public:
|
|
|
|
ExportDialog(Diagram *, QWidget * = 0);
|
|
|
|
virtual ~ExportDialog();
|
|
|
|
|
|
|
|
private:
|
|
|
|
ExportDialog(const ExportDialog &);
|
|
|
|
|
|
|
|
// attributs
|
|
|
|
private:
|
|
|
|
// elements graphiques
|
|
|
|
QLineEdit *filename;
|
|
|
|
QPushButton *button_browse;
|
|
|
|
QComboBox *format;
|
|
|
|
QSpinBox *width;
|
|
|
|
QSpinBox *height;
|
|
|
|
QCheckBox *keep_aspect_ratio;
|
|
|
|
QCheckBox *draw_grid;
|
|
|
|
QCheckBox *draw_border;
|
|
|
|
QCheckBox *draw_inset;
|
|
|
|
QCheckBox *draw_columns;
|
2007-09-30 12:35:25 +00:00
|
|
|
QCheckBox *draw_terminals;
|
2007-04-12 03:13:13 +00:00
|
|
|
QRadioButton *export_elements;
|
|
|
|
QRadioButton *export_border;
|
|
|
|
QDialogButtonBox *buttons;
|
|
|
|
QGraphicsScene *preview_scene;
|
|
|
|
QGraphicsView *preview_view;
|
|
|
|
|
|
|
|
// booleens pour ne pas avoir de boucle lors de l'edition des dimensions de l'image
|
|
|
|
bool dontchangewidth;
|
|
|
|
bool dontchangeheight;
|
|
|
|
|
|
|
|
// elements relatifs au traitement effectue par le dialogue
|
|
|
|
Diagram *diagram;
|
|
|
|
QSize diagram_size;
|
|
|
|
qreal diagram_ratio;
|
2007-10-05 12:06:39 +00:00
|
|
|
QVector<QRgb> ColorTab;
|
2007-04-12 03:13:13 +00:00
|
|
|
|
|
|
|
// methodes
|
|
|
|
private:
|
|
|
|
QWidget *leftPart();
|
|
|
|
QWidget *rightPart();
|
|
|
|
QGroupBox *setupDimensionsGroupBox();
|
|
|
|
QGroupBox *setupOptionsGroupBox();
|
2007-10-05 12:06:39 +00:00
|
|
|
void saveReloadDiagramParameters(bool = true);
|
|
|
|
void generateSvg(QFile &file);
|
2007-04-12 03:13:13 +00:00
|
|
|
QImage generateImage();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void slot_correctWidth();
|
|
|
|
void slot_correctHeight();
|
|
|
|
void slot_chooseAFile();
|
|
|
|
void slot_check();
|
|
|
|
void slot_changeUseBorder();
|
|
|
|
void slot_refreshPreview();
|
|
|
|
};
|
2007-01-20 18:11:42 +00:00
|
|
|
#endif
|