[QGIS Commit] r13501 - in trunk/qgis: images images/themes/default
python/core src/app src/app/legend src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun May 16 10:44:43 EDT 2010
Author: jef
Date: 2010-05-16 10:44:42 -0400 (Sun, 16 May 2010)
New Revision: 13501
Added:
trunk/qgis/images/themes/default/mActionSaveEdits.png
Modified:
trunk/qgis/images/images.qrc
trunk/qgis/python/core/symbology-ng-core.sip
trunk/qgis/src/app/legend/qgslegend.cpp
trunk/qgis/src/app/legend/qgslegend.h
trunk/qgis/src/app/legend/qgslegendlayer.cpp
trunk/qgis/src/app/legend/qgslegendlayer.h
trunk/qgis/src/app/qgisapp.cpp
trunk/qgis/src/app/qgisapp.h
trunk/qgis/src/app/qgsattributedialog.cpp
trunk/qgis/src/app/qgsattributedialog.h
trunk/qgis/src/app/qgsmaptoolnodetool.cpp
trunk/qgis/src/app/qgsmeasuredialog.cpp
trunk/qgis/src/app/qgsundowidget.cpp
trunk/qgis/src/core/qgsapplication.cpp
trunk/qgis/src/core/qgsmaplayerregistry.cpp
trunk/qgis/src/core/qgsmaplayerregistry.h
trunk/qgis/src/core/qgsvectorlayer.cpp
Log:
[FEATURE]
- save edits button added (implements #2579)
- subset option to layer menu (implements #2660)
- show selected feature count in status bar (implements #2708)
- temporary workaround for #2714
- refactored redundant code from legend to qgisapp:
attribute table, save as, layer removal, layer properties
- some more cleanups
Modified: trunk/qgis/images/images.qrc
===================================================================
--- trunk/qgis/images/images.qrc 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/images/images.qrc 2010-05-16 14:44:42 UTC (rev 13501)
@@ -374,5 +374,6 @@
<file>themes/gis/plugins/spit.png</file>
<file>themes/gis/plugins/wfs.png</file>
<file>themes/gis/plugins/coordinate_capture/coordinate_capture.png</file>
+ <file>themes/default/mActionSaveEdits.png</file>
</qresource>
</RCC>
Added: trunk/qgis/images/themes/default/mActionSaveEdits.png
===================================================================
(Binary files differ)
Property changes on: trunk/qgis/images/themes/default/mActionSaveEdits.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/qgis/python/core/symbology-ng-core.sip
===================================================================
--- trunk/qgis/python/core/symbology-ng-core.sip 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/python/core/symbology-ng-core.sip 2010-05-16 14:44:42 UTC (rev 13501)
@@ -489,8 +489,7 @@
//! @note added in 1.5
void setRenderHints( int hints );
- // Colour used for selections
-
+ // Color used for selections
static QColor selectionColor();
double outputLineWidth(double width) const;
Modified: trunk/qgis/src/app/legend/qgslegend.cpp
===================================================================
--- trunk/qgis/src/app/legend/qgslegend.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/legend/qgslegend.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -32,13 +32,8 @@
#include "qgsmaprenderer.h"
#include "qgsproject.h"
#include "qgsrasterlayer.h"
-#include "qgsrasterlayerproperties.h"
-#include "qgsvectorlayerproperties.h"
+#include "qgsvectorlayer.h"
-#include "qgsattributetabledialog.h"
-
-#include <cfloat>
-
#include <QFont>
#include <QDomDocument>
#include <QHeaderView>
@@ -57,14 +52,15 @@
set mItemBeingMoved pointer to 0 to prevent SuSE 9.0 crash
*/
-QgsLegend::QgsLegend( QWidget * parent, const char *name )
+QgsLegend::QgsLegend( QgsMapCanvas *canvas, QWidget * parent, const char *name )
: QTreeWidget( parent ),
mMousePressedFlag( false ),
mItemBeingMoved( 0 ),
- mToggleEditingAction( 0 ),
- mMapCanvas( 0 ),
+ mMapCanvas( canvas ),
mMinimumIconSize( 20, 20 )
{
+ setObjectName( name );
+
connect( this, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ),
this, SLOT( handleItemChange( QTreeWidgetItem*, int ) ) );
@@ -77,6 +73,17 @@
connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ),
this, SLOT( writeProject( QDomDocument & ) ) );
+ // connect map layer registry signal to legend
+ connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ),
+ this, SLOT( removeLayer( QString ) ) );
+ connect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ),
+ this, SLOT( removeAll() ) );
+ connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ),
+ this, SLOT( addLayer( QgsMapLayer * ) ) );
+
+ connect( mMapCanvas, SIGNAL( layersChanged() ),
+ this, SLOT( refreshCheckStates() ) );
+
// Initialise the line indicator widget.
mInsertionLine = new QWidget( viewport() );
hideLine();
@@ -174,13 +181,8 @@
}
}
-void QgsLegend::removeLayer( QString layer_key )
+void QgsLegend::removeLayer( QString layerId )
{
- if ( !mMapCanvas || mMapCanvas->isDrawing() )
- {
- return;
- }
-
QgsDebugMsg( "called." );
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
@@ -191,11 +193,10 @@
// save legend layer (parent of a legend layer file we're going to delete)
QgsLegendLayer* ll = qobject_cast<QgsLegendLayer *>( li );
- if ( ll && ll->layer() && ll->layer()->getLayerID() == layer_key )
+ if ( ll && ll->layer() && ll->layer()->getLayerID() == layerId )
{
removeItem( ll );
delete ll;
-
break;
}
@@ -422,11 +423,7 @@
void QgsLegend::mouseDoubleClickEvent( QMouseEvent* e )
{
- if ( !mMapCanvas || mMapCanvas->isDrawing() )
- {
- return;
- }
- legendLayerShowProperties();
+ QgisApp::instance()->layerProperties();
}
void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& position )
@@ -444,7 +441,7 @@
if ( li->type() == QgsLegendItem::LEGEND_LAYER )
{
- ( static_cast<QgsLegendLayer*>( li ) )->addToPopupMenu( theMenu, mToggleEditingAction );
+ qobject_cast<QgsLegendLayer*>( li )->addToPopupMenu( theMenu );
if ( li->parent() )
{
@@ -565,17 +562,6 @@
}
}
-void QgsLegend::setMapCanvas( QgsMapCanvas * canvas )
-{
- if ( mMapCanvas )
- {
- disconnect( mMapCanvas, SIGNAL( layersChanged() ) );
- }
-
- mMapCanvas = canvas;
- connect( mMapCanvas, SIGNAL( layersChanged() ), this, SLOT( refreshCheckStates() ) );
-}
-
QgsLegendLayer* QgsLegend::currentLegendLayer()
{
QgsLegendItem* citem = dynamic_cast<QgsLegendItem *>( currentItem() );
@@ -646,84 +632,16 @@
QTreeWidgetItem * child = lg->child( 0 );
while ( child )
{
- setCurrentItem( child );
- removeCurrentLayer();
+ QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer *>( child );
+ if ( ll )
+ QgsMapLayerRegistry::instance()->removeMapLayer( ll->layer()->getLayerID() );
child = lg->child( 0 );
}
delete lg;
- adjustIconSize();
-}
-void QgsLegend::removeCurrentLayer()
-{
- if ( !mMapCanvas || mMapCanvas->isDrawing() )
- {
- return;
- }
-
- //if the current item is a legend layer: remove all layers of the current legendLayer
- QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer *>( currentItem() );
- if ( !ll )
- return;
-
- removeLayer( ll->layer(), true );
-
adjustIconSize();
}
-bool QgsLegend::removeLayer( QgsMapLayer* ml, bool askCancelOnEditable )
-{
- if ( !ml )
- {
- return false;
- }
-
- QgsVectorLayer* vl = qobject_cast<QgsVectorLayer *>( ml );
- if ( vl )
- {
- //is layer editable and changed?
- if ( vl->isEditable() && vl->isModified() )
- {
- QMessageBox::StandardButton commit;
- if ( askCancelOnEditable )
- {
- commit = QMessageBox::information( this,
- tr( "Stop editing" ),
- tr( "Do you want to save the changes to layer %1?" ).arg( vl->name() ),
- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel );
- if ( commit == QMessageBox::Cancel )
- {
- return false;
- }
- }
- else
- {
- commit = QMessageBox::information( this,
- tr( "Stop editing" ),
- tr( "Do you want to save the changes to layer %1?" ).arg( vl->name() ),
- QMessageBox::Save | QMessageBox::Discard );
- }
-
- if ( commit == QMessageBox::Save )
- {
- if ( !vl->commitChanges() )
- {
- return false;
- }
- }
- else if ( commit == QMessageBox::Discard )
- {
- if ( !vl->rollBack() )
- {
- return false;
- }
- }
- }
- }
- QgsMapLayerRegistry::instance()->removeMapLayer( ml->getLayerID() );
- return true;
-}
-
void QgsLegend::moveLayer( QgsMapLayer * ml, int groupIndex )
{
if ( !ml )
@@ -740,35 +658,6 @@
insertItem( layer, group );
}
-void QgsLegend::legendLayerShowProperties()
-{
- if ( !mMapCanvas || mMapCanvas->isDrawing() )
- {
- return;
- }
-
- QgsLegendItem* li = dynamic_cast<QgsLegendItem *>( currentItem() );
-
- if ( !li )
- {
- return;
- }
-
- if ( li->type() != QgsLegendItem::LEGEND_LAYER )
- return;
-
- QgsLegendLayer* ll = qobject_cast<QgsLegendLayer *>( li );
- if ( !ll )
- return;
-
- //QgsDebugMsg("Showing layer properties dialog");
-
- QgisApp::instance()->showLayerProperties( ll->layer() );
-
- ll->updateIcon();
-
-}
-
void QgsLegend::legendLayerShowInOverview()
{
if ( !mMapCanvas || mMapCanvas->isDrawing() )
@@ -1732,35 +1621,6 @@
}
}
-void QgsLegend::legendLayerAttributeTable()
-{
- if ( !mMapCanvas || mMapCanvas->isDrawing() )
- {
- return;
- }
-
- QgsVectorLayer *vlayer = 0;
-
- // try whether it's a legend layer
- QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer *>( currentItem() );
- if ( !ll )
- {
- // nothing selected
- QMessageBox::information( this,
- tr( "No Layer Selected" ),
- tr( "To open an attribute table, you must select a vector layer in the legend" ) );
- return;
- }
-
- vlayer = qobject_cast<QgsVectorLayer *>( ll->layer() );
- if ( vlayer )
- {
- QgsAttributeTableDialog *mDialog = new QgsAttributeTableDialog( vlayer );
- mDialog->show();
- // the dialog will be deleted by itself on close
- }
-}
-
void QgsLegend::readProject( const QDomDocument & doc )
{
QDomNodeList nodes = doc.elementsByTagName( "legend" );
Modified: trunk/qgis/src/app/legend/qgslegend.h
===================================================================
--- trunk/qgis/src/app/legend/qgslegend.h 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/legend/qgslegend.h 2010-05-16 14:44:42 UTC (rev 13501)
@@ -96,7 +96,7 @@
* @param theParent An optional parent widget
* @param theName An optional name for the widget
*/
- QgsLegend( QWidget * parent = 0, const char *name = 0 );
+ QgsLegend( QgsMapCanvas *canvas, QWidget * parent = 0, const char *name = 0 );
//! Destructor
~QgsLegend();
@@ -181,9 +181,6 @@
/**Removes an entry from mPixmapHeightValues*/
void removePixmapHeightValue( int height );
- /**Sets the toggle editing action. Usually called from QgisApp*/
- void setToggleEditingAction( QAction* editingAction ) {mToggleEditingAction = editingAction;}
-
/**Returns structure with legend pixmaps*/
QgsLegendPixmaps& pixmaps() { return mPixmaps; }
@@ -200,8 +197,6 @@
void setLayerVisible( QgsMapLayer * layer, bool visible );
- void setMapCanvas( QgsMapCanvas * canvas );
-
/**Updates symbology items for a layer*/
void refreshLayerSymbology( QString key, bool expandItem = true );
@@ -243,16 +238,6 @@
/** called to write legend settings to project */
void writeProject( QDomDocument & );
- /**Removes the current LegendLayer*/
- void removeCurrentLayer();
-
- /**Removes a layer. If the layer is editable, a dialog is shown where user can select 'save', 'discard' and optionally 'cancel'. Cancel
- is useful if a single layer is removed whereas on closing of the whole project or application, the cancel option may not be possible
- @param ml the maplayer to remove
- @param askCancelOnEditable gibe cancel option in the dialog for editable (and changed) layers
- @param return false if canceled or in case of error, true else*/
- bool removeLayer( QgsMapLayer* ml, bool askCancelOnEditable );
-
/*!
* Moves a layer to a group.
* @param ml the maplayer to move
@@ -272,12 +257,6 @@
Only works on raster layers*/
void legendLayerZoomNative();
- /**Show attribute table*/
- void legendLayerAttributeTable();
-
- /**Shows the property dialog of the first legend layer file in a legend layer*/
- void legendLayerShowProperties();
-
/**Updates check states when the map canvas layer set is changed */
void refreshCheckStates();
protected:
@@ -440,9 +419,6 @@
decide if the mapcanvas really has to be refreshed*/
std::deque<QString> mLayersPriorToMove;
- /**Action for the legendlayer right click menu*/
- QAction* mToggleEditingAction;
-
/*!
* A function to determine how far down in the list an item is (starting with one for the first Item).
*If the item is not in the legend, -1 is returned
Modified: trunk/qgis/src/app/legend/qgslegendlayer.cpp
===================================================================
--- trunk/qgis/src/app/legend/qgslegendlayer.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/legend/qgslegendlayer.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -33,10 +33,6 @@
#include "qgssymbol.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"
-#include "qgsvectorfilewriter.h"
-#include "qgsgenericprojectionselector.h"
-#include "qgsattributetabledialog.h"
-#include "ogr/qgsvectorlayersaveasdialog.h"
#include "qgsrendererv2.h"
#include "qgssymbolv2.h"
@@ -171,6 +167,8 @@
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( theMapLayer );
rasterLayerSymbology( rlayer ); // get and change symbology
}
+
+ updateIcon();
}
void QgsLegendLayer::changeSymbologySettings( const QgsMapLayer* theMapLayer,
@@ -302,8 +300,6 @@
itemList.append( qMakePair( QString(), legendpixmap ) );
changeSymbologySettings( layer, itemList );
-
- updateIcon();
}
void QgsLegendLayer::updateIcon()
@@ -380,11 +376,11 @@
return QgisApp::getThemePixmap( "/mIconLayer.png" );
}
-void QgsLegendLayer::addToPopupMenu( QMenu& theMenu, QAction* toggleEditingAction )
+void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
{
+ QgsMapLayer *lyr = layer();
+ QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing();
- QgsMapLayer* lyr = layer();
-
// zoom to layer extent
theMenu.addAction( QgisApp::getThemeIcon( "/mActionZoomToLayer.png" ),
tr( "&Zoom to layer extent" ), legend(), SLOT( legendLayerZoom() ) );
@@ -401,8 +397,7 @@
showInOverviewAction->blockSignals( false );
// remove from canvas
- theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemove.png" ),
- tr( "&Remove" ), legend(), SLOT( removeCurrentLayer() ) );
+ theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemove.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
theMenu.addSeparator();
@@ -411,7 +406,8 @@
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( lyr );
// attribute table
- theMenu.addAction( tr( "&Open attribute table" ), this, SLOT( table() ) );
+ theMenu.addAction( tr( "&Open attribute table" ),
+ QgisApp::instance(), SLOT( attributeTable() ) );
// allow editing
int cap = vlayer->dataProvider()->capabilities();
@@ -425,42 +421,25 @@
}
// save as vector file
- theMenu.addAction( tr( "Save as..." ), this, SLOT( saveAsVectorFile() ) );
+ theMenu.addAction( tr( "Save as..." ), QgisApp::instance(), SLOT( saveAsVectorFile() ) );
// save selection as vector file
- QAction* saveSelectionAsAction = theMenu.addAction( tr( "Save selection as..." ), this, SLOT( saveSelectionAsVectorFile() ) );
+ QAction* saveSelectionAsAction = theMenu.addAction( tr( "Save selection as..." ), QgisApp::instance(), SLOT( saveSelectionAsVectorFile() ) );
if ( vlayer->selectedFeatureCount() == 0 )
{
saveSelectionAsAction->setEnabled( false );
}
+ theMenu.addAction( tr( "&Subset" ), QgisApp::instance(), SLOT( layerSubsetString() ) );
+
theMenu.addSeparator();
}
// properties goes on bottom of menu for consistency with normal ui standards
// e.g. kde stuff
- theMenu.addAction( tr( "&Properties" ), legend(), SLOT( legendLayerShowProperties() ) );
-
+ theMenu.addAction( tr( "&Properties" ), QgisApp::instance(), SLOT( layerProperties() ) );
}
-void QgsLegendLayer::table()
-{
- QgsVectorLayer * myLayer = qobject_cast<QgsVectorLayer *>( mLyr.layer() );
- QgsAttributeTableDialog *mDialog = new QgsAttributeTableDialog( myLayer );
- mDialog->show();
- // the dialog will be deleted by itself on close
-}
-
-void QgsLegendLayer::saveAsVectorFile()
-{
- saveAsVectorFileGeneral( false );
-}
-
-void QgsLegendLayer::saveSelectionAsVectorFile()
-{
- saveAsVectorFileGeneral( true );
-}
-
//////////
void QgsLegendLayer::setVisible( bool visible )
@@ -493,84 +472,6 @@
legend()->updateOverview();
}
-void QgsLegendLayer::saveAsVectorFileGeneral( bool saveOnlySelection )
-{
- QgsCoordinateReferenceSystem destCRS;
-
- if ( mLyr.layer()->type() != QgsMapLayer::VectorLayer )
- return;
-
- QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( mLyr.layer() );
-
- QgsVectorLayerSaveAsDialog *dialog = new QgsVectorLayerSaveAsDialog( QgisApp::instance() );
-
- if ( dialog->exec() == QDialog::Accepted )
- {
- QString encoding = dialog->encoding();
- QString vectorFilename = dialog->filename();
- QString format = dialog->format();
-
- if ( dialog->crs() < 0 )
- {
- // Find out if we have projections enabled or not
- if ( QgisApp::instance()->mapCanvas()->mapRenderer()->hasCrsTransformEnabled() )
- {
- destCRS = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationSrs();
- }
- else
- {
- destCRS = vlayer->srs();
- }
- }
- else
- {
- destCRS = QgsCoordinateReferenceSystem( dialog->crs(), QgsCoordinateReferenceSystem::InternalCrsId );
- }
-
- // overwrite the file - user will already have been prompted
- // to verify they want to overwrite by the file dialog above
- // might not even exists in the given case.
- // add the extension if not present
- if ( format == "ESRI Shapefile" )
- {
- if ( !vectorFilename.endsWith( ".shp", Qt::CaseInsensitive ) )
- {
- vectorFilename += ".shp";
- }
- QgsVectorFileWriter::deleteShapeFile( vectorFilename );
- }
-
- //GE does not open files without extensions. Therefore we append it automatically for kml files
- if ( format == "KML" )
- {
- if ( !vectorFilename.endsWith( ".kml", Qt::CaseInsensitive ) )
- {
- vectorFilename += ".kml";
- }
- }
-
- // ok if the file existed it should be deleted now so we can continue...
- QApplication::setOverrideCursor( Qt::WaitCursor );
-
- QgsVectorFileWriter::WriterError error;
- QString errorMessage;
- error = QgsVectorFileWriter::writeAsVectorFormat( vlayer, vectorFilename, encoding, &destCRS, format, saveOnlySelection, &errorMessage );
-
- QApplication::restoreOverrideCursor();
-
- if ( error == QgsVectorFileWriter::NoError )
- {
- QMessageBox::information( 0, tr( "Saving done" ), tr( "Export to vector file has been completed" ) );
- }
- else
- {
- QMessageBox::warning( 0, tr( "Save error" ), tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) );
- }
- }
-
- delete dialog;
-}
-
QString QgsLegendLayer::nameFromLayer( QgsMapLayer* layer )
{
QString sourcename = layer->publicSource(); //todo: move this duplicated code into a new function
@@ -588,7 +489,6 @@
return sourcename;
}
-
QgsMapCanvasLayer& QgsLegendLayer::canvasLayer()
{
return mLyr;
@@ -599,4 +499,3 @@
QString name = mLyr.layer()->name();
setText( 0, name );
}
-
Modified: trunk/qgis/src/app/legend/qgslegendlayer.h
===================================================================
--- trunk/qgis/src/app/legend/qgslegendlayer.h 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/legend/qgslegendlayer.h 2010-05-16 14:44:42 UTC (rev 13501)
@@ -61,7 +61,7 @@
void refreshSymbology( const QString& key, double widthScale = 1.0 );
/** called to add appropriate menu items to legend's popup menu */
- void addToPopupMenu( QMenu& theMenu, QAction* toggleEditingAction );
+ void addToPopupMenu( QMenu& theMenu );
/** Set layer to be visible in canvas */
void setVisible( bool visible = true );
@@ -81,12 +81,6 @@
/**Toggle show in overview*/
void showInOverview();
- /**Show layer attribute table*/
- void table();
-
- void saveAsVectorFile();
- void saveSelectionAsVectorFile();
-
/**update the layer's icon to show whether is in editing mode or in overview */
void updateIcon();
@@ -108,8 +102,6 @@
QPixmap getOriginalPixmap();
- void saveAsVectorFileGeneral( bool saveOnlySelection );
-
private:
/** Helper method to make the font bold from all ctors.
* Not to be confused with setFont() which is inherited
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/qgisapp.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -152,10 +152,12 @@
#include "qgsvectorlayer.h"
#include "ogr/qgsogrsublayersdialog.h"
#include "ogr/qgsopenvectorlayerdialog.h"
+#include "ogr/qgsvectorlayersaveasdialog.h"
#include "qgsattributetabledialog.h"
#include "qgsvectorfilewriter.h"
#include "qgscredentialdialog.h"
#include "qgstilescalewidget.h"
+#include "qgsquerybuilder.h"
#ifdef HAVE_QWT
#include "qgsgpsinformationwidget.h"
@@ -349,7 +351,6 @@
srs->createFromProj4( mySettings.value( "/Projections/defaultProjectionString", GEOPROJ4 ).toString() );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS" ) );
}
-
}
@@ -386,35 +387,46 @@
// Do this early on before anyone else opens it and prevents us copying it
createDB();
-
mSplash->showMessage( tr( "Reading settings" ), Qt::AlignHCenter | Qt::AlignBottom );
qApp->processEvents();
mSplash->showMessage( tr( "Setting up the GUI" ), Qt::AlignHCenter | Qt::AlignBottom );
qApp->processEvents();
+ // "theMapCanvas" used to find this canonical instance later
+ mMapCanvas = new QgsMapCanvas( this, "theMapCanvas" );
+ mMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector "
+ "layers are displayed when added to the map" ) );
+ setCentralWidget( mMapCanvas );
+ //set the focus to the map canvas
+ mMapCanvas->setFocus();
+
+ // "theMapLegend" used to find this canonical instance later
+ mMapLegend = new QgsLegend( mMapCanvas, this, "theMapLegend" );
+
+ // create undo widget
+ mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas );
+ mUndoWidget->setObjectName( "Undo" );
+
createActions();
createActionGroups();
createMenus();
createToolBars();
createStatusBar();
- createCanvas();
+ createCanvasTools();
mMapCanvas->freeze();
- createLegend();
+ initLegend();
createOverview();
createMapTips();
readSettings();
updateRecentProjectPaths();
+ addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget );
+ mUndoWidget->hide();
+
mInternalClipboard = new QgsClipboard; // create clipboard
mQgisInterface = new QgisAppInterface( this ); // create the interfce
- // create undo widget
- mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas );
- mUndoWidget->setObjectName( "Undo" );
- addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget );
- mUndoWidget->hide();
-
#ifdef Q_WS_MAC
// action for Window menu (create before generating WindowTitleChange event))
mWindowAction = new QAction( this );
@@ -697,14 +709,14 @@
mActionUndo = new QAction( getThemeIcon( "mActionUndo.png" ), tr( "&Undo" ), this );
shortcuts->registerAction( mActionUndo, tr( "Ctrl+Z" ) );
mActionUndo->setStatusTip( tr( "Undo the last operation" ) );
+ connect( mActionUndo, SIGNAL( triggered() ), mUndoWidget, SLOT( undo() ) );
mActionUndo->setEnabled( false );
- // action connected to mUndoWidget::undo slot in setupConnections()
mActionRedo = new QAction( getThemeIcon( "mActionRedo.png" ), tr( "&Redo" ), this );
shortcuts->registerAction( mActionRedo, tr( "Ctrl+Shift+Z" ) );
mActionRedo->setStatusTip( tr( "Redo the last operation" ) );
+ connect( mActionRedo, SIGNAL( triggered() ), mUndoWidget, SLOT( redo() ) );
mActionRedo->setEnabled( false );
- // action connected to mUndoWidget::redo slot in setupConnections()
mActionCutFeatures = new QAction( getThemeIcon( "mActionEditCut.png" ), tr( "Cut Features" ), this );
shortcuts->registerAction( mActionCutFeatures, tr( "Ctrl+X" ) );
@@ -999,6 +1011,12 @@
connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) );
mActionToggleEditing->setEnabled( false );
+ mActionSaveEdits = new QAction( getThemeIcon( "mActionSaveEdits.png" ), tr( "Save edits" ), this );
+ shortcuts->registerAction( mActionSaveEdits );
+ mActionSaveEdits->setStatusTip( tr( "Save edits to current layer , but continue editing" ) );
+ connect( mActionSaveEdits, SIGNAL( triggered() ), this, SLOT( saveEdits() ) );
+ mActionSaveEdits->setEnabled( false );
+
mActionLayerSaveAs = new QAction( tr( "Save as..." ), this );
shortcuts->registerAction( mActionLayerSaveAs );
mActionLayerSaveAs->setStatusTip( tr( "Save the current layer as a vector file" ) );
@@ -1037,6 +1055,12 @@
connect( mActionLayerProperties, SIGNAL( triggered() ), this, SLOT( layerProperties() ) );
mActionLayerProperties->setEnabled( false );
+ mActionLayerSubsetString = new QAction( tr( "Subset..." ), this );
+ shortcuts->registerAction( mActionLayerSubsetString );
+ mActionLayerProperties->setStatusTip( tr( "Set subset query of the current layer" ) );
+ connect( mActionLayerSubsetString, SIGNAL( triggered() ), this, SLOT( layerSubsetString() ) );
+ mActionLayerSubsetString->setEnabled( false );
+
mActionAddToOverview = new QAction( getThemeIcon( "mActionInOverview.png" ), tr( "Add to Overview" ), this );
shortcuts->registerAction( mActionAddToOverview, tr( "Ctrl+Shift+O", "Add current layer to overview map" ) );
mActionAddToOverview->setStatusTip( tr( "Add current layer to overview map" ) );
@@ -1437,11 +1461,13 @@
mActionLayerSeparator1 = mLayerMenu->addSeparator();
mLayerMenu->addAction( mActionOpenTable );
+ mLayerMenu->addAction( mActionSaveEdits );
mLayerMenu->addAction( mActionToggleEditing );
mLayerMenu->addAction( mActionLayerSaveAs );
mLayerMenu->addAction( mActionLayerSelectionSaveAs );
mLayerMenu->addAction( mActionRemoveLayer );
mLayerMenu->addAction( mActionLayerProperties );
+ mLayerMenu->addAction( mActionLayerSubsetString );
mActionLayerSeparator2 = mLayerMenu->addSeparator();
mLayerMenu->addAction( mActionAddToOverview );
@@ -1557,6 +1583,7 @@
mDigitizeToolBar->setIconSize( myIconSize );
mDigitizeToolBar->setObjectName( "Digitizing" );
mDigitizeToolBar->addAction( mActionToggleEditing );
+ mDigitizeToolBar->addAction( mActionSaveEdits );
mDigitizeToolBar->addAction( mActionCapturePoint );
mDigitizeToolBar->addAction( mActionCaptureLine );
mDigitizeToolBar->addAction( mActionCapturePolygon );
@@ -1621,18 +1648,18 @@
mAttributesToolBar->addAction( mActionShowBookmarks );
mAttributesToolBar->addAction( mActionNewBookmark );
// Annotation tools
- QToolButton* mAnnotationToolButton = new QToolButton();
- mAnnotationToolButton->setPopupMode( QToolButton::InstantPopup );
- mAnnotationToolButton->setAutoRaise( true );
- mAnnotationToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
- mAnnotationToolButton->setCheckable( true );
- mAnnotationToolButton->addAction( mActionTextAnnotation );
- mAnnotationToolButton->addAction( mActionFormAnnotation );
- mAnnotationToolButton->addAction( mActionAnnotation );
- mAnnotationToolButton->setDefaultAction( mActionTextAnnotation );
- QObject::connect( mAnnotationToolButton, SIGNAL( triggered( QAction* ) ), \
- mAnnotationToolButton, SLOT( setDefaultAction( QAction* ) ) );
- mAttributesToolBar->addWidget( mAnnotationToolButton );
+ QToolButton *annotationToolButton = new QToolButton();
+ annotationToolButton->setPopupMode( QToolButton::InstantPopup );
+ annotationToolButton->setAutoRaise( true );
+ annotationToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
+ annotationToolButton->setCheckable( true );
+ annotationToolButton->addAction( mActionTextAnnotation );
+ annotationToolButton->addAction( mActionFormAnnotation );
+ annotationToolButton->addAction( mActionAnnotation );
+ annotationToolButton->setDefaultAction( mActionTextAnnotation );
+ connect( annotationToolButton, SIGNAL( triggered( QAction* ) ),
+ annotationToolButton, SLOT( setDefaultAction( QAction* ) ) );
+ mAttributesToolBar->addWidget( annotationToolButton );
mToolbarMenu->addAction( mAttributesToolBar->toggleViewAction() );
//
// Plugins Toolbar
@@ -1836,6 +1863,7 @@
mActionAbout->setIcon( getThemeIcon( "/mActionHelpAbout.png" ) );
mActionDraw->setIcon( getThemeIcon( "/mActionDraw.png" ) );
mActionToggleEditing->setIcon( getThemeIcon( "/mActionToggleEditing.png" ) );
+ mActionSaveEdits->setIcon( getThemeIcon( "/mActionSaveEdits.png" ) );
mActionCutFeatures->setIcon( getThemeIcon( "/mActionEditCut.png" ) );
mActionCopyFeatures->setIcon( getThemeIcon( "/mActionEditCopy.png" ) );
mActionPasteFeatures->setIcon( getThemeIcon( "/mActionEditPaste.png" ) );
@@ -1897,83 +1925,76 @@
{
// connect the "cleanup" slot
connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( saveWindowState() ) );
- //connect the legend, mapcanvas and overview canvas to the registry
- // connect map layer registry signals to legend
- connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ),
- mMapLegend, SLOT( removeLayer( QString ) ) );
- connect( QgsMapLayerRegistry::instance(), SIGNAL( removedAll() ),
- mMapLegend, SLOT( removeAll() ) );
- connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ),
- mMapLegend, SLOT( addLayer( QgsMapLayer * ) ) );
- connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
- this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer* ) ) );
- connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
- mUndoWidget, SLOT( layerChanged( QgsMapLayer* ) ) );
- connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
- mMapTools.mNodeTool, SLOT( currentLayerChanged( QgsMapLayer* ) ) );
+ // signal when mouse moved over window (coords display in status bar)
+ connect( mMapCanvas, SIGNAL( xyCoordinates( const QgsPoint & ) ),
+ this, SLOT( showMouseCoordinate( const QgsPoint & ) ) );
+ connect( mMapCanvas, SIGNAL( extentsChanged() ),
+ this, SLOT( showExtents() ) );
+ connect( mMapCanvas, SIGNAL( scaleChanged( double ) ),
+ this, SLOT( showScale( double ) ) );
+ connect( mMapCanvas, SIGNAL( scaleChanged( double ) ),
+ this, SLOT( updateMouseCoordinatePrecision() ) );
+ connect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ),
+ this, SLOT( mapToolChanged( QgsMapTool * ) ) );
+ connect( mMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ),
+ this, SLOT( selectionChanged( QgsMapLayer * ) ) );
+ connect( mMapCanvas, SIGNAL( extentsChanged() ),
+ this, SLOT( markDirty() ) );
+ connect( mMapCanvas, SIGNAL( layersChanged() ),
+ this, SLOT( markDirty() ) );
- //signal when mouse moved over window (coords display in status bar)
- connect( mMapCanvas, SIGNAL( xyCoordinates( const QgsPoint & ) ), this, SLOT( showMouseCoordinate( const QgsPoint & ) ) );
- connect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) );
- connect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( hasCrsTransformEnabled( bool ) ) );
- connect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( destinationSrsChanged() ) );
- connect( mMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( showExtents() ) );
- connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( showScale( double ) ) );
- connect( mMapCanvas, SIGNAL( scaleChanged( double ) ), this, SLOT( updateMouseCoordinatePrecision() ) );
- connect( mMapCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), this, SLOT( mapToolChanged( QgsMapTool * ) ) );
- connect( mMapCanvas, SIGNAL( selectionChanged( QgsMapLayer * ) ),
+ connect( mMapCanvas, SIGNAL( zoomLastStatusChanged( bool ) ),
+ mActionZoomLast, SLOT( setEnabled( bool ) ) );
+ connect( mMapCanvas, SIGNAL( zoomNextStatusChanged( bool ) ),
+ mActionZoomNext, SLOT( setEnabled( bool ) ) );
+ connect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ),
+ mMapCanvas, SLOT( setRenderFlag( bool ) ) );
+
+ // connect renderer
+ connect( mMapCanvas->mapRenderer(), SIGNAL( drawingProgress( int, int ) ),
+ this, SLOT( showProgress( int, int ) ) );
+ connect( mMapCanvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ),
+ this, SLOT( hasCrsTransformEnabled( bool ) ) );
+ connect( mMapCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ),
+ this, SLOT( destinationSrsChanged() ) );
+
+ // connect legend signals
+ connect( mMapLegend, SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) );
+ connect( mMapLegend, SIGNAL( zOrderChanged() ),
+ this, SLOT( markDirty() ) );
- // track of canvas layers and extents and mark project dirty on changes
- connect( mMapCanvas, SIGNAL( extentsChanged() ), this, SLOT( markDirty() ) );
- connect( mMapCanvas, SIGNAL( layersChanged() ), this, SLOT( markDirty() ) );
- connect( mMapLegend, SIGNAL( zOrderChanged() ), this, SLOT( markDirty() ) );
-
+ // connect map layer registry
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ),
this, SLOT( layerWasAdded( QgsMapLayer * ) ) );
+ connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ),
+ this, SLOT( removingLayer( QString ) ) );
- connect( mRenderSuppressionCBox, SIGNAL( toggled( bool ) ), mMapCanvas, SLOT( setRenderFlag( bool ) ) );
- //
- // Do we really need this ??? - its already connected to the esc key...TS
- //
- connect( mStopRenderButton, SIGNAL( clicked() ), this, SLOT( stopRendering() ) );
-
// Connect warning dialog from project reading
connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
this, SLOT( oldProjectVersionWarning( QString ) ) );
-
- connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ), this, SLOT( showProgress( int, int ) ) );
-
- // setup undo/redo actions
- connect( mActionUndo, SIGNAL( triggered() ), mUndoWidget, SLOT( undo() ) );
- connect( mActionRedo, SIGNAL( triggered() ), mUndoWidget, SLOT( redo() ) );
- connect( mUndoWidget, SIGNAL( undoStackChanged() ), this, SLOT( updateUndoActions() ) );
-
- // Connect status from ZoomLast/ZoomNext to corresponding action
- connect( mMapCanvas, SIGNAL( zoomLastStatusChanged( bool ) ), mActionZoomLast, SLOT( setEnabled( bool ) ) );
- connect( mMapCanvas, SIGNAL( zoomNextStatusChanged( bool ) ), mActionZoomNext, SLOT( setEnabled( bool ) ) );
-
- // Monitor change of project path
+ connect( QgsProject::instance(), SIGNAL( layerLoaded( int, int ) ),
+ this, SLOT( showProgress( int, int ) ) );
connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ),
this, SLOT( readProject( const QDomDocument & ) ) );
connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ),
this, SLOT( writeProject( QDomDocument & ) ) );
+ connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument& ) ),
+ this, SLOT( writeAnnotationItemsToProject( QDomDocument& ) ) );
- connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument& ) ), this, SLOT( writeAnnotationItemsToProject( QDomDocument& ) ) );
+ //
+ // Do we really need this ??? - its already connected to the esc key...TS
+ //
+ connect( mStopRenderButton, SIGNAL( clicked() ),
+ this, SLOT( stopRendering() ) );
+
+ // setup undo/redo actions
+ connect( mUndoWidget, SIGNAL( undoStackChanged() ), this, SLOT( updateUndoActions() ) );
}
-void QgisApp::createCanvas()
+void QgisApp::createCanvasTools()
{
- // "theMapCanvas" used to find this canonical instance later
- mMapCanvas = new QgsMapCanvas( this, "theMapCanvas" );
- mMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector "
- "layers are displayed when added to the map" ) );
-
- setCentralWidget( mMapCanvas );
- // set the focus to the map canvas
- mMapCanvas->setFocus();
-
// create tools
mMapTools.mZoomIn = new QgsMapToolZoom( mMapCanvas, false /* zoomIn */ );
mMapTools.mZoomIn->setAction( mActionZoomIn );
@@ -2096,16 +2117,20 @@
return toolBar;
}
-void QgisApp::createLegend()
+QgsLegend *QgisApp::legend()
{
- //legend
- mMapLegend = new QgsLegend( NULL, "theMapLegend" );
- mMapLegend->setObjectName( "theMapLegend" );
- mMapLegend->setMapCanvas( mMapCanvas );
+ Q_ASSERT( mMapLegend );
+ return mMapLegend;
+}
- //add the toggle editing action also to legend such that right click menu and button show the same state
- mMapLegend->setToggleEditingAction( mActionToggleEditing );
+QgsMapCanvas *QgisApp::mapCanvas()
+{
+ Q_ASSERT( mMapCanvas );
+ return mMapCanvas;
+}
+void QgisApp::initLegend()
+{
mMapLegend->setWhatsThis( tr( "Map legend that displays all the layers currently on the map canvas. Click on the check box to turn a layer on or off. Double click on a layer in the legend to customize its appearance and set other properties." ) );
mLegendDock = new QDockWidget( tr( "Layers" ), this );
mLegendDock->setObjectName( "Legend" );
@@ -2852,9 +2877,6 @@
delete wmss;
}
-
-
-
void QgisApp::fileExit()
{
if ( mMapCanvas && mMapCanvas->isDrawing() )
@@ -3778,7 +3800,7 @@
return;
}
- QgsVectorLayer *myLayer = qobject_cast<QgsVectorLayer *>( mMapLegend->currentLayer() );
+ QgsVectorLayer *myLayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
if ( !myLayer )
{
return;
@@ -3791,31 +3813,104 @@
void QgisApp::saveAsVectorFile()
{
- if ( mMapLegend )
- {
- QgsLegendLayer* currentLegendLayer = mMapLegend->currentLegendLayer();
- if ( currentLegendLayer )
- {
- currentLegendLayer->saveAsVectorFile();
- }
- }
+ saveAsVectorFileGeneral( false );
}
void QgisApp::saveSelectionAsVectorFile()
{
- if ( mMapLegend )
+ saveAsVectorFileGeneral( true );
+}
+
+void QgisApp::saveAsVectorFileGeneral( bool saveOnlySelection )
+{
+ if ( mMapCanvas && mMapCanvas->isDrawing() )
+ return;
+
+ if ( !mMapLegend )
+ return;
+
+ QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
+ if ( !vlayer )
+ return;
+
+ QgsCoordinateReferenceSystem destCRS;
+
+ QgsVectorLayerSaveAsDialog *dialog = new QgsVectorLayerSaveAsDialog( this );
+
+ if ( dialog->exec() == QDialog::Accepted )
{
- QgsLegendLayer* currentLegendLayer = mMapLegend->currentLegendLayer();
- if ( currentLegendLayer )
+ QString encoding = dialog->encoding();
+ QString vectorFilename = dialog->filename();
+ QString format = dialog->format();
+
+ if ( dialog->crs() < 0 )
{
- currentLegendLayer->saveSelectionAsVectorFile();
+ // Find out if we have projections enabled or not
+ if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
+ {
+ destCRS = mMapCanvas->mapRenderer()->destinationSrs();
+ }
+ else
+ {
+ destCRS = vlayer->srs();
+ }
}
+ else
+ {
+ destCRS = QgsCoordinateReferenceSystem( dialog->crs(), QgsCoordinateReferenceSystem::InternalCrsId );
+ }
+
+ // overwrite the file - user will already have been prompted
+ // to verify they want to overwrite by the file dialog above
+ // might not even exists in the given case.
+ // add the extension if not present
+ if ( format == "ESRI Shapefile" )
+ {
+ if ( !vectorFilename.endsWith( ".shp", Qt::CaseInsensitive ) )
+ {
+ vectorFilename += ".shp";
+ }
+ QgsVectorFileWriter::deleteShapeFile( vectorFilename );
+ }
+
+ //GE does not open files without extensions. Therefore we append it automatically for kml files
+ if ( format == "KML" )
+ {
+ if ( !vectorFilename.endsWith( ".kml", Qt::CaseInsensitive ) )
+ {
+ vectorFilename += ".kml";
+ }
+ }
+
+ // ok if the file existed it should be deleted now so we can continue...
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+
+ QgsVectorFileWriter::WriterError error;
+ QString errorMessage;
+ error = QgsVectorFileWriter::writeAsVectorFormat( vlayer, vectorFilename, encoding, &destCRS, format, saveOnlySelection, &errorMessage );
+
+ QApplication::restoreOverrideCursor();
+
+ if ( error == QgsVectorFileWriter::NoError )
+ {
+ QMessageBox::information( 0, tr( "Saving done" ), tr( "Export to vector file has been completed" ) );
+ }
+ else
+ {
+ QMessageBox::warning( 0, tr( "Save error" ), tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) );
+ }
}
+
+ delete dialog;
}
+
void QgisApp::layerProperties()
{
- mMapLegend->legendLayerShowProperties();
+ if ( mMapCanvas && mMapCanvas->isDrawing() )
+ return;
+
+ showLayerProperties( activeLayer() );
}
void QgisApp::deleteSelected( QgsMapLayer *layer )
@@ -4378,9 +4473,7 @@
return;
}
- QgsMapLayer * selectionLayer = ( layerContainingSelection != 0 ) ?
- ( layerContainingSelection ) :
- ( activeLayer() );
+ QgsMapLayer *selectionLayer = layerContainingSelection ? layerContainingSelection : activeLayer();
if ( selectionLayer )
{
@@ -4407,9 +4500,7 @@
return;
}
- QgsMapLayer * selectionLayer = ( layerContainingSelection != 0 ) ?
- ( layerContainingSelection ) :
- ( activeLayer() );
+ QgsMapLayer *selectionLayer = layerContainingSelection ? layerContainingSelection : activeLayer();
if ( selectionLayer )
{
@@ -4433,9 +4524,7 @@
return;
}
- QgsMapLayer * pasteLayer = ( destinationLayer != 0 ) ?
- ( destinationLayer ) :
- ( activeLayer() );
+ QgsMapLayer *pasteLayer = destinationLayer ? destinationLayer : activeLayer();
if ( pasteLayer )
{
@@ -4493,28 +4582,78 @@
if ( mMapCanvas && mMapCanvas->isDrawing() )
return;
- QgsLegendLayer* currentLayer = mMapLegend->currentLegendLayer();
+ QgsVectorLayer *currentLayer = qobject_cast<QgsVectorLayer*>( activeLayer() );
if ( currentLayer )
{
- toggleEditing( mMapLegend->currentLayer() );
+ toggleEditing( currentLayer, true );
}
else
{
+ // active although there's no layer active!?
mActionToggleEditing->setChecked( false );
}
}
-void QgisApp::toggleEditing( QgsMapLayer *layer )
+void QgisApp::saveEdits()
{
- if ( !layer )
+ if ( mMapCanvas && mMapCanvas->isDrawing() )
+ return;
+
+ QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
+ if ( !vlayer || !vlayer->isEditable() || !vlayer->isModified() )
+ return;
+
+ if ( !vlayer->commitChanges() )
{
+ QMessageBox::information( 0,
+ tr( "Error" ),
+ tr( "Could not commit changes to layer %1\n\nErrors: %2\n" )
+ .arg( vlayer->name() )
+ .arg( vlayer->commitErrors().join( "\n " ) ) );
+ }
+
+ vlayer->startEditing();
+}
+
+void QgisApp::layerSubsetString()
+{
+ if ( mMapCanvas && mMapCanvas->isDrawing() )
return;
+
+ QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
+ if ( !vlayer )
+ return;
+
+ // launch the query builder
+ QgsQueryBuilder *qb = new QgsQueryBuilder( vlayer, this );
+
+ // Set the sql in the query builder to the same in the prop dialog
+ // (in case the user has already changed it)
+ qb->setSql( vlayer->subsetString() );
+ // Open the query builder
+ if ( qb->exec() )
+ {
+ // if the sql is changed, update it in the prop subset text box
+ vlayer->setSubsetString( qb->sql() );
+ mMapCanvas->refresh();
}
+ // delete the query builder object
+ delete qb;
+}
+
+
+bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
+{
+ if ( !layer )
+ {
+ return false;
+ }
+
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
if ( !vlayer )
{
- return;
+ return false;
}
if ( !vlayer->isEditable() )
@@ -4523,50 +4662,57 @@
if ( !( vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::EditingCapabilities ) )
{
QMessageBox::information( 0, tr( "Start editing failed" ), tr( "Provider cannot be opened for editing" ) );
+ return false;
}
}
else if ( vlayer->isModified() )
{
- // commit or roll back?
- QMessageBox::StandardButton commit =
- QMessageBox::information( 0,
- tr( "Stop editing" ),
- tr( "Do you want to save the changes to layer %1?" ).arg( vlayer->name() ),
- QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel );
+ QMessageBox::StandardButtons buttons = QMessageBox::Save | QMessageBox::Discard;
+ if ( allowCancel )
+ buttons |= QMessageBox::Cancel;
- if ( commit == QMessageBox::Save )
+ switch ( QMessageBox::information( 0,
+ tr( "Stop editing" ),
+ tr( "Do you want to save the changes to layer %1?" ).arg( vlayer->name() ),
+ buttons ) )
{
- if ( !vlayer->commitChanges() )
- {
- QMessageBox::information( 0,
- tr( "Error" ),
- tr( "Could not commit changes to layer %1\n\nErrors: %2\n" )
- .arg( vlayer->name() )
- .arg( vlayer->commitErrors().join( "\n " ) ) );
- // Leave the in-memory editing state alone,
- // to give the user a chance to enter different values
- // and try the commit again later
- }
+ case QMessageBox::Cancel:
+ mActionToggleEditing->setChecked( vlayer->isEditable() );
+ return false;
+
+ case QMessageBox::Save:
+ if ( !vlayer->commitChanges() )
+ {
+ QMessageBox::information( 0,
+ tr( "Error" ),
+ tr( "Could not commit changes to layer %1\n\nErrors: %2\n" )
+ .arg( vlayer->name() )
+ .arg( vlayer->commitErrors().join( "\n " ) ) );
+ // Leave the in-memory editing state alone,
+ // to give the user a chance to enter different values
+ // and try the commit again later
+ return false;
+ }
+ break;
+
+ case QMessageBox::Discard:
+ if ( !vlayer->rollBack() )
+ {
+ QMessageBox::information( 0, tr( "Error" ), tr( "Problems during roll back" ) );
+ return false;
+ }
+ break;
+
+ default:
+ break;
}
- else if ( commit == QMessageBox::Discard )
- {
- if ( !vlayer->rollBack() )
- {
- QMessageBox::information( 0, tr( "Error" ), tr( "Problems during roll back" ) );
- }
- }
- else //cancel
- {
- mActionToggleEditing->setChecked( vlayer->isEditable() );
- return;
- }
}
else //layer not modified
{
vlayer->rollBack();
}
- if ( layer == mMapLegend->currentLayer() )
+ if ( layer == activeLayer() )
{
activateDeactivateLayerRelatedActions( layer );
}
@@ -4574,6 +4720,7 @@
//ensure the toolbar icon state is consistent with the layer editing state
mActionToggleEditing->setChecked( vlayer->isEditable() );
vlayer->triggerRepaint();
+ return true;
}
void QgisApp::showMouseCoordinate( const QgsPoint & p )
@@ -4685,32 +4832,41 @@
mMapLegend->legendLayerShowInOverview();
}
-void QgisApp::removeLayer()
+void QgisApp::removingLayer( QString layerId )
{
- mMapLegend->removeCurrentLayer();
+ QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( layerId ) );
+ if ( !vlayer || !vlayer->isEditable() )
+ return;
+
+ toggleEditing( vlayer, false );
}
-
void QgisApp::removeAllLayers()
{
- //iterate through all the layers in order to ask if uncommited changes should be saved
- if ( mMapLegend )
+ QgsMapLayerRegistry::instance()->removeAllMapLayers();
+}
+
+void QgisApp::removeLayer()
+{
+ if ( mMapCanvas && mMapCanvas->isDrawing() )
{
- QMap<QString, QgsMapLayer*> layers = QgsMapLayerRegistry::instance()->mapLayers();
- QMap<QString, QgsMapLayer*>::iterator layer_it = layers.begin();
- for ( ; layer_it != layers.end(); ++layer_it )
- {
- mMapLegend->removeLayer( layer_it.value(), false );
- }
- mMapLegend->removeAll();
+ return;
}
- else //no legend? Remove all the layers from the registry directly in this case
+
+ QgsMapLayer *layer = activeLayer();
+
+ if ( !layer )
{
- QgsMapLayerRegistry::instance()->removeAllMapLayers();
+ return;
}
+ QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer*>( layer );
+ if ( vlayer && vlayer->isEditable() && !toggleEditing( vlayer, true ) )
+ return;
+
+ QgsMapLayerRegistry::instance()->removeMapLayer( layer->getLayerID() );
mMapCanvas->refresh();
-} //remove all layers
+}
void QgisApp::showGpsTool()
{
@@ -5050,12 +5206,15 @@
/** Get a pointer to the currently selected map layer */
QgsMapLayer *QgisApp::activeLayer()
{
- return mMapLegend->currentLayer();
+ return mMapLegend ? mMapLegend->currentLayer() : 0;
}
/** set the current layer */
bool QgisApp::setActiveLayer( QgsMapLayer *layer )
{
+ if ( !layer )
+ return false;
+
return mMapLegend->setCurrentLayer( layer );
}
@@ -5078,8 +5237,6 @@
// Let render() do its own cursor management
// QApplication::setOverrideCursor(Qt::WaitCursor);
- // create the layer
- QgsVectorLayer *layer;
/* Eliminate the need to instantiate the layer based on provider type.
The caller is responsible for cobbling together the needed information to
open the layer
@@ -5088,7 +5245,8 @@
+ " with baseName of " + baseName
+ " and providerKey of " + providerKey );
- layer = new QgsVectorLayer( vectorLayerPath, baseName, providerKey );
+ // create the layer
+ QgsVectorLayer *layer = new QgsVectorLayer( vectorLayerPath, baseName, providerKey );
if ( layer && layer->isValid() )
{
@@ -5199,8 +5357,7 @@
mMapCanvas->freeze( false );
- return ( answer != QMessageBox::Cancel );
-
+ return answer != QMessageBox::Cancel;
} // QgisApp::saveDirty()
@@ -5593,6 +5750,16 @@
return mInternalClipboard;
}
+void QgisApp::selectionChanged( QgsMapLayer *layer )
+{
+ QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
+ if ( vlayer )
+ {
+ showStatusMessage( tr( "%n feature(s) selected on layer %1.", "number of selected features", vlayer->selectedFeatureCount() ).arg( vlayer->name() ) );
+ }
+ activateDeactivateLayerRelatedActions( layer );
+}
+
void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
{
if ( !layer )
@@ -5602,10 +5769,12 @@
mActionZoomActualSize->setEnabled( false );
mActionOpenTable->setEnabled( false );
mActionToggleEditing->setEnabled( false );
+ mActionSaveEdits->setEnabled( false );
mActionLayerSaveAs->setEnabled( false );
mActionLayerSelectionSaveAs->setEnabled( false );
mActionRemoveLayer->setEnabled( false );
mActionLayerProperties->setEnabled( false );
+ mActionLayerSubsetString->setEnabled( false );
mActionAddToOverview->setEnabled( false );
mActionCapturePoint->setEnabled( false );
@@ -5646,7 +5815,7 @@
{
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( layer );
const QgsVectorDataProvider* dprovider = vlayer->dataProvider();
- bool layerHasSelection = ( vlayer->selectedFeatureCount() != 0 );
+ bool layerHasSelection = vlayer->selectedFeatureCount() != 0;
mActionSelect->setEnabled( true );
mActionIdentify->setEnabled( true );
@@ -5668,10 +5837,12 @@
{
mActionToggleEditing->setEnabled( true );
mActionToggleEditing->setChecked( vlayer->isEditable() );
+ mActionSaveEdits->setEnabled( vlayer->isEditable() );
}
else
{
mActionToggleEditing->setEnabled( false );
+ mActionSaveEdits->setEnabled( false );
}
if ( dprovider->capabilities() & QgsVectorDataProvider::AddFeatures )
@@ -5863,10 +6034,12 @@
/*************Raster layers*************/
else if ( layer->type() == QgsMapLayer::RasterLayer )
{
+ mActionLayerSubsetString->setEnabled( false );
mActionSelect->setEnabled( false );
mActionZoomActualSize->setEnabled( true );
mActionOpenTable->setEnabled( false );
mActionToggleEditing->setEnabled( false );
+ mActionSaveEdits->setEnabled( false );
mActionLayerSaveAs->setEnabled( false );
mActionLayerSelectionSaveAs->setEnabled( false );
mActionCapturePoint->setEnabled( false );
@@ -5995,12 +6168,12 @@
QgsMapLayerRegistry::instance()->addMapLayer( theRasterLayer );
// connect up any request the raster may make to update the app progress
- QObject::connect( theRasterLayer, SIGNAL( drawingProgress( int, int ) ),
- this, SLOT( showProgress( int, int ) ) );
+ connect( theRasterLayer, SIGNAL( drawingProgress( int, int ) ),
+ this, SLOT( showProgress( int, int ) ) );
// connect up any request the raster may make to update the statusbar message
- QObject::connect( theRasterLayer, SIGNAL( statusChanged( QString ) ),
- this, SLOT( showStatusMessage( QString ) ) );
+ connect( theRasterLayer, SIGNAL( statusChanged( QString ) ),
+ this, SLOT( showStatusMessage( QString ) ) );
return true;
}
@@ -6467,6 +6640,9 @@
a separate copy of the dialog pointer needs to be stored with each layer.
*/
+ if ( !ml )
+ return;
+
if ( ml->type() == QgsMapLayer::RasterLayer )
{
QgsRasterLayerProperties *rlp = NULL; // See note above about reusing this
@@ -6513,7 +6689,6 @@
{
QMessageBox::information( this, tr( "Warning" ), tr( "This layer doesn't have a properties dialog." ) );
}
-
}
}
Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/qgisapp.h 2010-05-16 14:44:42 UTC (rev 13501)
@@ -153,11 +153,8 @@
//!Overloaded version of the private function with same name that takes the imagename as a parameter
void saveMapAsImage( QString, QPixmap * );
/** Get the mapcanvas object from the app */
- QgsMapCanvas * mapCanvas() { return mMapCanvas; };
+ QgsMapCanvas * mapCanvas();
- //! returns pointer to map legend
- QgsLegend *legend() { return mMapLegend; }
-
//! Set theme (icons)
void setTheme( QString themeName = "default" );
//! Setup the toolbar popup menus for a given theme
@@ -274,6 +271,7 @@
QAction *actionLayerSeparator1() { return mActionLayerSeparator1; }
QAction *actionOpenTable() { return mActionOpenTable; }
QAction *actionToggleEditing() { return mActionToggleEditing; }
+ QAction *actionSaveEdits() { return mActionSaveEdits; }
QAction *actionLayerSaveAs() { return mActionLayerSaveAs; }
QAction *actionLayerSelectionSaveAs() { return mActionLayerSelectionSaveAs; }
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
@@ -282,6 +280,7 @@
QAction *actionGpsTool() { return mActionGpsTool; }
#endif
QAction *actionLayerProperties() { return mActionLayerProperties; }
+ QAction *actionLayerSubsetString() { return mActionLayerSubsetString; }
QAction *actionLayerSeparator2() { return mActionLayerSeparator2; }
QAction *actionAddToOverview() { return mActionAddToOverview; }
QAction *actionAddAllToOverview() { return mActionAddAllToOverview; }
@@ -356,6 +355,9 @@
//! show layer properties
void showLayerProperties( QgsMapLayer *ml );
+ //! returns pointer to map legend
+ QgsLegend *legend();
+
public slots:
//! Zoom to full extent
void zoomFull();
@@ -366,12 +368,18 @@
//! Zoom to selected features
void zoomToSelected();
+ //! open the properties dialog for the currently selected layer
+ void layerProperties();
+
//! mark project dirty
void markDirty();
//! layer was added
void layerWasAdded( QgsMapLayer * );
+ //! layer will be removed
+ void removingLayer( QString );
+
void updateUndoActions();
//! cuts selected features on the active layer to the clipboard
@@ -593,6 +601,12 @@
//! starts/stops editing mode of the current layer
void toggleEditing();
+ //! save current edits and start new transaction
+ void saveEdits();
+
+ //! change layer subset of current vector layer
+ void layerSubsetString();
+
//! map tool changed
void mapToolChanged( QgsMapTool *tool );
@@ -600,6 +614,8 @@
Is called from the legend when the current legend item has changed*/
void activateDeactivateLayerRelatedActions( QgsMapLayer* layer );
+ void selectionChanged( QgsMapLayer *layer );
+
void showProgress( int theProgress, int theTotalSteps );
void extentsViewToggled( bool theFlag );
void showExtents();
@@ -638,15 +654,12 @@
void attributeTable();
//! starts/stops editing mode of a layer
- void toggleEditing( QgsMapLayer *layer );
+ bool toggleEditing( QgsMapLayer *layer, bool allowCancel = true );
//! save current vector layer
void saveAsVectorFile();
void saveSelectionAsVectorFile();
- //! open the properties dialog for the currently selected layer
- void layerProperties();
-
//! show python console
void showPythonDialog();
@@ -756,6 +769,8 @@
/**Creates the composer instances in a project file and adds them to the menu*/
bool loadComposersFromProject( const QString& projectFilePath );
+ void saveAsVectorFileGeneral( bool saveOnlySelection );
+
/**Returns all annotation items in the canvas*/
QList<QgsAnnotationItem*> annotationItems();
/**Removes annotation items in the canvas*/
@@ -776,9 +791,9 @@
void createToolBars();
void createStatusBar();
void setupConnections();
- void createLegend();
+ void initLegend();
void createOverview();
- void createCanvas();
+ void createCanvasTools();
bool createDB();
void createMapTips();
@@ -874,6 +889,7 @@
QAction *mActionLayerSeparator1;
QAction *mActionOpenTable;
QAction *mActionToggleEditing;
+ QAction *mActionSaveEdits;
QAction *mActionLayerSaveAs;
QAction *mActionLayerSelectionSaveAs;
QAction *mActionRemoveLayer;
@@ -882,6 +898,7 @@
QAction *mActionGpsTool;
#endif
QAction *mActionLayerProperties;
+ QAction *mActionLayerSubsetString;
QAction *mActionLayerSeparator2;
QAction *mActionAddToOverview;
QAction *mActionAddAllToOverview;
Modified: trunk/qgis/src/app/qgsattributedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributedialog.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/qgsattributedialog.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -205,7 +205,6 @@
}
connect( buttonBox, SIGNAL( rejected() ), mDialog, SLOT( reject() ) );
- connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
}
QMetaObject::connectSlotsByName( mDialog );
Modified: trunk/qgis/src/app/qgsattributedialog.h
===================================================================
--- trunk/qgis/src/app/qgsattributedialog.h 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/qgsattributedialog.h 2010-05-16 14:44:42 UTC (rev 13501)
@@ -51,9 +51,6 @@
QDialog *dialog() { return mDialog; }
public slots:
- /** Overloaded accept method which will write the feature field
- * values, then delegate to QDialog::accept()
- */
void accept();
int exec();
Modified: trunk/qgis/src/app/qgsmaptoolnodetool.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolnodetool.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/qgsmaptoolnodetool.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -26,6 +26,7 @@
#include <QMessageBox>
#include "qgslogger.h"
#include "qgisapp.h"
+#include "qgslegend.h"
#include <QStatusBar>
@@ -69,6 +70,9 @@
connect( canvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( coordinatesChanged() ) );
//signal changing of coordinate renderer changed to repaint markers
connect( canvas->mapRenderer(), SIGNAL( hasCrsTransformEnabled( bool ) ), this, SLOT( coordinatesChanged( ) ) );
+ //signal changing of current layer
+ connect( QgisApp::instance()->legend(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
+ this, SLOT( currentLayerChanged( QgsMapLayer* ) ) );
}
QgsMapToolNodeTool::~QgsMapToolNodeTool()
Modified: trunk/qgis/src/app/qgsmeasuredialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsmeasuredialog.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/qgsmeasuredialog.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -76,7 +76,7 @@
if ( mTool->points().size() == 0 )
{
addPoint( point );
- this->show();
+ show();
}
raise();
Modified: trunk/qgis/src/app/qgsundowidget.cpp
===================================================================
--- trunk/qgis/src/app/qgsundowidget.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/app/qgsundowidget.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -2,6 +2,7 @@
#include "qgsmaplayer.h"
#include "qgsmapcanvas.h"
+#include "qgslegend.h"
#include "qgisapp.h"
@@ -10,11 +11,12 @@
{
setupUi( this );
setWidget( dockWidgetContents );
- connect( this->undoButton, SIGNAL( clicked() ),
- this, SLOT( undo( ) ) );
- connect( this->redoButton, SIGNAL( clicked() ),
- this, SLOT( redo( ) ) );
+ connect( undoButton, SIGNAL( clicked() ), this, SLOT( undo( ) ) );
+ connect( redoButton, SIGNAL( clicked() ), this, SLOT( redo( ) ) );
+ connect( QgisApp::instance()->legend(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
+ this, SLOT( layerChanged( QgsMapLayer* ) ) );
+
undoButton->setDisabled( true );
redoButton->setDisabled( true );
mMapCanvas = mapCanvas;
@@ -99,17 +101,17 @@
mUndoView->setObjectName( "undoView" );
gridLayout->addWidget( mUndoView, 0, 0, 1, 2 );
setWidget( dockWidgetContents );
- connect( this->mUndoStack, SIGNAL( canUndoChanged( bool ) ), this, SLOT( undoChanged( bool ) ) );
- connect( this->mUndoStack, SIGNAL( canRedoChanged( bool ) ), this, SLOT( redoChanged( bool ) ) );
+ connect( mUndoStack, SIGNAL( canUndoChanged( bool ) ), this, SLOT( undoChanged( bool ) ) );
+ connect( mUndoStack, SIGNAL( canRedoChanged( bool ) ), this, SLOT( redoChanged( bool ) ) );
// indexChanged() triggers a refresh. but it gets triggered also when a new action
// is done, resulting in two refreshes. For now let's trigger the refresh from
// vector layer: it causes potentially multiple refreshes when moving more commands
// back, but avoids double refresh in common case when adding commands to the stack
- //connect(this->mUndoStack, SIGNAL(indexChanged(int)), this, SLOT(indexChanged(int)));
+ //connect(mUndoStack, SIGNAL(indexChanged(int)), this, SLOT(indexChanged(int)));
- this->undoButton->setDisabled( !mUndoStack->canUndo() );
- this->redoButton->setDisabled( !mUndoStack->canRedo() );
+ undoButton->setDisabled( !mUndoStack->canUndo() );
+ redoButton->setDisabled( !mUndoStack->canRedo() );
}
Modified: trunk/qgis/src/core/qgsapplication.cpp
===================================================================
--- trunk/qgis/src/core/qgsapplication.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/core/qgsapplication.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -71,7 +71,6 @@
QgsApplication::~QgsApplication()
{
-
}
bool QgsApplication::notify( QObject * receiver, QEvent * event )
Modified: trunk/qgis/src/core/qgsmaplayerregistry.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaplayerregistry.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/core/qgsmaplayerregistry.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -102,7 +102,6 @@
void QgsMapLayerRegistry::removeAllMapLayers()
{
-
// moved before physically removing the layers
emit removedAll(); // now let all canvas Observers know to clear
// themselves, and then consequently any of
Modified: trunk/qgis/src/core/qgsmaplayerregistry.h
===================================================================
--- trunk/qgis/src/core/qgsmaplayerregistry.h 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/core/qgsmaplayerregistry.h 2010-05-16 14:44:42 UTC (rev 13501)
@@ -63,7 +63,7 @@
Not emitting signal is useful when you want to use registry also for layers
which won't be used in main map canvas but will be used in a special one
*/
- QgsMapLayer * addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true );
+ QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true );
/** Remove a layer from qgis
@note
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2010-05-16 14:38:12 UTC (rev 13500)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2010-05-16 14:44:42 UTC (rev 13501)
@@ -2950,7 +2950,7 @@
node.appendChild( dField );
// add label node
- QDomElement label = doc.createElement( "label" );
+ QDomElement labelElem = doc.createElement( "label" );
QDomText labelText = doc.createTextNode( "" );
if ( hasLabelsEnabled() )
@@ -2961,9 +2961,9 @@
{
labelText.setData( "0" );
}
- label.appendChild( labelText );
+ labelElem.appendChild( labelText );
- node.appendChild( label );
+ node.appendChild( labelElem );
// add attribute actions
mActions->writeXML( node, doc );
@@ -2974,7 +2974,7 @@
// XXX therefore becomes a candidate to be generalized into a separate
// XXX function. I think.
- const QgsLabel *myLabel = this->label();
+ const QgsLabel *myLabel = label();
if ( myLabel )
{
More information about the QGIS-commit
mailing list