Skip to content
Permalink
Browse files

[saveas] Cleanup for Save As GUI

Add options to aliased vectorfilewriter drivers
  • Loading branch information
m-kuhn committed Nov 16, 2013
1 parent d0e6c2a commit 898b9f319f6b359d09085dd6dd20a9c0257688d8
@@ -87,6 +87,7 @@ void QgsVectorLayerSaveAsDialog::setup()
mSymbologyExportComboBox->addItem( tr( "Feature symbology" ), QgsVectorFileWriter::FeatureSymbology );
mSymbologyExportComboBox->addItem( tr( "Symbol layer symbology" ), QgsVectorFileWriter::SymbolLayerSymbology );
on_mSymbologyExportComboBox_currentIndexChanged( mSymbologyExportComboBox->currentText() );
mOptionsButton->setChecked( settings.value( "/UI/vectorLayerSaveAsOptionsVisible" ).toBool() );
}

QList<QPair<QLabel*, QWidget*> > QgsVectorLayerSaveAsDialog::createControls( const QMap<QString, QgsVectorFileWriter::Option*>& options )
@@ -163,6 +164,7 @@ void QgsVectorLayerSaveAsDialog::accept()
settings.setValue( "/UI/lastVectorFileFilterDir", QFileInfo( filename() ).absolutePath() );
settings.setValue( "/UI/lastVectorFormat", format() );
settings.setValue( "/UI/encoding", encoding() );
settings.setValue( "/UI/vectorLayerSaveAsOptionsVisible", mOptionsButton->isChecked() );
QDialog::accept();
}

@@ -429,3 +431,8 @@ void QgsVectorLayerSaveAsDialog::on_mSymbologyExportComboBox_currentIndexChanged
mScaleSpinBox->setEnabled( scaleEnabled );
mScaleLabel->setEnabled( scaleEnabled );
}

void QgsVectorLayerSaveAsDialog::on_mOptionsButton_toggled( bool checked )
{
mOptionsGroupBox->setVisible( checked );
}
@@ -64,6 +64,7 @@ class QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSav
void on_browseCRS_clicked();
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
void on_mSymbologyExportComboBox_currentIndexChanged( const QString& text );
void on_mOptionsButton_toggled( bool checked );
void accept();

private:
@@ -1068,35 +1068,39 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
datasetOptions.clear();
layerOptions.clear();

datasetOptions.insert( "FORMAT", new SetOption(
QObject::tr( "To create MIF/MID instead of TAB files." ),
QStringList()
<< "MIF/MID"
<< "TAB"
, "TAB" // Default value
) );

layerOptions.insert( "SPATIAL_INDEX_MODE", new SetOption(
QObject::tr( "Use this to turn on 'quick spatial index mode'. "
"In this mode writing files can be about 5 times faster, "
"but spatial queries can be up to 30 times slower." ),
QStringList()
<< "QUICK"
, "" // Default value
, true // Allow None
, true // Allow None
) );

driverMetadata.insert( "MapInfo File",
MetaData(
"Mapinfo",
QObject::tr( "Mapinfo" ),
"*.tab *.mif",
QObject::tr( "Mapinfo TAB" ),
"*.tab",
"tab",
datasetOptions,
layerOptions
)
);

// QGIS internal alias for MIF files
driverMetadata.insert( "MapInfo MIF",
MetaData(
"Mapinfo",
QObject::tr( "Mapinfo MIF" ),
"*.mif",
"mif",
datasetOptions,
layerOptions
)
);

// Microstation DGN
datasetOptions.clear();
layerOptions.clear();
@@ -1277,12 +1281,15 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
, true // Default value
) );

// Will be handled with the SpatiaLite driver alias
#if 0
datasetOptions.insert( "SPATIALITE", new BoolOption(
QObject::tr( "Create the SpatiaLite flavour of the metadata tables, which are a bit "
"differ from the metadata used by this OGR driver and from OGC "
"specifications. Implies METADATA=yes" )
, true // Default value
) );
#endif

datasetOptions.insert( "INIT_WITH_EPSG", new BoolOption(
QObject::tr( "Insert the content of the EPSG CSV files into the spatial_ref_sys table. "
@@ -1351,15 +1358,25 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()

driverMetadata.insert( "SQLite",
MetaData(
"SQLite/SpatiaLite",
QObject::tr( "SQLite/SpatiaLite" ),
"SQLite",
QObject::tr( "SQLite" ),
"*.sqlite",
"sqlite",
datasetOptions,
layerOptions
)
);

driverMetadata.insert( "SpatiaLite",
MetaData(
"SpatiaLite",
QObject::tr( "SpatiaLite" ),
"*.sqlite",
"sqlite",
datasetOptions,
layerOptions
)
);
// AutoCAD DXF
datasetOptions.clear();
layerOptions.clear();

0 comments on commit 898b9f3

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