Skip to content
Permalink
Browse files

QgsRasterFormatSaveOptionsWidget: do not put pyramid option profiles …

…into format option profiles

Before this commit, if the user opened Settings / Options / GDAL / Edit Pyramid options and
validated it, it added pyramid options as creation options of the GTiff driver, which
caused later confusion since they wrongly appeared in Creation Options / profile
combo box, when saving as raster layer.
  • Loading branch information
rouault committed May 27, 2016
1 parent 7f3edb8 commit 88c8d352e820cf64ae0d109402b7e8c5a133a338
Showing with 11 additions and 5 deletions.
  1. +10 −5 src/gui/qgsrasterformatsaveoptionswidget.cpp
  2. +1 −0 src/gui/qgsrasterformatsaveoptionswidget.h
@@ -154,10 +154,15 @@ void QgsRasterFormatSaveOptionsWidget::setType( QgsRasterFormatSaveOptionsWidget
}
}

QString QgsRasterFormatSaveOptionsWidget::pseudoFormat() const
{
return mPyramids ? "_pyramids" : mFormat;
}

void QgsRasterFormatSaveOptionsWidget::updateProfiles()
{
// build profiles list = user + builtin(last)
QString format = mPyramids ? "_pyramids" : mFormat;
QString format = pseudoFormat();
QStringList profileKeys = profiles();
QMapIterator<QString, QStringList> it( mBuiltinProfiles );
while ( it.hasNext() )
@@ -498,7 +503,7 @@ QString QgsRasterFormatSaveOptionsWidget::settingsKey( QString profileName ) con
profileName = "/profile_" + profileName;
else
profileName = "/profile_default" + profileName;
return mProvider + "/driverOptions/" + mFormat.toLower() + profileName + "/create";
return mProvider + "/driverOptions/" + pseudoFormat().toLower() + profileName + "/create";
}

QString QgsRasterFormatSaveOptionsWidget::currentProfileKey() const
@@ -534,9 +539,9 @@ void QgsRasterFormatSaveOptionsWidget::setCreateOptions()
myProfiles += i.key() + QLatin1String( " " );
++i;
}
mySettings.setValue( mProvider + "/driverOptions/" + mFormat.toLower() + "/profiles",
mySettings.setValue( mProvider + "/driverOptions/" + pseudoFormat().toLower() + "/profiles",
myProfiles.trimmed() );
mySettings.setValue( mProvider + "/driverOptions/" + mFormat.toLower() + "/defaultProfile",
mySettings.setValue( mProvider + "/driverOptions/" + pseudoFormat().toLower() + "/defaultProfile",
currentProfileKey().trimmed() );
}

@@ -554,7 +559,7 @@ void QgsRasterFormatSaveOptionsWidget::setCreateOptions( const QString& profileN
QStringList QgsRasterFormatSaveOptionsWidget::profiles() const
{
QSettings mySettings;
return mySettings.value( mProvider + "/driverOptions/" + mFormat.toLower() + "/profiles", "" ).toString().trimmed().split( ' ', QString::SkipEmptyParts );
return mySettings.value( mProvider + "/driverOptions/" + pseudoFormat().toLower() + "/profiles", "" ).toString().trimmed().split( ' ', QString::SkipEmptyParts );
}

void QgsRasterFormatSaveOptionsWidget::swapOptionsUI( int newIndex )
@@ -104,6 +104,7 @@ class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget,
void setCreateOptions( const QString& profile, const QStringList& list );
QStringList profiles() const;
bool eventFilter( QObject *obj, QEvent *event ) override;
QString pseudoFormat() const;

};

0 comments on commit 88c8d35

Please sign in to comment.
You can’t perform that action at this time.