Skip to content

Commit 29adf23

Browse files
author
jef
committedNov 18, 2009
automatic indentation update (r12139-r12177)
git-svn-id: http://svn.osgeo.org/qgis/trunk@12178 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 621ee62 commit 29adf23

17 files changed

+557
-557
lines changed
 

‎src/app/qgsmeasuredialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WFlags f )
3535
: QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool )
3636
{
3737
setupUi( this );
38-
38+
3939
QPushButton *nb = new QPushButton( tr( "&New" ) );
4040
buttonBox->addButton( nb, QDialogButtonBox::ActionRole );
4141
connect( nb, SIGNAL( clicked() ), this, SLOT( restart() ) );

‎src/core/qgsmaplayer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ class CORE_EXPORT QgsMapLayer : public QObject
7878
*/
7979
QString const & name() const;
8080

81-
/** This is the method that does the actual work of
81+
/** This is the method that does the actual work of
8282
* drawing the layer onto a paint device.
83-
* @param QgsRenderContext - describes the extents,
84-
* resolution etc. that should be used when rendering the
83+
* @param QgsRenderContext - describes the extents,
84+
* resolution etc. that should be used when rendering the
8585
* layer.
8686
*/
8787
virtual bool draw( QgsRenderContext& rendererContext );
@@ -291,9 +291,9 @@ class CORE_EXPORT QgsMapLayer : public QObject
291291
/** Get the QImage used for caching render operations
292292
* @note This method was added in QGIS 1.4 **/
293293
QImage * cacheImage() { return mpCacheImage; }
294-
/** Set the QImage used for caching render operations
294+
/** Set the QImage used for caching render operations
295295
* @note This method was added in QGIS 1.4 **/
296-
void setCacheImage( QImage * thepImage );
296+
void setCacheImage( QImage * thepImage );
297297

298298
public slots:
299299

‎src/core/qgsmaprenderer.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void QgsMapRenderer::adjustExtentToSize()
212212

213213
void QgsMapRenderer::render( QPainter* painter )
214214
{
215-
//flag to see if the render context has changed
215+
//flag to see if the render context has changed
216216
//since the last time we rendered. If it hasnt changed we can
217217
//take some shortcuts with rendering
218218
bool mySameAsLastFlag = true;
@@ -285,20 +285,20 @@ void QgsMapRenderer::render( QPainter* painter )
285285
mySameAsLastFlag = false;
286286
}
287287

288-
mRenderContext.setLabelingEngine(mLabelingEngine);
288+
mRenderContext.setLabelingEngine( mLabelingEngine );
289289
if ( mLabelingEngine )
290290
mLabelingEngine->init();
291291

292-
// know we know if this render is just a repeat of the last time, we
292+
// know we know if this render is just a repeat of the last time, we
293293
// can clear caches if it has changed
294294
if ( !mySameAsLastFlag )
295295
{
296-
//clear the cache pixmap if we changed resolution / extent
297-
QSettings mySettings;
298-
if ( mySettings.value ( "/qgis/enable_render_caching", false ).toBool() )
299-
{
300-
QgsMapLayerRegistry::instance()->clearAllLayerCaches();
301-
}
296+
//clear the cache pixmap if we changed resolution / extent
297+
QSettings mySettings;
298+
if ( mySettings.value( "/qgis/enable_render_caching", false ).toBool() )
299+
{
300+
QgsMapLayerRegistry::instance()->clearAllLayerCaches();
301+
}
302302
}
303303

304304
bool placeOverlays = false;
@@ -322,7 +322,7 @@ void QgsMapRenderer::render( QPainter* painter )
322322
break;
323323
}
324324

325-
// Store the painter in case we need to swap it out for the
325+
// Store the painter in case we need to swap it out for the
326326
// cache painter
327327
QPainter * mypContextPainter = mRenderContext.painter();
328328

@@ -422,31 +422,31 @@ void QgsMapRenderer::render( QPainter* painter )
422422
ml->setCacheImage( 0 );
423423
}
424424
}
425-
425+
426426
QSettings mySettings;
427427
if ( ! split )//render caching does not yet cater for split extents
428428
{
429-
if ( mySettings.value ( "/qgis/enable_render_caching", false ).toBool() )
429+
if ( mySettings.value( "/qgis/enable_render_caching", false ).toBool() )
430430
{
431-
if ( !mySameAsLastFlag || ml->cacheImage() == 0 )
431+
if ( !mySameAsLastFlag || ml->cacheImage() == 0 )
432432
{
433433
QgsDebugMsg( "\n\n\nCaching enabled but layer redraw forced by extent change or empty cache\n\n\n" );
434-
QImage * mypImage = new QImage( mRenderContext.painter()->device()->width(),
435-
mRenderContext.painter()->device()->height(), QImage::Format_ARGB32 );
434+
QImage * mypImage = new QImage( mRenderContext.painter()->device()->width(),
435+
mRenderContext.painter()->device()->height(), QImage::Format_ARGB32 );
436436
mypImage->fill( 0 );
437437
ml->setCacheImage( mypImage ); //no need to delete the old one, maplayer does it for you
438438
QPainter * mypPainter = new QPainter( ml->cacheImage() );
439439
if ( mySettings.value( "/qgis/enable_anti_aliasing", false ).toBool() )
440440
{
441441
mypPainter->setRenderHint( QPainter::Antialiasing );
442442
}
443-
mRenderContext.setPainter( mypPainter );
443+
mRenderContext.setPainter( mypPainter );
444444
}
445445
else if ( mySameAsLastFlag )
446446
{
447447
//draw from cached image
448448
QgsDebugMsg( "\n\n\nCaching enabled --- drawing layer from cached image\n\n\n" );
449-
mypContextPainter->drawImage( 0,0, *(ml->cacheImage()) );
449+
mypContextPainter->drawImage( 0, 0, *( ml->cacheImage() ) );
450450
disconnect( ml, SIGNAL( drawingProgress( int, int ) ), this, SLOT( onDrawingProgress( int, int ) ) );
451451
//short circuit as there is nothing else to do...
452452
continue;
@@ -472,7 +472,7 @@ void QgsMapRenderer::render( QPainter* painter )
472472
}
473473
else
474474
{
475-
QgsDebugMsg( "\n\n\nLayer rendered without issues\n\n\n" );
475+
QgsDebugMsg( "\n\n\nLayer rendered without issues\n\n\n" );
476476
}
477477
if ( split )
478478
{
@@ -489,24 +489,24 @@ void QgsMapRenderer::render( QPainter* painter )
489489
mRenderContext.painter()->restore();
490490
}
491491

492-
if ( mySettings.value ( "/qgis/enable_render_caching", false ).toBool() )
492+
if ( mySettings.value( "/qgis/enable_render_caching", false ).toBool() )
493493
{
494494
if ( !split )
495495
{
496496
// composite the cached image into our view and then clean up from caching
497497
// by reinstating the painter as it was swapped out for caching renders
498498
delete mRenderContext.painter();
499-
mRenderContext.setPainter( mypContextPainter );
499+
mRenderContext.setPainter( mypContextPainter );
500500
//draw from cached image that we created further up
501-
mypContextPainter->drawImage( 0,0, *(ml->cacheImage()) );
501+
mypContextPainter->drawImage( 0, 0, *( ml->cacheImage() ) );
502502
}
503503
}
504504
disconnect( ml, SIGNAL( drawingProgress( int, int ) ), this, SLOT( onDrawingProgress( int, int ) ) );
505505
}
506506
else // layer not visible due to scale
507507
{
508508
QgsDebugMsg( "Layer not rendered because it is not within the defined "
509-
"visibility scale range" );
509+
"visibility scale range" );
510510
}
511511

512512
} // while (li.hasPrevious())
@@ -1055,9 +1055,9 @@ bool QgsMapRenderer::writeXML( QDomNode & theNode, QDomDocument & theDoc )
10551055
return true;
10561056
}
10571057

