Skip to content

Commit

Permalink
Paste as - new memory layer name dialog
Browse files Browse the repository at this point in the history
Save as dialog collapsible OGR options
  • Loading branch information
blazek committed Sep 5, 2013
1 parent 8d3199f commit fa66803
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/app/ogr/qgsvectorlayersaveasdialog.cpp
Expand Up @@ -15,6 +15,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgslogger.h"
#include "qgsvectorlayersaveasdialog.h"
#include "qgsgenericprojectionselector.h"
#include "qgsvectordataprovider.h"
Expand Down Expand Up @@ -51,6 +52,7 @@ void QgsVectorLayerSaveAsDialog::setup()
setupUi( this );
QSettings settings;
restoreGeometry( settings.value( "/Windows/VectorLayerSaveAs/geometry" ).toByteArray() );

QMap<QString, QString> map = QgsVectorFileWriter::ogrDriverList();
mFormatComboBox->blockSignals( true );
for ( QMap< QString, QString>::const_iterator it = map.constBegin(); it != map.constEnd(); ++it )
Expand Down
14 changes: 14 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -5568,9 +5568,23 @@ void QgisApp::pasteAsNewMemoryVector()
{
if ( mMapCanvas && mMapCanvas->isDrawing() ) return;

bool ok;
QString defaultName = tr( "Pasted" );
QString layerName = QInputDialog::getText( this, tr( "New memory layer name" ),
tr( "Layer name" ), QLineEdit::Normal,
defaultName, &ok );
if ( !ok ) return;

if ( layerName.isEmpty() )
{
layerName = defaultName;
}

QgsVectorLayer * layer = pasteToNewMemoryVector();
if ( !layer ) return;

layer->setLayerName( layerName );

mMapCanvas->freeze();

QgsMapLayerRegistry::instance()->addMapLayer( layer );
Expand Down
136 changes: 113 additions & 23 deletions src/ui/qgsvectorlayersaveasdialogbase.ui
Expand Up @@ -7,13 +7,22 @@
<x>0</x>
<y>0</y>
<width>383</width>
<height>496</height>
<height>444</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Save vector layer as...</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<item row="1" column="1">
<widget class="QLineEdit" name="leFilename">
<property name="enabled">
Expand Down Expand Up @@ -104,7 +113,7 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<item row="12" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -118,16 +127,90 @@
<widget class="QComboBox" name="mFormatComboBox"/>
</item>
<item row="9" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<widget class="QgsCollapsibleGroupBox" name="mOgrOptionsGroupBox" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title" stdset="0">
<string>OGR creation options</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QTextEdit" name="mOgrDatasourceOptions"/>
<widget class="QTextEdit" name="mOgrDatasourceOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QTextEdit" name="mOgrLayerOptions"/>
<widget class="QTextEdit" name="mOgrLayerOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
Expand All @@ -149,23 +232,6 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="mSkipAttributeCreation">
<property name="toolTip">
<string>This allows one to surpress attribute creation as some OGR drivers (eg. DGN, DXF) don't support it.</string>
</property>
<property name="text">
<string>Skip attribute creation</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="mAddToCanvas">
<property name="text">
<string>Add saved file to map</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand All @@ -189,8 +255,32 @@
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="mAddToCanvas">
<property name="text">
<string>Add saved file to map</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="mSkipAttributeCreation">
<property name="toolTip">
<string>This allows one to surpress attribute creation as some OGR drivers (eg. DGN, DXF) don't support it.</string>
</property>
<property name="text">
<string>Skip attribute creation</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QWidget</extends>
<header>qgscollapsiblegroupbox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mFormatComboBox</tabstop>
<tabstop>leFilename</tabstop>
Expand Down

0 comments on commit fa66803

Please sign in to comment.