QtiPlot  0.9.8.2
ImageExportDialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ImageExportDialog.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006,2007 by Ion Vasilief, Knut Franke
6  Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de
7  Description : QFileDialog extended with options for image export
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef IMAGEEXPORTDIALOG_H
30 #define IMAGEEXPORTDIALOG_H
31 
32 #include <ExtensibleFileDialog.h>
33 
34 #include <QSpinBox>
35 #include <QCheckBox>
36 #include <QComboBox>
37 #include <QPrinter>
38 
39 class QLabel;
40 class QStackedWidget;
41 class QGroupBox;
42 class MdiSubWindow;
43 class DoubleSpinBox;
44 class Graph;
45 
48 {
49  Q_OBJECT
50 
51 private:
53  void initAdvancedOptions();
54 
59  // vector format options
61  QGroupBox *d_vector_options;
63  QCheckBox *d_color;
64  // raster format options
66  QGroupBox *d_raster_options;
67  QSpinBox *d_quality;
68  QCheckBox *d_transparency;
70  QComboBox *d_compression;
71 
73  QComboBox *d_3D_export_sort;
74 
76  QGroupBox *d_custom_size_box;
78  QComboBox *unitBox;
80  QCheckBox *keepRatioBox;
82  QCheckBox *d_tex_font_sizes;
83 
84  QPushButton *d_preview_button;
85 
86  double aspect_ratio;
88 
89 public:
91 
98  ImageExportDialog(MdiSubWindow *window, QWidget * parent = 0, bool extended = true, Graph *g = 0, Qt::WFlags flags = 0 );
100  int vectorResolution() const { return d_vector_resolution->value(); };
102  bool color() const { return d_color->isChecked(); };
104  bool escapeStrings(){return d_escape_tex_strings->isChecked();};
106  bool exportFontSizes(){return d_tex_font_sizes->isChecked();};
107 
109  int bitmapResolution() const { return d_bitmap_resolution->value(); };
110 
112  int compression() const {return d_compression->currentIndex();};
113 
115  int quality() const { return d_quality->value(); };
117  bool transparency() const;
119  int textExportMode() const {return d_3D_text_export_mode->currentIndex();};
121  int sortMode() const {return d_3D_export_sort->currentIndex();};
122 
123  void selectFilter(const QString & filter);
125  QSizeF customExportSize();
127  int sizeUnit(){return unitBox->currentIndex();};
129  double scaleFontsFactor();
130 
131 public slots:
132  void accept();
133 
134 protected slots:
135  void closeEvent(QCloseEvent*);
137  void updateAdvancedOptions (const QString &filter);
138  void adjustWidth(double height);
139  void adjustHeight(double width);
140  void preview();
141  void drawPreview(QPrinter *);
142  void drawVectorPreview(QPrinter *);
143 };
144 
145 #endif
QComboBox * unitBox
Definition: ImageExportDialog.h:78
void updateAdvancedOptions(const QString &filter)
Update which options are visible and enabled based on the output format.
Definition: ImageExportDialog.cpp:293
QPushButton * d_preview_button
Definition: ImageExportDialog.h:84
QSpinBox * d_vector_resolution
Definition: ImageExportDialog.h:62
QSpinBox * d_quality
Definition: ImageExportDialog.h:67
QComboBox * d_3D_text_export_mode
Definition: ImageExportDialog.h:72
A 2D-plotting widget.
Definition: Graph.h:123
QCheckBox * d_escape_tex_strings
Definition: ImageExportDialog.h:81
void selectFilter(const QString &filter)
Definition: ImageExportDialog.cpp:384
QWidget * d_advanced_options
Container widget for all advanced options.
Definition: ImageExportDialog.h:58
QComboBox * d_3D_export_sort
Definition: ImageExportDialog.h:73
int vectorResolution() const
For vector formats: returns the output resolution the user selected, defaulting to the screen resolut...
Definition: ImageExportDialog.h:100
Graph * d_layer
Definition: ImageExportDialog.h:87
QLabel * compressionLabel
Definition: ImageExportDialog.h:79
void preview()
Definition: ImageExportDialog.cpp:472
MdiSubWindow * d_window
Pointer to the window to be exported.
Definition: ImageExportDialog.h:56
DoubleSpinBox * widthBox
Definition: ImageExportDialog.h:77
double aspect_ratio
Definition: ImageExportDialog.h:86
bool color() const
For vector formats: returns whether colors should be enabled for ouput (default: true).
Definition: ImageExportDialog.h:102
QSpinBox * d_bitmap_resolution
Definition: ImageExportDialog.h:69
A QDoubleSpinBox allowing to customize numbers display with respect to locale settings.
Definition: DoubleSpinBox.h:39
bool exportFontSizes()
For TeX format: returns whether font sizes should be exported (default: true).
Definition: ImageExportDialog.h:106
int textExportMode() const
Return the text export mode for 3D plots.
Definition: ImageExportDialog.h:119
QGroupBox * d_vector_options
Container widget for all options available for vector formats.
Definition: ImageExportDialog.h:61
DoubleSpinBox * heightBox
Definition: ImageExportDialog.h:77
void drawVectorPreview(QPrinter *)
Definition: ImageExportDialog.cpp:526
int sortMode() const
Return the sort export mode for 3D plots.
Definition: ImageExportDialog.h:121
bool transparency() const
Return whether the output&#39;s background should be transparent.
Definition: ImageExportDialog.cpp:398
QGroupBox * d_custom_size_box
Container widget for user defined export size.
Definition: ImageExportDialog.h:76
QComboBox * d_compression
Definition: ImageExportDialog.h:70
int compression() const
For raster formats supporting this option returns the output image compression, 0 means no compressio...
Definition: ImageExportDialog.h:112
void adjustHeight(double width)
Definition: ImageExportDialog.cpp:427
DoubleSpinBox * scaleFontsBox
Definition: ImageExportDialog.h:77
QCheckBox * d_tex_font_sizes
Definition: ImageExportDialog.h:82
QLabel * resolutionLabel
Definition: ImageExportDialog.h:79
QCheckBox * keepRatioBox
Definition: ImageExportDialog.h:80
QGroupBox * d_raster_options
Container widget for all options available for raster formats.
Definition: ImageExportDialog.h:66
Base class of all MDI client windows.
Definition: MdiSubWindow.h:51
int quality() const
Return the quality (in percent) the user selected for export to raster formats.
Definition: ImageExportDialog.h:115
void initAdvancedOptions()
Create d_advanced_options and everything it contains.
Definition: ImageExportDialog.cpp:98
int sizeUnit()
Return the unit used for the custom export size.
Definition: ImageExportDialog.h:127
double scaleFontsFactor()
Return the scale fonts factor.
Definition: ImageExportDialog.cpp:406
void accept()
Definition: ImageExportDialog.cpp:440
bool escapeStrings()
For TeX format: returns whether special characters should be escaped for ouput (default: true)...
Definition: ImageExportDialog.h:104
QCheckBox * d_transparency
Definition: ImageExportDialog.h:68
QSizeF customExportSize()
Return the custom export size.
Definition: ImageExportDialog.cpp:390
void closeEvent(QCloseEvent *)
Definition: ImageExportDialog.cpp:358
QFileDialog extended with options for image export.
Definition: ImageExportDialog.h:47
QCheckBox * d_color
Definition: ImageExportDialog.h:63
void drawPreview(QPrinter *)
Definition: ImageExportDialog.cpp:486
ImageExportDialog(MdiSubWindow *window, QWidget *parent=0, bool extended=true, Graph *g=0, Qt::WFlags flags=0)
Constructor.
Definition: ImageExportDialog.cpp:46
QFileDialog plus generic extension support.
Definition: ExtensibleFileDialog.h:44
int bitmapResolution() const
For raster formats: returns the output resolution the user selected, defaulting to the screen resolut...
Definition: ImageExportDialog.h:109
void adjustWidth(double height)
Definition: ImageExportDialog.cpp:414