Skip to content

Commit

Permalink
QgsRasterFormatSaveOptionsWidget: do not put pyramid option profiles …
Browse files Browse the repository at this point in the history
…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 88c8d35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/gui/qgsrasterformatsaveoptionswidget.cpp
Expand Up @@ -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() )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() );
}

Expand All @@ -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 )
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsrasterformatsaveoptionswidget.h
Expand Up @@ -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;

};

Expand Down

0 comments on commit 88c8d35

Please sign in to comment.