Skip to content
Permalink
Browse files

Merge pull request #5529 from DelazJ/chkgeom_format

[Geometry Checker] Use a more readable file format list
  • Loading branch information
nyalldawson committed Dec 11, 2017
2 parents aed128e + 7aab0c7 commit 2ec1a0f679144213dfe8bb97f25f99fa7eb60f30
Showing with 4 additions and 19 deletions.
  1. +4 −19 src/plugins/geometry_checker/qgsgeometrycheckersetuptab.cpp
@@ -54,15 +54,10 @@ QgsGeometryCheckerSetupTab::QgsGeometryCheckerSetupTab( QgisInterface *iface, QD
mAbortButton = new QPushButton( tr( "Abort" ) );
mRunButton->setEnabled( false );

const auto filterFormatMap = QgsVectorFileWriter::supportedFiltersAndFormats( QgsVectorFileWriter::SortRecommended | QgsVectorFileWriter::SkipNonSpatialFormats );
for ( const QgsVectorFileWriter::FilterFormatDetails &filter : filterFormatMap )
const auto drivers = QgsVectorFileWriter::ogrDriverList( QgsVectorFileWriter::SortRecommended | QgsVectorFileWriter::SkipNonSpatialFormats );
for ( const QgsVectorFileWriter::DriverDetails &driver : drivers )
{
QString driverName = filter.driverName;
ui.comboBoxOutputFormat->addItem( driverName );
if ( driverName == QLatin1String( "ESRI Shapefile" ) )
{
ui.comboBoxOutputFormat->setCurrentIndex( ui.comboBoxOutputFormat->count() - 1 );
}
ui.comboBoxOutputFormat->addItem( driver.longName, driver.driverName );
}
ui.listWidgetInputLayers->setIconSize( QSize( 16, 16 ) );

@@ -215,16 +210,6 @@ void QgsGeometryCheckerSetupTab::validateInput()

void QgsGeometryCheckerSetupTab::selectOutputDirectory()
{
QString filterString = QgsVectorFileWriter::filterForDriver( QStringLiteral( "GPKG" ) );
const auto filterFormatMap = QgsVectorFileWriter::supportedFiltersAndFormats( QgsVectorFileWriter::SortRecommended | QgsVectorFileWriter::SkipNonSpatialFormats );
for ( const QgsVectorFileWriter::FilterFormatDetails &filter : filterFormatMap )
{
QString driverName = filter.driverName;
if ( driverName != QLatin1String( "ESRI Shapefile" ) ) // Default entry, first in list (see above)
{
filterString += ";;" + filter.filterString;
}
}
QString initialdir = ui.lineEditOutputDirectory->text();
if ( initialdir.isEmpty() || !QDir( initialdir ).exists() )
{
@@ -297,7 +282,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
{
// Get output directory and file extension
QDir outputDir = QDir( ui.lineEditOutputDirectory->text() );
QString outputDriverName = ui.comboBoxOutputFormat->currentText();
QString outputDriverName = ui.comboBoxOutputFormat->currentData().toString();
QgsVectorFileWriter::MetaData metadata;
if ( !QgsVectorFileWriter::driverMetadata( outputDriverName, metadata ) )
{

0 comments on commit 2ec1a0f

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