1,986 changes: 1,057 additions & 929 deletions i18n/qgis_de.ts

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -490,24 +490,24 @@
<file>themes/default/text.png</file>
<file>themes/default/histogram.png</file>
<file>themes/default/pie-chart.png</file>
<file>console/iconClassConsole.png</file>
<file>console/iconSaveConsole.png</file>
<file>console/iconHelpConsole.png</file>
<file>console/iconSettingsConsole.png</file>
<file>console/iconOpenConsole.png</file>
<file>console/iconClearConsole.png</file>
<file>console/imgHelpDialog.png</file>
<file>console/iconSextanteConsole.png</file>
<file>console/iconScriptConsole.png</file>
<file>console/iconIfaceConsole.png</file>
<file>console/iconQtCoreConsole.png</file>
<file>console/iconQtGuiConsole.png</file>
<file>console/iconRunConsole.png</file>
<file>console/iconAboutConsole.png</file>
<file>console/iconCodepadConsole.png</file>
<file>console/imgHelpConsole.png</file>
<file>console/imgHelpMenu.png</file>
<file>console/iconHideToolConsole.png</file>
<file>themes/default/console/iconClassConsole.png</file>
<file>themes/default/console/iconSaveConsole.png</file>
<file>themes/default/console/iconHelpConsole.png</file>
<file>themes/default/console/iconSettingsConsole.png</file>
<file>themes/default/console/iconOpenConsole.png</file>
<file>themes/default/console/iconClearConsole.png</file>
<file>themes/default/console/imgHelpDialog.png</file>
<file>themes/default/console/iconSextanteConsole.png</file>
<file>themes/default/console/iconScriptConsole.png</file>
<file>themes/default/console/iconIfaceConsole.png</file>
<file>themes/default/console/iconQtCoreConsole.png</file>
<file>themes/default/console/iconQtGuiConsole.png</file>
<file>themes/default/console/iconRunConsole.png</file>
<file>themes/default/console/iconAboutConsole.png</file>
<file>themes/default/console/iconCodepadConsole.png</file>
<file>themes/default/console/imgHelpConsole.png</file>
<file>themes/default/console/imgHelpMenu.png</file>
<file>themes/default/console/iconHideToolConsole.png</file>
<file>flags/sr_Cyrl.png</file>
<file>flags/sr_Latn.png</file>
<file>flags/sw.png</file>
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed images/themes/default/mActionSaveEdits.png
Binary file not shown.
5 changes: 2 additions & 3 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)

ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(qsci_apis)
ADD_SUBDIRECTORY(console)

IF (WITH_PYSPATIALITE)
ADD_SUBDIRECTORY(pyspatialite)
Expand Down Expand Up @@ -150,7 +151,7 @@ ADD_CUSTOM_TARGET(pyutils ALL)
INSTALL(FILES ${PY_FILES} DESTINATION "${QGIS_PYTHON_DIR}")

# stage to output to make available when QGIS is run from build directory
FOREACH(pyfile ${PY_FILES} ${PYUI_FILES})
FOREACH(pyfile ${PY_FILES})
ADD_CUSTOM_COMMAND(TARGET pyutils
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} "${QGIS_PYTHON_OUTPUT_DIRECTORY}"
Expand All @@ -159,8 +160,6 @@ FOREACH(pyfile ${PY_FILES} ${PYUI_FILES})
)
ENDFOREACH(pyfile)

ADD_SUBDIRECTORY(console)

# Byte-compile staged PyQGIS utilities
IF(WITH_PY_COMPILE)
ADD_CUSTOM_TARGET(pycompile_pyutils ALL
Expand Down
14 changes: 7 additions & 7 deletions python/console/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
ADD_SUBDIRECTORY(console_help)

SET(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
SET(QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)
SET (QGIS_CONSOLE_DIR ${QGIS_DATA_DIR}/python/console)
SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)

# PyQGIS console files to copy to staging or install
SET(PY_CONSOLE_FILES
console.py
console_sci.py
console_help.py
console_settings.py
console_output.py
__init__.py
)

FILE(GLOB UI_FILES *.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES}) # returns absolute paths
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
ADD_CUSTOM_TARGET(pyconsole ALL DEPENDS ${PYUI_FILES})

# stage to output to make available when QGIS is run from build directory
FOREACH(pyfile ${PY_CONSOLE_FILES} ${PYUI_FILES})
ADD_CUSTOM_COMMAND(TARGET pyconsole
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} "${QGIS_PYTHON_OUTPUT_DIRECTORY}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_OUTPUT_DIRECTORY}/console
COMMAND ${CMAKE_COMMAND} -E copy ${pyfile} ${PYTHON_OUTPUT_DIRECTORY}/console
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${pyfile}
)
ENDFOREACH(pyfile)

INSTALL(FILES ${PY_CONSOLE_FILES} ${PYUI_FILES} DESTINATION "${QGIS_PYTHON_DIR}")
INSTALL(FILES ${PY_CONSOLE_FILES} ${PYUI_FILES} DESTINATION "${QGIS_CONSOLE_DIR}")

26 changes: 26 additions & 0 deletions python/console/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
__init__.py
---------------------
Date : September 2012
Copyright : (C) 2012 by Salvatore Larosa
Email : lrssvtml at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Salvatore Larosa'
__date__ = 'September 2012'
__copyright__ = '(C) 2012, Salvatore Larosa'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from console import show_console
25 changes: 13 additions & 12 deletions python/console/console.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from console_output import EditorOutput
from console_help import HelpDialog
from console_settings import optionsDialog
from qgis.core import QgsApplication