1058-
void QgsMapRenderer::setLabelingEngine(QgsLabelingEngineInterface* iface)
1058+
void QgsMapRenderer::setLabelingEngine( QgsLabelingEngineInterface* iface )
10591059
{
1060-
if (mLabelingEngine)
1060+
if ( mLabelingEngine )
10611061
delete mLabelingEngine;
10621062

10631063
mLabelingEngine = iface;

‎src/core/qgsmaprenderer.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ class QgsFeature;
4242
*/
4343
class QgsLabelingEngineInterface
4444
{
45-
public:
46-
virtual ~QgsLabelingEngineInterface() {}
47-
48-
//! called when we're going to start with rendering
49-
virtual void init() = 0;
50-
//! called when starting rendering of a layer
51-
virtual int prepareLayer(QgsVectorLayer* layer, int& attrIndex) = 0;
52-
//! called for every feature
53-
virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat ) = 0;
54-
//! called when the map is drawn and labels should be placed
55-
virtual void drawLabeling( QgsRenderContext& context ) = 0;
56-
//! called when we're done with rendering
57-
virtual void exit() = 0;
45+
public:
46+
virtual ~QgsLabelingEngineInterface() {}
47+
48+
//! called when we're going to start with rendering
49+
virtual void init() = 0;
50+
//! called when starting rendering of a layer
51+
virtual int prepareLayer( QgsVectorLayer* layer, int& attrIndex ) = 0;
52+
//! called for every feature
53+
virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat ) = 0;
54+
//! called when the map is drawn and labels should be placed
55+
virtual void drawLabeling( QgsRenderContext& context ) = 0;
56+
//! called when we're done with rendering
57+
virtual void exit() = 0;
5858

5959
};
6060

@@ -178,7 +178,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
178178
//! Set labeling engine. Previous engine (if any) is deleted.
179179
//! Takes ownership of the engine.
180180
//! Added in QGIS v1.4
181-
void setLabelingEngine(QgsLabelingEngineInterface* iface);
181+
void setLabelingEngine( QgsLabelingEngineInterface* iface );
182182

183183
signals:
184184

