Quantum GIS API Documentation  master-ce49b66
src/gui/qgsrasterformatsaveoptionswidget.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           qgsrasterformatsaveoptionswidget.h
00003                              -------------------
00004     begin                : July 2012
00005     copyright            : (C) 2012 by Etienne Tourigny
00006     email                : etourigny dot dev at gmail dot com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QGSRASTERFORMATSAVEOPTIONSWIDGET_H
00019 #define QGSRASTERFORMATSAVEOPTIONSWIDGET_H
00020 
00021 #include "ui_qgsrasterformatsaveoptionswidgetbase.h"
00022 
00023 #include "qgsrasterdataprovider.h"
00024 
00025 class QgsRasterLayer;
00026 
00030 class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget,
00031       private Ui::QgsRasterFormatSaveOptionsWidgetBase
00032 {
00033     Q_OBJECT
00034 
00035   public:
00036 
00037     enum Type
00038     {
00039       Default, // everything except profile buttons (save as dlg)
00040       Full, // everything (options dlg)
00041       Table, // just table
00042       LineEdit, // just the line edit
00043       ProfileLineEdit // Profile + LineEdit
00044     };
00045 
00046     QgsRasterFormatSaveOptionsWidget( QWidget* parent = 0, QString format = "GTiff",
00047                                       QgsRasterFormatSaveOptionsWidget::Type type = Default,
00048                                       QString provider = "gdal" );
00049     ~QgsRasterFormatSaveOptionsWidget();
00050 
00051     void setFormat( QString format );
00052     void setProvider( QString provider );
00053     void setRasterLayer( QgsRasterLayer* rasterLayer ) { mRasterLayer = rasterLayer; mRasterFileName = QString(); }
00054     void setRasterFileName( const QString& file ) { mRasterLayer = 0; mRasterFileName = file; }
00055     QStringList options() const;
00056     void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
00057     void setPyramidsFormat( QgsRaster::RasterPyramidsFormat format )
00058     { mPyramids = true; mPyramidsFormat = format; }
00059 
00060   public slots:
00061 
00062     void apply();
00063     void helpOptions();
00064     QString validateOptions( bool gui = true, bool reportOk = true );
00065     void updateProfiles();
00066 
00067   private slots:
00068 
00069     void on_mProfileNewButton_clicked();
00070     void on_mProfileDeleteButton_clicked();
00071     void on_mProfileResetButton_clicked();
00072     void on_mOptionsAddButton_clicked();
00073     void on_mOptionsDeleteButton_clicked();
00074     void on_mOptionsLineEdit_editingFinished();
00075     void optionsTableChanged();
00076     void optionsTableEnableDeleteButton();
00077     void updateOptions();
00078     void swapOptionsUI( int newIndex = -1 );
00079     void updateControls();
00080 
00081   protected:
00082     virtual void showEvent( QShowEvent * event );
00083 
00084   signals:
00085     void optionsChanged();
00086 
00087   private:
00088 
00089     QString mFormat;
00090     QString mProvider;
00091     QgsRasterLayer* mRasterLayer;
00092     QString mRasterFileName;
00093     QMap< QString, QString> mOptionsMap;
00094     static QMap< QString, QStringList > mBuiltinProfiles;
00095     bool mPyramids;
00096     QgsRaster::RasterPyramidsFormat mPyramidsFormat;
00097 
00098     QString settingsKey( QString profile ) const;
00099     QString currentProfileKey() const;
00100     QString createOptions( QString profile ) const;
00101     void deleteCreateOptions( QString profile );
00102     void setCreateOptions( );
00103     void setCreateOptions( QString profile, QString options );
00104     void setCreateOptions( QString profile, QStringList list );
00105     QStringList profiles() const;
00106     bool eventFilter( QObject *obj, QEvent *event );
00107 
00108 };
00109 
00110 #endif // QGSRASTERLAYERSAVEASDIALOG_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines