10 changes: 5 additions & 5 deletions python/plugins/sextante/tests/GeoAlgorithmTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
from sextante.core.QGisLayers import QGisLayers
from sextante.core.SextanteUtils import SextanteUtils

class GeoAlgorithmTest(unittest.TestCase):
def testWrongformat(self):
class GeoAlgorithmTest(unittest.TestCase):

def testWrongformat(self):
outputs=sextante.runalg("qgis:countpointsinpolygon",polygons(),points(),"NUMPOINTS",SextanteUtils.getTempFilename("wrongext"))
output=outputs['OUTPUT']
self.assertTrue(output.endswith('shp'))
self.assertTrue(output.endswith('shp'))
layer=QGisLayers.getObjectFromUri(output, True)
fields=layer.pendingFields()
expectednames=['ID','POLY_NUM_A','POLY_ST_A','NUMPOINTS']
Expand All @@ -51,7 +51,7 @@ def testWrongformat(self):
expectedvalues=["1","1.1","string a","6"]
values=[str(attr.toString()) for attr in attrs]
self.assertEqual(expectedvalues, values)


def suite():
suite = unittest.makeSuite(GeoAlgorithmTest, 'test')
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/sextante/tests/ModelerAlgorithmTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class ModelerAlgorithmTest(unittest.TestCase):

def testCreateModel(self):
pass

def testEditModelParameter(self):
pass

def testEditModelAlgorithm(self):
pass

Expand All @@ -54,12 +54,12 @@ def testRemoveAlgorithm(self):
model.provider = Providers.providers['model']
self.assertTrue(2, len(model.algs))
self.assertFalse(model.removeAlgorithm(0))
self.assertTrue(model.removeAlgorithm(len(model.algs) - 1));
self.assertTrue(model.removeAlgorithm(len(model.algs) - 1));
model.execute(None)
outputs = model.outputs
self.assertEquals(1, len(outputs))
output=outputs[0].value
self.assertTrue(os.path.exists(output))
self.assertTrue(os.path.exists(output))

def testRemoveParameter(self):
folder = os.path.join(os.path.dirname(ModelerAlgorithmProvider.__file__), "models")
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_modelernotinorder(self):
dataset=gdal.Open(output, GA_ReadOnly)
strhash=hash(str(dataset.ReadAsArray(0).tolist()))
self.assertEqual(strhash,-1557050506)

def test_modeleroptionalfield(self):
outputs=sextante.runalg("modeler:optionalfield",points(),None)
output=outputs['OUTPUT_ALG0']
Expand All @@ -166,7 +166,7 @@ def test_modeleroptionalfield(self):
values=[str(attr.toString()) for attr in attrs]
self.assertEqual(expectedvalues, values)
wkt='POLYGON((270839.46818665 4458921.97813894,270778.60197966 4458935.96883677,270786.54279065 4458980.04784113,270803.15756434 4458983.84880322,270839.65586926 4458983.16267036,270855.74530134 4458940.79948673,270839.46818665 4458921.97813894))'
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))

def test_modeleremptystring(self):
outputs=sextante.runalg("modeler:emptystring",union(),None)
Expand All @@ -187,7 +187,7 @@ def test_modeleremptystring(self):
values=[str(attr.toString()) for attr in attrs]
self.assertEqual(expectedvalues, values)
wkt='POLYGON((270807.08580285 4458940.1594565,270798.42294527 4458914.62661676,270780.81854858 4458914.21983449,270763.52289518 4458920.715993,270760.3449542 4458926.6570575,270763.78234766 4458958.22561242,270794.30290024 4458942.16424502,270807.08580285 4458940.1594565))'
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))


def suite():
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/sextante/tests/QgisAlgsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_qgiscreategridnointeger(self):
self.assertEqual(expectedvalues, values)
wkt='LINESTRING(-0.5 -0.5, -0.5 -0.4, -0.5 -0.3, -0.5 -0.2, -0.5 -0.1, -0.5 -0.0, -0.5 0.1, -0.5 0.2, -0.5 0.3, -0.5 0.4, -0.5 0.5)'
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))

def test_qgiscreategridhex(self):
outputs=sextante.runalg("qgis:creategrid",10,10,360,180,0,0,3,None)
output=outputs['SAVENAME']
Expand Down Expand Up @@ -944,9 +944,9 @@ def test_qgisstatisticsbycategories(self):
output=outputs['OUTPUT']
layer=QGisLayers.getObjectFromUri(output, True)
fields=layer.pendingFields()
expectednames=['category','min','max','mean','stddev']
expectednames=['category','min','max','mean','stddev']
names=[str(f.name()) for f in fields]
self.assertEqual(expectednames, names)
self.assertEqual(expectednames, names)
features=sextante.getfeatures(layer)
self.assertEqual(3, len(features))
feature=features.next()
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/tests/SagaTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_SagaVectorAlgorithWithUnsupportedInputAndOutputFormat(self):
self.assertEqual(expectedvalues, values)
wkt='POINT(270787.49991451 4458955.46775295)'
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))

def test_SagaRasterAlgorithmWithUnsupportedOutputFormat(self):
outputs=sextante.runalg("saga:convergenceindex",raster(),0,0,SextanteUtils.getTempFilename("img"))
output=outputs['RESULT']
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/tests/ScriptTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def test_scriptascriptthatreturnsanumber(self):
outputs=sextante.runalg("script:ascriptthatreturnsanumber")
output=outputs['number']
self.assertTrue(10, output)



def suite():
suite = unittest.makeSuite(ScriptTest, 'test')
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/tests/SextanteTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

'''Convenience module to create a test suite will all SEXTANTE tests'''
'''Convenience module to create a test suite will all SEXTANTE tests'''
import unittest
from sextante.tests import QgisAlgsTest
from sextante.tests import ParametersTest
Expand All @@ -41,7 +41,7 @@ def suite():
suite.addTests(SagaTest.suite())
suite.addTests(GdalTest.suite())
suite.addTests(ScriptTest.suite())
suite.addTests(SextanteToolsTest.suite())
suite.addTests(SextanteToolsTest.suite())
#suite.addTests(ParametersTest.suite())
suite.addTests(GeoAlgorithmTest.suite())
return suite
Expand Down
32 changes: 16 additions & 16 deletions python/plugins/sextante/tests/SextanteToolsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,46 +32,46 @@
from sextante.tools.general import getfromname

class SextanteToolsTest(unittest.TestCase):
'''tests the method imported when doing an "import sextante", and also in sextante.tools.
'''tests the method imported when doing an "import sextante", and also in sextante.tools.
They are mostly convenience tools'''

def test_getobject(self):
layer = sextante.getobject(points());
self.assertIsNotNone(layer)
self.assertIsNotNone(layer)
layer = sextante.getobject("points");
self.assertIsNotNone(layer)

def test_runandload(self):
sextante.runandload("qgis:countpointsinpolygon",polygons(),points(),"NUMPOINTS", None)
sextante.runandload("qgis:countpointsinpolygon",polygons(),points(),"NUMPOINTS", None)
layer = getfromname("Result")
self.assertIsNotNone(layer)
self.assertIsNotNone(layer)

def test_featuresWithoutSelection(self):
layer = sextante.getobject(points())
layer = sextante.getobject(points())
features = sextante.getfeatures(layer)
self.assertEqual(12, len(features))
self.assertEqual(12, len(features))

def test_featuresWithSelection(self):
layer = sextante.getobject(points())
feature = layer.getFeatures().next()
selected = [feature.id()]
layer.setSelectedFeatures(selected)
features = sextante.getfeatures(layer)
features = sextante.getfeatures(layer)
self.assertEqual(1, len(features))
layer.setSelectedFeatures([])

def test_attributeValues(self):
layer = sextante.getobject(points())
layer = sextante.getobject(points())
attributeValues = values(layer, "ID")
i = 1
for value in attributeValues['ID']:
self.assertEqual(int(i), int(value))
i+=1
i+=1
self.assertEquals(13,i)

def test_extent(self):
pass



def suite():
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/sextante/tools/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def uniquevalues(layer, attribute):
It considers the existing selection'''
values = []
fieldIndex = resolveFieldIndex(layer, attribute)
features = QGisLayers.features(layer)
features = QGisLayers.features(layer)
for feat in features:
if feat.attributes()[fieldIndex] not in values:
values.append(feat.attributes()[fieldIndex])
Expand All @@ -41,7 +41,7 @@ def uniquevalues(layer, attribute):
def resolveFieldIndex(layer, attr):
'''This method takes an object and returns the index field it refers to in a layer.
If the passed object is an integer, it returns the same integer value.
If the passed value is not an integer, it returns the field whose name is the string
If the passed value is not an integer, it returns the field whose name is the string
representation of the passed object.
Ir raises an exception if the int value is larger than the number of fields, or if
the passed object does not correspond to any field'''
Expand All @@ -51,7 +51,7 @@ def resolveFieldIndex(layer, attr):
index = layer.fieldNameIndex(unicode(attr))
if index == -1:
raise ValueError('Wrong field name')
return index
return index


def values(layer, *attributes):
Expand All @@ -63,7 +63,7 @@ def values(layer, *attributes):
for attr in attributes:
index = resolveFieldIndex(layer, attr)
values = []
features = QGisLayers.features(layer)
features = QGisLayers.features(layer)
for feature in features:
try:
v = float(feature.attributes()[index].toString())
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,13 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b
return false;

QgsFeatureAction action( tr( "Attributes changed" ), f, vlayer, -1, -1, QgisApp::instance() );
if (vlayer->isEditable())
if ( vlayer->isEditable() )
{
return action.editFeature();
}
else
{
return action.viewFeatureForm();
return action.viewFeatureForm();
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsaddtaborgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include <QComboBox>

QgsAddTabOrGroup::QgsAddTabOrGroup( QgsVectorLayer *lyr, QList < TabPair > tabList, QWidget * parent )
: QDialog( parent )
, mLayer( lyr )
, mTabs( tabList )
: QDialog( parent )
, mLayer( lyr )
, mTabs( tabList )
{
setupUi( this );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsaddtaborgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class QgsAddTabOrGroup : public QDialog, private Ui::QgsAddTabOrGroupBase
Q_OBJECT

public:
typedef QPair<QString,QTreeWidgetItem*> TabPair;
typedef QPair<QString, QTreeWidgetItem*> TabPair;

public:
QgsAddTabOrGroup( QgsVectorLayer *lyr, QList< TabPair > tabList, QWidget *parent = 0 );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( layerDeleted() ), this, SLOT( close() ) );
connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateTitle() ) );
connect( mLayer, SIGNAL( attributeAdded(int) ), this, SLOT( columnBoxInit() ) );
connect( mLayer, SIGNAL( attributeDeleted(int) ), this, SLOT( columnBoxInit() ) );
connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( columnBoxInit() ) );
connect( mLayer, SIGNAL( attributeDeleted( int ) ), this, SLOT( columnBoxInit() ) );

// connect table info to window
connect( mMainView, SIGNAL( filterChanged() ), this, SLOT( updateTitle() ) );
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ void QgsFieldsProperties::on_mAddTabOrGroupButton_clicked()
QList<QgsAddTabOrGroup::TabPair> tabList;


for( QTreeWidgetItemIterator it( mAttributesTree ); *it; ++it )
for ( QTreeWidgetItemIterator it( mAttributesTree ); *it; ++it )
{
if ( ( *it )->data( 0 , Qt::UserRole ) == "container" )
if (( *it )->data( 0 , Qt::UserRole ) == "container" )
{
tabList.append( QgsAddTabOrGroup::TabPair( (*it)->text( 0 ), *it ) );
tabList.append( QgsAddTabOrGroup::TabPair(( *it )->text( 0 ), *it ) );
}
}
QgsAddTabOrGroup addTabOrGroup( mLayer, tabList, this );
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void QgsComposerLabel::paint( QPainter* painter, const QStyleOptionGraphicsItem*
/*Track when QWebPage has finished loading its html contents*/
void QgsComposerLabel::loadingHtmlFinished( bool result )
{
Q_UNUSED (result);
Q_UNUSED( result );
mHtmlLoaded = true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/composer/qgscomposerlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ QgsComposerLegend::Nucleon QgsComposerLegend::drawSymbolItem( QgsComposerLegendI
if ( painter ) painter->setPen( mFontColor );

//double labelX = point.x() + labelXOffset; // + mIconLabelSpace;
double labelX = point.x() + qMax( (double) symbolSize.width(), labelXOffset );
double labelX = point.x() + qMax(( double ) symbolSize.width(), labelXOffset );

// Vertical alignment of label with symbol:
// a) label height < symbol heigh: label centerd with symbol
Expand Down Expand Up @@ -410,7 +410,7 @@ QgsComposerLegend::Nucleon QgsComposerLegend::drawSymbolItem( QgsComposerLegendI
nucleon.symbolSize = symbolSize;
nucleon.labelSize = labelSize;
//QgsDebugMsg( QString( "symbol height = %1 label height = %2").arg( symbolSize.height()).arg( labelSize.height() ));
double width = qMax( (double) symbolSize.width(), labelXOffset ) + labelSize.width();
double width = qMax(( double ) symbolSize.width(), labelXOffset ) + labelSize.width();
double height = qMax( symbolSize.height(), labelSize.height() );
nucleon.size = QSizeF( width, height );
return nucleon;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ QStringList
QgsProject::readListEntry( QString const & scope,
const QString & key,
QStringList def,
bool * ok) const
bool * ok ) const
{
QgsProperty * property = findKey_( scope, key, imp_->properties_ );

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class CORE_EXPORT QgsProject : public QObject
@note The key string <em>must</em> include '/'s. E.g., "/foo" not "foo".
*/
//@{
QStringList readListEntry( const QString & scope, const QString & key, QStringList def = QStringList(), bool *ok = 0 ) const;
QStringList readListEntry( const QString & scope, const QString & key, QStringList def = QStringList(), bool *ok = 0 ) const;

QString readEntry( const QString & scope, const QString & key, const QString & def = QString::null, bool * ok = 0 ) const;
int readNumEntry( const QString & scope, const QString & key, int def = 0, bool * ok = 0 ) const;
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
//mUpdateThreshold = settings.readNumEntry("Map/updateThreshold", 1000);
}

connect ( this, SIGNAL( selectionChanged(QgsFeatureIds,QgsFeatureIds,bool) ), this, SIGNAL( selectionChanged() ) );
connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged() ) );
} // QgsVectorLayer ctor


Expand Down Expand Up @@ -714,7 +714,7 @@ void QgsVectorLayer::deselect( const QgsFeatureIds& featureIds )
emit selectionChanged( QgsFeatureIds(), featureIds, false );
}

void QgsVectorLayer::select(QgsRectangle & rect, bool addToSelection )
void QgsVectorLayer::select( QgsRectangle & rect, bool addToSelection )
{
// normalize the rectangle
rect.normalize();
Expand Down Expand Up @@ -2605,7 +2605,7 @@ bool QgsVectorLayer::addFeatures( QgsFeatureList features, bool makeSelected )
for ( QgsFeatureList::iterator iter = features.begin(); iter != features.end(); ++iter )
ids << iter->id();

setSelectedFeatures ( ids );
setSelectedFeatures( ids );
}

return res;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayerfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayer* la
if ( L->pendingFields().fieldOrigin( attrIndex ) == QgsFields::OriginProvider )
providerSubset << L->pendingFields().fieldOriginIndex( attrIndex );
}
mProviderRequest.setSubsetOfAttributes(providerSubset);
mProviderRequest.setSubsetOfAttributes( providerSubset );
}

if ( request.filterType() == QgsFeatureRequest::FilterFid )
Expand Down
18 changes: 9 additions & 9 deletions src/core/raster/qgsrasteridentifyresult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
#include "qgsrasterdataprovider.h"

QgsRasterIdentifyResult::QgsRasterIdentifyResult()
: mValid(false)
, mFormat(QgsRasterDataProvider::IdentifyFormatUndefined)
: mValid( false )
, mFormat( QgsRasterDataProvider::IdentifyFormatUndefined )
{
}

QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormat theFormat, QMap<int, QVariant> theResults )
: mValid(true)
, mFormat(theFormat)
, mResults(theResults)
: mValid( true )
, mFormat( theFormat )
, mResults( theResults )
{
}

QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsError theError )
: mValid(false)
, mFormat(QgsRasterDataProvider::IdentifyFormatUndefined)
, mError(theError)
QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsError theError )
: mValid( false )
, mFormat( QgsRasterDataProvider::IdentifyFormatUndefined )
, mError( theError )
{
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/raster/qgsrasterrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
#include "qgsrasterrange.h"

QgsRasterRange::QgsRasterRange()
: mMin ( std::numeric_limits<double>::quiet_NaN() )
, mMax ( std::numeric_limits<double>::quiet_NaN() )
: mMin( std::numeric_limits<double>::quiet_NaN() )
, mMax( std::numeric_limits<double>::quiet_NaN() )
{
}

QgsRasterRange::QgsRasterRange( double theMin, double theMax )
: mMin ( theMin )
, mMax ( theMax )
QgsRasterRange::QgsRasterRange( double theMin, double theMax )
: mMin( theMin )
, mMax( theMax )
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgsrasterrange.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
qgsrasterrange.h
qgsrasterrange.h
--------------------------------------
Date : Oct 9, 2012
Copyright : (C) 2012 by Radim Blazek
Expand Down Expand Up @@ -39,7 +39,7 @@ class CORE_EXPORT QgsRasterRange
* @param theMin minimum value
* @param theMax max value
*/
QgsRasterRange( double theMin, double theMax );
QgsRasterRange( double theMin, double theMax );

~QgsRasterRange();

Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgssymbologyv2conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static QString readMarkerSymbolName( const QDomNode& synode )
QDomElement psymbelement = psymbnode.toElement();
return psymbelement.text();
}
return QString("hard:circle");
return QString( "hard:circle" );
}

static float readMarkerSymbolSize( const QDomNode& synode )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsattributetabledelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class QgsAttributeTableDelegate : public QItemDelegate

void setFeatureSelectionModel( QgsFeatureSelectionModel* featureSelectionModel );

private:
private:
QgsFeatureSelectionModel* mFeatureSelectionModel;
};