import sys
import os
Expand Down Expand Up @@ -121,7 +122,7 @@ def __init__(self, parent=None):
self.clearButton = QAction(parent)
self.clearButton.setCheckable(False)
self.clearButton.setEnabled(True)
self.clearButton.setIcon(QIcon(":/images/console/iconClearConsole.png"))
self.clearButton.setIcon(QgsApplication.getThemeIcon("console/iconClearConsole.png"))
self.clearButton.setMenuRole(QAction.PreferencesRole)
self.clearButton.setIconVisibleInMenu(True)
self.clearButton.setToolTip(clearBt)
Expand All @@ -131,7 +132,7 @@ def __init__(self, parent=None):
self.optionsButton = QAction(parent)
self.optionsButton.setCheckable(False)
self.optionsButton.setEnabled(True)
self.optionsButton.setIcon(QIcon(":/images/console/iconSettingsConsole.png"))
self.optionsButton.setIcon(QgsApplication.getThemeIcon("console/iconSettingsConsole.png"))
self.optionsButton.setMenuRole(QAction.PreferencesRole)
self.optionsButton.setIconVisibleInMenu(True)
self.optionsButton.setToolTip(optionsBt)
Expand All @@ -141,7 +142,7 @@ def __init__(self, parent=None):
self.actionClass = QAction(parent)
self.actionClass.setCheckable(False)
self.actionClass.setEnabled(True)
self.actionClass.setIcon(QIcon(":/images/console/iconClassConsole.png"))
self.actionClass.setIcon(QgsApplication.getThemeIcon("console/iconClassConsole.png"))
self.actionClass.setMenuRole(QAction.PreferencesRole)
self.actionClass.setIconVisibleInMenu(True)
self.actionClass.setToolTip(actionClassBt)
Expand All @@ -151,7 +152,7 @@ def __init__(self, parent=None):
self.actionScript = QAction(parent)
self.actionScript.setCheckable(False)
self.actionScript.setEnabled(True)
self.actionScript.setIcon(QIcon(":/images/console/iconScriptConsole.png"))
self.actionScript.setIcon(QgsApplication.getThemeIcon("console/iconScriptConsole.png"))
self.actionScript.setMenuRole(QAction.PreferencesRole)
self.actionScript.setIconVisibleInMenu(True)
self.actionScript.setToolTip(actionScriptBt)
Expand All @@ -161,7 +162,7 @@ def __init__(self, parent=None):
self.loadSextanteButton = QAction(parent)
self.loadSextanteButton.setCheckable(False)
self.loadSextanteButton.setEnabled(True)
self.loadSextanteButton.setIcon(QIcon(":/images/console/iconSextanteConsole.png"))
self.loadSextanteButton.setIcon(QgsApplication.getThemeIcon("console/iconSextanteConsole.png"))
self.loadSextanteButton.setMenuRole(QAction.PreferencesRole)
self.loadSextanteButton.setIconVisibleInMenu(True)
self.loadSextanteButton.setToolTip(loadSextanteBt)
Expand All @@ -171,7 +172,7 @@ def __init__(self, parent=None):
self.loadIfaceButton = QAction(parent)
self.loadIfaceButton.setCheckable(False)
self.loadIfaceButton.setEnabled(True)
self.loadIfaceButton.setIcon(QIcon(":/images/console/iconIfaceConsole.png"))
self.loadIfaceButton.setIcon(QgsApplication.getThemeIcon("console/iconIfaceConsole.png"))
self.loadIfaceButton.setMenuRole(QAction.PreferencesRole)
self.loadIfaceButton.setIconVisibleInMenu(True)
self.loadIfaceButton.setToolTip(loadIfaceBt)
Expand All @@ -181,7 +182,7 @@ def __init__(self, parent=None):
self.loadQtCoreButton = QAction(parent)
self.loadQtCoreButton.setCheckable(False)
self.loadQtCoreButton.setEnabled(True)
self.loadQtCoreButton.setIcon(QIcon(":/images/console/iconQtCoreConsole.png"))
self.loadQtCoreButton.setIcon(QgsApplication.getThemeIcon("console/iconQtCoreConsole.png"))
self.loadQtCoreButton.setMenuRole(QAction.PreferencesRole)
self.loadQtCoreButton.setIconVisibleInMenu(True)
self.loadQtCoreButton.setToolTip(loadQtCoreBt)
Expand All @@ -191,7 +192,7 @@ def __init__(self, parent=None):
self.loadQtGuiButton = QAction(parent)
self.loadQtGuiButton.setCheckable(False)
self.loadQtGuiButton.setEnabled(True)
self.loadQtGuiButton.setIcon(QIcon(":/images/console/iconQtGuiConsole.png"))
self.loadQtGuiButton.setIcon(QgsApplication.getThemeIcon("console/iconQtGuiConsole.png"))
self.loadQtGuiButton.setMenuRole(QAction.PreferencesRole)
self.loadQtGuiButton.setIconVisibleInMenu(True)
self.loadQtGuiButton.setToolTip(loadQtGuiBt)
Expand All @@ -201,7 +202,7 @@ def __init__(self, parent=None):
self.openFileButton = QAction(parent)
self.openFileButton.setCheckable(False)
self.openFileButton.setEnabled(True)
self.openFileButton.setIcon(QIcon(":/images/console/iconOpenConsole.png"))
self.openFileButton.setIcon(QgsApplication.getThemeIcon("console/iconOpenConsole.png"))
self.openFileButton.setMenuRole(QAction.PreferencesRole)
self.openFileButton.setIconVisibleInMenu(True)
self.openFileButton.setToolTip(openFileBt)
Expand All @@ -211,7 +212,7 @@ def __init__(self, parent=None):
self.saveFileButton = QAction(parent)
self.saveFileButton.setCheckable(False)
self.saveFileButton.setEnabled(True)
self.saveFileButton.setIcon(QIcon(":/images/console/iconSaveConsole.png"))
self.saveFileButton.setIcon(QgsApplication.getThemeIcon("console/iconSaveConsole.png"))
self.saveFileButton.setMenuRole(QAction.PreferencesRole)
self.saveFileButton.setIconVisibleInMenu(True)
self.saveFileButton.setToolTip(saveFileBt)
Expand All @@ -221,7 +222,7 @@ def __init__(self, parent=None):
self.runButton = QAction(parent)
self.runButton.setCheckable(False)
self.runButton.setEnabled(True)
self.runButton.setIcon(QIcon(":/images/console/iconRunConsole.png"))
self.runButton.setIcon(QgsApplication.getThemeIcon("console/iconRunConsole.png"))
self.runButton.setMenuRole(QAction.PreferencesRole)
self.runButton.setIconVisibleInMenu(True)
self.runButton.setToolTip(runBt)
Expand All @@ -231,7 +232,7 @@ def __init__(self, parent=None):
self.helpButton = QAction(parent)
self.helpButton.setCheckable(False)
self.helpButton.setEnabled(True)
self.helpButton.setIcon(QIcon(":/images/console/iconHelpConsole.png"))
self.helpButton.setIcon(QgsApplication.getThemeIcon("console/iconHelpConsole.png"))
self.helpButton.setMenuRole(QAction.PreferencesRole)
self.helpButton.setIconVisibleInMenu(True)
self.helpButton.setToolTip(helpBt)
Expand Down
30 changes: 15 additions & 15 deletions python/console/console_help/help.htm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<table id="header">
<tr>
<td>
<img src="qrc:/images/console/imgHelpDialog.png" />
<img src="qrc:/images/themes/default/console/imgHelpDialog.png" />
</td>
<td>
<span id="headerTitle" class="_title">Python Console for QGIS</span>
Expand All @@ -58,7 +58,7 @@
</td>
</tr>
<tr>
<td><img src="qrc:/images/console/imgHelpConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/imgHelpConsole.png" /></td>
</tr>
<tr>
<td>
Expand All @@ -69,7 +69,7 @@
You can drag and drop or copy text into input area (no matter if selected text contains >>> or ...).
Use 'Share on codepad' from contextual menu for sharing snippets code.
The context menu looks like the image below.</span><br><br>
<img src="qrc:/images/console/imgHelpMenu.png"><br>
<img src="qrc:/images/themes/default/console/imgHelpMenu.png"><br>
<span id="headerSubjectB">Input area pane is the interactive python shell for input commands.</span>
</p>
</td>
Expand Down Expand Up @@ -127,49 +127,49 @@
<p><span id="toolbarTitle">The following is a description of the tools in the toolbar:</span></p>
<table width="100%" border="0" id="headerTool">
<tr>
<td><img src="qrc:/images/console/iconClearConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconClearConsole.png" /></td>
<td colspan="2"><span id="toolbarClear">Tool to clear python console</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconClassConsole.png" /></td>
<td><img src="qrc:/images/console/iconIfaceConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconClassConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconIfaceConsole.png" /></td>
<td><span id="toolbarIfaceClass">Tool to import QgisInterface class</span></td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/console/iconSextanteConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconSextanteConsole.png" /></td>
<td><span id="toolbarSextClass">Tool to import Sextante class</span></td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/console/iconQtCoreConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconQtCoreConsole.png" /></td>
<td><span id="toolbarQtCoreClass">Tool to import PyQt4.QtCore class</span></td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/console/iconQtGuiConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconQtGuiConsole.png" /></td>
<td><span id="toolbarQtGuiClass">Tool to import PyQt4.QtGui class</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconScriptConsole.png" /></td>
<td><img src="qrc:/images/console/iconOpenConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconScriptConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconOpenConsole.png" /></td>
<td><span id="toolbarScriptOpen">Tool to open a python script and load in console</span></td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/console/iconSaveConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconSaveConsole.png" /></td>
<td><span id="toolbarScriptSave">Tool to save a python script</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconSettingsConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconSettingsConsole.png" /></td>
<td colspan="2"><span id="toolbarSettings">Settings</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconHelpConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconHelpConsole.png" /></td>
<td colspan="2"><span id="toolbarHelp">Help</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconRunConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconRunConsole.png" /></td>
<td colspan="2"><span id="toolbarRun">Run command (like Enter key pressed)</span></td>
</tr>
</table>
Expand Down
9 changes: 5 additions & 4 deletions python/console/console_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from PyQt4.Qsci import (QsciScintilla,
QsciScintillaBase,
QsciLexerPython)
from qgis.core import QgsApplication
import sys

class writeOut:
Expand Down Expand Up @@ -162,10 +163,10 @@ def clearConsole(self):

def contextMenuEvent(self, e):
menu = QMenu(self)
iconRun = QIcon(":/images/console/iconRunConsole.png")
iconPastebin = QIcon(":/images/console/iconCodepadConsole.png")
iconClear = QIcon(":/images/console/iconClearConsole.png")
iconHideTool = QIcon(":/images/console/iconHideToolConsole.png")
iconRun = QgsApplication.getThemeIcon("console/iconRunConsole.png")
iconPastebin = QgsApplication.getThemeIcon("console/iconCodepadConsole.png")
iconClear = QgsApplication.getThemeIcon("console/iconClearConsole.png")
iconHideTool = QgsApplication.getThemeIcon("console/iconHideToolConsole.png")
hideToolBar = menu.addAction(iconHideTool,
"Hide/Show Toolbar",
self.hideToolBar)
Expand Down
Empty file modified python/console/console_sci.py
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ class QgisInterface : QObject
virtual QAction *actionOpenTable() = 0;
virtual QAction *actionToggleEditing() = 0;
/** @note added in 1.9 */
virtual QAction *actionSaveActiveLayerEdits() = 0;
/** @note added in 1.9 */
virtual QAction *actionAllEdits() = 0;
/** @note added in 1.9 */
virtual QAction *actionSaveEdits() = 0;
Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsmessagebar.sip
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class QgsMessageBar: QFrame
* @param widget widget to add
* @param level is 0 for information, 1 for warning, 2 for critical
*/
void pushWidget( QWidget *widget, int level = 0 );
void pushWidget( QWidget *widget /Transfer/, int level = 0 );

/*! remove the passed widget from the bar (if previously added),
* then display the next one in the stack if any or hide the bar
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/GdalTools/tools/GdalTools_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def layerAdded(self, layer):
self.emit( SIGNAL( "layersChanged" ) )

def removeLayer(self, layerId):
LayerRegistry.layers = filter( lambda x: x.getLayerID() != layerId, LayerRegistry.layers)
LayerRegistry.layers = filter( lambda x: x.id() != layerId, LayerRegistry.layers)
self.emit( SIGNAL( "layersChanged" ) )

def removeAllLayers(self):
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/GdalTools/tools/inOutSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ def setLayer(self, layer=None):
prevFn, prevLayer = self.filename(), self.layer()

if isinstance(layer, QgsMapLayer):
if self.combo.findData(layer.getLayerID()) >= 0:
index = self.combo.findData( layer.getLayerID() )
if self.combo.findData(layer.id()) >= 0:
index = self.combo.findData( layer.id() )
self.combo.setCurrentIndex( index )
else:
self.combo.setCurrentIndex( -1 )
Expand Down Expand Up @@ -199,7 +199,7 @@ def setLayers(self, layers=None):

self.combo.clear()
for l in layers:
self.combo.addItem( l.name(), l.getLayerID() )
self.combo.addItem( l.name(), l.id() )

self.restoreComboState()
self.blockSignals( False )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,49 @@ def run(item, action, mainwindow):
prevRenderFlagState = iface.mapCanvas().renderFlag()
iface.mapCanvas().setRenderFlag( False )
try:
# NOTE: -1 parent is an attempt to always add to the root, but
# it is currently broken: http://hub.qgis.org/issues/6879
group = legend.addGroup(u'%s topology' % toponame, False, -1)
supergroup = legend.addGroup(u'Topology "%s"' % toponame, False)
# should not be needed: http://hub.qgis.org/issues/6938
legend.setGroupVisible(supergroup, False)

provider = db.dbplugin().providerName()
uri = db.uri();

# FACES
group = legend.addGroup(u'Faces', False, supergroup)
# should not be needed: http://hub.qgis.org/issues/6938
legend.setGroupVisible(group, False)

# face
layer = db.toSqlLayer(u'SELECT face_id, topology.ST_GetFaceGeometry(%s, face_id) as geom ' \
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame)),
'geom', 'face_id', u'%s.face' % toponame)
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame)),
'geom', 'face_id', u'geom')
layer.loadNamedStyle(os.path.join(template_dir, 'face.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

# face_seed
layer = db.toSqlLayer(u'SELECT face_id, ST_PointOnSurface(topology.ST_GetFaceGeometry(%s, face_id)) as geom ' \
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame)),
'geom', 'face_id', u'seed')
layer.loadNamedStyle(os.path.join(template_dir, 'face_seed.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

# TODO: add polygon0, polygon1 and polygon2 ?


# NODES
group = legend.addGroup(u'Nodes', False, supergroup)
# should not be needed: http://hub.qgis.org/issues/6938
legend.setGroupVisible(group, False)

# node
uri.setDataSource(toponame, 'node', 'geom', '', 'node_id')
layer = QgsVectorLayer(uri.uri(), u'%s.nodes' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'geom', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'node.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -120,25 +143,39 @@ def run(item, action, mainwindow):

# node labels
uri.setDataSource(toponame, 'node', 'geom', '', 'node_id')
layer = QgsVectorLayer(uri.uri(), u'%s.node label' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'node_id', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'node_label.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

# EDGES
group = legend.addGroup(u'Edges', False, supergroup)
# should not be needed: http://hub.qgis.org/issues/6938
legend.setGroupVisible(group, False)

# edge
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'%s.edge' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'geom', provider)
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

# directed edge
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'directed_geom', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'edge.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)


# edge labels
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'%s.edge label' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'edge_id', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'edge_label.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -147,7 +184,7 @@ def run(item, action, mainwindow):

# face_left
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'%s.face_left' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'face_left', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'face_left.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -156,7 +193,7 @@ def run(item, action, mainwindow):

# face_right
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'%s.face_right' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'face_right', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'face_right.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -165,7 +202,7 @@ def run(item, action, mainwindow):

# next_left
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'%s.next_left' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'next_left', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'next_left.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
Expand All @@ -174,25 +211,13 @@ def run(item, action, mainwindow):

# next_right
uri.setDataSource(toponame, 'edge_data', 'geom', '', 'edge_id')
layer = QgsVectorLayer(uri.uri(), u'%s.next_right' % toponame, provider)
layer = QgsVectorLayer(uri.uri(), u'next_right', provider)
layer.loadNamedStyle(os.path.join(template_dir, 'next_right.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

# face_seed
layer = db.toSqlLayer(u'SELECT face_id, ST_PointOnSurface(topology.ST_GetFaceGeometry(%s, face_id)) as geom ' \
'FROM %s.face WHERE face_id > 0' % (quoteStr(toponame), quoteId(toponame)),
'geom', 'face_id', u'%s.face_seed' % toponame)
layer.loadNamedStyle(os.path.join(template_dir, 'face_seed.qml'))
registry.addMapLayers([layer])
legend.setLayerVisible(layer, False)
legend.setLayerExpanded(layer, False)
legend.moveLayer(layer, group)

# TODO: add polygon0, polygon1 and polygon2 ?

finally:
# restore canvas render flag
iface.mapCanvas().setRenderFlag( prevRenderFlagState )
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/ui/DlgExportVector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<bool>false</bool>
</property>
<property name="text">
<string>Append data into file</string>
<string>Append data to file</string>
</property>
</widget>
</item>
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/ui/DlgImportVector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<bool>false</bool>
</property>
<property name="text">
<string>Append data into table</string>
<string>Append data to table</string>
</property>
</widget>
</item>
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/fTools/tools/doEliminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName = None):
try:
found = fidsToEliminate.index(selFid)
except ValueError: #selFid is not in fidsToEliminate
# check wether the geometry to eliminate and the other geometry intersect
# check whether the geometry to eliminate and the other geometry intersect
selFeat = QgsFeature()

if outLayer.featureAtId(selFid, selFeat, True, False):
Expand All @@ -190,7 +190,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName = None):
mergeWithFid = selFid
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry

if mergeWithFid: # a successful candidate
if mergeWithFid != None: # a successful candidate
try:
geomList = geomsToMerge[mergeWithFid]
except KeyError:
Expand Down
4 changes: 4 additions & 0 deletions python/plugins/fTools/tools/doMergeShapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ def accept( self ):
baseDir = self.leInputDir.text()
# look for shapes with specified geometry type
self.inputFiles = ftools_utils.getShapesByGeometryType( baseDir, self.inputFiles, self.cmbGeometry.currentIndex() )
if self.inputFiles is None:
QMessageBox.warning( self, self.tr( "No shapefiles found" ),
self.tr( "There are no shapefiles with the given geometry type. Please select an available geometry type." ) )
return
self.progressFiles.setRange( 0, self.inputFiles.count() )

outFile = QFile( self.outFileName )
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/fTools/tools/doRandPoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def randomize(self, inLayer, outPath, minimum, design, value):
points = self.vectorRandom(int(value), inLayer,
ext.xMinimum(), ext.xMaximum(), ext.yMinimum(), ext.yMaximum())
else: points = self.loopThruPolygons(inLayer, value, design)
crs = self.iface.mapCanvas().mapRenderer().destinationSrs()
crs = self.iface.mapCanvas().mapRenderer().destinationCrs()
if not crs.isValid(): crs = None
fields = { 0 : QgsField("ID", QVariant.Int) }
check = QFile(self.shapefileName)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/fTools/tools/doRegPoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def accept(self):
crs = mLayer.crs()
else:
boundBox = QgsRectangle(float(self.xMin.text()), float(self.yMin.text()), float(self.xMax.text()), float(self.yMax.text()))
crs = self.mapCanvas.mapRenderer().destinationSrs()
crs = self.mapCanvas.mapRenderer().destinationCrs()
print crs.isValid()
if not crs.isValid(): crs = None
self.regularize(boundBox, outPath, offset, value, self.rdoSpacing.isChecked(), self.spnInset.value(), crs)
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/fTools/tools/doValidate.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def zoomToError(self, curr, prev):
self.marker.setGeom(e)

rect = mc.extent()
rect.expand( 0.25, e )
rect.scale( 0.5, e )

else:
self.marker.reset()
Expand All @@ -186,7 +186,7 @@ def zoomToError(self, curr, prev):
return

rect = mc.mapRenderer().layerExtentToOutputExtent( self.vlayer, ft.geometry().boundingBox() )
rect.expand(1.05)
rect.scale( 1.05 )

# Set the extent to our new rectangle
mc.setExtent(rect)
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/osm/OsmDatabaseManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,22 @@ def layerRemoved(self,layerID):
key=dbFileName.toLatin1().data()

# remove map layers that belong to dbFileName database
if key in self.lineLayers.keys() and layer.id()==self.lineLayers[key].getLayerID():
if key in self.lineLayers.keys() and layer.id()==self.lineLayers[key].id():
del self.lineLayers[key]

elif key in self.pointLayers.keys() and layer.id()==self.pointLayers[key].id():
del self.pointLayers[key]
if key in self.lineLayers.keys():
if self.lineLayers[key]:
lineLayID=self.lineLayers[key].id()
self.mapReg.removeMapLayer(lineLayID,True)
self.mapReg.removeMapLayers([lineLayID],True)

elif key in self.polygonLayers.keys() and layer.id()==self.polygonLayers[key].id():
del self.polygonLayers[key]
if key in self.pointLayers.keys():
if self.pointLayers[key]:
pointLayID=self.pointLayers[key].id()
self.mapReg.removeMapLayer(pointLayID,True)
self.mapReg.removeMapLayers([pointLayID],True)

if key in self.dbConns.keys():
del self.dbConns[key]
Expand All @@ -202,7 +202,7 @@ def removeAllOsmLayers(self):
continue

if layer.type()==QgsMapLayer.VectorLayer and layer.dataProvider().name()=="osm":
QgsMapLayerRegistry.instance().removeMapLayer(layer.id(),True)
QgsMapLayerRegistry.instance().removeMapLayers([layer.id()],True)

self.dbConns={} # map dbFileName->sqlite3ConnectionObject
self.pointLayers={}
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/osm/OsmDownloadDlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, plugin):
# check whether the extent needs to be projected back to WGS84
mapRenderer = plugin.canvas.mapRenderer()
if mapRenderer.hasCrsTransformEnabled():
crsMap=mapRenderer.destinationSrs()
crsMap=mapRenderer.destinationCrs()
crsWgs84=QgsCoordinateReferenceSystem(4326)
xform=QgsCoordinateTransform(crsMap, crsWgs84)
currentExtent=xform.transformBoundingBox(currentExtent)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/osm/OsmFeatureDW.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def projectionChanged(self):

renderer = self.plugin.canvas.mapRenderer()
if renderer.hasCrsTransformEnabled():
self.coordXform = QgsCoordinateTransform(renderer.destinationSrs(), QgsCoordinateReferenceSystem(4326))
self.coordXform = QgsCoordinateTransform(renderer.destinationCrs(), QgsCoordinateReferenceSystem(4326))
else:
self.coordXform = None

Expand Down
158 changes: 46 additions & 112 deletions python/plugins/sextante/algs/ftools/Dissolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,157 +41,91 @@ class Dissolve(GeoAlgorithm):
INPUT = "INPUT"
OUTPUT = "OUTPUT"
FIELD = "FIELD"
USE_SELECTED = "USE_SELECTED"
DISSOLVE_ALL = "DISSOLVE_ALL"

#===========================================================================
# def getIcon(self):
# return QtGui.QIcon(os.path.dirname(__file__) + "/icons/dissolve.png")
#===========================================================================

def processAlgorithm(self, progress):
useSelection = self.getParameterValue(Dissolve.USE_SELECTED)
useField = not self.getParameterValue(Dissolve.USE_SELECTED)
def processAlgorithm(self, progress):
useField = not self.getParameterValue(Dissolve.DISSOLVE_ALL)
fieldname = self.getParameterValue(Dissolve.FIELD)
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(Dissolve.INPUT))
field = vlayerA.dataProvider().fieldNameIndex(fieldname)
GEOS_EXCEPT = True
FEATURE_EXCEPT = True
vproviderA = vlayerA.dataProvider()
allAttrsA = vproviderA.attributeIndexes()
fields = vproviderA.fields()
writer = self.getOutputFromName(Dissolve.OUTPUT).getVectorWriter(fields, vproviderA.geometryType(), vproviderA.crs() )
inFeat = QgsFeature()
#inFeat = QgsFeature()
outFeat = QgsFeature()
vproviderA.rewind()
nElement = 0
# there is selection in input layer
if useSelection:
nFeat = vlayerA.selectedFeatureCount()
selectionA = vlayerA.selectedFeatures()
if not useField:
nFeat = vproviderA.featureCount()
if not useField:
first = True
for inFeat in selectionA:
nElement += 1
progress.setPercentage(int(nElement/nFeat * 100))
if first:
attrs = inFeat.attributeMap()
tmpInGeom = QgsGeometry( inFeat.geometry() )
outFeat.setGeometry( tmpInGeom )
first = False
else:
tmpInGeom = QgsGeometry( inFeat.geometry() )
tmpOutGeom = QgsGeometry( outFeat.geometry() )
try:
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
GEOS_EXCEPT = False
continue
outFeat.setAttributeMap( attrs )
writer.addFeature( outFeat )
else:
unique = vproviderA.uniqueValues( int( field ) )
nFeat = nFeat * len( unique )
for item in unique:
first = True
add = False
vproviderA.select( allAttrsA )
vproviderA.rewind()
for inFeat in selectionA:
features = QGisLayers.features(vlayerA)
for inFeat in features:
nElement += 1
progress.setPercentage(int(nElement/nFeat * 100))
atMap = inFeat.attributeMap()
tempItem = atMap[ field ]
if tempItem.toString().trimmed() == item.toString().trimmed():
add = True
if first:
QgsGeometry( inFeat.geometry() )
if first:
attrs = inFeat.attributeMap()
tmpInGeom = QgsGeometry( inFeat.geometry() )
outFeat.setGeometry( tmpInGeom )
first = False
attrs = inFeat.attributeMap()
else:
else:
tmpInGeom = QgsGeometry( inFeat.geometry() )
tmpOutGeom = QgsGeometry( outFeat.geometry() )
try:
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
GEOS_EXCEPT = False
add = False
if add:
outFeat.setAttributeMap( attrs )
writer.addFeature( outFeat )
# there is no selection in input layer
GEOS_EXCEPT = False
continue
outFeat.setAttributeMap( attrs )
writer.addFeature( outFeat )
else:
nFeat = vproviderA.featureCount()
if not useField:
first = True
while vproviderA.nextFeature( inFeat ):
nElement += 1
progress.setPercentage(int(nElement/nFeat * 100))
if first:
attrs = inFeat.attributeMap()
tmpInGeom = QgsGeometry( inFeat.geometry() )
outFeat.setGeometry( tmpInGeom )
first = False
else:
tmpInGeom = QgsGeometry( inFeat.geometry() )
tmpOutGeom = QgsGeometry( outFeat.geometry() )
try:
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
GEOS_EXCEPT = False
continue
outFeat.setAttributeMap( attrs )
writer.addFeature( outFeat )
else:
unique = vproviderA.uniqueValues( int( field ) )
nFeat = nFeat * len( unique )
for item in unique:
first = True
add = True
vproviderA.select( allAttrsA )
vproviderA.rewind()
while vproviderA.nextFeature( inFeat ):
nElement += 1
progress.setPercentage(int(nElement/nFeat * 100))
atMap = inFeat.attributeMap()
tempItem = atMap[ field ]
if tempItem.toString().trimmed() == item.toString().trimmed():
if first:
QgsGeometry( inFeat.geometry() )
tmpInGeom = QgsGeometry( inFeat.geometry() )
outFeat.setGeometry( tmpInGeom )
first = False
attrs = inFeat.attributeMap()
else:
tmpInGeom = QgsGeometry( inFeat.geometry() )
tmpOutGeom = QgsGeometry( outFeat.geometry() )
try:
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
GEOS_EXCEPT = False
add = False
if add:
outFeat.setAttributeMap( attrs )
writer.addFeature( outFeat )
first = True
add = True
vproviderA.select( allAttrsA )
vproviderA.rewind()
features = QGisLayers.features(vlayerA)
for inFeat in features:
nElement += 1
progress.setPercentage(int(nElement/nFeat * 100))
atMap = inFeat.attributeMap()
tempItem = atMap[ field ]
if tempItem.toString().trimmed() == item.toString().trimmed():
if first:
QgsGeometry( inFeat.geometry() )
tmpInGeom = QgsGeometry( inFeat.geometry() )
outFeat.setGeometry( tmpInGeom )
first = False
attrs = inFeat.attributeMap()
else:
tmpInGeom = QgsGeometry( inFeat.geometry() )
tmpOutGeom = QgsGeometry( outFeat.geometry() )
try:
tmpOutGeom = QgsGeometry( tmpOutGeom.combine( tmpInGeom ) )
outFeat.setGeometry( tmpOutGeom )
except:
GEOS_EXCEPT = False
add = False
if add:
outFeat.setAttributeMap( attrs )
writer.addFeature( outFeat )
del writer
if not GEOS_EXCEPT:
SextanteLog.addToLog(SextanteLog.LOG_WARNING, "Geometry exception while dissolving")
if not FEATURE_EXCEPT:
SextanteLog.addToLog(SextanteLog.LOG_WARNING, "Feature exception while dissolving")



def defineCharacteristics(self):
self.name = "Dissolve"
self.group = "Vector geometry tools"
self.addParameter(ParameterVector(Dissolve.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterBoolean(Dissolve.USE_SELECTED, "Use selected features", False))
self.addParameter(ParameterVector(Dissolve.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterBoolean(Dissolve.DISSOLVE_ALL, "Dissolve all (do not use field)", True))
self.addParameter(ParameterTableField(Dissolve.FIELD, "Unique ID field",Dissolve.INPUT ))
self.addOutput(OutputVector(Dissolve.OUTPUT, "Dissolved"))
Expand Down
13 changes: 13 additions & 0 deletions src/app/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ void QgsLegend::handleCurrentItemChanged( QTreeWidgetItem* current, QTreeWidgetI
mMapCanvas->setCurrentLayer( layer );
}

blockSignals( true ); // or itemChanged() emitted
foreach ( QgsLegendLayer *ll, legendLayers() )
{
QFont itemFont = ll->font( 0 );
itemFont.setUnderline( ll->layer() == layer );
ll->setFont( 0, itemFont );
}
blockSignals( false );

emit currentLayerChanged( layer );
}

Expand Down Expand Up @@ -385,6 +394,10 @@ void QgsLegend::mousePressEvent( QMouseEvent * e )
{
mMousePressedFlag = true;
mDropTarget = itemAt( e->pos() );
if ( !mDropTarget )
{
setCurrentItem( 0 );
}
}
else if ( e->button() == Qt::RightButton )
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegend.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ class QgsLegend : public QTreeWidget
void collapseAll();
/** toogle update drawing order */
void toggleDrawingOrderUpdate();
void handleItemChange( QTreeWidgetItem* item, int row );
void handleItemChange( QTreeWidgetItem* item, int column );
void handleCloseEditor( QWidget * editor, QAbstractItemDelegate::EndEditHint hint );
/** delegates current layer to map canvas */
void handleCurrentItemChanged( QTreeWidgetItem* current, QTreeWidgetItem* previous );
Expand Down
5 changes: 5 additions & 0 deletions src/app/legend/qgslegendlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
{
QgsMapLayer *lyr = layer();
QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing();
QAction *saveLayerEditsAction = QgisApp::instance()->actionSaveActiveLayerEdits();
QAction *allEditsAction = QgisApp::instance()->actionAllEdits();

// zoom to layer extent
Expand Down Expand Up @@ -469,6 +470,10 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
theMenu.addAction( toggleEditingAction );
toggleEditingAction->setChecked( vlayer->isEditable() );
}
if ( saveLayerEditsAction && vlayer->isModified() )
{
theMenu.addAction( saveLayerEditsAction );
}
}

if ( allEditsAction->isEnabled() )
Expand Down
2 changes: 0 additions & 2 deletions src/app/nodetool/qgsselectedfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#ifndef QGSSELECTEDFEATURE_H
#define QGSSELECTEDFEATURE_H

#include "nodetool/qgsselectedfeature.h"

#include "qgsfeature.h"
#include "qgsgeometry.h"

Expand Down
50 changes: 39 additions & 11 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,12 @@ static QgsMessageOutput *messageOutputViewer_()
return new QgsMessageOutputConsole();
}

static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
static void customSrsValidation_( QgsCoordinateReferenceSystem &srs )
{
QgisApp::instance()->emitCustomSrsValidation( srs );
}

void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem &srs )
{
emit customSrsValidation( srs );
}
Expand All @@ -361,7 +361,7 @@ void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
* - use project's CRS
* - use predefined global CRS
*/
void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
void QgisApp::validateSrs( QgsCoordinateReferenceSystem &srs )
{
static QString authid = QString::null;
QSettings mySettings;
Expand All @@ -372,9 +372,10 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
//it in the ctor of the layer projection selector

QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
mySelector->setMessage( srs.validationHint() ); //shows a generic message, if not specified
if ( authid.isNull() )
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();

QgsCoordinateReferenceSystem defaultCrs;
if ( defaultCrs.createFromOgcWmsCrs( authid ) )
{
Expand All @@ -389,7 +390,7 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
{
QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
authid = mySelector->selectedAuthId();
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
srs.createFromOgcWmsCrs( mySelector->selectedAuthId() );
}

//QApplication::restoreOverrideCursor();
Expand All @@ -402,12 +403,12 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();
QgsDebugMsg( "Layer srs set from project: " + authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to project CRS" ) );
srs->createFromOgcWmsCrs( authid );
srs.createFromOgcWmsCrs( authid );
}
else ///Projections/defaultBehaviour==useGlobal
{
authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
srs->createFromOgcWmsCrs( authid );
srs.createFromOgcWmsCrs( authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
}
}
Expand Down Expand Up @@ -566,8 +567,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
QgsMessageLog::logMessage( tr( "QGIS starting..." ) );

// set QGIS specific srs validation
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem * ) ),
this, SLOT( validateSrs( QgsCoordinateReferenceSystem * ) ) );
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem& ) ),
this, SLOT( validateSrs( QgsCoordinateReferenceSystem& ) ) );
QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ );

// set graphical message output
Expand Down Expand Up @@ -948,6 +949,7 @@ void QgisApp::createActions()
connect( mActionAddWfsLayer, SIGNAL( triggered() ), this, SLOT( addWfsLayer() ) );
connect( mActionOpenTable, SIGNAL( triggered() ), this, SLOT( attributeTable() ) );
connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) );
connect( mActionSaveLayerEdits, SIGNAL( triggered() ), this, SLOT( saveActiveLayerEdits() ) );
connect( mActionSaveEdits, SIGNAL( triggered() ), this, SLOT( saveEdits() ) );
connect( mActionSaveAllEdits, SIGNAL( triggered() ), this, SLOT( saveAllEdits() ) );
connect( mActionRollbackEdits, SIGNAL( triggered() ), this, SLOT( rollbackEdits() ) );
Expand Down Expand Up @@ -1091,8 +1093,8 @@ void QgisApp::showPythonDialog()
return;

bool res = mPythonUtils->runStringUnsafe(
"import qgis.console\n"
"qgis.console.show_console()\n", false );
"import console\n"
"console.show_console()\n", false );

if ( !res )
{
Expand Down Expand Up @@ -1656,6 +1658,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionToggleFullScreen->setIcon( QgsApplication::getThemeIcon( "/mActionToggleFullScreen.png" ) );
mActionProjectProperties->setIcon( QgsApplication::getThemeIcon( "/mActionProjectProperties.png" ) );
mActionManagePlugins->setIcon( QgsApplication::getThemeIcon( "/mActionShowPluginManager.png" ) );
mActionShowPythonDialog->setIcon( QgsApplication::getThemeIcon( "console/iconRunConsole.png" ) );
mActionCheckQgisVersion->setIcon( QgsApplication::getThemeIcon( "/mActionCheckQgisVersion.png" ) );
mActionOptions->setIcon( QgsApplication::getThemeIcon( "/mActionOptions.png" ) );
mActionConfigureShortcuts->setIcon( QgsApplication::getThemeIcon( "/mActionOptions.png" ) );
Expand All @@ -1669,6 +1672,7 @@ void QgisApp::setTheme( QString theThemeName )
mActionSponsors->setIcon( QgsApplication::getThemeIcon( "/mActionHelpSponsors.png" ) );
mActionDraw->setIcon( QgsApplication::getThemeIcon( "/mActionDraw.png" ) );
mActionToggleEditing->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.svg" ) );
mActionSaveLayerEdits->setIcon( QgsApplication::getThemeIcon( "/mActionSaveAllEdits.svg" ) );
mActionAllEdits->setIcon( QgsApplication::getThemeIcon( "/mActionAllEdits.svg" ) );
mActionSaveEdits->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.svg" ) );
mActionSaveAllEdits->setIcon( QgsApplication::getThemeIcon( "/mActionSaveAllEdits.svg" ) );
Expand Down Expand Up @@ -5205,6 +5209,11 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
return res;
}

void QgisApp::saveActiveLayerEdits()
{
saveEdits( activeLayer() );
}

void QgisApp::saveEdits( QgsMapLayer *layer, bool leaveEditable )
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
Expand Down Expand Up @@ -5361,6 +5370,20 @@ bool QgisApp::verifyEditsActionDialog( QString act, QString upon )

void QgisApp::updateLayerModifiedActions()
{
bool enableSaveLayerEdits = false;
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
if ( vlayer )
{
QgsVectorDataProvider* dprovider = vlayer->dataProvider();
if ( dprovider )
{
enableSaveLayerEdits = ( dprovider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues
&& vlayer->isEditable()
&& vlayer->isModified() );
}
}
mActionSaveLayerEdits->setEnabled( enableSaveLayerEdits );

mActionSaveEdits->setEnabled( mMapLegend && mMapLegend->selectedLayersEditable( true ) );
mActionRollbackEdits->setEnabled( mMapLegend && mMapLegend->selectedLayersEditable( true ) );
mActionCancelEdits->setEnabled( mMapLegend && mMapLegend->selectedLayersEditable() );
Expand Down Expand Up @@ -7020,6 +7043,7 @@ void QgisApp::markDirty()
// notify the project that there was a change
QgsProject::instance()->dirty( true );
}

//changed from layerWasAdded to layersWereAdded in 1.8
void QgisApp::layersWereAdded( QList<QgsMapLayer *> theLayers )
{
Expand Down Expand Up @@ -7320,6 +7344,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionOpenTable->setEnabled( false );
mActionToggleEditing->setEnabled( false );
mActionToggleEditing->setChecked( false );
mActionSaveLayerEdits->setEnabled( false );
mActionLayerSaveAs->setEnabled( false );
mActionLayerSelectionSaveAs->setEnabled( false );
mActionLayerProperties->setEnabled( false );
Expand Down Expand Up @@ -7411,13 +7436,15 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
bool canChangeAttributes = dprovider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
mActionToggleEditing->setEnabled( canChangeAttributes && !vlayer->isReadOnly() );
mActionToggleEditing->setChecked( vlayer->isEditable() );
mActionSaveLayerEdits->setEnabled( canChangeAttributes && vlayer->isEditable() && vlayer->isModified() );
mUndoWidget->dockContents()->setEnabled( vlayer->isEditable() );
updateUndoActions();
}
else
{
mActionToggleEditing->setEnabled( false );
mActionToggleEditing->setChecked( false );
mActionSaveLayerEdits->setEnabled( false );
mUndoWidget->dockContents()->setEnabled( false );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
Expand Down Expand Up @@ -7586,6 +7613,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionOpenTable->setEnabled( false );
mActionToggleEditing->setEnabled( false );
mActionToggleEditing->setChecked( false );
mActionSaveLayerEdits->setEnabled( false );
mUndoWidget->dockContents()->setEnabled( false );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
Expand Down
84 changes: 45 additions & 39 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
QAction *actionOpenTable() { return mActionOpenTable; }
QAction *actionToggleEditing() { return mActionToggleEditing; }
/** @note added in 1.9 */
QAction *actionSaveActiveLayerEdits() { return mActionSaveLayerEdits; }
/** @note added in 1.9 */
QAction *actionAllEdits() { return mActionAllEdits; }
QAction *actionSaveEdits() { return mActionSaveEdits; }
/** @note added in 1.9 */
Expand Down Expand Up @@ -404,7 +406,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! @note added in 1.6
void completeInitialization();

void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs );
void emitCustomSrsValidation( QgsCoordinateReferenceSystem &crs );

QList<QgsDecorationItem*> decorationItems() { return mDecorationItems; }
void addDecorationItem( QgsDecorationItem* item ) { mDecorationItems.append( item ); }
Expand Down Expand Up @@ -439,6 +441,46 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
*/
void removingLayers( QStringList );

//! starts/stops editing mode of the current layer
void toggleEditing();

//! starts/stops editing mode of a layer
bool toggleEditing( QgsMapLayer *layer, bool allowCancel = true );

/** Save edits for active vector layer and start new transactions
* @note added in 1.9 */
void saveActiveLayerEdits();

//! Save edits of a layer
void saveEdits( QgsMapLayer *layer, bool leaveEditable = true );

/** Cancel edits for a layer
* @note added in 1.9 */
void cancelEdits( QgsMapLayer *layer, bool leaveEditable = true );

//! Save current edits for selected layer(s) and start new transaction(s)
void saveEdits();

/** Save edits for all layers and start new transactions
* @note added in 1.9 */
void saveAllEdits( bool verifyAction = true );

/** Rollback current edits for selected layer(s) and start new transaction(s)
* @note added in 1.9 */
void rollbackEdits();

/** Rollback edits for all layers and start new transactions
* @note added in 1.9 */
void rollbackAllEdits( bool verifyAction = true );

/** Cancel edits for selected layer(s) and toggle off editing
* @note added in 1.9 */
void cancelEdits();

/** Cancel all edits for all layers and toggle off editing
* @note added in 1.9 */
void cancelAllEdits( bool verifyAction = true );

void updateUndoActions();

//! cuts selected features on the active layer to the clipboard
Expand Down Expand Up @@ -533,7 +575,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow

private slots:
//! validate a SRS
void validateSrs( QgsCoordinateReferenceSystem *crs );
void validateSrs( QgsCoordinateReferenceSystem &crs );

//! QGis Sponsors
void sponsors();
Expand Down Expand Up @@ -786,42 +828,6 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! refresh map canvas
void refreshMapCanvas();

//! starts/stops editing mode of the current layer
void toggleEditing();

//! starts/stops editing mode of a layer
bool toggleEditing( QgsMapLayer *layer, bool allowCancel = true );

//! Save edits of a layer
void saveEdits( QgsMapLayer *layer, bool leaveEditable = true );

/** Cancel edits for a layer
* @note added in 1.9 */
void cancelEdits( QgsMapLayer *layer, bool leaveEditable = true );

//! Save current edits for selected layer(s) and start new transaction(s)
void saveEdits();

/** Save edits for all layers and start new transactions
* @note added in 1.9 */
void saveAllEdits( bool verifyAction = true );

/** Rollback current edits for selected layer(s) and start new transaction(s)
* @note added in 1.9 */
void rollbackEdits();

/** Rollback edits for all layers and start new transactions
* @note added in 1.9 */
void rollbackAllEdits( bool verifyAction = true );

/** Cancel edits for selected layer(s) and toggle off editing
* @note added in 1.9 */
void cancelEdits();

/** Cancel all edits for all layers and toggle off editing
* @note added in 1.9 */
void cancelAllEdits( bool verifyAction = true );

/** Dialog for verification of action on many edits
* @note added in 1.9 */
bool verifyEditsActionDialog( QString act, QString upon );
Expand Down Expand Up @@ -1008,7 +1014,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
@note added in version 1.6*/
void initializationCompleted();

void customSrsValidation( QgsCoordinateReferenceSystem *crs );
void customSrsValidation( QgsCoordinateReferenceSystem &crs );

private:
/** This method will open a dialog so the user can select GDAL sublayers to load
Expand Down
1 change: 1 addition & 0 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ QAction *QgisAppInterface::actionCopyLayerStyle() { return qgis->actionCopyLayer
QAction *QgisAppInterface::actionPasteLayerStyle() { return qgis->actionPasteLayerStyle(); }
QAction *QgisAppInterface::actionOpenTable() { return qgis->actionOpenTable(); }
QAction *QgisAppInterface::actionToggleEditing() { return qgis->actionToggleEditing(); }
QAction *QgisAppInterface::actionSaveActiveLayerEdits() { return qgis->actionSaveActiveLayerEdits(); }
QAction *QgisAppInterface::actionAllEdits() { return qgis->actionAllEdits(); }
QAction *QgisAppInterface::actionSaveEdits() { return qgis->actionSaveEdits(); }
QAction *QgisAppInterface::actionSaveAllEdits() { return qgis->actionSaveAllEdits(); }
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisappinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class QgisAppInterface : public QgisInterface
virtual QAction *actionOpenTable();
virtual QAction *actionToggleEditing();
/** @note added in 1.9 */
virtual QAction *actionSaveActiveLayerEdits();
/** @note added in 1.9 */
virtual QAction *actionAllEdits();
/** @note added in 1.9 */
virtual QAction *actionSaveEdits();
Expand Down
15 changes: 11 additions & 4 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
mZoomMapToSelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionZoomToSelected.png" ) );
mPanMapToSelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionPanToSelected.png" ) );
mInvertSelectionButton->setIcon( QgsApplication::getThemeIcon( "/mActionInvertSelection.png" ) );
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.png" ) );
mSaveEditsButton->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.png" ) );
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.svg" ) );
mSaveEditsButton->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.svg" ) );
mDeleteSelectedButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.png" ) );
mOpenFieldCalculator->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) );
mAddAttribute->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
Expand All @@ -107,9 +107,11 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
bool canAddFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddFeatures;

mToggleEditingButton->blockSignals( true );
mToggleEditingButton->setCheckable( true );
mToggleEditingButton->setChecked( mLayer->isEditable() );
mToggleEditingButton->setEnabled( canChangeAttributes && !mLayer->isReadOnly() );
mToggleEditingButton->blockSignals( false );

mSaveEditsButton->setEnabled( canChangeAttributes && mLayer->isEditable() );
mOpenFieldCalculator->setEnabled(( canChangeAttributes || canAddAttributes ) && mLayer->isEditable() );
Expand All @@ -120,7 +122,6 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
mAddFeature->setHidden( !canAddFeatures || mLayer->geometryType() != QGis::NoGeometry );

// info from table to application
connect( this, SIGNAL( editingToggled( QgsMapLayer * ) ), QgisApp::instance(), SLOT( toggleEditing( QgsMapLayer * ) ) );
connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) );

// info from layer to table
Expand Down Expand Up @@ -665,7 +666,13 @@ void QgsAttributeTableDialog::on_mAdvancedSearchButton_clicked()

void QgsAttributeTableDialog::on_mToggleEditingButton_toggled()
{
emit editingToggled( mLayer );
if ( !mLayer )
return;
if ( !QgisApp::instance()->toggleEditing( mLayer ) )
{
// restore gui state if toggling was canceled or layer commit/rollback failed
editingToggled();
}
}

void QgsAttributeTableDialog::on_mSaveEditsButton_clicked()
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ QgsFieldsProperties::QgsFieldsProperties( QgsVectorLayer *layer, QWidget* parent

mAddAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
mDeleteAttributeButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.png" ) );
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.svg" ) );
mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) );

connect( mToggleEditingButton, SIGNAL( clicked() ), this, SIGNAL( toggleEditing() ) );
Expand Down
7 changes: 7 additions & 0 deletions src/app/qgsmaptoolselectrectangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ void QgsMapToolSelectRectangle::canvasReleaseEvent( QMouseEvent *e )
QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( mCanvas );
if ( vlayer == NULL )
{
if ( mRubberBand )
{
mRubberBand->reset( QGis::Polygon );
delete mRubberBand;
mRubberBand = 0;
mDragging = false;
}
return;
}

Expand Down
7 changes: 7 additions & 0 deletions src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,13 @@ double QgsComposerItem::fontAscentMillimeters( const QFont& font ) const
return ( fontMetrics.ascent() / FONT_WORKAROUND_SCALE );
}

double QgsComposerItem::fontDescentMillimeters( const QFont& font ) const
{
QFont metricsFont = scaledFontPixelSize( font );
QFontMetricsF fontMetrics( metricsFont );
return ( fontMetrics.descent() / FONT_WORKAROUND_SCALE );
}

double QgsComposerItem::pixelFontSize( double pointSize ) const
{
return ( pointSize * 0.3527 );
Expand Down
3 changes: 3 additions & 0 deletions src/core/composer/qgscomposeritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem
/**Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double fontAscentMillimeters( const QFont& font ) const;

/**Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double fontDescentMillimeters( const QFont& font ) const;

/**Calculates font to from point size to pixel size*/
double pixelFontSize( double pointSize ) const;

Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ QSizeF QgsComposerLegend::drawTitle( QPainter* painter, QPointF point, Qt::Align
{
// it does not draw the last world if rectangle width is exactly text width
double width = textWidthMillimeters( mTitleFont, *titlePart ) + 1;
double height = fontAscentMillimeters( mTitleFont );
double height = fontAscentMillimeters( mTitleFont ) + fontDescentMillimeters( mTitleFont );

double left = halignement == Qt::AlignLeft ? point.x() : point.x() - width / 2;

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void QgsCoordinateReferenceSystem::validate()

// try to validate using custom validation routines
if ( mCustomSrsValidation )
mCustomSrsValidation( this );
mCustomSrsValidation( *this );

if ( !mIsValidFlag )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef void *OGRSpatialReferenceH;
#endif

class QgsCoordinateReferenceSystem;
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem* );
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem& );

/** \ingroup core
* Class for storing a coordinate reference system (CRS)
Expand Down
137 changes: 70 additions & 67 deletions src/core/raster/qgsrasterfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs
destProvider = initOutput( nCols, nRows, crs, geoTransform, nBands, destDataType , destHasNoDataValueList, destNoDataValueList );
error = writeDataRaster( pipe, iter, nCols, nRows, outputExtent, crs, destDataType, destHasNoDataValueList, destNoDataValueList, destProvider, progressDialog );
}
if ( destProvider ) delete destProvider;

if ( destProvider )
delete destProvider;

return error;
}
Expand Down Expand Up @@ -347,9 +349,9 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster(
progressDialog->setLabelText( QObject::tr( "Reading raster part %1 of %2" ).arg( fileIndex + 1 ).arg( nParts ) );
}

// hmm why is there a while( true ) here ..
// hmm why is there a for(;;) here ..
// not good coding practice IMHO, it might be better to use [ for() and break ] or [ while (test) ]
while ( true )
for ( ;; )
{
for ( int i = 1; i <= nBands; ++i )
{
Expand All @@ -359,8 +361,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster(
//delete destProvider;
if ( mTiledMode )
{
QFileInfo outputInfo( mOutputUrl );
QString vrtFilePath( mOutputUrl + "/" + outputInfo.baseName() + ".vrt" );
QString vrtFilePath( mOutputUrl + "/" + vrtFileName() );
writeVRT( vrtFilePath );
if ( mBuildPyramidsFlag == QgsRasterDataProvider::PyramidsFlagYes )
{
Expand Down Expand Up @@ -421,17 +422,20 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster(
iterLeft, iterTop, mOutputUrl,
fileIndex, nBands, destDataType, crs );

//write data to output file. todo: loop over the data list
for ( int i = 1; i <= nBands; ++i )
if ( partDestProvider )
{
partDestProvider->setNoDataValue( i, destNoDataValueList.value( i - 1 ) );
partDestProvider->write( destBlockList[i - 1]->bits( 0 ), i, iterCols, iterRows, 0, 0 );
delete destBlockList[i - 1];
addToVRT( partFileName( fileIndex ), i, iterCols, iterRows, iterLeft, iterTop );
//write data to output file. todo: loop over the data list
for ( int i = 1; i <= nBands; ++i )
{
partDestProvider->setNoDataValue( i, destNoDataValueList.value( i - 1 ) );
partDestProvider->write( destBlockList[i - 1]->bits( 0 ), i, iterCols, iterRows, 0, 0 );
delete destBlockList[i - 1];
addToVRT( partFileName( fileIndex ), i, iterCols, iterRows, iterLeft, iterTop );
}
delete partDestProvider;
}
delete partDestProvider;
}
else
else if ( destProvider )
{
//loop over data
for ( int i = 1; i <= nBands; ++i )
Expand Down Expand Up @@ -556,19 +560,22 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste
iterLeft, iterTop, mOutputUrl, fileIndex,
4, QGis::Byte, crs );

//write data to output file
partDestProvider->write( redData, 1, iterCols, iterRows, 0, 0 );
partDestProvider->write( greenData, 2, iterCols, iterRows, 0, 0 );
partDestProvider->write( blueData, 3, iterCols, iterRows, 0, 0 );
partDestProvider->write( alphaData, 4, iterCols, iterRows, 0, 0 );

addToVRT( partFileName( fileIndex ), 1, iterCols, iterRows, iterLeft, iterTop );
addToVRT( partFileName( fileIndex ), 2, iterCols, iterRows, iterLeft, iterTop );
addToVRT( partFileName( fileIndex ), 3, iterCols, iterRows, iterLeft, iterTop );
addToVRT( partFileName( fileIndex ), 4, iterCols, iterRows, iterLeft, iterTop );
delete partDestProvider;
if ( partDestProvider )
{
//write data to output file
partDestProvider->write( redData, 1, iterCols, iterRows, 0, 0 );
partDestProvider->write( greenData, 2, iterCols, iterRows, 0, 0 );
partDestProvider->write( blueData, 3, iterCols, iterRows, 0, 0 );
partDestProvider->write( alphaData, 4, iterCols, iterRows, 0, 0 );

addToVRT( partFileName( fileIndex ), 1, iterCols, iterRows, iterLeft, iterTop );
addToVRT( partFileName( fileIndex ), 2, iterCols, iterRows, iterLeft, iterTop );
addToVRT( partFileName( fileIndex ), 3, iterCols, iterRows, iterLeft, iterTop );
addToVRT( partFileName( fileIndex ), 4, iterCols, iterRows, iterLeft, iterTop );
delete partDestProvider;
}
}
else
else if ( destProvider )
{
destProvider->write( redData, 1, iterCols, iterRows, iterLeft, iterTop );
destProvider->write( greenData, 2, iterCols, iterRows, iterLeft, iterTop );
Expand All @@ -579,7 +586,9 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste
++fileIndex;
}

if ( destProvider ) delete destProvider;
if ( destProvider )
delete destProvider;

QgsFree( redData ); QgsFree( greenData ); QgsFree( blueData ); QgsFree( alphaData );

if ( progressDialog )
Expand All @@ -589,8 +598,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste

if ( mTiledMode )
{
QFileInfo outputInfo( mOutputUrl );
QString vrtFilePath( mOutputUrl + "/" + outputInfo.baseName() + ".vrt" );
QString vrtFilePath( mOutputUrl + "/" + vrtFileName() );
writeVRT( vrtFilePath );
if ( mBuildPyramidsFlag == QgsRasterDataProvider::PyramidsFlagYes )
{
Expand Down Expand Up @@ -674,13 +682,15 @@ void QgsRasterFileWriter::buildPyramids( const QString& filename )
overviewList[4] = 32;
overviewList[5] = 64;

/*if ( mProgressDialog )
#if 0
if ( mProgressDialog )
{
mProgressDialog->setLabelText( QObject::tr( "Building Pyramids..." ) );
mProgressDialog->setValue( 0 );
mProgressDialog->setWindowModality( Qt::WindowModal );
mProgressDialog->show();
}*/
}
#endif
GDALBuildOverviews( dataSet, "AVERAGE", 6, overviewList, 0, 0, /*pyramidsProgress*/ 0, /*mProgressDialog*/ 0 );
}
#endif
Expand Down Expand Up @@ -872,12 +882,14 @@ QgsRasterDataProvider* QgsRasterFileWriter::createPartProvider( const QgsRectang
QgsRectangle mapRect( mapLeft, mapBottom, mapRight, mapTop );

QString outputFile = outputUrl + "/" + partFileName( fileIndex );
#if 0
//QgsRasterDataProvider* destProvider = QgsRasterLayer::loadProvider( mOutputProviderKey, outputFile );
//QgsRasterDataProvider* destProvider = ( QgsRasterDataProvider* ) QgsProviderRegistry::instance()->provider( mOutputProviderKey, outputFile );
//if ( !destProvider )
//{
// return 0;
//}
QgsRasterDataProvider* destProvider = ( QgsRasterDataProvider* ) QgsProviderRegistry::instance()->provider( mOutputProviderKey, outputFile );
if ( !destProvider )
{
return 0;
}
#endif

//geotransform
double geoTransform[6];
Expand All @@ -889,29 +901,18 @@ QgsRasterDataProvider* QgsRasterFileWriter::createPartProvider( const QgsRectang
geoTransform[5] = -mup;

// perhaps we need a separate createOptions for tiles ?
/*
if ( !destProvider->create( mOutputFormat, nBands, type, iterCols, iterRows, geoTransform,
crs ) )
{
delete destProvider;
return 0;
}
*/

QgsRasterDataProvider* destProvider = QgsRasterDataProvider::create( mOutputProviderKey, mOutputUrl, mOutputFormat, nBands, type, iterCols, iterRows, geoTransform, crs, mCreateOptions ) ;

if ( !destProvider )
{
return 0;
}

// TODO: return provider and report error
if ( !destProvider->isValid() )
#if 0
if ( !destProvider->create( mOutputFormat, nBands, type, iterCols, iterRows, geoTransform,
crs ) )
{
delete destProvider;
return 0;
}
#endif

QgsRasterDataProvider* destProvider = QgsRasterDataProvider::create( mOutputProviderKey, outputFile, mOutputFormat, nBands, type, iterCols, iterRows, geoTransform, crs, mCreateOptions ) ;

// TODO: return provider and report error
return destProvider;
}

Expand All @@ -926,35 +927,31 @@ QgsRasterDataProvider* QgsRasterFileWriter::initOutput( int nCols, int nRows, co
}
else
{
#if 0
// TODO enable "use existing", has no effect for now, because using Create() in gdal provider
// should this belong in provider? should also test that source provider is gdal
// if ( mBuildPyramidsFlag == -4 && mOutputProviderKey == "gdal" && mOutputFormat.toLower() == "gtiff" )
// mCreateOptions << "COPY_SRC_OVERVIEWS=YES";
if ( mBuildPyramidsFlag == -4 && mOutputProviderKey == "gdal" && mOutputFormat.toLower() == "gtiff" )
mCreateOptions << "COPY_SRC_OVERVIEWS=YES";
#endif

//QgsRasterDataProvider* destProvider = QgsRasterLayer::loadProvider( mOutputProviderKey, mOutputUrl );
//QgsRasterDataProvider* destProvider = ( QgsRasterDataProvider* ) QgsProviderRegistry::instance()->provider( mOutputProviderKey, mOutputUrl );
QgsRasterDataProvider* destProvider = QgsRasterDataProvider::create( mOutputProviderKey, mOutputUrl, mOutputFormat, nBands, type, nCols, nRows, geoTransform, crs, mCreateOptions ) ;

if ( !destProvider )
{
return 0;
QgsDebugMsg( "No provider created" );
}

// TODO: return provider and report error
if ( !destProvider->isValid() )
#if 0
if ( !destProvider->create( mOutputFormat, nBands, type, nCols, nRows, geoTransform,
crs, mCreateOptions ) )
{
delete destProvider;
return 0;
}
#endif

/*
if ( !destProvider->create( mOutputFormat, nBands, type, nCols, nRows, geoTransform,
crs, mCreateOptions ) )
{
delete destProvider;
return 0;
}
*/
return destProvider;
}
}
Expand All @@ -981,5 +978,11 @@ QString QgsRasterFileWriter::partFileName( int fileIndex )
{
// .tif for now
QFileInfo outputInfo( mOutputUrl );
return QString( "%1.%2.tif" ).arg( outputInfo.baseName() ).arg( fileIndex );
return QString( "%1.%2.tif" ).arg( outputInfo.fileName() ).arg( fileIndex );
}

QString QgsRasterFileWriter::vrtFileName()
{
QFileInfo outputInfo( mOutputUrl );
return QString( "%1.vrt" ).arg( outputInfo.fileName() );
}
1 change: 1 addition & 0 deletions src/core/raster/qgsrasterfilewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class CORE_EXPORT QgsRasterFileWriter
void globalOutputParameters( const QgsRectangle& extent, int nCols, int& nRows, double* geoTransform, double& pixelSize );

QString partFileName( int fileIndex );
QString vrtFileName();

Mode mMode;
QString mOutputUrl;
Expand Down
43 changes: 30 additions & 13 deletions src/core/symbology-ng/qgsstylev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include <sqlite3.h>

#define STYLE_CURRENT_VERSION "0"
#define STYLE_CURRENT_VERSION "1"

QgsStyleV2 *QgsStyleV2::mDefaultStyle = 0;

Expand Down Expand Up @@ -1343,30 +1343,47 @@ bool QgsStyleV2::importXML( QString filename )
}

QString version = docEl.attribute( "version" );
if ( version != STYLE_CURRENT_VERSION )
if ( version != STYLE_CURRENT_VERSION && version != "0" )
{
mErrorString = "Unknown style file version: " + version;
return false;
}

// load symbols
QgsSymbolV2Map symbols;

QDomElement symbolsElement = docEl.firstChildElement( "symbols" );
QDomElement e = symbolsElement.firstChildElement();
while ( !e.isNull() )

if ( version == STYLE_CURRENT_VERSION )
{
if ( e.tagName() == "symbol" )
// For the new style, load symbols individualy
while ( !e.isNull() )
{
QgsSymbolV2* symbol = QgsSymbolLayerV2Utils::loadSymbol( e );
if ( symbol )
if ( e.tagName() == "symbol" )
{
addSymbol( e.attribute( "name" ), symbol );
QgsSymbolV2* symbol = QgsSymbolLayerV2Utils::loadSymbol( e );
if ( symbol )
{
symbols.insert( e.attribute( "name" ), symbol );
}
}
else
{
QgsDebugMsg( "unknown tag: " + e.tagName() );
}
e = e.nextSiblingElement();
}
else
{
QgsDebugMsg( "unknown tag: " + e.tagName() );
}
e = e.nextSiblingElement();
}
else
{
// for the old version, use the utility function to solve @symbol@layer subsymbols
symbols = QgsSymbolLayerV2Utils::loadSymbols( symbolsElement );
}

// save the symbols with proper name
for ( QMap<QString, QgsSymbolV2*>::iterator it = symbols.begin(); it != symbols.end(); it++ )
{
addSymbol( it.key(), it.value() );
}

// load color ramps
Expand Down
1 change: 0 additions & 1 deletion src/core/symbology-ng/qgssymbollayerv2utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,6 @@ void QgsSymbolLayerV2Utils::saveProperties( QgsStringMap props, QDomDocument& do
}
}

// XXX Not used by QgStyleV2 anymore, But renderers use it still
QgsSymbolV2Map QgsSymbolLayerV2Utils::loadSymbols( QDomElement& element )
{
// go through symbols one-by-one and load them
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgisinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ class GUI_EXPORT QgisInterface : public QObject
virtual QAction *actionOpenTable() = 0;
virtual QAction *actionToggleEditing() = 0;
/** @note added in 1.9 */
virtual QAction *actionSaveActiveLayerEdits() = 0;
/** @note added in 1.9 */
virtual QAction *actionAllEdits() = 0;
/** @note added in 1.9 */
virtual QAction *actionSaveEdits() = 0;
Expand Down
10 changes: 9 additions & 1 deletion src/gui/qgsmessagebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ void QgsMessageBar::popItem( QgsMessageBarItem *item )
{
mLayout->removeWidget( mCurrentItem->widget() );
mCurrentItem->widget()->hide();
if ( mCurrentItem->widget()->parent() == this )
{
delete mCurrentItem->widget();
}
delete mCurrentItem;
mCurrentItem = 0;
}

Expand Down Expand Up @@ -126,6 +131,10 @@ bool QgsMessageBar::popWidget( QWidget *widget )
if ( item->widget() == widget )
{
mList.removeOne( item );
if ( item->widget()->parent() == this )
{
delete item->widget();
}
delete item;
return true;
}
Expand All @@ -141,7 +150,6 @@ bool QgsMessageBar::popWidget()

QgsMessageBarItem *item = mCurrentItem;
popItem( item );
delete item;

return true;
}
Expand Down
9 changes: 7 additions & 2 deletions src/gui/symbology-ng/qgssymbolslistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,14 @@ void QgsSymbolsListWidget::populateSymbols( QStringList names )
continue;
}
QStandardItem* item = new QStandardItem( names[i] );
item->setData( names[i], Qt::UserRole ); //so we can show a label when it is clicked
item->setText( "" ); //set the text to nothing and show in label when clicked rather
item->setData( names[i], Qt::UserRole ); //so we can load symbol with that name
item->setText( names[i] );
item->setToolTip( names[i] );
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
// Set font to 10points to show reasonable text
QFont itemFont = item->font();
itemFont.setPointSize( 10 );
item->setFont( itemFont );
// create preview icon
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( s, previewSize );
item->setIcon( icon );
Expand Down
6 changes: 3 additions & 3 deletions src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ class SymbolLayerItem : public QStandardItem
{
switch ( mSymbol->type() )
{
case QgsSymbolV2::Marker : return "Symbol: Marker";
case QgsSymbolV2::Fill : return "Symbol: Fill";
case QgsSymbolV2::Line : return "Symbol: Line";
case QgsSymbolV2::Marker : return "Marker";
case QgsSymbolV2::Fill : return "Fill";
case QgsSymbolV2::Line : return "Line";
default: return "Symbol";
}
}
Expand Down
24 changes: 24 additions & 0 deletions src/plugins/grass/qgis_grass_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------
#
# Copyright (C) 2012 Radim Blazek
# EMAIL: radim.blazek (at) gmail.com
#
#-----------------------------------------------------------
#
# licensed under the terms of GNU GPL 2
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#---------------------------------------------------------------------

"""
***************************************************************************
Expand Down
36 changes: 21 additions & 15 deletions src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ int CPL_STDCALL progressCallback( double dfComplete,
QgsGdalProvider::QgsGdalProvider( QString const & uri, QgsError error )
: QgsRasterDataProvider( uri )
, mValid( false )
, mGdalBaseDataset( 0 )
, mGdalDataset( 0 )
{
setError( error );
}
Expand All @@ -103,13 +105,11 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri, bool update )
: QgsRasterDataProvider( uri )
, QgsGdalProviderBase()
, mUpdate( update )
, mValid( true )
, mValid( false )
, mGdalBaseDataset( 0 )
, mGdalDataset( 0 )
{
QgsDebugMsg( "QgsGdalProvider: constructing with uri '" + uri + "'." );

mValid = false;
mGdalBaseDataset = 0;
mGdalDataset = 0;
QgsDebugMsg( "constructing with uri '" + uri + "'." );

QgsGdalProviderBase::registerGdalDrivers();

Expand All @@ -123,7 +123,7 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri, bool update )
return;
}

mGdalDataset = NULL;
mGdalDataset = 0;

// Try to open using VSIFileHandler (see qgsogrprovider.cpp)
QString vsiPrefix = QgsZipItem::vsiPrefix( uri );
Expand Down Expand Up @@ -196,7 +196,7 @@ bool QgsGdalProvider::crsFromWkt( const char *wkt )

QgsGdalProvider::~QgsGdalProvider()
{
QgsDebugMsg( "QgsGdalProvider: deconstructing." );
QgsDebugMsg( "entering." );
if ( mGdalBaseDataset )
{
GDALDereferenceDataset( mGdalBaseDataset );
Expand Down Expand Up @@ -2414,10 +2414,7 @@ QGISEXTERN QgsGdalProvider * create(
return new QgsGdalProvider( uri, error );
}

QString tmpStr = "create options:";
foreach ( QString option, createOptions )
tmpStr += " " + option;
QgsDebugMsg( tmpStr );
QgsDebugMsg( "create options: " + createOptions.join( " " ) );

//create dataset
CPLErrorReset();
Expand All @@ -2427,6 +2424,7 @@ QGISEXTERN QgsGdalProvider * create(
if ( dataset == NULL )
{
QgsError error( QString( "Cannot create new dataset %1:\n%2" ).arg( uri ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ), "GDAL provider" );
QgsDebugMsg( error.summary() );
return new QgsGdalProvider( uri, error );
}

Expand All @@ -2439,17 +2437,25 @@ QGISEXTERN QgsGdalProvider * create(

bool QgsGdalProvider::write( void* data, int band, int width, int height, int xOffset, int yOffset )
{
if ( !mGdalDataset )
{
return false;
}

GDALRasterBandH rasterBand = GDALGetRasterBand( mGdalDataset, band );
if ( rasterBand == NULL )
if ( !rasterBand )
{
return false;
}
return ( GDALRasterIO( rasterBand, GF_Write, xOffset, yOffset, width, height, data, width, height, GDALGetRasterDataType( rasterBand ), 0, 0 ) == CE_None );
return GDALRasterIO( rasterBand, GF_Write, xOffset, yOffset, width, height, data, width, height, GDALGetRasterDataType( rasterBand ), 0, 0 ) == CE_None;
}

bool QgsGdalProvider::setNoDataValue( int bandNo, double noDataValue )
{
if ( !mGdalDataset ) return false;
if ( !mGdalDataset )
{
return false;
}

GDALRasterBandH rasterBand = GDALGetRasterBand( mGdalDataset, bandNo );
CPLErrorReset();
Expand Down
10 changes: 6 additions & 4 deletions src/providers/wms/qgswmssourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl, bool ma
, mManagerMode( managerMode )
, mEmbeddedMode( embeddedMode )
, mCurrentTileset( 0 )
, mDefaultCRS( GEO_EPSG_CRS_AUTHID )
{
setupUi( this );

Expand Down Expand Up @@ -117,7 +118,7 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WFlags fl, bool ma
QgsCoordinateReferenceSystem currentRefSys( currentCRS, QgsCoordinateReferenceSystem::InternalCrsId );
if ( currentRefSys.isValid() )
{
mCRS = currentRefSys.authid();
mDefaultCRS = mCRS = currentRefSys.authid();
}
}

Expand Down Expand Up @@ -409,6 +410,8 @@ bool QgsWMSSourceSelect::populateLayerList( QgsWmsProvider *wmsProvider )
lstLayers->expandItem( lstLayers->topLevelItem( 0 ) );
}

on_lstLayers_itemSelectionChanged();

return true;
}

Expand Down Expand Up @@ -741,7 +744,6 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
mCurrentSelection = lstLayers->selectedItems();
lstLayers->blockSignals( false );


// selected layers with styles
QStringList layers;
QStringList styles;
Expand Down Expand Up @@ -801,7 +803,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
defaultCRS = *it;

// prefer value of DEFAULT_GEO_EPSG_CRS_ID if available
if ( *it == GEO_EPSG_CRS_AUTHID )
if ( *it == mDefaultCRS )
defaultCRS = *it;
}

Expand All @@ -813,7 +815,7 @@ void QgsWMSSourceSelect::on_lstLayers_itemSelectionChanged()
}

}
else if ( mCRSs.isEmpty() )
else if ( layers.isEmpty() || mCRSs.isEmpty() )
{
mCRS = "";
labelCoordRefSys->setText( "" );
Expand Down
3 changes: 3 additions & 0 deletions src/providers/wms/qgswmssourceselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ class QgsWMSSourceSelect : public QDialog, private Ui::QgsWMSSourceSelectBase
//! Selected CRS
QString mCRS;

//! Default CRS
QString mDefaultCRS;

//! Common CRSs for selected layers
QSet<QString> mCRSs;

Expand Down
14 changes: 14 additions & 0 deletions src/ui/qgisapp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<addaction name="separator"/>
<addaction name="mActionOpenTable"/>
<addaction name="mActionToggleEditing"/>
<addaction name="mActionSaveLayerEdits"/>
<addaction name="mActionAllEdits"/>
<addaction name="separator"/>
<addaction name="mActionLayerSaveAs"/>
Expand Down Expand Up @@ -282,6 +283,7 @@
</attribute>
<addaction name="mActionAllEdits"/>
<addaction name="mActionToggleEditing"/>
<addaction name="mActionSaveLayerEdits"/>
<addaction name="mActionAddFeature"/>
<addaction name="mActionMoveFeature"/>
<addaction name="mActionNodeTool"/>
Expand Down Expand Up @@ -1940,6 +1942,18 @@ Acts on currently active editable layer</string>
<string/>
</property>
</action>
<action name="mActionSaveLayerEdits">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionSaveAllEdits.svg</normaloff>:/images/themes/default/mActionSaveAllEdits.svg</iconset>
</property>
<property name="text">
<string>Save Layer Edits</string>
</property>
<property name="toolTip">
<string>Save Layer Edits</string>
</property>
</action>
</widget>
<resources>
<include location="../../images/images.qrc"/>
Expand Down
12 changes: 7 additions & 5 deletions src/ui/qgsattributetabledialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionToggleEditing.png</normaloff>../../images/themes/default/mActionToggleEditing.png</iconset>
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionToggleEditing.svg</normaloff>:/images/themes/default/mActionToggleEditing.svg</iconset>
</property>
<property name="iconSize">
<size>
Expand Down Expand Up @@ -303,8 +303,8 @@
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>../../images/themes/default/mActionSaveEdits.png</normaloff>../../images/themes/default/mActionSaveEdits.png</iconset>
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionSaveEdits.svg</normaloff>:/images/themes/default/mActionSaveEdits.svg</iconset>
</property>
<property name="iconSize">
<size>
Expand Down Expand Up @@ -491,7 +491,9 @@
<tabstop>mRemoveAttribute</tabstop>
<tabstop>mOpenFieldCalculator</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../images/images.qrc"/>
</resources>
<connections>
<connection>
<sender>mToggleEditingButton</sender>
Expand Down
5 changes: 1 addition & 4 deletions src/ui/qgscustomizationdialogbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
<attribute name="headerVisible">
<bool>true</bool>
</attribute>
<attribute name="headerVisible">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
Expand Down Expand Up @@ -103,7 +100,7 @@
<action name="actionSave">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionSaveEdits.png</normaloff>:/images/themes/default/mActionSaveEdits.png</iconset>
<normaloff>:/images/themes/default/mActionFileSave.png</normaloff>:/images/themes/default/mActionFileSave.png</iconset>
</property>
<property name="text">
<string>Save</string>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsgpsinformationwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ gray = no data
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionToggleEditing.png</normaloff>:/images/themes/default/mActionToggleEditing.png</iconset>
<normaloff>:/images/themes/default/mActionToggleEditing.svg</normaloff>:/images/themes/default/mActionToggleEditing.svg</iconset>
</property>
</widget>
</item>
Expand Down
25 changes: 3 additions & 22 deletions src/ui/qgssponsorsbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>640</width>
<height>493</height>
<height>292</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -33,27 +33,8 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;We work really hard to make this nice software for you. See all the cool features it has? Get a warm fuzzy feeling when you use it? Quantum GIS is a labour of love by a dedicated team of developers. We want you to copy &amp;amp; share it and put it in the hands of as many people as possible. If QGIS is saving you money or you like our work and have the financial ability to help, please consider sponsoring the development of Quantum GIS. We use money from sponsors to pay for travel and costs related to our bi-annual hackfests, and to generally support the goals of our project. Please see the &lt;/span&gt;&lt;a href=&quot;http://qgis.org/en/sponsorship.html&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;QGIS Sponsorship Web Page&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt; for more details. In the list below you can see the fine people and companies that are helping us financially - a great big 'thank you' to you all!&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;2011 Sponsors&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;&quot;&gt;SILVER SPONSORS&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://www.vorarlberg.at&quot;&gt;&lt;span style=&quot; font-family:'Courier New,courier'; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;State of Vorarlberg&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Courier New,courier'; font-size:10pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; font-family:'Courier New,courier'; font-size:10pt; color:#333333;&quot;&gt;, Austria (11.2011)&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://www.agi.so.ch&quot;&gt;&lt;span style=&quot; font-family:'Courier New,courier'; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;Kanton Solothurn&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Courier New,courier'; font-size:10pt; color:#333333;&quot;&gt;, Switzerland (4.2011)&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;BRONZE SPONSORS&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://gis.uster.ch/&quot;&gt;&lt;span style=&quot; font-family:'Helvetica,Arial,sans-serif'; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;City of Uster&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Helvetica,Arial,sans-serif'; font-size:10pt; color:#0000ff;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; font-family:'Helvetica,Arial,sans-serif'; font-size:10pt; color:#000000;&quot;&gt;, Switzerland&lt;/span&gt;&lt;span style=&quot; font-family:'Helvetica,Arial,sans-serif'; color:#000000;&quot;&gt; (11.2011)&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://www.municipia.pt&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;Municípia, SA&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;2010 Sponsors&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;BRONZE SPONSORS&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://www.gfosservices.com&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;Studio Associato Gfosservices&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;http://nextgis.org&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;NEXTGIS&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt; font-weight:600;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt;&quot;&gt;We work really hard to make this nice software for you. See all the cool features it has? Get a warm fuzzy feeling when you use it? Quantum GIS is a labour of love by a dedicated team of developers. We want you to copy &amp;amp; share it and put it in the hands of as many people as possible. If QGIS is saving you money or you like our work and have the financial ability to help, please consider sponsoring the development of Quantum GIS. We use money from sponsors to pay for travel and costs related to our bi-annual hackfests, and to generally support the goals of our project. Please see the &lt;/span&gt;&lt;a href=&quot;http://qgis.org/en/sponsorship.html&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt; text-decoration: underline; color:#0000ff;&quot;&gt;QGIS Sponsorship Web Page&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt;&quot;&gt; for more details. In the &lt;/span&gt;&lt;a href=&quot;http://qgis.org/en/sponsorship/sponsors.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Sponsors page&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt;&quot;&gt; you can see the fine people and companies that are helping us financially - a great big 'thank you' to you all!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
Expand Down
3 changes: 3 additions & 0 deletions src/ui/symbollayer/widget_symbolslist.ui
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@
<height>48</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
Expand Down
Loading