Skip to content
Permalink
Browse files

Remember last used directory for raster save as dialog (fix #6950)

  • Loading branch information
nyalldawson committed Mar 16, 2015
1 parent 897eb47 commit e151e2fe34fa1b0fdea4f3dc31962514ceaca271
Showing with 9 additions and 2 deletions.
  1. +3 −0 src/app/qgisapp.cpp
  2. +6 −2 src/gui/qgsrasterlayersaveasdialog.cpp
@@ -5038,6 +5038,9 @@ void QgisApp::saveAsRasterFile()
this );
if ( d.exec() == QDialog::Accepted )
{
QSettings settings;
settings.setValue( "/UI/lastRasterFileDir", QFileInfo( d.outputFileName() ).absolutePath() );

QgsRasterFileWriter fileWriter( d.outputFileName() );
if ( d.tileMode() )
{
@@ -155,12 +155,16 @@ QgsRasterLayerSaveAsDialog::~QgsRasterLayerSaveAsDialog()
void QgsRasterLayerSaveAsDialog::on_mBrowseButton_clicked()
{
QString fileName;

QSettings settings;
QString dirName = mSaveAsLineEdit->text().isEmpty() ? settings.value( "/UI/lastRasterFileDir", "." ).toString() : mSaveAsLineEdit->text();

if ( mTileModeCheckBox->isChecked() )
{
while ( true )
{
// TODO: would not it be better to select .vrt file instead of directory?
fileName = QFileDialog::getExistingDirectory( this, tr( "Select output directory" ) );
fileName = QFileDialog::getExistingDirectory( this, tr( "Select output directory" ), dirName );
//fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ), QString(), tr( "VRT" ) + " (*.vrt *.VRT)" );

if ( fileName.isEmpty() ) break; // canceled
@@ -194,7 +198,7 @@ void QgsRasterLayerSaveAsDialog::on_mBrowseButton_clicked()
}
else
{
fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ), QString(), tr( "GeoTIFF" ) + " (*.tif *.tiff *.TIF *.TIFF)" );
fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ), dirName, tr( "GeoTIFF" ) + " (*.tif *.tiff *.TIF *.TIFF)" );
}

if ( !fileName.isEmpty() )

0 comments on commit e151e2f

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