267 changes: 134 additions & 133 deletions src/app/composer/qgscomposer.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/composer/qgscomposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
QgsComposerView *view( void );

//! Return current composition
QgsComposition* composition(void){ return mComposition; }
QgsComposition* composition( void ) { return mComposition; }

//! Restore the window and toolbar state
void restoreWindowState();
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposerlabelwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void QgsComposerLabelWidget::on_mFontColorButton_clicked()

void QgsComposerLabelWidget::on_mInsertExpressionButton_clicked()
{
if ( !mComposerLabel)
if ( !mComposerLabel )
{
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsidentifyresults.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase

void on_mExpandNewToolButton_toggled( bool checked );

void on_mExpandToolButton_clicked( bool checked ) { Q_UNUSED( checked); expandAll(); }
void on_mCollapseToolButton_clicked( bool checked ) { Q_UNUSED( checked); collapseAll(); }
void on_mExpandToolButton_clicked( bool checked ) { Q_UNUSED( checked ); expandAll(); }
void on_mCollapseToolButton_clicked( bool checked ) { Q_UNUSED( checked ); collapseAll(); }

void openUrl( const QUrl &url );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgspluginregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
{
if ( corePlugins.contains( packageName ) )
{
QgsApplication::setPkgDataPath( QString("") );
QgsApplication::setPkgDataPath( QString( "" ) );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsprojectproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }

void on_cbxProjectionEnabled_stateChanged( int state );

/*!
* Slot to link WFS checkboxes
*/
Expand Down
24 changes: 12 additions & 12 deletions src/app/qgssnappingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,20 @@ void QgsSnappingDialog::addLayer( QgsMapLayer * theMapLayer )
int idx = layerIdList.indexOf( currentVectorLayer->id() );
if ( idx < 0 )
{
if ( myDockFlag )
if ( myDockFlag )
{
connect( cbxEnable, SIGNAL( stateChanged( int ) ), this, SLOT( apply() ) );
connect( cbxSnapTo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( apply() ) );
connect( leTolerance, SIGNAL( textEdited( const QString ) ), this, SLOT( apply() ) );
connect( cbxUnits, SIGNAL( currentIndexChanged( int ) ), this, SLOT( apply() ) );

if ( cbxAvoidIntersection )
{
connect( cbxEnable, SIGNAL( stateChanged( int ) ), this, SLOT( apply() ) );
connect( cbxSnapTo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( apply() ) );
connect( leTolerance, SIGNAL( textEdited( const QString ) ), this, SLOT( apply() ) );
connect( cbxUnits, SIGNAL( currentIndexChanged( int ) ), this, SLOT( apply() ) );

if ( cbxAvoidIntersection )
{
connect( cbxAvoidIntersection, SIGNAL( stateChanged( int ) ), this, SLOT( apply() ) );
}
setTopologicalEditingState();
setIntersectionSnappingState();
connect( cbxAvoidIntersection, SIGNAL( stateChanged( int ) ), this, SLOT( apply() ) );
}
setTopologicalEditingState();
setIntersectionSnappingState();
}
// no settings for this layer yet
return;
}
Expand Down
22 changes: 11 additions & 11 deletions src/core/composer/qgsatlascomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#include "qgsmaplayerregistry.h"

QgsAtlasComposition::QgsAtlasComposition( QgsComposition* composition ) :
mComposition( composition ),
mEnabled( false ),
mComposerMap( 0 ),
mHideCoverage( false ), mFixedScale( false ), mMargin( 0.10 ), mFilenamePattern( "'output_'||$feature" ),
mCoverageLayer( 0 ), mSingleFile( false )
mComposition( composition ),
mEnabled( false ),
mComposerMap( 0 ),
mHideCoverage( false ), mFixedScale( false ), mMargin( 0.10 ), mFilenamePattern( "'output_'||$feature" ),
mCoverageLayer( 0 ), mSingleFile( false )
{

// declare special columns with a default value
Expand All @@ -52,7 +52,7 @@ void QgsAtlasComposition::setCoverageLayer( QgsVectorLayer* layer )
{
// update the number of features
QgsVectorDataProvider* provider = mCoverageLayer->dataProvider();
QgsExpression::setSpecialColumn( "$numfeatures", QVariant( (int)provider->featureCount() ) );
QgsExpression::setSpecialColumn( "$numfeatures", QVariant(( int )provider->featureCount() ) );
}
}

Expand Down Expand Up @@ -289,9 +289,9 @@ void QgsAtlasComposition::writeXML( QDomElement& elem, QDomDocument& doc ) const
atlasElem.setAttribute( "hideCoverage", mHideCoverage ? "true" : "false" );
atlasElem.setAttribute( "fixedScale", mFixedScale ? "true" : "false" );
atlasElem.setAttribute( "singleFile", mSingleFile ? "true" : "false" );
atlasElem.setAttribute( "margin", QString::number(mMargin) );
atlasElem.setAttribute( "margin", QString::number( mMargin ) );
atlasElem.setAttribute( "filenamePattern", mFilenamePattern );

elem.appendChild( atlasElem );
}

Expand All @@ -309,9 +309,9 @@ void QgsAtlasComposition::readXML( const QDomElement& atlasElem, const QDomDocum
QMap<QString, QgsMapLayer*> layers = QgsMapLayerRegistry::instance()->mapLayers();
for ( QMap<QString, QgsMapLayer*>::const_iterator it = layers.begin(); it != layers.end(); ++it )
{
if ( it.key() == atlasElem.attribute("coverageLayer") )
if ( it.key() == atlasElem.attribute( "coverageLayer" ) )
{
mCoverageLayer = dynamic_cast<QgsVectorLayer*>(it.value());
mCoverageLayer = dynamic_cast<QgsVectorLayer*>( it.value() );
break;
}
}
Expand All @@ -320,7 +320,7 @@ void QgsAtlasComposition::readXML( const QDomElement& atlasElem, const QDomDocum
QList<const QgsComposerMap*> maps = mComposition->composerMapItems();
for ( QList<const QgsComposerMap*>::const_iterator it = maps.begin(); it != maps.end(); ++it )
{
if ( (*it)->id() == atlasElem.attribute( "composerMap" ).toInt() )
if (( *it )->id() == atlasElem.attribute( "composerMap" ).toInt() )
{
mComposerMap = const_cast<QgsComposerMap*>( *it );
break;
Expand Down
22 changes: 11 additions & 11 deletions src/core/composer/qgsatlascomposition.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,35 @@ class QgsExpression;
class CORE_EXPORT QgsAtlasComposition : public QObject
{
Q_OBJECT
public:
public:
QgsAtlasComposition( QgsComposition* composition );
~QgsAtlasComposition();

/** Is the atlas generation enabled ? */
bool enabled() const { return mEnabled; }
void setEnabled( bool e ) { mEnabled = e; }

QgsComposerMap* composerMap() const { return mComposerMap; }
void setComposerMap( QgsComposerMap* map ) { mComposerMap = map; }

bool hideCoverage() const { return mHideCoverage; }
void setHideCoverage( bool hide ) { mHideCoverage = hide; }

bool fixedScale() const { return mFixedScale; }
void setFixedScale( bool fixed ) { mFixedScale = fixed; }

float margin() const { return mMargin; }
void setMargin( float margin ) { mMargin = margin; }

QString filenamePattern() const { return mFilenamePattern; }
void setFilenamePattern( const QString& pattern ) { mFilenamePattern = pattern; }

QgsVectorLayer* coverageLayer() const { return mCoverageLayer; }
void setCoverageLayer( QgsVectorLayer* lmap );

bool singleFile() const { return mSingleFile; }
void setSingleFile( bool single ) { mSingleFile = single; }

/** Begins the rendering. */
void beginRender();
/** Ends the rendering. Restores original extent */
Expand All @@ -85,11 +85,11 @@ class CORE_EXPORT QgsAtlasComposition : public QObject

QgsComposition* composition() { return mComposition; }

signals:
signals:
/** emitted when one of the parameters changes */
void parameterChanged();

private:
private:
QgsComposition* mComposition;

bool mEnabled;
Expand Down
14 changes: 7 additions & 7 deletions src/core/composer/qgscomposerlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <QPainter>

QgsComposerLabel::QgsComposerLabel( QgsComposition *composition ):
QgsComposerItem( composition ), mMargin( 1.0 ), mFontColor( QColor( 0, 0, 0 ) ),
mHAlignment( Qt::AlignLeft ), mVAlignment( Qt::AlignTop ),
mExpressionFeature( 0 ), mExpressionLayer( 0 )
QgsComposerItem( composition ), mMargin( 1.0 ), mFontColor( QColor( 0, 0, 0 ) ),
mHAlignment( Qt::AlignLeft ), mVAlignment( Qt::AlignTop ),
mExpressionFeature( 0 ), mExpressionLayer( 0 )
{
//default font size is 10 point
mFont.setPointSizeF( 10 );
Expand Down Expand Up @@ -90,7 +90,7 @@ QString QgsComposerLabel::displayText() const
QString displayText = mText;
replaceDateText( displayText );
QMap<QString, QVariant> subs = mSubstitutions;
subs[ "$page" ] = QVariant((int)mComposition->itemPageNumber( this ) + 1);
subs[ "$page" ] = QVariant(( int )mComposition->itemPageNumber( this ) + 1 );
return QgsExpression::replaceExpressionText( displayText, mExpressionFeature, mExpressionLayer, &subs );
}

Expand All @@ -105,9 +105,9 @@ void QgsComposerLabel::replaceDateText( QString& text ) const
int openingBracketPos = text.indexOf( "(", currentDatePos );
int closingBracketPos = text.indexOf( ")", openingBracketPos + 1 );
if ( openingBracketPos != -1 &&
closingBracketPos != -1 &&
( closingBracketPos - openingBracketPos ) > 1 &&
openingBracketPos == currentDatePos + constant.size() )
closingBracketPos != -1 &&
( closingBracketPos - openingBracketPos ) > 1 &&
openingBracketPos == currentDatePos + constant.size() )
{
formatText = text.mid( openingBracketPos + 1, closingBracketPos - openingBracketPos - 1 );
text.replace( currentDatePos, closingBracketPos - currentDatePos + 1, QDate::currentDate().toString( formatText ) );
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@

QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height )
: QgsComposerItem( x, y, width, height, composition ), mKeepLayerSet( false ),
mOverviewFrameMapId( -1 ), mGridEnabled( false ), mGridStyle( Solid ),
mOverviewFrameMapId( -1 ), mGridEnabled( false ), mGridStyle( Solid ),
mGridIntervalX( 0.0 ), mGridIntervalY( 0.0 ), mGridOffsetX( 0.0 ), mGridOffsetY( 0.0 ), mGridAnnotationPrecision( 3 ), mShowGridAnnotation( false ),
mLeftGridAnnotationPosition( OutsideMapFrame ), mRightGridAnnotationPosition( OutsideMapFrame ), mTopGridAnnotationPosition( OutsideMapFrame ),
mBottomGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mLeftGridAnnotationDirection( Horizontal ), mRightGridAnnotationDirection( Horizontal ),
mTopGridAnnotationDirection( Horizontal ), mBottomGridAnnotationDirection( Horizontal ), mGridFrameStyle( NoGridFrame ), mGridFrameWidth( 2.0 ),
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true )
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true )
{
mComposition = composition;
mOverviewFrameMapSymbol = 0;
Expand Down Expand Up @@ -85,7 +85,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )
mLeftGridAnnotationPosition( OutsideMapFrame ), mRightGridAnnotationPosition( OutsideMapFrame ), mTopGridAnnotationPosition( OutsideMapFrame ),
mBottomGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mLeftGridAnnotationDirection( Horizontal ), mRightGridAnnotationDirection( Horizontal ),
mTopGridAnnotationDirection( Horizontal ), mBottomGridAnnotationDirection( Horizontal ), mGridFrameStyle( NoGridFrame ), mGridFrameWidth( 2.0 ), mCrossLength( 3 ),
mMapCanvas( 0 ), mDrawCanvasItems( true )
mMapCanvas( 0 ), mDrawCanvasItems( true )
{
mOverviewFrameMapSymbol = 0;
createDefaultOverviewFrameSymbol();
Expand Down
2 changes: 1 addition & 1 deletion src/core/gps/parser.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Copyright Tim (xtimor@gmail.com)
*
* NMEA library is free software; you can redistribute it and/or modify
Expand Down
20 changes: 10 additions & 10 deletions src/core/qgserror.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CORE_EXPORT QgsErrorMessage
{
public:
/** Format */
enum Format
enum Format
{
Text, // Plain text
Html
Expand All @@ -45,7 +45,7 @@ class CORE_EXPORT QgsErrorMessage
* @param theFunction the function where error was created
* @param theLine the line where error was created
*/
QgsErrorMessage ( const QString & theMessage, const QString & theTag = QString::null, const QString & theFile = QString::null, const QString & theFunction = QString::null, int theLine = 0 );
QgsErrorMessage( const QString & theMessage, const QString & theTag = QString::null, const QString & theFile = QString::null, const QString & theFunction = QString::null, int theLine = 0 );

QString message() const { return mMessage; }
QString tag() const { return mTag; }
Expand All @@ -70,9 +70,9 @@ class CORE_EXPORT QgsErrorMessage
};

/** \ingroup core
* QgsError is container for error messages (report). It may contain chain
* (sort of traceback) of error messages (e.g. GDAL - provider - layer).
* Higher level messages are appended at the end.
* QgsError is container for error messages (report). It may contain chain
* (sort of traceback) of error messages (e.g. GDAL - provider - layer).
* Higher level messages are appended at the end.
*/
class CORE_EXPORT QgsError
{
Expand All @@ -84,25 +84,25 @@ class CORE_EXPORT QgsError
* @param theMessage error message
* @param theTag short description, e.g. GDAL, Provider, Layer
*/
QgsError ( const QString & theMessage, const QString & theTag );
QgsError( const QString & theMessage, const QString & theTag );

/** Append new error message.
* @param theMessage error message string
* @param theTag error label, for example GDAL, GDAL Provider, Raster layer
*/
void append ( const QString & theMessage, const QString & theTag );
void append( const QString & theMessage, const QString & theTag );

/** Append new error message.
* @param theMessage error message
*/
void append ( const QgsErrorMessage & theMessage );
void append( const QgsErrorMessage & theMessage );

/** Test if any error is set.
/** Test if any error is set.
* @return true if contains error
*/
bool isEmpty() const { return mMessageList.isEmpty(); }

/** Full error messages description
/** Full error messages description
* @param theFormat output format
* @return error report
*/
Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ static QVariant fcnFormatNumber( const QVariantList& values, QgsFeature*, QgsExp
static QVariant fcnFormatDate( const QVariantList& values, QgsFeature*, QgsExpression* parent )
{
QDateTime dt = getDateTimeValue( values.at( 0 ), parent );
QString format = getStringValue( values.at( 1 ), parent );
QString format = getStringValue( values.at( 1 ), parent );
return dt.toString( format );
}

Expand Down Expand Up @@ -882,7 +882,7 @@ const QList<QgsExpression::FunctionDef> &QgsExpression::BuiltinFunctions()
<< FunctionDef( "$rownum", 0, fcnRowNumber, QObject::tr( "Record" ) )
<< FunctionDef( "$id", 0, fcnFeatureId, QObject::tr( "Record" ) )
<< FunctionDef( "$scale", 0, fcnScale, QObject::tr( "Record" ) )
// private functions
// private functions
<< FunctionDef( "_specialcol_", 1, fcnSpecialColumn, QObject::tr( "Special" ) )
;
}
Expand Down Expand Up @@ -933,7 +933,7 @@ QList<QgsExpression::FunctionDef> QgsExpression::specialColumns()
QList<FunctionDef> defs;
for ( QMap<QString, QVariant>::const_iterator it = gmSpecialColumns.begin(); it != gmSpecialColumns.end(); ++it )
{
defs << FunctionDef( it.key(), 0, 0, QObject::tr( "Record" ));
defs << FunctionDef( it.key(), 0, 0, QObject::tr( "Record" ) );
}
return defs;
}
Expand Down Expand Up @@ -1126,7 +1126,7 @@ QString QgsExpression::replaceExpressionText( QString action, QgsFeature* feat,
{
QVariant oldValue = QgsExpression::specialColumn( sit.key() );
if ( !oldValue.isNull() )
savedValues.insert( sit.key(), oldValue );
savedValues.insert( sit.key(), oldValue );

// set the new value
QgsExpression::setSpecialColumn( sit.key(), sit.value() );
Expand Down Expand Up @@ -2146,7 +2146,7 @@ QVariant QgsExpression::NodeColumnRef::eval( QgsExpression* /*parent*/, QgsFeatu
{
return f->attributeMap()[mIndex];
}
return QVariant("[" + mName + "]");
return QVariant( "[" + mName + "]" );
}

bool QgsExpression::NodeColumnRef::prepare( QgsExpression* parent, const QgsFieldMap& fields )
Expand Down
32 changes: 16 additions & 16 deletions src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ QgsGeometry* QgsGeometry::fromGML2( const QDomNode& geometryNode )
QDomElement geometryTypeElement = geometryNode.toElement();
QString geomType = geometryTypeElement.tagName();

if ( !( geomType == "Point" || geomType == "LineString" || geomType == "Polygon" || geomType == "MultiPoint" || geomType == "MultiLineString" || geomType == "MultiPolygon") )
if ( !( geomType == "Point" || geomType == "LineString" || geomType == "Polygon" || geomType == "MultiPoint" || geomType == "MultiLineString" || geomType == "MultiPolygon" ) )
{
QDomNode geometryChild = geometryNode.firstChild();
if ( geometryChild.isNull() )
Expand All @@ -551,7 +551,7 @@ QgsGeometry* QgsGeometry::fromGML2( const QDomNode& geometryNode )
geomType = geometryTypeElement.tagName();
}

if ( !( geomType == "Point" || geomType == "LineString" || geomType == "Polygon" || geomType == "MultiPoint" || geomType == "MultiLineString" || geomType == "MultiPolygon") )
if ( !( geomType == "Point" || geomType == "LineString" || geomType == "Polygon" || geomType == "MultiPoint" || geomType == "MultiLineString" || geomType == "MultiPolygon" ) )
return 0;

if ( geomType == "Point" )
Expand Down Expand Up @@ -594,7 +594,7 @@ bool QgsGeometry::setFromGML2Point( const QDomElement& geometryElement )
}
QDomElement coordElement = coordList.at( 0 ).toElement();
std::list<QgsPoint> pointCoordinate;
if ( readGML2Coordinates( pointCoordinate, coordElement ) != 0)
if ( readGML2Coordinates( pointCoordinate, coordElement ) != 0 )
{
return false;
}
Expand All @@ -603,7 +603,7 @@ bool QgsGeometry::setFromGML2Point( const QDomElement& geometryElement )
{
return false;
}

std::list<QgsPoint>::const_iterator point_it = pointCoordinate.begin();
//char e = QgsApplication::endian();
char e = ( htonl( 1 ) == 1 ) ? 0 : 1 ;
Expand Down Expand Up @@ -5131,10 +5131,10 @@ QDomElement QgsGeometry::exportToGML2( QDomDocument& doc )
coordElem.setAttribute( "ts", " " );
QString coordString;
x = ( double * )( mGeometry + 5 );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
coordString += ",";
y = ( double * )( mGeometry + 5 + sizeof( double ) );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
QDomText coordText = doc.createTextNode( coordString );
coordElem.appendChild( coordText );
pointElem.appendChild( coordElem );
Expand All @@ -5161,11 +5161,11 @@ QDomElement QgsGeometry::exportToGML2( QDomDocument& doc )
coordElem.setAttribute( "ts", " " );
QString coordString;
x = ( double * )( ptr );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
coordString += ",";
ptr += sizeof( double );
y = ( double * )( ptr );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
QDomText coordText = doc.createTextNode( coordString );
coordElem.appendChild( coordText );
pointElem.appendChild( coordElem );
Expand Down Expand Up @@ -5205,11 +5205,11 @@ QDomElement QgsGeometry::exportToGML2( QDomDocument& doc )
coordString += " ";
}
x = ( double * ) ptr;
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
coordString += ",";
ptr += sizeof( double );
y = ( double * ) ptr;
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
ptr += sizeof( double );
if ( hasZValue )
{
Expand Down Expand Up @@ -5251,11 +5251,11 @@ QDomElement QgsGeometry::exportToGML2( QDomDocument& doc )
coordString += " ";
}
x = ( double * ) ptr;
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
ptr += sizeof( double );
coordString += ",";
y = ( double * ) ptr;
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
ptr += sizeof( double );
if ( hasZValue )
{
Expand Down Expand Up @@ -5315,11 +5315,11 @@ QDomElement QgsGeometry::exportToGML2( QDomDocument& doc )
coordString += " ";
}
x = ( double * ) ptr;
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
coordString += ",";
ptr += sizeof( double );
y = ( double * ) ptr;
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
ptr += sizeof( double );
if ( hasZValue )
{
Expand Down Expand Up @@ -5378,11 +5378,11 @@ QDomElement QgsGeometry::exportToGML2( QDomDocument& doc )
coordString += " ";
}
x = ( double * ) ptr;
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *x, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
ptr += sizeof( double );
coordString += ",";
y = ( double * ) ptr;
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp("[0]{1,7}$") );
coordString += QString::number( *y, 'f', 8 ).remove( QRegExp( "[0]{1,7}$" ) );
ptr += sizeof( double );
if ( hasZValue )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsgeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class CORE_EXPORT QgsGeometry
/** static method that creates geometry from Wkt */
static QgsGeometry* fromWkt( QString wkt );

/** static method that creates geometry from GML2
/** static method that creates geometry from GML2
@note added in 1.9
*/
static QgsGeometry* fromGML2( const QDomNode& geometryNode );
Expand Down
14 changes: 7 additions & 7 deletions src/gui/qgscomposerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,13 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )
}
if ( composition() )
{
QgsComposerMap* composerMap = new QgsComposerMap( composition(), mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
composition()->addComposerMap( composerMap );
scene()->removeItem( mRubberBandItem );
delete mRubberBandItem;
mRubberBandItem = 0;
emit actionFinished();
composition()->pushAddRemoveCommand( composerMap, tr( "Map added" ) );
QgsComposerMap* composerMap = new QgsComposerMap( composition(), mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
composition()->addComposerMap( composerMap );
scene()->removeItem( mRubberBandItem );
delete mRubberBandItem;
mRubberBandItem = 0;
emit actionFinished();
composition()->pushAddRemoveCommand( composerMap, tr( "Map added" ) );
}
break;

Expand Down
22 changes: 11 additions & 11 deletions src/gui/qgserrordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@ QgsErrorDialog::QgsErrorDialog( const QgsError & theError, const QString & theTi
{
setupUi( this );
QString title = theTitle;
if ( title.isEmpty() ) title = tr("Error");
if ( title.isEmpty() ) title = tr( "Error" );
setWindowTitle( title );

// QMessageBox has static standardIcon( Icon icon ), but it is marked as obsolete
QMessageBox messageBox( QMessageBox::Critical, "", "" );
mIconLabel->setPixmap( messageBox.iconPixmap() );
mSummaryTextBrowser->setOpenExternalLinks ( true );
mDetailTextBrowser->setOpenExternalLinks ( true );
mSummaryTextBrowser->setOpenExternalLinks( true );
mDetailTextBrowser->setOpenExternalLinks( true );
mDetailTextBrowser->hide();

QPalette p = palette();
p.setColor(QPalette::Base, Qt::transparent);
mSummaryTextBrowser->setPalette(p);
p.setColor( QPalette::Base, Qt::transparent );
mSummaryTextBrowser->setPalette( p );

mDetailCheckBox->hide();

mSummaryTextBrowser->setText ( mError.summary() );
mSummaryTextBrowser->setText( mError.summary() );
mDetailTextBrowser->setText( mError.message( QgsErrorMessage::Html ) );

resize( width(), 150);
resize( width(), 150 );

QSettings settings;
Qt::CheckState state = (Qt::CheckState) settings.value( "/Error/dialog/detail", 0 ).toInt();
Qt::CheckState state = ( Qt::CheckState ) settings.value( "/Error/dialog/detail", 0 ).toInt();
mDetailCheckBox->setCheckState( state );
if ( state == Qt::Checked ) on_mDetailPushButton_clicked();
}
Expand All @@ -56,7 +56,7 @@ QgsErrorDialog::~QgsErrorDialog()
{
}

void QgsErrorDialog::show ( const QgsError & theError, const QString & theTitle, QWidget *parent, Qt::WFlags fl )
void QgsErrorDialog::show( const QgsError & theError, const QString & theTitle, QWidget *parent, Qt::WFlags fl )
{
QgsErrorDialog d( theError, theTitle, parent, fl );
d.exec();
Expand All @@ -68,10 +68,10 @@ void QgsErrorDialog::on_mDetailPushButton_clicked()
mDetailTextBrowser->show();
mDetailCheckBox->show();
mDetailPushButton->hide();
resize( width(), 400);
resize( width(), 400 );
}

void QgsErrorDialog::on_mDetailCheckBox_stateChanged ( int state )
void QgsErrorDialog::on_mDetailCheckBox_stateChanged( int state )
{
QSettings settings;
settings.setValue( "/Error/dialog/detail", state );
Expand Down
10 changes: 5 additions & 5 deletions src/gui/qgserrordialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class GUI_EXPORT QgsErrorDialog: public QDialog, private Ui::QgsErrorDialogBase
QgsErrorDialog( const QgsError & theError, const QString & theTitle, QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
~QgsErrorDialog();

/** Show dialog with error
* @param theError error
*/
static void show ( const QgsError & theError, const QString & theTitle, QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );
/** Show dialog with error
* @param theError error
*/
static void show( const QgsError & theError, const QString & theTitle, QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags );

public slots:
void on_mDetailPushButton_clicked();
void on_mDetailCheckBox_stateChanged ( int state );
void on_mDetailCheckBox_stateChanged( int state );

private:
QgsError mError;
Expand Down
10 changes: 5 additions & 5 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ void QgsCategorizedSymbolRendererV2Widget::changeSelectedSymbols()
return;
}

foreach( QModelIndex idx, selectedIndexes )
foreach ( QModelIndex idx, selectedIndexes )
{
if( idx.isValid() )
if ( idx.isValid() )
{
int catIdx = mRenderer->categoryIndexForValue( idx.data( Qt::UserRole + 1 ) );
QgsSymbolV2* newCatSymbol = newSymbol->clone();
Expand Down Expand Up @@ -452,9 +452,9 @@ QList<QVariant> QgsCategorizedSymbolRendererV2Widget::selectedCategories()
QModelIndexList rows = viewCategories->selectionModel()->selectedRows();
QStandardItemModel* m = qobject_cast<QStandardItemModel*>( viewCategories->model() );

foreach( QModelIndex r, rows )
foreach ( QModelIndex r, rows )
{
if( r.isValid() )
if ( r.isValid() )
{
categories.append( m->item( r.row(), 1 )->data() );
}
Expand All @@ -470,7 +470,7 @@ void QgsCategorizedSymbolRendererV2Widget::deleteCategory()
if ( !categories.size() )
return;

foreach( const QVariant k, categories )
foreach ( const QVariant k, categories )
{
if ( k.isValid() )
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ void QgsGraduatedSymbolRendererV2Widget::changeSelectedSymbols()
return;
}

foreach( QModelIndex idx, selectedIndexes )
foreach ( QModelIndex idx, selectedIndexes )
{
if( idx.isValid() )
if ( idx.isValid() )
{
int rangeIdx = idx.row();
QgsSymbolV2* newRangeSymbol = newSymbol->clone();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgsstylev2managerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ void QgsStyleV2ManagerDialog::removeItem()
bool QgsStyleV2ManagerDialog::removeSymbol()
{
QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
foreach( QModelIndex index, indexes )
foreach ( QModelIndex index, indexes )
{
QString symbolName = index.data().toString();
// delete from style and update list
Expand Down
21 changes: 14 additions & 7 deletions src/mapserver/qgsfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ QgsFilter* QgsFilter::createFilterFromXml( const QDomElement& filterElem, QgsVec
QgsGeometry* geom;

QDomNodeList bNodes = filterElem.elementsByTagName( "Box" );
if ( bNodes.size() > 0 ) {
if ( bNodes.size() > 0 )
{
QDomElement bElem = bNodes.at( 0 ).toElement().firstChild().toElement();
QString coordSeparator = ",";
QString tupelSeparator = " ";
Expand All @@ -125,7 +126,8 @@ QgsFilter* QgsFilter::createFilterFromXml( const QDomElement& filterElem, QgsVec
if ( !geom )
{
QDomNodeList gNodes = filterElem.elementsByTagName( "Point" );
if ( gNodes.size() > 0 ) {
if ( gNodes.size() > 0 )
{
QDomElement gElem = gNodes.at( 0 ).toElement();
geom = QgsGeometry::fromGML2( gElem );
}
Expand All @@ -134,7 +136,8 @@ QgsFilter* QgsFilter::createFilterFromXml( const QDomElement& filterElem, QgsVec
if ( !geom )
{
QDomNodeList gNodes = filterElem.elementsByTagName( "LineString" );
if ( gNodes.size() > 0 ) {
if ( gNodes.size() > 0 )
{
QDomElement gElem = gNodes.at( 0 ).toElement();
geom = QgsGeometry::fromGML2( gElem );
}
Expand All @@ -143,7 +146,8 @@ QgsFilter* QgsFilter::createFilterFromXml( const QDomElement& filterElem, QgsVec
if ( !geom )
{
QDomNodeList gNodes = filterElem.elementsByTagName( "Polygon" );
if ( gNodes.size() > 0 ) {
if ( gNodes.size() > 0 )
{
QDomElement gElem = gNodes.at( 0 ).toElement();
geom = QgsGeometry::fromGML2( gElem );
}
Expand All @@ -152,7 +156,8 @@ QgsFilter* QgsFilter::createFilterFromXml( const QDomElement& filterElem, QgsVec
if ( !geom )
{
QDomNodeList gNodes = filterElem.elementsByTagName( "MultiPoint" );
if ( gNodes.size() > 0 ) {
if ( gNodes.size() > 0 )
{
QDomElement gElem = gNodes.at( 0 ).toElement();
geom = QgsGeometry::fromGML2( gElem );
}
Expand All @@ -161,7 +166,8 @@ QgsFilter* QgsFilter::createFilterFromXml( const QDomElement& filterElem, QgsVec
if ( !geom )
{
QDomNodeList gNodes = filterElem.elementsByTagName( "MultiLineString" );
if ( gNodes.size() > 0 ) {
if ( gNodes.size() > 0 )
{
QDomElement gElem = gNodes.at( 0 ).toElement();
geom = QgsGeometry::fromGML2( gElem );
}
Expand All @@ -170,7 +176,8 @@ QgsFilter* QgsFilter::createFilterFromXml( const QDomElement& filterElem, QgsVec
if ( !geom )
{
QDomNodeList gNodes = filterElem.elementsByTagName( "MultiPolygon" );
if ( gNodes.size() > 0 ) {
if ( gNodes.size() > 0 )
{
QDomElement gElem = gNodes.at( 0 ).toElement();
geom = QgsGeometry::fromGML2( gElem );
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgsspatialfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class QgsSpatialFilter: public QgsFilter
WITHIN,
UNKNOWN
};

QgsSpatialFilter();
QgsSpatialFilter( SPATIAL_TYPE st, QgsGeometry* geom );
~QgsSpatialFilter();
Expand Down
14 changes: 7 additions & 7 deletions src/mapserver/qgswfsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,22 +406,22 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
//map extent
QgsRectangle searchRect = layer->extent();
searchRect.set( searchRect.xMinimum() - 0.000001
, searchRect.yMinimum() - 0.000001
, searchRect.xMaximum() + 0.000001
, searchRect.yMaximum() + 0.000001 );
, searchRect.yMinimum() - 0.000001
, searchRect.xMaximum() + 0.000001
, searchRect.yMaximum() + 0.000001 );
QgsCoordinateReferenceSystem layerCrs = layer->crs();

if ( maxFeatures == 0 )
maxFeat += layer->featureCount();

provider->select( attrIndexes, searchRect, mWithGeom, true );

if ( i == 0 )
startGetFeature( request, format, layerCrs, &searchRect );

long featCounter = 0;
QDomNodeList filterNodes = queryElem.elementsByTagName( "Filter" );
if (filterNodes.size() > 0 )
if ( filterNodes.size() > 0 )
{
QDomElement filterElem = filterNodes.at( 0 ).toElement();
QDomNodeList fidNodes = filterElem.elementsByTagName( "FeatureId" );
Expand All @@ -436,7 +436,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
++featCounter;
++featureCounter;
}
}
}
else
{
QgsFilter* mFilter = QgsFilter::createFilterFromXml( filterElem.firstChild().toElement(), layer );
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dxf2shp_converter/getInsertions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// http://www.happysquirrel.com/index.php?feature=hs_questions
//
// Thank you!
//
//

// getInsertions.cpp: The class which retrieves the block insertions from the DXF file

Expand Down
6 changes: 4 additions & 2 deletions src/plugins/globe/globe_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,11 +837,13 @@ void GlobePlugin::elevationLayersChanged()

void GlobePlugin::reset()
{
if (mViewerWidget) {
if ( mViewerWidget )
{
delete mViewerWidget;
mViewerWidget = 0;
}
if (mOsgViewer) {
if ( mOsgViewer )
{
delete mOsgViewer;
mOsgViewer = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/globe/globe_plugin_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ void QgsGlobePluginDialog::resetElevationDatasources()
{
elevationDatasourcesWidget->clearContents();
elevationDatasourcesWidget->setRowCount( 1 );
elevationDatasourcesWidget->setItem( 0, 0, new QTableWidgetItem("TMS") );
elevationDatasourcesWidget->setItem( 0, 0, new QTableWidgetItem( "TMS" ) );
elevationDatasourcesWidget->setItem( 0, 1, new QTableWidgetItem() );
//elevationDatasourcesWidget->item( 0, 1 )->setCheckState( Qt::Unchecked );
elevationDatasourcesWidget->setItem( 0, 2, new QTableWidgetItem("http://readymap.org/readymap/tiles/1.0.0/9/") );
elevationDatasourcesWidget->setItem( 0, 2, new QTableWidgetItem( "http://readymap.org/readymap/tiles/1.0.0/9/" ) );
}

void QgsGlobePluginDialog::readElevationDatasources()
Expand Down
11 changes: 7 additions & 4 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,20 +2408,23 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )

QString update;

if ( mSpatialColType == sctTopoGeometry ) {
if ( mSpatialColType == sctTopoGeometry )
{
// NOTE: We are creating a new TopoGeometry objects with the new shape.
// TODO: _replace_ the initial TopoGeometry instead, so that it keeps
// the same identifier and thus still partecipates in any
// hierarchical definition. Also creating a new object results
// in orphaned topogeometries!
update = QString( "UPDATE %1 SET %2=toTopoGeom(%3,t.name,layer_id(%2))"
" FROM topology.topology t WHERE t.id = topology_id(%2)"
" AND %4" )
" FROM topology.topology t WHERE t.id = topology_id(%2)"
" AND %4" )
.arg( mQuery )
.arg( quotedIdentifier( mGeometryColumn ) )
.arg( geomParam( 1 ) )
.arg( pkParamWhereClause( 2 ) );
} else {
}
else
{
update = QString( "UPDATE %1 SET %2=%3 WHERE %4" )
.arg( mQuery )
.arg( quotedIdentifier( mGeometryColumn ) )
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ bool QgsWFSProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
nameElem.appendChild( nameText );
propertyElem.appendChild( nameElem );
QDomElement valueElem = transactionDoc.createElementNS( "http://www.opengis.net/wfs", "Value" );
QDomElement gmlElem = (&geomIt.value())->exportToGML2( transactionDoc );
QDomElement gmlElem = ( &geomIt.value() )->exportToGML2( transactionDoc );
valueElem.appendChild( gmlElem );
propertyElem.appendChild( valueElem );
updateElem.appendChild( propertyElem );
Expand Down
2 changes: 1 addition & 1 deletion src/python/qgspythonutilsimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ QString QgsPythonUtilsImpl::pythonPath()

QString QgsPythonUtilsImpl::pluginsPath()
{
return pythonPath() + "/plugins";
return pythonPath() + "/plugins";
}

QString QgsPythonUtilsImpl::homePythonPath()
Expand Down
68 changes: 34 additions & 34 deletions tests/src/core/testqgsatlascomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,30 @@

class TestQgsAtlasComposition: public QObject
{
Q_OBJECT;
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init();// will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.
// test filename pattern evaluation
void filename();
// test rendering with an autoscale atlas
void autoscale_render();
// test rendering with a fixed scale atlas
void fixedscale_render();
// test rendering with a hidden coverage
void hiding_render();
Q_OBJECT;
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init();// will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.

// test filename pattern evaluation
void filename();
// test rendering with an autoscale atlas
void autoscale_render();
// test rendering with a fixed scale atlas
void fixedscale_render();
// test rendering with a hidden coverage
void hiding_render();
private:
QgsComposition* mComposition;
QgsComposerLabel* mLabel1;
QgsComposerLabel* mLabel2;
QgsComposerMap* mAtlasMap;
QgsComposerMap* mOverview;
QgsMapRenderer* mMapRenderer;
QgsVectorLayer* mVectorLayer;
QgsAtlasComposition* mAtlas;
QgsComposition* mComposition;
QgsComposerLabel* mLabel1;
QgsComposerLabel* mLabel2;
QgsComposerMap* mAtlasMap;
QgsComposerMap* mOverview;
QgsMapRenderer* mMapRenderer;
QgsVectorLayer* mVectorLayer;
QgsAtlasComposition* mAtlas;
};

void TestQgsAtlasComposition::initTestCase()
Expand All @@ -67,7 +67,7 @@ void TestQgsAtlasComposition::initTestCase()
QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "france_parts.shp" );
mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(),
vectorFileInfo.completeBaseName(),
"ogr" );
"ogr" );

QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mVectorLayer );

Expand Down Expand Up @@ -151,7 +151,7 @@ void TestQgsAtlasComposition::filename()
for ( size_t fi = 0; fi < mAtlas->numFeatures(); ++fi )
{
mAtlas->prepareForFeature( fi );
QString expected = QString( "output_%1" ).arg( (int)(fi+1) );
QString expected = QString( "output_%1" ).arg(( int )( fi + 1 ) );
QCOMPARE( mAtlas->currentFilename(), expected );
}
mAtlas->endRender();
Expand All @@ -171,9 +171,9 @@ void TestQgsAtlasComposition::autoscale_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas autoscale test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "autoscale_%1.png" ).arg((int)fit) );
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "autoscale_%1.png" ).arg(( int )fit ) );
QVERIFY( checker.testComposition( 0 ) );
}
mAtlas->endRender();
Expand All @@ -192,9 +192,9 @@ void TestQgsAtlasComposition::fixedscale_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas fixedscale test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "fixedscale_%1.png" ).arg((int)fit) );
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "fixedscale_%1.png" ).arg(( int )fit ) );
QVERIFY( checker.testComposition( 0 ) );
}
mAtlas->endRender();
Expand All @@ -215,9 +215,9 @@ void TestQgsAtlasComposition::hiding_render()
mLabel1->adjustSizeToText();

QgsCompositionChecker checker( "Atlas hidden test", mComposition,
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "hiding_%1.png" ).arg((int)fit) );
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
"expected_composermapatlas" + QDir::separator() +
QString( "hiding_%1.png" ).arg(( int )fit ) );
QVERIFY( checker.testComposition( 0 ) );
}
mAtlas->endRender();
Expand Down
42 changes: 21 additions & 21 deletions tests/src/core/testqgscomposerlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@

class TestQgsComposerLabel: public QObject
{
Q_OBJECT;
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init();// will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.
// test simple expression evaluation
void evaluation();
// test expression evaluation when a feature is set
void feature_evaluation();
// test "$page" expressions
void page_evaluation();
Q_OBJECT;
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init();// will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.

// test simple expression evaluation
void evaluation();
// test expression evaluation when a feature is set
void feature_evaluation();
// test "$page" expressions
void page_evaluation();
private:
QgsComposition* mComposition;
QgsComposerLabel* mComposerLabel;
QgsMapRenderer* mMapRenderer;
QgsVectorLayer* mVectorLayer;
QgsComposition* mComposition;
QgsComposerLabel* mComposerLabel;
QgsMapRenderer* mMapRenderer;
QgsVectorLayer* mVectorLayer;
};

void TestQgsComposerLabel::initTestCase()
Expand All @@ -56,7 +56,7 @@ void TestQgsComposerLabel::initTestCase()
QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "france_parts.shp" );
mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(),
vectorFileInfo.completeBaseName(),
"ogr" );
"ogr" );
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mVectorLayer );

//create composition with composer map
Expand Down Expand Up @@ -108,8 +108,8 @@ void TestQgsComposerLabel::evaluation()
// $CURRENT_DATE() evaluation (inside an expression)
QDate now = QDate::currentDate();
int dd = now.day();
QString expected = "__" + QString("%1").arg(dd+1) + "(ok)__";

QString expected = "__" + QString( "%1" ).arg( dd + 1 ) + "(ok)__";
mComposerLabel->setText( "__[%$CURRENT_DATE(dd) + 1%](ok)__" );
QString evaluated = mComposerLabel->displayText();
QCOMPARE( evaluated, expected );
Expand Down Expand Up @@ -173,7 +173,7 @@ void TestQgsComposerLabel::page_evaluation()

// move to the second page and re-evaluate
mComposerLabel->setItemPosition( 0, 320 );
QCOMPARE( mComposerLabel->displayText(), QString("2/2") );
QCOMPARE( mComposerLabel->displayText(), QString( "2/2" ) );
}
}

Expand Down
50 changes: 25 additions & 25 deletions tests/src/core/testqgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,31 +545,31 @@ class TestQgsExpression: public QObject
QCOMPARE( vPerimeter.toDouble(), 20. );
}

void eval_special_columns()
{
QTest::addColumn<QString>( "string" );
QTest::addColumn<QVariant>( "result" );

QgsExpression::setSpecialColumn( "$var1", QVariant((int)42) );

QgsExpression exp( "$var1 + 1" );
QVariant v1 = exp.evaluate();
QCOMPARE( v1.toInt(), 43 );
QgsExpression::setSpecialColumn( "$var1", QVariant((int)100) );
QVariant v2 = exp.evaluate();
QCOMPARE( v2.toInt(), 101 );

QgsExpression exp2( "_specialcol_('$var1')+1" );
QVariant v3 = exp2.evaluate();
QCOMPARE( v3.toInt(), 101 );

QgsExpression exp3( "_specialcol_('undefined')");
QVariant v4 = exp3.evaluate();
QCOMPARE( v4, QVariant() );

QgsExpression::unsetSpecialColumn( "$var1" );
}
void eval_special_columns()
{
QTest::addColumn<QString>( "string" );
QTest::addColumn<QVariant>( "result" );

QgsExpression::setSpecialColumn( "$var1", QVariant(( int )42 ) );

QgsExpression exp( "$var1 + 1" );
QVariant v1 = exp.evaluate();
QCOMPARE( v1.toInt(), 43 );

QgsExpression::setSpecialColumn( "$var1", QVariant(( int )100 ) );
QVariant v2 = exp.evaluate();
QCOMPARE( v2.toInt(), 101 );

QgsExpression exp2( "_specialcol_('$var1')+1" );
QVariant v3 = exp2.evaluate();
QCOMPARE( v3.toInt(), 101 );

QgsExpression exp3( "_specialcol_('undefined')" );
QVariant v4 = exp3.evaluate();
QCOMPARE( v4, QVariant() );

QgsExpression::unsetSpecialColumn( "$var1" );
}

};

Expand Down