@@ -234,7 +234,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
234234
//! current extent to be drawn
235235
QgsRectangle mExtent;
236236
//
237-
/** Last extent to we drew so we know if we can
237+
/** Last extent to we drew so we know if we can
238238
used layer render caching or not. Note there are no
239239
accessors for this as it is intended to internal
240240
use only.

‎src/core/qgsrendercontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "qgsrendercontext.h"
2020

2121
QgsRenderContext::QgsRenderContext()
22-
: mPainter( 0 ),
22+
: mPainter( 0 ),
2323
mCoordTransform( 0 ),
2424
mDrawEditingInformation( false ),
2525
mForceVectorOutput( true ),

‎src/core/qgsrendercontext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class CORE_EXPORT QgsRenderContext
7676
void setRendererScale( double scale ) {mRendererScale = scale;}
7777
void setPainter( QPainter* p ) {mPainter = p;}
7878
//! Added in QGIS v1.4
79-
void setLabelingEngine(QgsLabelingEngineInterface* iface) { mLabelingEngine = iface; }
79+
void setLabelingEngine( QgsLabelingEngineInterface* iface ) { mLabelingEngine = iface; }
8080

8181
private:
8282

‎src/core/symbology-ng/qgsfillsymbollayerv2.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,33 @@
66

77
#include <QPainter>
88

9-
QgsSimpleFillSymbolLayerV2::QgsSimpleFillSymbolLayerV2(QColor color, Qt::BrushStyle style, QColor borderColor, Qt::PenStyle borderStyle, double borderWidth)
10-
: mBrushStyle(style), mBorderColor(borderColor), mBorderStyle(borderStyle), mBorderWidth(borderWidth)
9+
QgsSimpleFillSymbolLayerV2::QgsSimpleFillSymbolLayerV2( QColor color, Qt::BrushStyle style, QColor borderColor, Qt::PenStyle borderStyle, double borderWidth )
10+
: mBrushStyle( style ), mBorderColor( borderColor ), mBorderStyle( borderStyle ), mBorderWidth( borderWidth )
1111
{
1212
mColor = color;
1313
}
1414

1515

16-
QgsSymbolLayerV2* QgsSimpleFillSymbolLayerV2::create(const QgsStringMap& props)
16+
QgsSymbolLayerV2* QgsSimpleFillSymbolLayerV2::create( const QgsStringMap& props )
1717
{
1818
QColor color = DEFAULT_SIMPLEFILL_COLOR;
1919
Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE;
2020
QColor borderColor = DEFAULT_SIMPLEFILL_BORDERCOLOR;
2121
Qt::PenStyle borderStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE;
2222
double borderWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH;
2323

24-
if (props.contains("color"))
25-
color = QgsSymbolLayerV2Utils::decodeColor(props["color"]);
26-
if (props.contains("style"))
27-
style = QgsSymbolLayerV2Utils::decodeBrushStyle(props["style"]);
28-
if (props.contains("color_border"))
29-
borderColor = QgsSymbolLayerV2Utils::decodeColor(props["color_border"]);
30-
if (props.contains("style_border"))
31-
borderStyle = QgsSymbolLayerV2Utils::decodePenStyle(props["style_border"]);
32-
if (props.contains("width_border"))
24+
if ( props.contains( "color" ) )
25+
color = QgsSymbolLayerV2Utils::decodeColor( props["color"] );
26+
if ( props.contains( "style" ) )
27+
style = QgsSymbolLayerV2Utils::decodeBrushStyle( props["style"] );
28+
if ( props.contains( "color_border" ) )
29+
borderColor = QgsSymbolLayerV2Utils::decodeColor( props["color_border"] );
30+
if ( props.contains( "style_border" ) )
31+
borderStyle = QgsSymbolLayerV2Utils::decodePenStyle( props["style_border"] );
32+
if ( props.contains( "width_border" ) )
3333
borderWidth = props["width_border"].toDouble();
3434

35-
return new QgsSimpleFillSymbolLayerV2(color, style, borderColor, borderStyle, borderWidth);
35+
return new QgsSimpleFillSymbolLayerV2( color, style, borderColor, borderStyle, borderWidth );
3636
}
3737

3838

@@ -41,54 +41,54 @@ QString QgsSimpleFillSymbolLayerV2::layerType() const
4141
return "SimpleFill";
4242
}
4343

44-
void QgsSimpleFillSymbolLayerV2::startRender(QgsRenderContext& context)
44+
void QgsSimpleFillSymbolLayerV2::startRender( QgsRenderContext& context )
4545
{
46-
mBrush = QBrush(mColor, mBrushStyle);
47-
mPen = QPen(mBorderColor);
48-
mPen.setStyle(mBorderStyle);
49-
mPen.setWidthF(mBorderWidth);
46+
mBrush = QBrush( mColor, mBrushStyle );
47+
mPen = QPen( mBorderColor );
48+
mPen.setStyle( mBorderStyle );
49+
mPen.setWidthF( mBorderWidth );
5050
}
5151

52-
void QgsSimpleFillSymbolLayerV2::stopRender(QgsRenderContext& context)
52+
void QgsSimpleFillSymbolLayerV2::stopRender( QgsRenderContext& context )
5353
{
5454
}
5555

56-
void QgsSimpleFillSymbolLayerV2::renderPolygon(const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context)
56+
void QgsSimpleFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context )
5757
{
5858
QPainter* p = context.painter();
59-
p->setBrush(mBrush);
60-
p->setPen(mPen);
61-
62-
if (rings == NULL)
59+
p->setBrush( mBrush );
60+
p->setPen( mPen );
61+
62+
if ( rings == NULL )
6363
{
6464
// simple polygon without holes
65-
p->drawPolygon(points);
65+
p->drawPolygon( points );
6666
}
6767
else
6868
{
6969
// polygon with holes must be drawn using painter path
7070
QPainterPath path;
71-
path.addPolygon(points);
71+
path.addPolygon( points );
7272
QList<QPolygonF>::iterator it;
73-
for (it = rings->begin(); it != rings->end(); ++it)
74-
path.addPolygon(*it);
75-
76-
p->drawPath(path);
73+
for ( it = rings->begin(); it != rings->end(); ++it )
74+
path.addPolygon( *it );
75+
76+
p->drawPath( path );
7777
}
7878
}
7979

8080
QgsStringMap QgsSimpleFillSymbolLayerV2::properties() const
8181
{
8282
QgsStringMap map;
83-
map["color"] = QgsSymbolLayerV2Utils::encodeColor(mColor);
84-
map["style"] = QgsSymbolLayerV2Utils::encodeBrushStyle(mBrushStyle);
85-
map["color_border"] = QgsSymbolLayerV2Utils::encodeColor(mBorderColor);
86-
map["style_border"] = QgsSymbolLayerV2Utils::encodePenStyle(mBorderStyle);
87-
map["width_border"] = QString::number(mBorderWidth);
83+
map["color"] = QgsSymbolLayerV2Utils::encodeColor( mColor );
84+
map["style"] = QgsSymbolLayerV2Utils::encodeBrushStyle( mBrushStyle );
85+
map["color_border"] = QgsSymbolLayerV2Utils::encodeColor( mBorderColor );
86+
map["style_border"] = QgsSymbolLayerV2Utils::encodePenStyle( mBorderStyle );
87+
map["width_border"] = QString::number( mBorderWidth );
8888
return map;
8989
}
9090

9191
QgsSymbolLayerV2* QgsSimpleFillSymbolLayerV2::clone() const
9292
{
93-
return new QgsSimpleFillSymbolLayerV2(mColor, mBrushStyle, mBorderColor, mBorderStyle, mBorderWidth);
93+
return new QgsSimpleFillSymbolLayerV2( mColor, mBrushStyle, mBorderColor, mBorderStyle, mBorderWidth );
9494
}

‎src/core/symbology-ng/qgsfillsymbollayerv2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2
2121
QColor borderColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
2222
Qt::PenStyle borderStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
2323
double borderWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH );
24-
24+
2525
// static stuff
2626

2727
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );

‎src/core/symbology-ng/qgslinesymbollayerv2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ QgsSymbolLayerV2* QgsSimpleLineSymbolLayerV2::clone() const
101101
class MyLine
102102
{
103103
public:
104-
MyLine( QPointF p1, QPointF p2 ) : mVertical(false), mIncreasing(false), mT(0.0), mLength(0.0)
104+
MyLine( QPointF p1, QPointF p2 ) : mVertical( false ), mIncreasing( false ), mT( 0.0 ), mLength( 0.0 )
105105
{
106106
if ( p1 == p2 )
107107
return; // invalid
@@ -356,7 +356,7 @@ static double _calculateAngle( double x1, double y1, double x2, double y2 )
356356
{
357357
// return angle (in radians) between two points
358358
if ( x1 == x2 )
359-
return M_PI * ( y2 >= y1 ? 1 / 2 : 3 / 2 ); // angle is 90 or 270
359+
return M_PI *( y2 >= y1 ? 1 / 2 : 3 / 2 ); // angle is 90 or 270
360360

361361
double t = ( y2 - y1 ) / ( x2 - x1 );
362362
if ( t >= 0 )

‎src/core/symbology-ng/qgsstylev2.cpp

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ QgsStyleV2::~QgsStyleV2()
3030

3131
QgsStyleV2* QgsStyleV2::defaultStyle() // static
3232
{
33-
if (mDefaultStyle == NULL)
33+
if ( mDefaultStyle == NULL )
3434
{
3535
QString styleFilename = QgsApplication::userStyleV2Path();
3636

@@ -49,48 +49,48 @@ QgsStyleV2* QgsStyleV2::defaultStyle() // static
4949

5050
void QgsStyleV2::clear()
5151
{
52-
for (QMap<QString, QgsSymbolV2*>::iterator its = mSymbols.begin(); its != mSymbols.end(); ++its)
52+
for ( QMap<QString, QgsSymbolV2*>::iterator its = mSymbols.begin(); its != mSymbols.end(); ++its )
5353
delete its.value();
54-
for (QMap<QString, QgsVectorColorRampV2*>::iterator itr = mColorRamps.begin(); itr != mColorRamps.end(); ++itr)
54+
for ( QMap<QString, QgsVectorColorRampV2*>::iterator itr = mColorRamps.begin(); itr != mColorRamps.end(); ++itr )
5555
delete itr.value();
56-
56+
5757
mSymbols.clear();
5858
mColorRamps.clear();
5959
}
6060

61-
bool QgsStyleV2::addSymbol(QString name, QgsSymbolV2* symbol)
61+
bool QgsStyleV2::addSymbol( QString name, QgsSymbolV2* symbol )
6262
{
63-
if (!symbol || name.count() == 0)
63+
if ( !symbol || name.count() == 0 )
6464
return false;
65-
65+
6666
// delete previous symbol (if any)
67-
if (mSymbols.contains(name))
68-
delete mSymbols.value(name);
69-
70-
mSymbols.insert(name, symbol);
67+
if ( mSymbols.contains( name ) )
68+
delete mSymbols.value( name );
69+
70+
mSymbols.insert( name, symbol );
7171
return true;
7272
}
7373

74-
bool QgsStyleV2::removeSymbol(QString name)
74+
bool QgsStyleV2::removeSymbol( QString name )
7575
{
76-
if (!mSymbols.contains(name))
76+
if ( !mSymbols.contains( name ) )
7777
return false;
78-
78+
7979
// remove from map and delete
80-
delete mSymbols.take(name);
80+
delete mSymbols.take( name );
8181
return true;
8282
}
8383

84-
QgsSymbolV2* QgsStyleV2::symbol(QString name)
84+
QgsSymbolV2* QgsStyleV2::symbol( QString name )
8585
{
86-
if (!mSymbols.contains(name))
86+
if ( !mSymbols.contains( name ) )
8787
return NULL;
8888
return mSymbols[name]->clone();
8989
}
9090

91-
const QgsSymbolV2* QgsStyleV2::symbolRef(QString name) const
91+
const QgsSymbolV2* QgsStyleV2::symbolRef( QString name ) const
9292
{
93-
if (!mSymbols.contains(name))
93+
if ( !mSymbols.contains( name ) )
9494
return NULL;
9595
return mSymbols[name];
9696
}
@@ -106,39 +106,39 @@ QStringList QgsStyleV2::symbolNames()
106106
}
107107

108108

109-
bool QgsStyleV2::addColorRamp(QString name, QgsVectorColorRampV2* colorRamp)
109+
bool QgsStyleV2::addColorRamp( QString name, QgsVectorColorRampV2* colorRamp )
110110
{
111-
if (!colorRamp || name.count() == 0)
111+
if ( !colorRamp || name.count() == 0 )
112112
return false;
113-
113+
114114
// delete previous symbol (if any)
115-
if (mColorRamps.contains(name))
116-
delete mColorRamps.value(name);
117-
118-
mColorRamps.insert(name, colorRamp);
115+
if ( mColorRamps.contains( name ) )
116+
delete mColorRamps.value( name );
117+
118+
mColorRamps.insert( name, colorRamp );
119119
return true;
120120
}
121121

122-
bool QgsStyleV2::removeColorRamp(QString name)
122+
bool QgsStyleV2::removeColorRamp( QString name )
123123
{
124-
if (!mColorRamps.contains(name))
124+
if ( !mColorRamps.contains( name ) )
125125
return false;
126-
126+
127127
// remove from map and delete
128-
delete mColorRamps.take(name);
128+
delete mColorRamps.take( name );
129129
return true;
130130
}
131131

132-
QgsVectorColorRampV2* QgsStyleV2::colorRamp(QString name)
132+
QgsVectorColorRampV2* QgsStyleV2::colorRamp( QString name )
133133
{
134-
if (!mColorRamps.contains(name))
134+
if ( !mColorRamps.contains( name ) )
135135
return NULL;
136136
return mColorRamps[name]->clone();
137137
}
138138

139-
const QgsVectorColorRampV2* QgsStyleV2::colorRampRef(QString name) const
139+
const QgsVectorColorRampV2* QgsStyleV2::colorRampRef( QString name ) const
140140
{
141-
if (!mColorRamps.contains(name))
141+
if ( !mColorRamps.contains( name ) )
142142
return NULL;
143143
return mColorRamps[name];
144144
}
@@ -147,71 +147,71 @@ int QgsStyleV2::colorRampCount()
147147
{
148148
return mColorRamps.count();
149149
}
150-
150+
151151
QStringList QgsStyleV2::colorRampNames()
152152
{
153153
return mColorRamps.keys();
154154
}
155155

156156

157-
bool QgsStyleV2::load(QString filename)
157+
bool QgsStyleV2::load( QString filename )
158158
{
159159
mErrorString = QString();
160-
160+
161161
// import xml file
162-
QDomDocument doc("style");
163-
QFile f(filename);
164-
if (!f.open(QFile::ReadOnly))
162+
QDomDocument doc( "style" );
163+
QFile f( filename );
164+
if ( !f.open( QFile::ReadOnly ) )
165165
{
166166
mErrorString = "Couldn't open the style file: " + filename;
167167
return false;
168168
}
169-
169+
170170
// parse the document
171-
if (!doc.setContent(&f))
171+
if ( !doc.setContent( &f ) )
172172
{
173173
mErrorString = "Couldn't parse the style file: " + filename;
174174
f.close();
175175
return false;
176176
}
177177
f.close();
178-
178+
179179
QDomElement docElem = doc.documentElement();
180-
if (docElem.tagName() != "qgis_style")
180+
if ( docElem.tagName() != "qgis_style" )
181181
{
182182
mErrorString = "Incorrect root tag in style: " + docElem.tagName();
183183
return false;
184184
}
185185

186186
// check for style version
187-
QString version = docElem.attribute("version");
188-
if (version != STYLE_CURRENT_VERSION)
187+
QString version = docElem.attribute( "version" );
188+
if ( version != STYLE_CURRENT_VERSION )
189189
{
190190
mErrorString = "Unknown style file version: " + version;
191191
return false;
192192
}
193193

194194
// load symbols
195-
QDomElement symbolsElement = docElem.firstChildElement("symbols");
196-
if (!symbolsElement.isNull())
195+
QDomElement symbolsElement = docElem.firstChildElement( "symbols" );
196+
if ( !symbolsElement.isNull() )
197197
{
198-
mSymbols = QgsSymbolLayerV2Utils::loadSymbols(symbolsElement);
198+
mSymbols = QgsSymbolLayerV2Utils::loadSymbols( symbolsElement );
199199
}
200200

201201
// load color ramps
202-
QDomElement rampsElement = docElem.firstChildElement("colorramps");
202+
QDomElement rampsElement = docElem.firstChildElement( "colorramps" );
203203
QDomElement e = rampsElement.firstChildElement();
204-
while (!e.isNull())
204+
while ( !e.isNull() )
205205
{
206-
if (e.tagName() == "colorramp")
206+
if ( e.tagName() == "colorramp" )
207207
{
208-
QgsVectorColorRampV2* ramp = QgsSymbolLayerV2Utils::loadColorRamp(e);
209-
if (ramp != NULL)
210-
addColorRamp(e.attribute("name"), ramp);
208+
QgsVectorColorRampV2* ramp = QgsSymbolLayerV2Utils::loadColorRamp( e );
209+
if ( ramp != NULL )
210+
addColorRamp( e.attribute( "name" ), ramp );
211211
}
212212
else
213213
{
214-
QgsDebugMsg("unknown tag: " + e.tagName());
214+
QgsDebugMsg( "unknown tag: " + e.tagName() );
215215
}
216216
e = e.nextSiblingElement();
217217
}
@@ -222,42 +222,42 @@ bool QgsStyleV2::load(QString filename)
222222

223223

224224

225-
bool QgsStyleV2::save(QString filename)
225+
bool QgsStyleV2::save( QString filename )
226226
{
227227
mErrorString = QString();
228-
if (filename.isEmpty())
228+
if ( filename.isEmpty() )
229229
filename = mFileName;
230-
231-
QDomDocument doc("qgis_style");
232-
QDomElement root = doc.createElement("qgis_style");
233-
root.setAttribute("version", STYLE_CURRENT_VERSION);
234-
doc.appendChild(root);
235230

236-
QDomElement symbolsElem = QgsSymbolLayerV2Utils::saveSymbols(mSymbols, "symbols", doc);
231+
QDomDocument doc( "qgis_style" );
232+
QDomElement root = doc.createElement( "qgis_style" );
233+
root.setAttribute( "version", STYLE_CURRENT_VERSION );
234+
doc.appendChild( root );
235+
236+
QDomElement symbolsElem = QgsSymbolLayerV2Utils::saveSymbols( mSymbols, "symbols", doc );
237+
238+
QDomElement rampsElem = doc.createElement( "colorramps" );
237239

238-
QDomElement rampsElem = doc.createElement("colorramps");
239-
240240
// save color ramps
241-
for (QMap<QString, QgsVectorColorRampV2*>::iterator itr = mColorRamps.begin(); itr != mColorRamps.end(); ++itr)
241+
for ( QMap<QString, QgsVectorColorRampV2*>::iterator itr = mColorRamps.begin(); itr != mColorRamps.end(); ++itr )
242242
{
243-
QDomElement rampEl = QgsSymbolLayerV2Utils::saveColorRamp(itr.key(), itr.value(), doc);
244-
rampsElem.appendChild(rampEl);
243+
QDomElement rampEl = QgsSymbolLayerV2Utils::saveColorRamp( itr.key(), itr.value(), doc );
244+
rampsElem.appendChild( rampEl );
245245
}
246246

247-
root.appendChild(symbolsElem);
248-
root.appendChild(rampsElem);
249-
247+
root.appendChild( symbolsElem );
248+
root.appendChild( rampsElem );
249+
250250
// save
251-
QFile f(filename);
252-
if (!f.open(QFile::WriteOnly))
251+
QFile f( filename );
252+
if ( !f.open( QFile::WriteOnly ) )
253253
{
254-
mErrorString = "Couldn't open file for writing: "+filename;
254+
mErrorString = "Couldn't open file for writing: " + filename;
255255
return false;
256256
}
257-
QTextStream ts(&f);
258-
doc.save(ts, 2);
257+
QTextStream ts( &f );
258+
doc.save( ts, 2 );
259259
f.close();
260-
260+
261261
mFileName = filename;
262262
return true;
263263
}

‎src/core/symbology/qgssymbol.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ void QgsSymbol::setNamedPointSymbol( QString name )
218218
QgsDebugMsg( "Name: " + name );
219219
//see if we can resolve the problem...
220220
//
221-
221+
222222
QStringList svgPaths = QgsApplication::svgPaths();
223-
for( int i=0; i<svgPaths.size(); i++)
223+
for ( int i = 0; i < svgPaths.size(); i++ )
224224
{
225225
QgsDebugMsg( "SvgPath: " + svgPaths[i] );
226226
QFileInfo myInfo( myTempName );
@@ -515,14 +515,14 @@ bool QgsSymbol::writeXML( QDomNode & item, QDomDocument & document, const QgsVec
515515

516516
QStringList svgPaths = QgsApplication::svgPaths();
517517

518-
for(int i=0; i<svgPaths.size(); i++)
518+
for ( int i = 0; i < svgPaths.size(); i++ )
519519
{
520520
QString dir = QFileInfo( svgPaths[i] ).canonicalFilePath();
521521

522522
if ( !dir.isEmpty() && name.startsWith( dir ) )
523523
{
524524
name = name.mid( dir.size() );
525-
break;
525+
break;
526526
}
527527
}
528528
}

‎src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories()
260260
if ( ramp == NULL )
261261
{
262262
if ( cboCategorizedColorRamp->count() == 0 )
263-
QMessageBox::critical( this, tr("Error"), tr("There are no available color ramps. You can add them in Style Manager.") );
263+
QMessageBox::critical( this, tr( "Error" ), tr( "There are no available color ramps. You can add them in Style Manager." ) );
264264
else
265-
QMessageBox::critical( this, tr("Error"), tr("The selected color ramp is not available.") );
265+
QMessageBox::critical( this, tr( "Error" ), tr( "The selected color ramp is not available." ) );
266266
return;
267267
}
268268

‎src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,46 @@
1616
#include <QStandardItem>
1717

1818

19-
QgsRendererV2Widget* QgsGraduatedSymbolRendererV2Widget::create(QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer)
19+
QgsRendererV2Widget* QgsGraduatedSymbolRendererV2Widget::create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer )
2020
{
21-
return new QgsGraduatedSymbolRendererV2Widget(layer, style, renderer);
21+
return new QgsGraduatedSymbolRendererV2Widget( layer, style, renderer );
2222
}
2323

24-
QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget(QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer)
25-
: QgsRendererV2Widget(layer, style)
24+
QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer )
25+
: QgsRendererV2Widget( layer, style )
2626
{
2727

2828
// try to recognize the previous renderer
2929
// (null renderer means "no previous renderer")
30-
if (!renderer || renderer->type() != "graduatedSymbol")
30+
if ( !renderer || renderer->type() != "graduatedSymbol" )
3131
{
3232
// we're not going to use it - so let's delete the renderer
3333
delete renderer;
3434

35-
mRenderer = new QgsGraduatedSymbolRendererV2("", QgsRangeList());
35+
mRenderer = new QgsGraduatedSymbolRendererV2( "", QgsRangeList() );
3636
}
3737
else
3838
{
39-
mRenderer = static_cast<QgsGraduatedSymbolRendererV2*>(renderer);
39+
mRenderer = static_cast<QgsGraduatedSymbolRendererV2*>( renderer );
4040
}
4141

4242
// setup user interface
43-
setupUi(this);
43+
setupUi( this );
4444

4545
populateColumns();
4646
populateColorRamps();
47-
QStandardItemModel* mg = new QStandardItemModel(this);
47+
QStandardItemModel* mg = new QStandardItemModel( this );
4848
QStringList labels;
4949
labels << "Range" << "Label";
50-
mg->setHorizontalHeaderLabels(labels);
51-
viewGraduated->setModel(mg);
50+
mg->setHorizontalHeaderLabels( labels );
51+
viewGraduated->setModel( mg );
5252

53-
mGraduatedSymbol = QgsSymbolV2::defaultSymbol(mLayer->geometryType());
53+
mGraduatedSymbol = QgsSymbolV2::defaultSymbol( mLayer->geometryType() );
5454

55-
connect(viewGraduated, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(rangesDoubleClicked(const QModelIndex &)));
55+
connect( viewGraduated, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( rangesDoubleClicked( const QModelIndex & ) ) );
5656

57-
connect(btnGraduatedClassify, SIGNAL(clicked()), this, SLOT(classifyGraduated()));
58-
connect(btnChangeGraduatedSymbol, SIGNAL(clicked()), this, SLOT(changeGraduatedSymbol()));
57+
connect( btnGraduatedClassify, SIGNAL( clicked() ), this, SLOT( classifyGraduated() ) );
58+
connect( btnChangeGraduatedSymbol, SIGNAL( clicked() ), this, SLOT( changeGraduatedSymbol() ) );
5959

6060
// initialize from previously set renderer
6161
updateUiFromRenderer();
@@ -79,36 +79,36 @@ void QgsGraduatedSymbolRendererV2Widget::updateUiFromRenderer()
7979
populateRanges();
8080

8181
// update UI from the graduated renderer (update combo boxes, view)
82-
if (mRenderer->mode() < cboGraduatedMode->count())
82+
if ( mRenderer->mode() < cboGraduatedMode->count() )
8383
cboGraduatedMode->setCurrentIndex( mRenderer->mode() );
84-
if (mRenderer->ranges().count())
84+
if ( mRenderer->ranges().count() )
8585
spinGraduatedClasses->setValue( mRenderer->ranges().count() );
8686

8787
// set column
8888
//disconnect(cboGraduatedColumn, SIGNAL(currentIndexChanged(int)), this, SLOT(graduatedColumnChanged()));
8989
QString attrName = mRenderer->classAttribute();
90-
int idx = cboGraduatedColumn->findText(attrName, Qt::MatchExactly);
91-
cboGraduatedColumn->setCurrentIndex(idx >= 0 ? idx : 0);
90+
int idx = cboGraduatedColumn->findText( attrName, Qt::MatchExactly );
91+
cboGraduatedColumn->setCurrentIndex( idx >= 0 ? idx : 0 );
9292
//connect(cboGraduatedColumn, SIGNAL(currentIndexChanged(int)), this, SLOT(graduatedColumnChanged()));
9393

9494
// set source symbol
95-
if (mRenderer->sourceSymbol())
95+
if ( mRenderer->sourceSymbol() )
9696
{
9797
delete mGraduatedSymbol;
9898
mGraduatedSymbol = mRenderer->sourceSymbol()->clone();
9999
updateGraduatedSymbolIcon();
100100
}
101101

102102
// set source color ramp
103-
if (mRenderer->sourceColorRamp())
103+
if ( mRenderer->sourceColorRamp() )
104104
{
105-
QSize rampIconSize(50,16);
106-
QIcon icon = QgsSymbolLayerV2Utils::colorRampPreviewIcon(mRenderer->sourceColorRamp(), rampIconSize);
107-
if (cboGraduatedColorRamp->itemText(0) == "[source]")
108-
cboGraduatedColorRamp->setItemIcon(0, icon);
105+
QSize rampIconSize( 50, 16 );
106+
QIcon icon = QgsSymbolLayerV2Utils::colorRampPreviewIcon( mRenderer->sourceColorRamp(), rampIconSize );
107+
if ( cboGraduatedColorRamp->itemText( 0 ) == "[source]" )
108+
cboGraduatedColorRamp->setItemIcon( 0, icon );
109109
else
110-
cboGraduatedColorRamp->insertItem(0, icon, "[source]");
111-
cboGraduatedColorRamp->setCurrentIndex(0);
110+
cboGraduatedColorRamp->insertItem( 0, icon, "[source]" );
111+
cboGraduatedColorRamp->setCurrentIndex( 0 );
112112
}
113113

114114
}
@@ -120,25 +120,25 @@ void QgsGraduatedSymbolRendererV2Widget::populateColumns()
120120
cboGraduatedColumn->clear();
121121
const QgsFieldMap& flds = mLayer->pendingFields();
122122
QgsFieldMap::ConstIterator it = flds.begin();
123-
for ( ; it != flds.end(); ++it)
123+
for ( ; it != flds.end(); ++it )
124124
{
125-
if (it->type() == QVariant::Double || it->type() == QVariant::Int)
126-
cboGraduatedColumn->addItem(it->name());
125+
if ( it->type() == QVariant::Double || it->type() == QVariant::Int )
126+
cboGraduatedColumn->addItem( it->name() );
127127
}
128128
}
129129

130130

131131
void QgsGraduatedSymbolRendererV2Widget::populateColorRamps()
132132
{
133-
QSize rampIconSize(50,16);
134-
cboGraduatedColorRamp->setIconSize(rampIconSize);
133+
QSize rampIconSize( 50, 16 );
134+
cboGraduatedColorRamp->setIconSize( rampIconSize );
135135

136136
QStringList rampNames = mStyle->colorRampNames();
137-
for (QStringList::iterator it = rampNames.begin(); it != rampNames.end(); ++it)
137+
for ( QStringList::iterator it = rampNames.begin(); it != rampNames.end(); ++it )
138138
{
139-
QgsVectorColorRampV2* ramp = mStyle->colorRamp(*it);
140-
QIcon icon = QgsSymbolLayerV2Utils::colorRampPreviewIcon(ramp, rampIconSize);
141-
cboGraduatedColorRamp->addItem(icon, *it);
139+
QgsVectorColorRampV2* ramp = mStyle->colorRamp( *it );
140+
QIcon icon = QgsSymbolLayerV2Utils::colorRampPreviewIcon( ramp, rampIconSize );
141+
cboGraduatedColorRamp->addItem( icon, *it );
142142
delete ramp;
143143
}
144144
}
@@ -153,81 +153,81 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()
153153

154154
QgsVectorColorRampV2* ramp = NULL;
155155
QString rampName = cboGraduatedColorRamp->currentText();
156-
if (rampName == "[source]")
156+
if ( rampName == "[source]" )
157157
ramp = mRenderer->sourceColorRamp()->clone();
158158
else
159159
ramp = mStyle->colorRamp( rampName );
160160

161161
if ( ramp == NULL )
162162
{
163163
if ( cboGraduatedColorRamp->count() == 0 )
164-
QMessageBox::critical( this, tr("Error"), tr("There are no available color ramps. You can add them in Style Manager.") );
164+
QMessageBox::critical( this, tr( "Error" ), tr( "There are no available color ramps. You can add them in Style Manager." ) );
165165
else
166-
QMessageBox::critical( this, tr("Error"), tr("The selected color ramp is not available.") );
166+
QMessageBox::critical( this, tr( "Error" ), tr( "The selected color ramp is not available." ) );
167167
return;
168168
}
169169

170170
QgsGraduatedSymbolRendererV2::Mode mode;
171-
if (cboGraduatedMode->currentIndex() == 0)
171+
if ( cboGraduatedMode->currentIndex() == 0 )
172172
mode = QgsGraduatedSymbolRendererV2::EqualInterval;
173173
else
174174
mode = QgsGraduatedSymbolRendererV2::Quantile;
175175

176176
// create and set new renderer
177177
delete mRenderer;
178178
mRenderer = QgsGraduatedSymbolRendererV2::createRenderer(
179-
mLayer, attrName, classes, mode, mGraduatedSymbol, ramp);
179+
mLayer, attrName, classes, mode, mGraduatedSymbol, ramp );
180180

181181
populateRanges();
182182
}
183183

184184
void QgsGraduatedSymbolRendererV2Widget::changeGraduatedSymbol()
185185
{
186-
QgsSymbolV2SelectorDialog dlg(mGraduatedSymbol, mStyle, this);
187-
if (!dlg.exec())
186+
QgsSymbolV2SelectorDialog dlg( mGraduatedSymbol, mStyle, this );
187+
if ( !dlg.exec() )
188188
return;
189189

190190
updateGraduatedSymbolIcon();
191191
}
192192

193193
void QgsGraduatedSymbolRendererV2Widget::updateGraduatedSymbolIcon()
194194
{
195-
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon(mGraduatedSymbol, btnChangeGraduatedSymbol->iconSize());
196-
btnChangeGraduatedSymbol->setIcon(icon);
195+
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( mGraduatedSymbol, btnChangeGraduatedSymbol->iconSize() );
196+
btnChangeGraduatedSymbol->setIcon( icon );
197197
}
198198

199199

200200
void QgsGraduatedSymbolRendererV2Widget::populateRanges()
201201
{
202202

203-
QStandardItemModel* m = qobject_cast<QStandardItemModel*>(viewGraduated->model());
203+
QStandardItemModel* m = qobject_cast<QStandardItemModel*>( viewGraduated->model() );
204204
m->clear();
205205

206206
QStringList labels;
207207
labels << "Range" << "Label";
208-
m->setHorizontalHeaderLabels(labels);
208+
m->setHorizontalHeaderLabels( labels );
209209

210-
QSize iconSize(16,16);
210+
QSize iconSize( 16, 16 );
211211

212212
int i, count = mRenderer->ranges().count();
213213

214-
for (i = 0; i < count; i++)
214+
for ( i = 0; i < count; i++ )
215215
{
216216
const QgsRendererRangeV2& range = mRenderer->ranges()[i];
217-
QString rangeStr = QString::number(range.lowerValue(),'f',4) + " - " + QString::number(range.upperValue(),'f',4);
217+
QString rangeStr = QString::number( range.lowerValue(), 'f', 4 ) + " - " + QString::number( range.upperValue(), 'f', 4 );
218218

219-
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon(range.symbol(), iconSize);
220-
QStandardItem* item = new QStandardItem(icon, rangeStr);
219+
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( range.symbol(), iconSize );
220+
QStandardItem* item = new QStandardItem( icon, rangeStr );
221221
//item->setData(k); // set attribute value as user role
222-
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
222+
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
223223

224224
QList<QStandardItem *> list;
225-
list << item << new QStandardItem(range.label());
225+
list << item << new QStandardItem( range.label() );
226226
m->appendRow( list );
227227
}
228228

229229
// make sure that the "range" column has visible context
230-
viewGraduated->resizeColumnToContents(0);
230+
viewGraduated->resizeColumnToContents( 0 );
231231
}
232232

233233

@@ -241,25 +241,25 @@ int QgsRendererV2PropertiesDialog::currentRangeRow()
241241
}
242242
*/
243243

244-
void QgsGraduatedSymbolRendererV2Widget::rangesDoubleClicked(const QModelIndex & idx)
244+
void QgsGraduatedSymbolRendererV2Widget::rangesDoubleClicked( const QModelIndex & idx )
245245
{
246-
if (idx.isValid() && idx.column() == 0)
247-
changeRangeSymbol(idx.row());
246+
if ( idx.isValid() && idx.column() == 0 )
247+
changeRangeSymbol( idx.row() );
248248
}
249249

250-
void QgsGraduatedSymbolRendererV2Widget::changeRangeSymbol(int rangeIdx)
250+
void QgsGraduatedSymbolRendererV2Widget::changeRangeSymbol( int rangeIdx )
251251
{
252252

253253
QgsSymbolV2* newSymbol = mRenderer->ranges()[rangeIdx].symbol()->clone();
254254

255-
QgsSymbolV2SelectorDialog dlg(newSymbol, mStyle, this);
256-
if (!dlg.exec())
255+
QgsSymbolV2SelectorDialog dlg( newSymbol, mStyle, this );
256+
if ( !dlg.exec() )
257257
{
258258
delete newSymbol;
259259
return;
260260
}
261261

262-
mRenderer->updateRangeSymbol(rangeIdx, newSymbol);
262+
mRenderer->updateRangeSymbol( rangeIdx, newSymbol );
263263

264264
populateRanges();
265265
}

‎src/gui/symbology-ng/qgspenstylecombobox.cpp

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,99 +9,99 @@
99
#include <QPainter>
1010
#include <QPen>
1111

12-
QgsPenStyleComboBox::QgsPenStyleComboBox(QWidget* parent)
13-
: QComboBox(parent)
12+
QgsPenStyleComboBox::QgsPenStyleComboBox( QWidget* parent )
13+
: QComboBox( parent )
1414
{
1515
QList < QPair<Qt::PenStyle, QString> > styles;
16-
styles << qMakePair(Qt::SolidLine, QString("Solid Line"))
17-
<< qMakePair(Qt::DashLine, QString("Dash Line"))
18-
<< qMakePair(Qt::DotLine, QString("Dot Line"))
19-
<< qMakePair(Qt::DashDotLine, QString("Dash Dot Line"))
20-
<< qMakePair(Qt::DashDotDotLine, QString("Dash Dot Dot Line"))
21-
<< qMakePair(Qt::NoPen, QString("No Pen"));
22-
23-
setIconSize(QSize(32,12));
24-
25-
for (int i = 0; i < styles.count(); i++)
16+
styles << qMakePair( Qt::SolidLine, QString( "Solid Line" ) )
17+
<< qMakePair( Qt::DashLine, QString( "Dash Line" ) )
18+
<< qMakePair( Qt::DotLine, QString( "Dot Line" ) )
19+
<< qMakePair( Qt::DashDotLine, QString( "Dash Dot Line" ) )
20+
<< qMakePair( Qt::DashDotDotLine, QString( "Dash Dot Dot Line" ) )
21+
<< qMakePair( Qt::NoPen, QString( "No Pen" ) );
22+
23+
setIconSize( QSize( 32, 12 ) );
24+
25+
for ( int i = 0; i < styles.count(); i++ )
2626
{
27-
Qt::PenStyle style = styles.at(i).first;
28-
QString name = styles.at(i).second;
29-
addItem(iconForPen(style), name, QVariant(style));
27+
Qt::PenStyle style = styles.at( i ).first;
28+
QString name = styles.at( i ).second;
29+
addItem( iconForPen( style ), name, QVariant( style ) );
3030
}
3131
}
32-
32+
3333
Qt::PenStyle QgsPenStyleComboBox::penStyle() const
3434
{
35-
return (Qt::PenStyle) itemData(currentIndex()).toInt();
35+
return ( Qt::PenStyle ) itemData( currentIndex() ).toInt();
3636
}
37-
38-
void QgsPenStyleComboBox::setPenStyle(Qt::PenStyle style)
37+
38+
void QgsPenStyleComboBox::setPenStyle( Qt::PenStyle style )
3939
{
40-
int idx = findData(QVariant(style));
40+
int idx = findData( QVariant( style ) );
4141
setCurrentIndex( idx == -1 ? 0 : idx );
4242
}
4343

44-
QIcon QgsPenStyleComboBox::iconForPen(Qt::PenStyle style)
44+
QIcon QgsPenStyleComboBox::iconForPen( Qt::PenStyle style )
4545
{
46-
QPixmap pix(iconSize());
46+
QPixmap pix( iconSize() );
4747
QPainter p;
48-
pix.fill(Qt::transparent);
49-
50-
p.begin(&pix);
51-
QPen pen(style);
52-
pen.setWidth(2);
53-
p.setPen(pen);
48+
pix.fill( Qt::transparent );
49+
50+
p.begin( &pix );
51+
QPen pen( style );
52+
pen.setWidth( 2 );
53+
p.setPen( pen );
5454
double mid = iconSize().height() / 2.0;
55-
p.drawLine(0,mid,iconSize().width(),mid);
55+
p.drawLine( 0, mid, iconSize().width(), mid );
5656
p.end();
57-
58-
return QIcon(pix);
57+
58+
return QIcon( pix );
5959
}
6060

6161

6262
/////////
6363
// join
6464

65-
QgsPenJoinStyleComboBox::QgsPenJoinStyleComboBox(QWidget* parent)
66-
: QComboBox(parent)
65+
QgsPenJoinStyleComboBox::QgsPenJoinStyleComboBox( QWidget* parent )
66+
: QComboBox( parent )
6767
{
6868
QString path = QgsApplication::defaultThemePath();
69-
addItem(QIcon(path + "/join_bevel.png"), tr("Bevel"), QVariant(Qt::BevelJoin));
70-
addItem(QIcon(path + "/join_miter.png"), tr("Miter"), QVariant(Qt::MiterJoin));
71-
addItem(QIcon(path + "/join_round.png"), tr("Round"), QVariant(Qt::RoundJoin));
69+
addItem( QIcon( path + "/join_bevel.png" ), tr( "Bevel" ), QVariant( Qt::BevelJoin ) );
70+
addItem( QIcon( path + "/join_miter.png" ), tr( "Miter" ), QVariant( Qt::MiterJoin ) );
71+
addItem( QIcon( path + "/join_round.png" ), tr( "Round" ), QVariant( Qt::RoundJoin ) );
7272
}
7373

7474
Qt::PenJoinStyle QgsPenJoinStyleComboBox::penJoinStyle() const
7575
{
76-
return (Qt::PenJoinStyle) itemData(currentIndex()).toInt();
76+
return ( Qt::PenJoinStyle ) itemData( currentIndex() ).toInt();
7777
}
7878

79-
void QgsPenJoinStyleComboBox::setPenJoinStyle(Qt::PenJoinStyle style)
79+
void QgsPenJoinStyleComboBox::setPenJoinStyle( Qt::PenJoinStyle style )
8080
{
81-
int idx = findData(QVariant(style));
81+
int idx = findData( QVariant( style ) );
8282
setCurrentIndex( idx == -1 ? 0 : idx );
8383
}
8484

8585

8686
/////////
8787
// cap
8888

89-
QgsPenCapStyleComboBox::QgsPenCapStyleComboBox(QWidget* parent)
90-
: QComboBox(parent)
89+
QgsPenCapStyleComboBox::QgsPenCapStyleComboBox( QWidget* parent )
90+
: QComboBox( parent )
9191
{
9292
QString path = QgsApplication::defaultThemePath();
93-
addItem(QIcon(path + "/cap_square.png"), tr("Square"), QVariant(Qt::SquareCap));
94-
addItem(QIcon(path + "/cap_flat.png"), tr("Flat"), QVariant(Qt::FlatCap));
95-
addItem(QIcon(path + "/cap_round.png"), tr("Round"), QVariant(Qt::RoundCap));
93+
addItem( QIcon( path + "/cap_square.png" ), tr( "Square" ), QVariant( Qt::SquareCap ) );
94+
addItem( QIcon( path + "/cap_flat.png" ), tr( "Flat" ), QVariant( Qt::FlatCap ) );
95+
addItem( QIcon( path + "/cap_round.png" ), tr( "Round" ), QVariant( Qt::RoundCap ) );
9696
}
9797

9898
Qt::PenCapStyle QgsPenCapStyleComboBox::penCapStyle() const
9999
{
100-
return (Qt::PenCapStyle) itemData(currentIndex()).toInt();
100+
return ( Qt::PenCapStyle ) itemData( currentIndex() ).toInt();
101101
}
102102

103-
void QgsPenCapStyleComboBox::setPenCapStyle(Qt::PenCapStyle style)
103+
void QgsPenCapStyleComboBox::setPenCapStyle( Qt::PenCapStyle style )
104104
{
105-
int idx = findData(QVariant(style));
105+
int idx = findData( QVariant( style ) );
106106
setCurrentIndex( idx == -1 ? 0 : idx );
107107
}

‎src/gui/symbology-ng/qgssymbollayerv2widget.cpp

Lines changed: 197 additions & 197 deletions
Large diffs are not rendered by default.

‎src/gui/symbology-ng/qgssymbolv2selectordialog.cpp

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -15,96 +15,96 @@
1515
#include <QInputDialog>
1616
#include <QKeyEvent>
1717

18-
QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog(QgsSymbolV2* symbol, QgsStyleV2* style, QWidget* parent, bool embedded)
19-
: QDialog(parent)
18+
QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, QWidget* parent, bool embedded )
19+
: QDialog( parent )
2020
{
2121
mStyle = style;
2222
mSymbol = symbol;
23-
24-
setupUi(this);
23+
24+
setupUi( this );
2525

2626
// can be embedded in renderer properties dialog
27-
if (embedded)
27+
if ( embedded )
2828
{
2929
buttonBox->hide();
30-
layout()->setContentsMargins(0,0,0,0);
30+
layout()->setContentsMargins( 0, 0, 0, 0 );
3131
}
32-
33-
connect(btnSymbolProperties, SIGNAL(clicked()), this, SLOT(changeSymbolProperties()));
32+
33+
connect( btnSymbolProperties, SIGNAL( clicked() ), this, SLOT( changeSymbolProperties() ) );
3434

3535

36-
QStandardItemModel* model = new QStandardItemModel(viewSymbols);
37-
viewSymbols->setModel(model);
38-
connect(viewSymbols, SIGNAL(clicked(const QModelIndex &)), this, SLOT(setSymbolFromStyle(const QModelIndex &)));
36+
QStandardItemModel* model = new QStandardItemModel( viewSymbols );
37+
viewSymbols->setModel( model );
38+
connect( viewSymbols, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) );
3939

4040
populateSymbolView();
4141
updateSymbolPreview();
4242
updateSymbolInfo();
43-
43+
4444
// select correct page in stacked widget
4545
// there's a correspondence between symbol type number and page numbering => exploit it!
46-
stackedWidget->setCurrentIndex(symbol->type());
47-
48-
connect(btnColorMarker, SIGNAL(clicked()), this, SLOT(setSymbolColor()));
49-
connect(btnColorLine, SIGNAL(clicked()), this, SLOT(setSymbolColor()));
50-
connect(btnColorFill, SIGNAL(clicked()), this, SLOT(setSymbolColor()));
51-
connect(spinAngle, SIGNAL(valueChanged(double)), this, SLOT(setMarkerAngle(double)));
52-
connect(spinSize, SIGNAL(valueChanged(double)), this, SLOT(setMarkerSize(double)));
53-
connect(spinWidth, SIGNAL(valueChanged(double)), this, SLOT(setLineWidth(double)));
54-
55-
connect(btnAddToStyle, SIGNAL(clicked()), this, SLOT(addSymbolToStyle()));
46+
stackedWidget->setCurrentIndex( symbol->type() );
47+
48+
connect( btnColorMarker, SIGNAL( clicked() ), this, SLOT( setSymbolColor() ) );
49+
connect( btnColorLine, SIGNAL( clicked() ), this, SLOT( setSymbolColor() ) );
50+
connect( btnColorFill, SIGNAL( clicked() ), this, SLOT( setSymbolColor() ) );
51+
connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerAngle( double ) ) );
52+
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerSize( double ) ) );
53+
connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( setLineWidth( double ) ) );
54+
55+
connect( btnAddToStyle, SIGNAL( clicked() ), this, SLOT( addSymbolToStyle() ) );
5656
btnSymbolProperties->setIcon( QIcon( QgsApplication::defaultThemePath() + "mActionOptions.png" ) );
5757
btnAddToStyle->setIcon( QIcon( QgsApplication::defaultThemePath() + "symbologyAdd.png" ) );
5858
}
5959

