QtiPlot 0.9.8.2
ImageExportDialog.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : ImageExportDialog.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006,2007 by Ion Vasilief, Knut Franke
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr, knut.franke*gmx.de
00007     Description          : QFileDialog extended with options for image export
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #ifndef IMAGEEXPORTDIALOG_H
00030 #define IMAGEEXPORTDIALOG_H
00031 
00032 #include <ExtensibleFileDialog.h>
00033 
00034 #include <QSpinBox>
00035 #include <QCheckBox>
00036 #include <QComboBox>
00037 #include <QPrinter>
00038 
00039 class QLabel;
00040 class QStackedWidget;
00041 class QGroupBox;
00042 class MdiSubWindow;
00043 class DoubleSpinBox;
00044 class Graph;
00045 
00047 class ImageExportDialog: public ExtensibleFileDialog
00048 {
00049     Q_OBJECT
00050 
00051 private:
00053     void initAdvancedOptions();
00054 
00056     MdiSubWindow *d_window;
00058     QWidget *d_advanced_options;
00059     // vector format options
00061     QGroupBox *d_vector_options;
00062     QSpinBox *d_vector_resolution;
00063     QCheckBox *d_color;
00064     // raster format options
00066     QGroupBox *d_raster_options;
00067     QSpinBox *d_quality;
00068     QCheckBox *d_transparency;
00069     QSpinBox *d_bitmap_resolution;
00070     QComboBox *d_compression;
00071 
00072     QComboBox *d_3D_text_export_mode;
00073     QComboBox *d_3D_export_sort;
00074 
00076     QGroupBox *d_custom_size_box;
00077     DoubleSpinBox *widthBox, *heightBox, *scaleFontsBox;
00078     QComboBox *unitBox;
00079     QLabel *resolutionLabel, *compressionLabel;
00080     QCheckBox *keepRatioBox;
00081     QCheckBox *d_escape_tex_strings;
00082     QCheckBox *d_tex_font_sizes;
00083 
00084     QPushButton *d_preview_button;
00085 
00086     double aspect_ratio;
00087     Graph *d_layer;
00088 
00089 public:
00091 
00098     ImageExportDialog(MdiSubWindow *window, QWidget * parent = 0, bool extended = true, Graph *g = 0, Qt::WFlags flags = 0 );
00100     int vectorResolution() const { return d_vector_resolution->value(); };
00102     bool color() const { return d_color->isChecked(); };
00104     bool escapeStrings(){return d_escape_tex_strings->isChecked();};
00106     bool exportFontSizes(){return d_tex_font_sizes->isChecked();};
00107 
00109     int bitmapResolution() const { return d_bitmap_resolution->value(); };
00110 
00112     int compression() const {return d_compression->currentIndex();};
00113 
00115     int quality() const { return d_quality->value(); };
00117     bool transparency() const;
00119     int textExportMode() const {return d_3D_text_export_mode->currentIndex();};
00121     int sortMode() const {return d_3D_export_sort->currentIndex();};
00122 
00123     void selectFilter(const QString & filter);
00125     QSizeF customExportSize();
00127     int sizeUnit(){return unitBox->currentIndex();};
00129     double scaleFontsFactor();
00130 
00131 public slots:
00132     void accept();
00133 
00134 protected slots:
00135     void closeEvent(QCloseEvent*);
00137     void updateAdvancedOptions (const QString &filter);
00138     void adjustWidth(double height);
00139     void adjustHeight(double width);
00140     void preview();
00141     void drawPreview(QPrinter *);
00142     void drawVectorPreview(QPrinter *);
00143 };
00144 
00145 #endif