ImageExportDialog.h
Go to the documentation of this file.
/***************************************************************************
File : ImageExportDialog.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2006,2007 by Ion Vasilief, Knut Franke
Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de
Description : QFileDialog extended with options for image export
***************************************************************************/
/***************************************************************************
* *
* This program 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. *
* *
* This program 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 this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef IMAGEEXPORTDIALOG_H
#define IMAGEEXPORTDIALOG_H
#include <ExtensibleFileDialog.h>
#include <QSpinBox>
#include <QCheckBox>
#include <QComboBox>
#include <QPrinter>
class QLabel;
class QStackedWidget;
class QGroupBox;
class MdiSubWindow;
class DoubleSpinBox;
class Graph;
class ImageExportDialog: public ExtensibleFileDialog
{
Q_OBJECT
private:
void initAdvancedOptions();
MdiSubWindow *d_window;
QWidget *d_advanced_options;
// vector format options
QGroupBox *d_vector_options;
QSpinBox *d_vector_resolution;
QCheckBox *d_color;
// raster format options
QGroupBox *d_raster_options;
QSpinBox *d_quality;
QCheckBox *d_transparency;
QSpinBox *d_bitmap_resolution;
QComboBox *d_compression;
QComboBox *d_3D_text_export_mode;
QComboBox *d_3D_export_sort;
QGroupBox *d_custom_size_box;
DoubleSpinBox *widthBox, *heightBox, *scaleFontsBox;
QComboBox *unitBox;
QLabel *resolutionLabel, *compressionLabel;
QCheckBox *keepRatioBox;
QCheckBox *d_escape_tex_strings;
QCheckBox *d_tex_font_sizes;
QPushButton *d_preview_button;
double aspect_ratio;
Graph *d_layer;
public:
ImageExportDialog(MdiSubWindow *window, QWidget * parent = 0, bool extended = true, Graph *g = 0, Qt::WFlags flags = 0 );
int vectorResolution() const { return d_vector_resolution->value(); };
bool color() const { return d_color->isChecked(); };
bool escapeStrings(){return d_escape_tex_strings->isChecked();};
bool exportFontSizes(){return d_tex_font_sizes->isChecked();};
int bitmapResolution() const { return d_bitmap_resolution->value(); };
int compression() const {return d_compression->currentIndex();};
int quality() const { return d_quality->value(); };
bool transparency() const;
int textExportMode() const {return d_3D_text_export_mode->currentIndex();};
int sortMode() const {return d_3D_export_sort->currentIndex();};
void selectFilter(const QString & filter);
QSizeF customExportSize();
int sizeUnit(){return unitBox->currentIndex();};
double scaleFontsFactor();
public slots:
void accept();
protected slots:
void closeEvent(QCloseEvent*);
void updateAdvancedOptions (const QString &filter);
void adjustWidth(double height);
void adjustHeight(double width);
void preview();
void drawPreview(QPrinter *);
void drawVectorPreview(QPrinter *);
};
#endif
ImageExportDialog::unitBox
QComboBox * unitBox
Definition: ImageExportDialog.h:78
ExtensibleFileDialog.h
ImageExportDialog::updateAdvancedOptions
void updateAdvancedOptions(const QString &filter)
Update which options are visible and enabled based on the output format.
Definition: ImageExportDialog.cpp:293
ImageExportDialog::d_preview_button
QPushButton * d_preview_button
Definition: ImageExportDialog.h:84
ImageExportDialog::d_vector_resolution
QSpinBox * d_vector_resolution
Definition: ImageExportDialog.h:62
ImageExportDialog::bitmapResolution
int bitmapResolution() const
For raster formats: returns the output resolution the user selected, defaulting to the screen resolut...
Definition: ImageExportDialog.h:109
ImageExportDialog::d_quality
QSpinBox * d_quality
Definition: ImageExportDialog.h:67
ImageExportDialog::d_3D_text_export_mode
QComboBox * d_3D_text_export_mode
Definition: ImageExportDialog.h:72
Graph
A 2D-plotting widget.
Definition: Graph.h:123
ImageExportDialog::d_escape_tex_strings
QCheckBox * d_escape_tex_strings
Definition: ImageExportDialog.h:81
ImageExportDialog::selectFilter
void selectFilter(const QString &filter)
Definition: ImageExportDialog.cpp:384
ImageExportDialog::d_advanced_options
QWidget * d_advanced_options
Container widget for all advanced options.
Definition: ImageExportDialog.h:58
ImageExportDialog::d_3D_export_sort
QComboBox * d_3D_export_sort
Definition: ImageExportDialog.h:73
ImageExportDialog::d_layer
Graph * d_layer
Definition: ImageExportDialog.h:87
ImageExportDialog::compressionLabel
QLabel * compressionLabel
Definition: ImageExportDialog.h:79
ImageExportDialog::preview
void preview()
Definition: ImageExportDialog.cpp:472
ImageExportDialog::d_window
MdiSubWindow * d_window
Pointer to the window to be exported.
Definition: ImageExportDialog.h:56
ImageExportDialog::widthBox
DoubleSpinBox * widthBox
Definition: ImageExportDialog.h:77
ImageExportDialog::aspect_ratio
double aspect_ratio
Definition: ImageExportDialog.h:86
ImageExportDialog::d_bitmap_resolution
QSpinBox * d_bitmap_resolution
Definition: ImageExportDialog.h:69
DoubleSpinBox
A QDoubleSpinBox allowing to customize numbers display with respect to locale settings.
Definition: DoubleSpinBox.h:39
ImageExportDialog::exportFontSizes
bool exportFontSizes()
For TeX format: returns whether font sizes should be exported (default: true).
Definition: ImageExportDialog.h:106
ImageExportDialog::d_vector_options
QGroupBox * d_vector_options
Container widget for all options available for vector formats.
Definition: ImageExportDialog.h:61
ImageExportDialog::heightBox
DoubleSpinBox * heightBox
Definition: ImageExportDialog.h:77
ImageExportDialog::drawVectorPreview
void drawVectorPreview(QPrinter *)
Definition: ImageExportDialog.cpp:526
ImageExportDialog::d_custom_size_box
QGroupBox * d_custom_size_box
Container widget for user defined export size.
Definition: ImageExportDialog.h:76
ImageExportDialog::d_compression
QComboBox * d_compression
Definition: ImageExportDialog.h:70
ImageExportDialog::vectorResolution
int vectorResolution() const
For vector formats: returns the output resolution the user selected, defaulting to the screen resolut...
Definition: ImageExportDialog.h:100
ImageExportDialog::sortMode
int sortMode() const
Return the sort export mode for 3D plots.
Definition: ImageExportDialog.h:121
ImageExportDialog::adjustHeight
void adjustHeight(double width)
Definition: ImageExportDialog.cpp:427
ImageExportDialog::scaleFontsBox
DoubleSpinBox * scaleFontsBox
Definition: ImageExportDialog.h:77
ImageExportDialog::d_tex_font_sizes
QCheckBox * d_tex_font_sizes
Definition: ImageExportDialog.h:82
ImageExportDialog::resolutionLabel
QLabel * resolutionLabel
Definition: ImageExportDialog.h:79
ImageExportDialog::quality
int quality() const
Return the quality (in percent) the user selected for export to raster formats.
Definition: ImageExportDialog.h:115
ImageExportDialog::compression
int compression() const
For raster formats supporting this option returns the output image compression, 0 means no compressio...
Definition: ImageExportDialog.h:112
ImageExportDialog::keepRatioBox
QCheckBox * keepRatioBox
Definition: ImageExportDialog.h:80
ImageExportDialog::d_raster_options
QGroupBox * d_raster_options
Container widget for all options available for raster formats.
Definition: ImageExportDialog.h:66
MdiSubWindow
Base class of all MDI client windows.
Definition: MdiSubWindow.h:51
ImageExportDialog::initAdvancedOptions
void initAdvancedOptions()
Create d_advanced_options and everything it contains.
Definition: ImageExportDialog.cpp:98
ImageExportDialog::sizeUnit
int sizeUnit()
Return the unit used for the custom export size.
Definition: ImageExportDialog.h:127
ImageExportDialog::textExportMode
int textExportMode() const
Return the text export mode for 3D plots.
Definition: ImageExportDialog.h:119
ImageExportDialog::scaleFontsFactor
double scaleFontsFactor()
Return the scale fonts factor.
Definition: ImageExportDialog.cpp:406
ImageExportDialog::accept
void accept()
Definition: ImageExportDialog.cpp:440
ImageExportDialog::escapeStrings
bool escapeStrings()
For TeX format: returns whether special characters should be escaped for ouput (default: true)...
Definition: ImageExportDialog.h:104
ImageExportDialog::d_transparency
QCheckBox * d_transparency
Definition: ImageExportDialog.h:68
ImageExportDialog::customExportSize
QSizeF customExportSize()
Return the custom export size.
Definition: ImageExportDialog.cpp:390
ImageExportDialog::transparency
bool transparency() const
Return whether the output&#39;s background should be transparent.
Definition: ImageExportDialog.cpp:398
ImageExportDialog::closeEvent
void closeEvent(QCloseEvent *)
Definition: ImageExportDialog.cpp:358
ImageExportDialog
QFileDialog extended with options for image export.
Definition: ImageExportDialog.h:47
ImageExportDialog::d_color
QCheckBox * d_color
Definition: ImageExportDialog.h:63
ImageExportDialog::drawPreview
void drawPreview(QPrinter *)
Definition: ImageExportDialog.cpp:486
ImageExportDialog::ImageExportDialog
ImageExportDialog(MdiSubWindow *window, QWidget *parent=0, bool extended=true, Graph *g=0, Qt::WFlags flags=0)
Constructor.
Definition: ImageExportDialog.cpp:46
ImageExportDialog::color
bool color() const
For vector formats: returns whether colors should be enabled for ouput (default: true).
Definition: ImageExportDialog.h:102
ExtensibleFileDialog
QFileDialog plus generic extension support.
Definition: ExtensibleFileDialog.h:44
ImageExportDialog::adjustWidth
void adjustWidth(double height)
Definition: ImageExportDialog.cpp:414