6060
void QgsSymbolV2SelectorDialog::populateSymbolView()
61-
{
61+
{
6262
QSize previewSize = viewSymbols->iconSize();
63-
QPixmap p(previewSize);
63+
QPixmap p( previewSize );
6464
QPainter painter;
6565

66-
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(viewSymbols->model());
67-
if (!model)
66+
QStandardItemModel* model = qobject_cast<QStandardItemModel*>( viewSymbols->model() );
67+
if ( !model )
6868
return;
6969
model->clear();
7070

7171
QStringList names = mStyle->symbolNames();
72-
for (int i = 0; i < names.count(); i++)
72+
for ( int i = 0; i < names.count(); i++ )
7373
{
74-
QgsSymbolV2* s = mStyle->symbol(names[i]);
75-
if (s->type() != mSymbol->type())
74+
QgsSymbolV2* s = mStyle->symbol( names[i] );
75+
if ( s->type() != mSymbol->type() )
7676
{
7777
delete s;
7878
continue;
7979
}
80-
QStandardItem* item = new QStandardItem(names[i]);
81-
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
80+
QStandardItem* item = new QStandardItem( names[i] );
81+
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
8282
// create preview icon
83-
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon(s, previewSize);
84-
item->setIcon(icon);
83+
QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( s, previewSize );
84+
item->setIcon( icon );
8585
// add to model
86-
model->appendRow(item);
86+
model->appendRow( item );
8787
delete s;
8888
}
8989
}
9090

91-
void QgsSymbolV2SelectorDialog::setSymbolFromStyle(const QModelIndex & index)
91+
void QgsSymbolV2SelectorDialog::setSymbolFromStyle( const QModelIndex & index )
9292
{
9393
QString symbolName = index.data().toString();
9494
// get new instance of symbol from style
95-
QgsSymbolV2* s = mStyle->symbol(symbolName);
95+
QgsSymbolV2* s = mStyle->symbol( symbolName );
9696
// remove all symbol layers from original symbol
97-
while (mSymbol->symbolLayerCount())
98-
mSymbol->deleteSymbolLayer(0);
97+
while ( mSymbol->symbolLayerCount() )
98+
mSymbol->deleteSymbolLayer( 0 );
9999
// move all symbol layers to our symbol
100-
while (s->symbolLayerCount())
100+
while ( s->symbolLayerCount() )
101101
{
102-
QgsSymbolLayerV2* sl = s->takeSymbolLayer(0);
103-
mSymbol->appendSymbolLayer(sl);
102+
QgsSymbolLayerV2* sl = s->takeSymbolLayer( 0 );
103+
mSymbol->appendSymbolLayer( sl );
104104
}
105105
// delete the temporary symbol
106106
delete s;
107-
107+
108108
updateSymbolPreview();
109109
updateSymbolInfo();
110110
emit symbolModified();
@@ -113,40 +113,40 @@ void QgsSymbolV2SelectorDialog::setSymbolFromStyle(const QModelIndex & index)
113113
void QgsSymbolV2SelectorDialog::updateSymbolPreview()
114114
{
115115
QImage preview = mSymbol->bigSymbolPreviewImage();
116-
lblPreview->setPixmap(QPixmap::fromImage(preview));
116+
lblPreview->setPixmap( QPixmap::fromImage( preview ) );
117117
}
118118

119119
void QgsSymbolV2SelectorDialog::updateSymbolColor()
120120
{
121121
QColor c = mSymbol->color();
122-
btnColorMarker->setColor(c);
123-
btnColorLine->setColor(c);
124-
btnColorFill->setColor(c);
122+
btnColorMarker->setColor( c );
123+
btnColorLine->setColor( c );
124+
btnColorFill->setColor( c );
125125
}
126126

127127
void QgsSymbolV2SelectorDialog::updateSymbolInfo()
128128
{
129129
updateSymbolColor();
130-
131-
if (mSymbol->type() == QgsSymbolV2::Marker)
130+
131+
if ( mSymbol->type() == QgsSymbolV2::Marker )
132132
{
133-
QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>(mSymbol);
134-
spinSize->setValue(markerSymbol->size());
135-
spinAngle->setValue(markerSymbol->angle());
133+
QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
134+
spinSize->setValue( markerSymbol->size() );
135+
spinAngle->setValue( markerSymbol->angle() );
136136
}
137-
else if (mSymbol->type() == QgsSymbolV2::Line)
137+
else if ( mSymbol->type() == QgsSymbolV2::Line )
138138
{
139-
QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>(mSymbol);
140-
spinWidth->setValue(lineSymbol->width());
139+
QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
140+
spinWidth->setValue( lineSymbol->width() );
141141
}
142142
}
143143

144144
void QgsSymbolV2SelectorDialog::changeSymbolProperties()
145145
{
146-
QgsSymbolV2PropertiesDialog dlg(mSymbol, this);
147-
if (!dlg.exec())
146+
QgsSymbolV2PropertiesDialog dlg( mSymbol, this );
147+
if ( !dlg.exec() )
148148
return;
149-
149+
150150
updateSymbolPreview();
151151
updateSymbolInfo();
152152
emit symbolModified();
@@ -155,56 +155,56 @@ void QgsSymbolV2SelectorDialog::changeSymbolProperties()
155155

156156
void QgsSymbolV2SelectorDialog::setSymbolColor()
157157
{
158-
QColor color = QColorDialog::getColor(mSymbol->color(), this);
159-
if (!color.isValid())
158+
QColor color = QColorDialog::getColor( mSymbol->color(), this );
159+
if ( !color.isValid() )
160160
return;
161-
162-
mSymbol->setColor(color);
161+
162+
mSymbol->setColor( color );
163163
updateSymbolColor();
164164
updateSymbolPreview();
165165
emit symbolModified();
166166
}
167-
168-
void QgsSymbolV2SelectorDialog::setMarkerAngle(double angle)
167+
168+
void QgsSymbolV2SelectorDialog::setMarkerAngle( double angle )
169169
{
170-
QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>(mSymbol);
171-
if (markerSymbol->angle() == angle)
170+
QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
171+
if ( markerSymbol->angle() == angle )
172172
return;
173-
markerSymbol->setAngle(angle);
173+
markerSymbol->setAngle( angle );
174174
updateSymbolPreview();
175175
emit symbolModified();
176176
}
177177

178-
void QgsSymbolV2SelectorDialog::setMarkerSize(double size)
178+
void QgsSymbolV2SelectorDialog::setMarkerSize( double size )
179179
{
180-
QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>(mSymbol);
181-
if (markerSymbol->size() == size)
180+
QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
181+
if ( markerSymbol->size() == size )
182182
return;
183-
markerSymbol->setSize(size);
183+
markerSymbol->setSize( size );
184184
updateSymbolPreview();
185185
emit symbolModified();
186186
}
187187

188-
void QgsSymbolV2SelectorDialog::setLineWidth(double width)
188+
void QgsSymbolV2SelectorDialog::setLineWidth( double width )
189189
{
190-
QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>(mSymbol);
191-
if (lineSymbol->width() == width)
190+
QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
191+
if ( lineSymbol->width() == width )
192192
return;
193-
lineSymbol->setWidth(width);
193+
lineSymbol->setWidth( width );
194194
updateSymbolPreview();
195195
emit symbolModified();
196196
}
197197

198198
void QgsSymbolV2SelectorDialog::addSymbolToStyle()
199199
{
200200
bool ok;
201-
QString name = QInputDialog::getText(this, "Symbol name",
202-
"Please enter name for the symbol:", QLineEdit::Normal, "New symbol", &ok);
203-
if (!ok || name.isEmpty())
201+
QString name = QInputDialog::getText( this, "Symbol name",
202+
"Please enter name for the symbol:", QLineEdit::Normal, "New symbol", &ok );
203+
if ( !ok || name.isEmpty() )
204204
return;
205205

206206
// add new symbol to style and re-populate the list
207-
mStyle->addSymbol(name, mSymbol->clone());
207+
mStyle->addSymbol( name, mSymbol->clone() );
208208

209209
// make sure the symbol is stored
210210
mStyle->save();
@@ -221,6 +221,6 @@ void QgsSymbolV2SelectorDialog::keyPressEvent( QKeyEvent * e )
221221
}
222222
else
223223
{
224-
QDialog::keyPressEvent(e);
224+
QDialog::keyPressEvent( e );
225225
}
226226
}

‎src/plugins/labeling/pallabeling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ int PalLabeling::prepareLayer( QgsVectorLayer* layer, int& attrIndex )
308308
case LayerSettings::Curved: arrangement = P_CURVED; break;
309309
case LayerSettings::Horizontal: arrangement = P_HORIZ; break;
310310
case LayerSettings::Free: arrangement = P_FREE; break;
311-
default: Q_ASSERT( "unsupported placement" && 0 ); return 0; break;
311+
default: Q_ASSERT( "unsupported placement" && 0 ); return 0; break;
312312
}
313313

314314
// create the pal layer
@@ -367,7 +367,7 @@ void PalLabeling::init()
367367
SearchMethod s;
368368
switch ( mSearch )
369369
{
370-
default:
370+
default:
371371
case Chain: s = CHAIN; break;
372372
case Popmusic_Tabu: s = POPMUSIC_TABU; break;
373373
case Popmusic_Chain: s = POPMUSIC_CHAIN; break;

0 commit comments

Comments
 (0)
Please sign in to comment.