Expand Down
4 changes: 2 additions & 2 deletions src/gui/attributetable/qgsattributetablefiltermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void QgsAttributeTableFilterModel::selectionChanged()
}
else if ( mSelectedOnTop )
{
sort ( sortColumn(), sortOrder() );
sort( sortColumn(), sortOrder() );
invalidate();
}
}
Expand Down Expand Up @@ -267,7 +267,7 @@ QModelIndex QgsAttributeTableFilterModel::fidToIndex( QgsFeatureId fid )
QModelIndexList QgsAttributeTableFilterModel::fidToIndexList( QgsFeatureId fid )
{
QModelIndexList indexes;
foreach( QModelIndex idx, masterModel()->idToIndexList( fid ) )
foreach ( QModelIndex idx, masterModel()->idToIndexList( fid ) )
{
indexes.append( mapFromMaster( idx ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsattributetablefiltermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
*/
void extentsChanged();

private slots:
private slots:
void selectionChanged();

private:
Expand Down
4 changes: 2 additions & 2 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void QgsAttributeTableModel::loadAttributes()

mFieldCount = attributes.size();
mAttributes = attributes;

if ( ins )
{
endInsertColumns();
Expand Down Expand Up @@ -381,7 +381,7 @@ QModelIndex QgsAttributeTableModel::idToIndex( QgsFeatureId id ) const
return index( idToRow( id ), 0 );
}

QModelIndexList QgsAttributeTableModel::idToIndexList(QgsFeatureId id) const
QModelIndexList QgsAttributeTableModel::idToIndexList( QgsFeatureId id ) const
{
QModelIndexList indexes;

Expand Down
78 changes: 39 additions & 39 deletions src/gui/attributetable/qgsattributetableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ QgsAttributeTableView::QgsAttributeTableView( QWidget *parent )

verticalHeader()->viewport()->installEventFilter( this );

connect( verticalHeader(), SIGNAL( sectionPressed(int) ), this, SLOT(selectRow(int) ) );
connect( verticalHeader(), SIGNAL( sectionEntered(int) ), this, SLOT(_q_selectRow(int) ) );
connect( verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( selectRow( int ) ) );
connect( verticalHeader(), SIGNAL( sectionEntered( int ) ), this, SLOT( _q_selectRow( int ) ) );
}

QgsAttributeTableView::~QgsAttributeTableView()
Expand All @@ -77,16 +77,16 @@ void QgsAttributeTableView::setCanvasAndLayerCache( QgsMapCanvas *canvas, QgsVec
mFilterModel = new QgsAttributeTableFilterModel( canvas, mMasterModel, mMasterModel );
setModel( mFilterModel );
delete mFeatureSelectionModel;
mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, layerCache->layer (), mFilterModel );
connect( mFeatureSelectionModel, SIGNAL(requestRepaint(QModelIndexList)), this, SLOT( repaintRequested(QModelIndexList) ) );
mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, layerCache->layer(), mFilterModel );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );
setSelectionModel ( mFeatureSelectionModel );
setSelectionModel( mFeatureSelectionModel );

delete oldModel;
delete filterModel;
}

bool QgsAttributeTableView::eventFilter(QObject *object, QEvent *event)
bool QgsAttributeTableView::eventFilter( QObject *object, QEvent *event )
{
if ( object == verticalHeader()->viewport() )
{
Expand Down Expand Up @@ -121,10 +121,10 @@ void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel* filterModel

delete mFeatureSelectionModel;
mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, mFilterModel->layer(), mFilterModel );
setSelectionModel ( mFeatureSelectionModel );
setSelectionModel( mFeatureSelectionModel );
mTableDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
connect( mFeatureSelectionModel, SIGNAL(requestRepaint(QModelIndexList)), this, SLOT( repaintRequested(QModelIndexList) ) );
connect( mFeatureSelectionModel, SIGNAL(requestRepaint()), this, SLOT( repaintRequested() ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );

if ( filterModel )
{
Expand Down Expand Up @@ -186,7 +186,7 @@ void QgsAttributeTableView::keyPressEvent( QKeyEvent *event )

void QgsAttributeTableView::repaintRequested( QModelIndexList indexes )
{
foreach( const QModelIndex index, indexes )
foreach ( const QModelIndex index, indexes )
{
update( index );
}
Expand Down Expand Up @@ -248,37 +248,37 @@ void QgsAttributeTableView::_q_selectRow( int row )
void QgsAttributeTableView::selectRow( int row, bool anchor )
{
if ( selectionBehavior() == QTableView::SelectColumns
|| ( selectionMode() == QTableView::SingleSelection
&& selectionBehavior() == QTableView::SelectItems))
return;
|| ( selectionMode() == QTableView::SingleSelection
&& selectionBehavior() == QTableView::SelectItems ) )
return;

if ( row >= 0 && row < model()->rowCount() )
{
int column = horizontalHeader()->logicalIndexAt( isRightToLeft() ? viewport()->width() : 0 );
QModelIndex index = model()->index( row, column );
QItemSelectionModel::SelectionFlags command = selectionCommand( index );
selectionModel()->setCurrentIndex( index, QItemSelectionModel::NoUpdate );
if ( ( anchor && !( command & QItemSelectionModel::Current ) )
|| ( selectionMode() == QTableView::SingleSelection ) )
mRowSectionAnchor = row;

if ( selectionMode() != QTableView::SingleSelection
&& command.testFlag( QItemSelectionModel::Toggle ) )
{
if ( anchor )
mCtrlDragSelectionFlag = mFeatureSelectionModel->isSelected( index )
? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
command &= ~QItemSelectionModel::Toggle;
command |= mCtrlDragSelectionFlag;
if ( !anchor )
command |= QItemSelectionModel::Current;
}

QModelIndex tl = model()->index( qMin( mRowSectionAnchor, row ), 0 );
QModelIndex br = model()->index( qMax( mRowSectionAnchor, row ), model()->columnCount() - 1 );
if ( verticalHeader()->sectionsMoved() && tl.row() != br.row() )
setSelection( visualRect( tl ) | visualRect( br ), command );
else
mFeatureSelectionModel->selectFeatures( QItemSelection( tl, br ), command );
int column = horizontalHeader()->logicalIndexAt( isRightToLeft() ? viewport()->width() : 0 );
QModelIndex index = model()->index( row, column );
QItemSelectionModel::SelectionFlags command = selectionCommand( index );
selectionModel()->setCurrentIndex( index, QItemSelectionModel::NoUpdate );
if (( anchor && !( command & QItemSelectionModel::Current ) )
|| ( selectionMode() == QTableView::SingleSelection ) )
mRowSectionAnchor = row;

if ( selectionMode() != QTableView::SingleSelection
&& command.testFlag( QItemSelectionModel::Toggle ) )
{
if ( anchor )
mCtrlDragSelectionFlag = mFeatureSelectionModel->isSelected( index )
? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
command &= ~QItemSelectionModel::Toggle;
command |= mCtrlDragSelectionFlag;
if ( !anchor )
command |= QItemSelectionModel::Current;
}

QModelIndex tl = model()->index( qMin( mRowSectionAnchor, row ), 0 );
QModelIndex br = model()->index( qMax( mRowSectionAnchor, row ), model()->columnCount() - 1 );
if ( verticalHeader()->sectionsMoved() && tl.row() != br.row() )
setSelection( visualRect( tl ) | visualRect( br ), command );
else
mFeatureSelectionModel->selectFeatures( QItemSelection( tl, br ), command );
}
}
4 changes: 2 additions & 2 deletions src/gui/attributetable/qgsfeaturelistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ int QgsFeatureListModel::rowCount( const QModelIndex& parent ) const
return sourceModel()->rowCount();
}

QModelIndex QgsFeatureListModel::fidToIndex(QgsFeatureId fid)
QModelIndex QgsFeatureListModel::fidToIndex( QgsFeatureId fid )
{
return mapFromMaster( masterModel()->idToIndex( fid ) );
}

QModelIndexList QgsFeatureListModel::fidToIndexList(QgsFeatureId fid)
QModelIndexList QgsFeatureListModel::fidToIndexList( QgsFeatureId fid )
{
return QModelIndexList() << fidToIndex( fid );
}
30 changes: 15 additions & 15 deletions src/gui/attributetable/qgsfeaturelistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void QgsFeatureListView::setModel( QgsFeatureListModel* featureListModel )
mModel = featureListModel;

delete mFeatureSelectionModel;
mFeatureSelectionModel = new QgsFeatureSelectionModel( featureListModel, featureListModel, featureListModel->layerCache ()->layer(), this );
setSelectionModel ( mFeatureSelectionModel );
mFeatureSelectionModel = new QgsFeatureSelectionModel( featureListModel, featureListModel, featureListModel->layerCache()->layer(), this );
setSelectionModel( mFeatureSelectionModel );

mCurrentEditSelectionModel = new QItemSelectionModel( mModel->masterModel(), this );

Expand All @@ -67,8 +67,8 @@ void QgsFeatureListView::setModel( QgsFeatureListModel* featureListModel )
setItemDelegate( mItemDelegate );

mItemDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
connect( mFeatureSelectionModel, SIGNAL(requestRepaint(QModelIndexList)), this, SLOT( repaintRequested(QModelIndexList) ) );
connect( mFeatureSelectionModel, SIGNAL(requestRepaint()), this, SLOT( repaintRequested() ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );

connect( mCurrentEditSelectionModel, SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( editSelectionChanged( QItemSelection, QItemSelection ) ) );
}
Expand Down Expand Up @@ -155,7 +155,7 @@ void QgsFeatureListView::setEditSelection( const QgsFeatureIds &fids )

void QgsFeatureListView::repaintRequested( QModelIndexList indexes )
{
foreach( const QModelIndex index, indexes )
foreach ( const QModelIndex index, indexes )
{
update( index );
}
Expand All @@ -172,7 +172,7 @@ void QgsFeatureListView::repaintRequested()
over the selection is extended; if a drag is in progress it is continued.
*/

void QgsFeatureListView::mouseMoveEvent(QMouseEvent *event)
void QgsFeatureListView::mouseMoveEvent( QMouseEvent *event )
{
QPoint pos = event->pos();

Expand Down Expand Up @@ -211,7 +211,7 @@ void QgsFeatureListView::mouseReleaseEvent( QMouseEvent *event )

void QgsFeatureListView::keyPressEvent( QKeyEvent *event )
{
if ( Qt::Key_Up == event->key () || Qt::Key_Down == event->key() )
if ( Qt::Key_Up == event->key() || Qt::Key_Down == event->key() )
{
int currentRow = 0;
if ( 0 != mCurrentEditSelectionModel->selectedIndexes().count() )
Expand Down Expand Up @@ -264,15 +264,15 @@ void QgsFeatureListView::selectRow( const QModelIndex& index, bool anchor )
mRowAnchor = row;

if ( selectionMode() != QListView::SingleSelection
&& command.testFlag( QItemSelectionModel::Toggle ) )
&& command.testFlag( QItemSelectionModel::Toggle ) )
{
if ( anchor )
mCtrlDragSelectionFlag = mFeatureSelectionModel->isSelected( index )
? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
command &= ~QItemSelectionModel::Toggle;
command |= mCtrlDragSelectionFlag;
if ( !anchor )
command |= QItemSelectionModel::Current;
if ( anchor )
mCtrlDragSelectionFlag = mFeatureSelectionModel->isSelected( index )
? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
command &= ~QItemSelectionModel::Toggle;
command |= mCtrlDragSelectionFlag;
if ( !anchor )
command |= QItemSelectionModel::Current;
}

QModelIndex tl = model()->index( qMin( mRowAnchor, row ), 0 );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsfeaturelistview.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class GUI_EXPORT QgsFeatureListView : public QListView
void editSelectionChanged( QItemSelection deselected, QItemSelection selected );

private:
void selectRow(const QModelIndex &index, bool anchor );
void selectRow( const QModelIndex &index, bool anchor );

QgsFeatureListModel *mModel;
QItemSelectionModel* mCurrentEditSelectionModel;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/attributetable/qgsfeaturelistviewdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ QgsFeatureListViewDelegate::Element QgsFeatureListViewDelegate::positionToElemen
}
}

void QgsFeatureListViewDelegate::setFeatureSelectionModel(QgsFeatureSelectionModel *featureSelectionModel)
void QgsFeatureListViewDelegate::setFeatureSelectionModel( QgsFeatureSelectionModel *featureSelectionModel )
{
mFeatureSelectionModel = featureSelectionModel;
}
Expand Down Expand Up @@ -61,7 +61,7 @@ void QgsFeatureListViewDelegate::paint( QPainter *painter, const QStyleOptionVie

QPixmap icon;

if ( mFeatureSelectionModel->isSelected ( index ) )
if ( mFeatureSelectionModel->isSelected( index ) )
{
// Item is selected
icon = QgsApplication::getThemePixmap( "/mIconSelected.svg" );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/attributetable/qgsfeaturemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

class QgsFeatureModel
{
public:
virtual QModelIndex fidToIndex( QgsFeatureId fid ) = 0;
public:
virtual QModelIndex fidToIndex( QgsFeatureId fid ) = 0;
};

#endif // QGSFEATUREMODEL_H
28 changes: 14 additions & 14 deletions src/gui/attributetable/qgsfeatureselectionmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#include <qdebug.h>

QgsFeatureSelectionModel::QgsFeatureSelectionModel( QAbstractItemModel* model, QgsFeatureModel* featureModel, QgsVectorLayer* layer, QObject* parent )
: QItemSelectionModel( model, parent )
, mFeatureModel( featureModel )
, mLayer( layer )
, mSyncEnabled( true )
, mClearAndSelectBuffer( false )
: QItemSelectionModel( model, parent )
, mFeatureModel( featureModel )
, mLayer( layer )
, mSyncEnabled( true )
, mClearAndSelectBuffer( false )
{
connect( mLayer, SIGNAL( selectionChanged(QgsFeatureIds,QgsFeatureIds,bool) ), this, SLOT( layerSelectionChanged(QgsFeatureIds,QgsFeatureIds,bool)) );
connect( mLayer, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( layerSelectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );
}

void QgsFeatureSelectionModel::enableSync( bool enable )
Expand Down Expand Up @@ -59,16 +59,16 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
{
QgsFeatureIds ids;

foreach( const QModelIndex index, selection.indexes() )
foreach ( const QModelIndex index, selection.indexes() )
{
QgsFeatureId id = index.model()->data( index, QgsAttributeTableModel::FeatureIdRole ).toInt();

ids << id;
}

disconnect( mLayer, SIGNAL( selectionChanged(QgsFeatureIds,QgsFeatureIds,bool) ), this, SLOT( layerSelectionChanged(QgsFeatureIds,QgsFeatureIds,bool)) );
disconnect( mLayer, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( layerSelectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );

if ( command.testFlag ( QItemSelectionModel::ClearAndSelect ) )
if ( command.testFlag( QItemSelectionModel::ClearAndSelect ) )
{
if ( !mSyncEnabled )
{
Expand All @@ -86,7 +86,7 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
mLayer->setSelectedFeatures( ids );
}
}
else if ( command.testFlag ( QItemSelectionModel::Select ) )
else if ( command.testFlag( QItemSelectionModel::Select ) )
{
if ( !mSyncEnabled )
{
Expand All @@ -103,7 +103,7 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
mLayer->select( ids );
}
}
else if ( command.testFlag ( QItemSelectionModel::Deselect ) )
else if ( command.testFlag( QItemSelectionModel::Deselect ) )
{
if ( !mSyncEnabled )
{
Expand All @@ -121,12 +121,12 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
}
}

connect( mLayer, SIGNAL( selectionChanged(QgsFeatureIds,QgsFeatureIds,bool) ), this, SLOT( layerSelectionChanged(QgsFeatureIds,QgsFeatureIds,bool)) );
connect( mLayer, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( layerSelectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );

QModelIndexList updatedIndexes;
foreach ( QModelIndex idx, selection.indexes() )
{
updatedIndexes.append( expandIndexToRow ( idx ) );
updatedIndexes.append( expandIndexToRow( idx ) );
}

emit requestRepaint( updatedIndexes );
Expand Down Expand Up @@ -164,7 +164,7 @@ QModelIndexList QgsFeatureSelectionModel::expandIndexToRow( const QModelIndex& i
if ( !model )
return indexes;

for( int column = 0; column < model->columnCount(); ++column )
for ( int column = 0; column < model->columnCount(); ++column )
{
indexes.append( model->index( row, column ) );
}
Expand Down
168 changes: 84 additions & 84 deletions src/gui/attributetable/qgsfeatureselectionmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,90 +10,90 @@ class QgsFeatureModel;

class QgsFeatureSelectionModel : public QItemSelectionModel
{
Q_OBJECT
public:
explicit QgsFeatureSelectionModel( QAbstractItemModel* model, QgsFeatureModel* featureModel, QgsVectorLayer* layer, QObject* parent );

/**
* Enables or disables synchronisation to the {@link QgsVectorLayer}
* When synchronisation is disabled, any selection change will be buffered inside this selection model.
* When enabled, any buffered changes are communicated to the layer and the buffer is emptied.
* Mainly to be used for performance reasons, because selection change on the layer can cost time as it
* repaints the layer.
*
* @param enable The synchronisation status to set.
*/
void enableSync( bool enable );

/**
* Returns the selection status of a given feature id.
*
* @param fid The featureid to determine the selection status of
*
* @return The selection status
*/

virtual bool isSelected( QgsFeatureId fid );
/**
* Returns the selection status of a given QModelIndex.
*
* @param index The index to determine the selection status of
*
* @return The selection status
*/
virtual bool isSelected( const QModelIndex& index );

signals:
/**
* Request a repaint of a list of model indexes.
* Views using this model should connect to and properly process this signal.
*
* @param indexes The model indexes which need to be repainted
*/
void requestRepaint( QModelIndexList indexes );

/**
* Request a repaint of the visible items of connected views.
* Views using this model should connect to and properly process this signal.
*/
void requestRepaint();
public slots:
/**
* Overwritten to do NOTHING (we handle selection ourselves)
*
* @see selectFeatures( const QItemSelection&, SelectionFlags )
*/
virtual void select ( const QModelIndex &index, SelectionFlags command ) { Q_UNUSED( index); Q_UNUSED( command ); }

/**
* Overwritten to do NOTHING (we handle selection ourselves)
*
* @see selectFeatures( const QItemSelection&, SelectionFlags )
*/
virtual void select ( const QItemSelection &selection, SelectionFlags command ) { Q_UNUSED( selection); Q_UNUSED( command ); }

/**
* Select features on this table. Is to be used in favor of the stock select methods.
*
* @param selection The QItemSelection which will be selected
* @param command The command to apply. Select, Deselect and ClearAndSelect are processed.
*/
virtual void selectFeatures( const QItemSelection &selection, SelectionFlags command );

private slots:
virtual void layerSelectionChanged( QgsFeatureIds selected, QgsFeatureIds deselected, bool clearAndSelect );

private:
QModelIndexList expandIndexToRow( const QModelIndex& index ) const;

private:
QgsFeatureModel* mFeatureModel;
QgsVectorLayer* mLayer;
bool mSyncEnabled;
QgsFeatureIds mSelectedBuffer;
QgsFeatureIds mDeselectedBuffer;
bool mClearAndSelectBuffer;
Q_OBJECT
public:
explicit QgsFeatureSelectionModel( QAbstractItemModel* model, QgsFeatureModel* featureModel, QgsVectorLayer* layer, QObject* parent );

/**
* Enables or disables synchronisation to the {@link QgsVectorLayer}
* When synchronisation is disabled, any selection change will be buffered inside this selection model.
* When enabled, any buffered changes are communicated to the layer and the buffer is emptied.
* Mainly to be used for performance reasons, because selection change on the layer can cost time as it
* repaints the layer.
*
* @param enable The synchronisation status to set.
*/
void enableSync( bool enable );

/**
* Returns the selection status of a given feature id.
*
* @param fid The featureid to determine the selection status of
*
* @return The selection status
*/

virtual bool isSelected( QgsFeatureId fid );
/**
* Returns the selection status of a given QModelIndex.
*
* @param index The index to determine the selection status of
*
* @return The selection status
*/
virtual bool isSelected( const QModelIndex& index );

signals:
/**
* Request a repaint of a list of model indexes.
* Views using this model should connect to and properly process this signal.
*
* @param indexes The model indexes which need to be repainted
*/
void requestRepaint( QModelIndexList indexes );

/**
* Request a repaint of the visible items of connected views.
* Views using this model should connect to and properly process this signal.
*/
void requestRepaint();

public slots:
/**
* Overwritten to do NOTHING (we handle selection ourselves)
*
* @see selectFeatures( const QItemSelection&, SelectionFlags )
*/
virtual void select( const QModelIndex &index, SelectionFlags command ) { Q_UNUSED( index ); Q_UNUSED( command ); }

/**
* Overwritten to do NOTHING (we handle selection ourselves)
*
* @see selectFeatures( const QItemSelection&, SelectionFlags )
*/
virtual void select( const QItemSelection &selection, SelectionFlags command ) { Q_UNUSED( selection ); Q_UNUSED( command ); }

/**
* Select features on this table. Is to be used in favor of the stock select methods.
*
* @param selection The QItemSelection which will be selected
* @param command The command to apply. Select, Deselect and ClearAndSelect are processed.
*/
virtual void selectFeatures( const QItemSelection &selection, SelectionFlags command );

private slots:
virtual void layerSelectionChanged( QgsFeatureIds selected, QgsFeatureIds deselected, bool clearAndSelect );

private:
QModelIndexList expandIndexToRow( const QModelIndex& index ) const;

private:
QgsFeatureModel* mFeatureModel;
QgsVectorLayer* mLayer;
bool mSyncEnabled;
QgsFeatureIds mSelectedBuffer;
QgsFeatureIds mDeselectedBuffer;
bool mClearAndSelectBuffer;
};

#endif // QGSFEATURESELECTIONMODEL_H
606 changes: 303 additions & 303 deletions src/providers/delimitedtext/qgsdelimitedtextfile.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/providers/ogr/qgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ void QgsOgrProvider::setEncoding( const QString& e )
{
#if defined(OLCStringsAsUTF8)
QSettings settings;
if ( ( ogrDriverName == "ESRI Shapefile" && settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() ) || !OGR_L_TestCapability( ogrLayer, OLCStringsAsUTF8 ) )
if (( ogrDriverName == "ESRI Shapefile" && settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() ) || !OGR_L_TestCapability( ogrLayer, OLCStringsAsUTF8 ) )
{
QgsVectorDataProvider::setEncoding( e );
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bench/qgsbench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ QString QgsBench::serialize( QMap<QString, QVariant> theMap, int level )
list.append( space2 + "\"" + i.key() + "\": " + QString( "%1" ).arg( i.value().toDouble(), 0, 'f', 3 ) );
break;
case QMetaType::QString:
list.append( space2 + "\"" + i.key() + "\": \"" + i.value().toString().replace("\\","\\\\").replace("\"","\\\"") + "\"" );
list.append( space2 + "\"" + i.key() + "\": \"" + i.value().toString().replace( "\\", "\\\\" ).replace( "\"", "\\\"" ) + "\"" );
break;
//case QMetaType::QMap: QMap is not in QMetaType
default:
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gui/testqgsdualview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void TestQgsDualView::testSelectAll()
mCanvas->setExtent( QgsRectangle( -139, 23, -100, 48 ) );
mDualView->mTableView->selectAll();
QVERIFY( mPointsLayer->selectedFeatureCount() == 10 );

mPointsLayer->setSelectedFeatures( QgsFeatureIds() );
mCanvas->setExtent( QgsRectangle( -110, 40, -100, 48 ) );
mDualView->mTableView->selectAll();
Expand Down
26 changes: 13 additions & 13 deletions tests/src/python/test_qgsdelimitedtextprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
__revision__ = '$Format:%H$'

# This module provides unit test for the delimtied text provider. It uses data files in
# the testdata/delimitedtext directory.
# the testdata/delimitedtext directory.
#
# New tests can be created (or existing ones updated), but incorporating a createTest
# call into the test. This will load the file and generate a test that the features
# loaded from it are correct. It assumes that the data is correct at the time the
# call into the test. This will load the file and generate a test that the features
# loaded from it are correct. It assumes that the data is correct at the time the
# test is created. The new test is written to the test output file, and can be edited into
# this module to implement the test.
#
Expand All @@ -28,7 +28,7 @@
import os.path;
import re

from PyQt4.QtCore import (QVariant,
from PyQt4.QtCore import (QVariant,
QUrl,
QObject,
QString,
Expand Down Expand Up @@ -73,7 +73,7 @@ def __enter__( self ):

def __exit__( self, type, value, traceback ):
QgsMessageLog.instance().messageReceived.disconnect( self.logMessage )

def logMessage( self, msg, tag, level ):
if tag == self.tag or not self.tag:
self.log.append(unicode(msg))
Expand Down Expand Up @@ -146,7 +146,7 @@ def createTest( name, description, filename, **params ):
print " if printTests:"
print " createTest({0},description,filename,**params)".format(repr(name))
print " assert False,\"Set printTests to False to run delimited text tests\""

data=result['data']
log=result['log']
fields=result['fields']
Expand All @@ -167,7 +167,7 @@ def createTest( name, description, filename, **params ):
print prefix+' '+repr(msg)+','
print prefix+' ]'
print ' runTest(description,wanted,log_wanted,filename,**params)'
print
print


def checkWktEqual( wkt1, wkt2 ):
Expand All @@ -186,33 +186,33 @@ def checkWktEqual( wkt1, wkt2 ):
diff=abs(float(p1[i])-float(p2[i]))
if diff > tolerance: return False
else:
# Could be more fancy here in terms of text comparison if
# Could be more fancy here in terms of text comparison if
# turn out to be necessary.
if p1 != p2: return False
return True

def recordDifference( record1, record2 ):
# Compare a record defined as a dictionary
for k in record1.keys():
if k not in record2:
if k not in record2:
return "Field {0} is missing".format(k)
r1k = record1[k]
r2k = record2[k]
if k == geomkey:
if not checkWktEqual(r1k,r2k):
return "Geometry differs: {0:.50} versus {1:.50}".format(r1k,r2k)
else:
if record1[k] != record2[k]:
if record1[k] != record2[k]:
return "Field {0} differs: {1:.50} versus {2:.50}".format(k,repr(r1k),repr(r2k));
for k in record2.keys():
if k not in record1:
if k not in record1:
return "Output contains extra field {0} is missing".format(k)
return ''

def runTest( name, wanted, log_wanted, file, **params ):
print "Running test:",name
result = delimitedTextData( file, **params )

result = delimitedTextData( file, **params )
data = result['data']
log = result['log']

Expand Down