mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
add qgsrasterformatsaveoptionswidget to sip and cleanup names ; better hack for mOptionsLabel click
This commit is contained in:
parent
ee3bf0e29f
commit
c998ee4ac5
@ -37,5 +37,7 @@
|
||||
%Include qgsattributeeditor.sip
|
||||
%Include qgsfieldvalidator.sip
|
||||
%Include qgsquerybuilder.sip
|
||||
%Include qgsrasterformatsaveoptionswidget.sip
|
||||
|
||||
%Include symbology-ng-gui.sip
|
||||
|
||||
|
49
python/gui/qgsrasterformatsaveoptionswidget.sip
Normal file
49
python/gui/qgsrasterformatsaveoptionswidget.sip
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
class QgsRasterFormatSaveOptionsWidget : QWidget
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsrasterformatsaveoptionswidget.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsRasterFormatSaveOptionsWidget( QWidget* parent = 0, QString format = "GTiff", QString provider = "gdal" );
|
||||
~QgsRasterFormatSaveOptionsWidget();
|
||||
|
||||
void setFormat( QString format );
|
||||
void setProvider( QString provider );
|
||||
QStringList options() const;
|
||||
void showProfileButtons( bool show = true );
|
||||
|
||||
public slots:
|
||||
|
||||
void apply();
|
||||
void helpOptions();
|
||||
bool validateOptions( bool gui = true );
|
||||
|
||||
private slots:
|
||||
|
||||
void on_mProfileNewButton_clicked();
|
||||
void on_mProfileDeleteButton_clicked();
|
||||
void on_mProfileResetButton_clicked();
|
||||
void on_mOptionsAddButton_clicked();
|
||||
void on_mOptionsDeleteButton_clicked();
|
||||
void on_mOptionsLabel_clicked();
|
||||
void on_mOptionsLineEdit_editingFinished();
|
||||
void optionsTableChanged();
|
||||
void optionsTableEnableDeleteButton();
|
||||
void updateOptions();
|
||||
|
||||
private:
|
||||
|
||||
QString settingsKey( QString profile ) const;
|
||||
QString currentProfileKey() const;
|
||||
QString createOptions( QString profile ) const;
|
||||
void deleteCreateOptions( QString profile );
|
||||
void setCreateOptions( );
|
||||
void setCreateOptions( QString profile, QString options );
|
||||
void setCreateOptions( QString profile, QStringList list );
|
||||
QStringList profiles() const;
|
||||
void updateProfiles();
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
};
|
@ -26,7 +26,7 @@
|
||||
#include "qgsnetworkaccessmanager.h"
|
||||
#include "qgsproject.h"
|
||||
|
||||
#include "qgsrasterformatoptionswidget.h"
|
||||
#include "qgsrasterformatsaveoptionswidget.h"
|
||||
#include "qgsdialog.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
@ -1103,7 +1103,8 @@ void QgsOptions::editGdalDriver( const QString& driverName )
|
||||
QLabel *label = new QLabel( title, &dlg );
|
||||
label->setAlignment( Qt::AlignHCenter );
|
||||
layout->addWidget( label );
|
||||
QgsRasterFormatOptionsWidget* optionsWidget = new QgsRasterFormatOptionsWidget( &dlg, driverName, "gdal" );
|
||||
QgsRasterFormatSaveOptionsWidget* optionsWidget =
|
||||
new QgsRasterFormatSaveOptionsWidget( &dlg, driverName, "gdal" );
|
||||
layout->addWidget( optionsWidget );
|
||||
optionsWidget->showProfileButtons( true );
|
||||
|
||||
|
@ -7,7 +7,6 @@ raster/qgspalettedrendererwidget.cpp
|
||||
raster/qgssinglebandgrayrendererwidget.cpp
|
||||
raster/qgssinglebandpseudocolorrendererwidget.cpp
|
||||
raster/qgsrasterhistogramwidget.cpp
|
||||
raster/qgsrasterformatoptionswidget.cpp
|
||||
|
||||
symbology-ng/qgsbrushstylecombobox.cpp
|
||||
symbology-ng/qgscolorrampcombobox.cpp
|
||||
@ -79,6 +78,7 @@ qgsprojectbadlayerguihandler.cpp
|
||||
qgsprojectionselector.cpp
|
||||
qgsquickprint.cpp
|
||||
qgsrasterlayersaveasdialog.cpp
|
||||
qgsrasterformatsaveoptionswidget.cpp
|
||||
qgsrubberband.cpp
|
||||
qgsscalecombobox.cpp
|
||||
qgstextannotationitem.cpp
|
||||
@ -105,7 +105,6 @@ raster/qgsmultibandcolorrendererwidget.h
|
||||
raster/qgssinglebandgrayrendererwidget.h
|
||||
raster/qgssinglebandpseudocolorrendererwidget.h
|
||||
raster/qgsrasterhistogramwidget.h
|
||||
raster/qgsrasterformatoptionswidget.h
|
||||
|
||||
symbology-ng/qgsdashspacedialog.h
|
||||
symbology-ng/qgssymbollayerv2widget.h
|
||||
@ -160,6 +159,7 @@ qgsowssourceselect.h
|
||||
qgsprojectionselector.h
|
||||
qgsquickprint.h
|
||||
qgsrasterlayersaveasdialog.h
|
||||
qgsrasterformatsaveoptionswidget.h
|
||||
qgsludialog.h
|
||||
qgsprojectbadlayerguihandler.h
|
||||
qgslonglongvalidator.h
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsrasterformatoptionswidget.cpp
|
||||
qgsrasterformatsaveoptionswidget.cpp
|
||||
-------------------
|
||||
begin : July 2012
|
||||
copyright : (C) 2012 by Etienne Tourigny
|
||||
@ -15,7 +15,7 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsrasterformatoptionswidget.h"
|
||||
#include "qgsrasterformatsaveoptionswidget.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsdialog.h"
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QTextEdit>
|
||||
#include <QMouseEvent>
|
||||
|
||||
// todo put this somewhere else - how can we access gdal provider?
|
||||
char** papszFromStringList( const QStringList& list )
|
||||
@ -40,10 +41,9 @@ char** papszFromStringList( const QStringList& list )
|
||||
return papszRetList;
|
||||
}
|
||||
|
||||
QMap< QString, QStringList > QgsRasterFormatSaveOptionsWidget::mBuiltinProfiles;
|
||||
|
||||
QMap< QString, QStringList > QgsRasterFormatOptionsWidget::mBuiltinProfiles;
|
||||
|
||||
QgsRasterFormatOptionsWidget::QgsRasterFormatOptionsWidget( QWidget* parent, QString format, QString provider )
|
||||
QgsRasterFormatSaveOptionsWidget::QgsRasterFormatSaveOptionsWidget( QWidget* parent, QString format, QString provider )
|
||||
: QWidget( parent ), mFormat( format ), mProvider( provider )
|
||||
|
||||
{
|
||||
@ -71,36 +71,37 @@ QgsRasterFormatOptionsWidget::QgsRasterFormatOptionsWidget( QWidget* parent, QSt
|
||||
connect( mProfileComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
|
||||
this, SLOT( updateOptions() ) );
|
||||
connect( mOptionsTable, SIGNAL( cellChanged( int, int ) ), this, SLOT( optionsTableChanged() ) );
|
||||
// connect( mOptionsAddButton, SIGNAL( clicked() ), this, SLOT( optionsTableAddNewRow() ) );
|
||||
// connect( mOptionsDeleteButton, SIGNAL( clicked() ), this, SLOT( optionsTableDeleteRow() ) );
|
||||
connect( mOptionsHelpButton, SIGNAL( clicked() ), this, SLOT( optionsHelp() ) );
|
||||
connect( mOptionsValidateButton, SIGNAL( clicked() ), this, SLOT( optionsValidate() ) );
|
||||
connect( mOptionsHelpButton, SIGNAL( clicked() ), this, SLOT( helpOptions() ) );
|
||||
connect( mOptionsValidateButton, SIGNAL( clicked() ), this, SLOT( validateOptions() ) );
|
||||
|
||||
// map options label left mouse click to optionsToggle()
|
||||
mOptionsLabel->installEventFilter( this );
|
||||
|
||||
updateProfiles();
|
||||
}
|
||||
|
||||
QgsRasterFormatOptionsWidget::~QgsRasterFormatOptionsWidget()
|
||||
QgsRasterFormatSaveOptionsWidget::~QgsRasterFormatSaveOptionsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::setFormat( QString format )
|
||||
void QgsRasterFormatSaveOptionsWidget::setFormat( QString format )
|
||||
{
|
||||
mFormat = format;
|
||||
updateProfiles();
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::setProvider( QString provider )
|
||||
void QgsRasterFormatSaveOptionsWidget::setProvider( QString provider )
|
||||
{
|
||||
mProvider = provider;
|
||||
}
|
||||
|
||||
|
||||
void QgsRasterFormatOptionsWidget::showProfileButtons( bool show )
|
||||
void QgsRasterFormatSaveOptionsWidget::showProfileButtons( bool show )
|
||||
{
|
||||
mProfileButtons->setVisible( show );
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::updateProfiles()
|
||||
void QgsRasterFormatSaveOptionsWidget::updateProfiles()
|
||||
{
|
||||
// build profiles list = user + builtin(last)
|
||||
QStringList profileKeys = profiles();
|
||||
@ -146,8 +147,7 @@ void QgsRasterFormatOptionsWidget::updateProfiles()
|
||||
updateOptions();
|
||||
}
|
||||
|
||||
// void QgsRasterFormatOptionsWidget::on_mProfileComboBox_currentIndexChanged( const QString & text )
|
||||
void QgsRasterFormatOptionsWidget::updateOptions()
|
||||
void QgsRasterFormatSaveOptionsWidget::updateOptions()
|
||||
{
|
||||
QString myOptions = mOptionsMap.value( currentProfileKey() );
|
||||
QStringList myOptionsList = myOptions.trimmed().split( " ", QString::SkipEmptyParts );
|
||||
@ -172,13 +172,13 @@ void QgsRasterFormatOptionsWidget::updateOptions()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::apply()
|
||||
void QgsRasterFormatSaveOptionsWidget::apply()
|
||||
{
|
||||
setCreateOptions();
|
||||
}
|
||||
|
||||
|
||||
void QgsRasterFormatOptionsWidget::optionsHelp()
|
||||
void QgsRasterFormatSaveOptionsWidget::helpOptions()
|
||||
{
|
||||
QString message;
|
||||
|
||||
@ -214,21 +214,21 @@ void QgsRasterFormatOptionsWidget::optionsHelp()
|
||||
dlg->show(); //non modal
|
||||
}
|
||||
|
||||
bool QgsRasterFormatOptionsWidget::optionsValidate( bool message )
|
||||
bool QgsRasterFormatSaveOptionsWidget::validateOptions( bool gui )
|
||||
{
|
||||
QStringList options = createOptions();
|
||||
QStringList createOptions = options();
|
||||
bool ok = false;
|
||||
|
||||
if ( !options.isEmpty() && mProvider == "gdal" && mFormat != "" && mFormat != "_pyramids" )
|
||||
if ( !createOptions.isEmpty() && mProvider == "gdal" && mFormat != "" && mFormat != "_pyramids" )
|
||||
{
|
||||
GDALDriverH myGdalDriver = GDALGetDriverByName( mFormat.toLocal8Bit().constData() );
|
||||
if ( myGdalDriver )
|
||||
{
|
||||
// print error string?
|
||||
char** papszOptions = papszFromStringList( options );
|
||||
char** papszOptions = papszFromStringList( createOptions );
|
||||
ok = ( GDALValidateCreationOptions( myGdalDriver, papszOptions ) == TRUE );
|
||||
CSLDestroy( papszOptions );
|
||||
if ( message )
|
||||
if ( gui )
|
||||
{
|
||||
if ( ok )
|
||||
QMessageBox::information( this, "", tr( "Valid" ), QMessageBox::Close );
|
||||
@ -240,7 +240,7 @@ bool QgsRasterFormatOptionsWidget::optionsValidate( bool message )
|
||||
return ok;
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::optionsTableChanged()
|
||||
void QgsRasterFormatSaveOptionsWidget::optionsTableChanged()
|
||||
{
|
||||
QTableWidgetItem *key, *value;
|
||||
QString options;
|
||||
@ -259,12 +259,12 @@ void QgsRasterFormatOptionsWidget::optionsTableChanged()
|
||||
mOptionsLineEdit->setText( options );
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::on_mOptionsLineEdit_editingFinished()
|
||||
void QgsRasterFormatSaveOptionsWidget::on_mOptionsLineEdit_editingFinished()
|
||||
{
|
||||
mOptionsMap[ currentProfileKey()] = mOptionsLineEdit->text().trimmed();
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::on_mProfileNewButton_clicked()
|
||||
void QgsRasterFormatSaveOptionsWidget::on_mProfileNewButton_clicked()
|
||||
{
|
||||
QString profileName = QInputDialog::getText( this, "", tr( "Profile name:" ) );
|
||||
if ( ! profileName.isEmpty() )
|
||||
@ -276,7 +276,7 @@ void QgsRasterFormatOptionsWidget::on_mProfileNewButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::on_mProfileDeleteButton_clicked()
|
||||
void QgsRasterFormatSaveOptionsWidget::on_mProfileDeleteButton_clicked()
|
||||
{
|
||||
int index = mProfileComboBox->currentIndex();
|
||||
QString profileKey = currentProfileKey();
|
||||
@ -287,7 +287,7 @@ void QgsRasterFormatOptionsWidget::on_mProfileDeleteButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::on_mProfileResetButton_clicked()
|
||||
void QgsRasterFormatSaveOptionsWidget::on_mProfileResetButton_clicked()
|
||||
{
|
||||
QString profileKey = currentProfileKey();
|
||||
if ( mBuiltinProfiles.contains( profileKey ) )
|
||||
@ -302,18 +302,12 @@ void QgsRasterFormatOptionsWidget::on_mProfileResetButton_clicked()
|
||||
updateOptions();
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::on_mOptionsLabel_clicked()
|
||||
{
|
||||
mOptionsStackedWIdget->setCurrentIndex(( mOptionsStackedWIdget->currentIndex() + 1 ) % 2 );
|
||||
updateOptions();
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::optionsTableEnableDeleteButton()
|
||||
void QgsRasterFormatSaveOptionsWidget::optionsTableEnableDeleteButton()
|
||||
{
|
||||
mOptionsDeleteButton->setEnabled( mOptionsTable->currentRow() >= 0 );
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::on_mOptionsAddButton_clicked()
|
||||
void QgsRasterFormatSaveOptionsWidget::on_mOptionsAddButton_clicked()
|
||||
{
|
||||
mOptionsTable->insertRow( mOptionsTable->rowCount() );
|
||||
// select the added row
|
||||
@ -323,7 +317,7 @@ void QgsRasterFormatOptionsWidget::on_mOptionsAddButton_clicked()
|
||||
mOptionsTable->setCurrentItem( item );
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::on_mOptionsDeleteButton_clicked()
|
||||
void QgsRasterFormatSaveOptionsWidget::on_mOptionsDeleteButton_clicked()
|
||||
{
|
||||
if ( mOptionsTable->currentRow() >= 0 )
|
||||
{
|
||||
@ -336,7 +330,7 @@ void QgsRasterFormatOptionsWidget::on_mOptionsDeleteButton_clicked()
|
||||
}
|
||||
|
||||
|
||||
QString QgsRasterFormatOptionsWidget::settingsKey( QString profileName ) const
|
||||
QString QgsRasterFormatSaveOptionsWidget::settingsKey( QString profileName ) const
|
||||
{
|
||||
if ( profileName != "" )
|
||||
profileName = "/profile_" + profileName;
|
||||
@ -345,29 +339,29 @@ QString QgsRasterFormatOptionsWidget::settingsKey( QString profileName ) const
|
||||
return mProvider + "/driverOptions/" + mFormat.toLower() + profileName + "/create";
|
||||
}
|
||||
|
||||
QString QgsRasterFormatOptionsWidget::currentProfileKey() const
|
||||
QString QgsRasterFormatSaveOptionsWidget::currentProfileKey() const
|
||||
{
|
||||
return mProfileComboBox->itemData( mProfileComboBox->currentIndex() ).toString();
|
||||
}
|
||||
|
||||
QStringList QgsRasterFormatOptionsWidget::createOptions() const
|
||||
QStringList QgsRasterFormatSaveOptionsWidget::options() const
|
||||
{
|
||||
return mOptionsMap.value( currentProfileKey() ).trimmed().split( " ", QString::SkipEmptyParts );
|
||||
}
|
||||
|
||||
QString QgsRasterFormatOptionsWidget::createOptions( QString profileName ) const
|
||||
QString QgsRasterFormatSaveOptionsWidget::createOptions( QString profileName ) const
|
||||
{
|
||||
QSettings mySettings;
|
||||
return mySettings.value( settingsKey( profileName ), "" ).toString();
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::deleteCreateOptions( QString profileName )
|
||||
void QgsRasterFormatSaveOptionsWidget::deleteCreateOptions( QString profileName )
|
||||
{
|
||||
QSettings mySettings;
|
||||
mySettings.remove( settingsKey( profileName ) );
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::setCreateOptions()
|
||||
void QgsRasterFormatSaveOptionsWidget::setCreateOptions()
|
||||
{
|
||||
QSettings mySettings;
|
||||
QString myProfiles;
|
||||
@ -381,19 +375,36 @@ void QgsRasterFormatOptionsWidget::setCreateOptions()
|
||||
mySettings.setValue( mProvider + "/driverOptions/" + mFormat.toLower() + "/profiles", myProfiles.trimmed() );
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::setCreateOptions( QString profileName, QString options )
|
||||
void QgsRasterFormatSaveOptionsWidget::setCreateOptions( QString profileName, QString options )
|
||||
{
|
||||
QSettings mySettings;
|
||||
mySettings.setValue( settingsKey( profileName ), options.trimmed() );
|
||||
}
|
||||
|
||||
void QgsRasterFormatOptionsWidget::setCreateOptions( QString profileName, QStringList list )
|
||||
void QgsRasterFormatSaveOptionsWidget::setCreateOptions( QString profileName, QStringList list )
|
||||
{
|
||||
setCreateOptions( profileName, list.join( " " ) );
|
||||
}
|
||||
|
||||
QStringList QgsRasterFormatOptionsWidget::profiles() const
|
||||
QStringList QgsRasterFormatSaveOptionsWidget::profiles() const
|
||||
{
|
||||
QSettings mySettings;
|
||||
return mySettings.value( mProvider + "/driverOptions/" + mFormat.toLower() + "/profiles", "" ).toString().trimmed().split( " ", QString::SkipEmptyParts );
|
||||
}
|
||||
|
||||
// map options label left mouse click to optionsToggle()
|
||||
bool QgsRasterFormatSaveOptionsWidget::eventFilter( QObject *obj, QEvent *event )
|
||||
{
|
||||
if ( event->type() == QEvent::MouseButtonPress )
|
||||
{
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>( event );
|
||||
if ( mouseEvent && ( mouseEvent->button() == Qt::LeftButton ) )
|
||||
{
|
||||
mOptionsStackedWIdget->setCurrentIndex(( mOptionsStackedWIdget->currentIndex() + 1 ) % 2 );
|
||||
updateOptions();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// standard event processing
|
||||
return QObject::eventFilter( obj, event );
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsrasterformatoptionswidget.h
|
||||
qgsrasterformatsaveoptionswidget.h
|
||||
-------------------
|
||||
begin : July 2012
|
||||
copyright : (C) 2012 by Etienne Tourigny
|
||||
@ -15,30 +15,33 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSRASTERFORMATOPTIONSWIDGET_H
|
||||
#define QGSRASTERFORMATOPTIONSWIDGET_H
|
||||
#ifndef QGSRASTERFORMATSAVEOPTIONSWIDGET_H
|
||||
#define QGSRASTERFORMATSAVEOPTIONSWIDGET_H
|
||||
|
||||
#include "ui_qgsrasterformatoptionswidgetbase.h"
|
||||
#include "ui_qgsrasterformatsaveoptionswidgetbase.h"
|
||||
|
||||
class GUI_EXPORT QgsRasterFormatOptionsWidget: public QWidget, private Ui::QgsRasterFormatOptionsWidgetBase
|
||||
/** \ingroup gui
|
||||
* A widget to select format-specific raster saving options
|
||||
*/
|
||||
class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget, private Ui::QgsRasterFormatSaveOptionsWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
QgsRasterFormatOptionsWidget( QWidget* parent = 0, QString format = "GTiff", QString provider = "gdal" );
|
||||
~QgsRasterFormatOptionsWidget();
|
||||
QgsRasterFormatSaveOptionsWidget( QWidget* parent = 0, QString format = "GTiff", QString provider = "gdal" );
|
||||
~QgsRasterFormatSaveOptionsWidget();
|
||||
|
||||
void setFormat( QString format );
|
||||
void setProvider( QString provider );
|
||||
QStringList createOptions() const;
|
||||
QStringList options() const;
|
||||
void showProfileButtons( bool show = true );
|
||||
|
||||
public slots:
|
||||
|
||||
void apply();
|
||||
void optionsHelp();
|
||||
bool optionsValidate( bool message = true );
|
||||
void helpOptions();
|
||||
bool validateOptions( bool gui = true );
|
||||
|
||||
private slots:
|
||||
|
||||
@ -47,7 +50,6 @@ class GUI_EXPORT QgsRasterFormatOptionsWidget: public QWidget, private Ui::QgsRa
|
||||
void on_mProfileResetButton_clicked();
|
||||
void on_mOptionsAddButton_clicked();
|
||||
void on_mOptionsDeleteButton_clicked();
|
||||
void on_mOptionsLabel_clicked();
|
||||
void on_mOptionsLineEdit_editingFinished();
|
||||
void optionsTableChanged();
|
||||
void optionsTableEnableDeleteButton();
|
||||
@ -69,6 +71,7 @@ class GUI_EXPORT QgsRasterFormatOptionsWidget: public QWidget, private Ui::QgsRa
|
||||
void setCreateOptions( QString profile, QStringList list );
|
||||
QStringList profiles() const;
|
||||
void updateProfiles();
|
||||
bool eventFilter( QObject *obj, QEvent *event );
|
||||
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "qgsrasterlayersaveasdialog.h"
|
||||
#include "qgsrasterdataprovider.h"
|
||||
#include "raster/qgsrasterformatoptionswidget.h"
|
||||
#include "qgsrasterformatsaveoptionswidget.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
|
||||
QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent,
|
||||
QWidget* parent, Qt::WindowFlags f ): QDialog( parent, f ),
|
||||
mDataProvider( sourceProvider ), mCurrentExtent( currentExtent )
|
||||
mDataProvider( sourceProvider ), mCurrentExtent( currentExtent )
|
||||
|
||||
{
|
||||
setupUi( this );
|
||||
@ -16,7 +16,7 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterDataProvider* s
|
||||
//only one hardcoded format at the moment
|
||||
QStringList myFormats;
|
||||
myFormats << "GTiff";
|
||||
foreach ( QString myFormat, myFormats )
|
||||
foreach( QString myFormat, myFormats )
|
||||
{
|
||||
mFormatComboBox->addItem( myFormat );
|
||||
}
|
||||
@ -124,8 +124,8 @@ void QgsRasterLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( const Q
|
||||
//gdal-specific
|
||||
if ( mDataProvider && mDataProvider->name() == "gdal" )
|
||||
{
|
||||
mOptionsWidget->setFormat( text );
|
||||
mOptionsWidget->update();
|
||||
mOptionsWidget->setFormat( text );
|
||||
mOptionsWidget->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,8 +166,7 @@ QString QgsRasterLayerSaveAsDialog::outputFormat() const
|
||||
|
||||
QStringList QgsRasterLayerSaveAsDialog::createOptions() const
|
||||
{
|
||||
// return mCreateOptionsLineEdit->text().trimmed().toUpper().split( " " );
|
||||
return mOptionsWidget ? mOptionsWidget->createOptions() : QStringList();
|
||||
return mOptionsWidget ? mOptionsWidget->options() : QStringList();
|
||||
}
|
||||
|
||||
QgsRectangle QgsRasterLayerSaveAsDialog::outputRectangle() const
|
||||
|
@ -1,26 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsRasterFormatOptionsWidgetBase</class>
|
||||
<widget class="QWidget" name="QgsRasterFormatOptionsWidgetBase">
|
||||
<class>QgsRasterFormatSaveOptionsWidgetBase</class>
|
||||
<widget class="QWidget" name="QgsRasterFormatSaveOptionsWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>205</height>
|
||||
<width>389</width>
|
||||
<height>203</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mProfileLabel">
|
||||
<property name="text">
|
||||
<string>Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -37,7 +30,64 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="mOptionsLabel">
|
||||
<property name="text">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="mProfileComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="mProfileButtons" native="true">
|
||||
<layout class="QHBoxLayout" name="mProfileButtonsLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mProfileNewButton">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mProfileDeleteButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mProfileResetButton">
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QStackedWidget" name="mOptionsStackedWIdget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
@ -140,9 +190,6 @@
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>mOptionsLineEdit</zorder>
|
||||
<zorder>mOptionsTable</zorder>
|
||||
<zorder>layoutWidget</zorder>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@ -157,74 +204,31 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>mOptionsTable</zorder>
|
||||
<zorder>layoutWidget</zorder>
|
||||
<zorder>mOptionsLineEdit</zorder>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="mOptionsLabel">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">Text-align:left</string>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mProfileLabel">
|
||||
<property name="text">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
<string>Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="mProfileComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="mProfileButtons" native="true">
|
||||
<layout class="QHBoxLayout" name="mProfileButtonsLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mProfileNewButton">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mProfileDeleteButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mProfileResetButton">
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
@ -218,7 +218,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QgsRasterFormatOptionsWidget" name="mOptionsWidget" native="true"/>
|
||||
<widget class="QgsRasterFormatSaveOptionsWidget" name="mOptionsWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -227,9 +227,9 @@
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsRasterFormatOptionsWidget</class>
|
||||
<class>QgsRasterFormatSaveOptionsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>raster/qgsrasterformatoptionswidget.h</header>
|
||||
<header>qgsrasterformatsaveoptionswidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
Loading…
x
Reference in New Issue
Block a user