//-------------------------------------------------------------------------- // $Id: Q3GUI/ExportImageDlg.hpp 2013/08/20 13:28:24 philw $ //-------------------------------------------------------------------------- #ifndef ExportImageDlgINCLUDED #define ExportImageDlgINCLUDED 1 #include //--- base class class QComboBox; class QFrame; class QHideEvent; class QLabel; class QShowEvent; class QSpinBox; //======================================================= //+class // // CLASS: // ExportImageDlg : QFileDialog // // DESCRIPTION: // Dialog that extends QFileDialog to allow the user to specify // image attributes (image size, format, resolution) for exporting // a GUI element as an image file. These new GUI elements appear // at the bottom of the file dialog. // // The dialog saves the user's most recent image settings and directory // into their local qt settings file. // //------------------------------------------------------- class ExportImageDlg : public QFileDialog { Q_OBJECT public: // Note [Phil, Gnats 5317, 8-19-2013, RW 6.4, Qt 4.8.4]: A resolution // of "100" turns OFF compression, which is a disaster for PNG and GIF // files (e.g. 162MB instead of 1MB). // enum { MAX_PNG_RESOLUTION = 85 }; public: ExportImageDlg(QWidget* parent=0, const char* name=0, bool modal=false); ~ExportImageDlg(); QString selectedFile() const; // See note above. Special processing for PNG and GIF files. int getResolution() const; // [0..100] void setResolution (int resolution); QString getFormat() const { return _format; } void setFormat(QString format) { _format = format; } bool isPngOrGif() const; int getWidth() const { return _width; } void setWidth(int w); int getHeight() const { return _height; } void setHeight(int h); QString getInitDir() const { return _dir; } void setInitDir(QString dir) { _dir = dir; } protected slots: virtual void accept(); protected: // Virtual from QWidget virtual void showEvent (QShowEvent*); virtual void hideEvent (QHideEvent*); protected: QString _dir; int _width; int _height; int _resolution; QString _format; private: QFrame* _userOptsFrame; QLabel* _resolutionLabel; QComboBox* _resolutionCombo; QLabel* _widthLabel; QSpinBox* _widthBox; QLabel* _heightLabel; QSpinBox* _heightBox; }; #endif // ExportImageDlgINCLUDED //--- (end ExportImageDlg.hpp) ---