Skip to content

Commit

Permalink
Append suffix in raster terrain plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jan 12, 2012
1 parent c8ac76c commit 8d560a9
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,29 @@ QString QgsRasterTerrainAnalysisDialog::inputFile() const

QString QgsRasterTerrainAnalysisDialog::outputFile() const
{
return mOutputLayerLineEdit->text();
QString outputFileName = mOutputLayerLineEdit->text();
QFileInfo fileInfo( outputFileName );
QString suffix = fileInfo.suffix();
if ( !suffix.isEmpty() )
{
return outputFileName;
}

//add the file format extension if the user did not specify it
int index = mOutputFormatComboBox->currentIndex();
if ( index == -1 )
{
return outputFileName;
}

QString driverShortName = mOutputFormatComboBox->itemData( index ).toString();
QMap<QString, QString>::const_iterator it = mDriverExtensionMap.find( driverShortName );
if ( it == mDriverExtensionMap.constEnd() )
{
return outputFileName;
}

return ( outputFileName + "." + it.value() );
}

QString QgsRasterTerrainAnalysisDialog::outputFormat() const
Expand Down

0 comments on commit 8d560a9

Please sign in to comment.