550 changes: 275 additions & 275 deletions src/core/qgsdiagramrendererv2.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,14 @@ static QVariant fcnRound( const QVariantList& values , QgsFeature *f, QgsExpress

static QVariant fcnScale( const QVariantList&, QgsFeature*, QgsExpression* parent )
{
return QVariant( parent->scale() );
return QVariant( parent->scale() );
}

static QVariant fcnFormatNumber( const QVariantList& values, QgsFeature*, QgsExpression* parent )
{
double value = getDoubleValue( values.at(0), parent );
int places = getIntValue( values.at(1), parent );
return QString( "%L1" ).arg( value, 0, 'f', places );
double value = getDoubleValue( values.at( 0 ), parent );
int places = getIntValue( values.at( 1 ), parent );
return QString( "%L1" ).arg( value, 0, 'f', places );
}

QList<QgsExpression::FunctionDef> QgsExpression::gmBuiltinFunctions;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3160,7 +3160,7 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
bool allowNull = editTypeElement.attribute( "allowNull" ) == "true";
bool orderByValue = editTypeElement.attribute( "orderByValue" ) == "true";
bool allowMulti = editTypeElement.attribute( "allowMulti", "false" ) == "true";
QString filterAttributeColumn= editTypeElement.attribute( "filterAttributeColumn", QString::null );
QString filterAttributeColumn = editTypeElement.attribute( "filterAttributeColumn", QString::null );
QString filterAttributeValue = editTypeElement.attribute( "filterAttributeValue", QString::null );
mValueRelations[ name ] = ValueRelationData( id, key, value, allowNull, orderByValue, allowMulti, filterAttributeColumn, filterAttributeValue );
}
Expand Down
28 changes: 14 additions & 14 deletions src/core/raster/qgsrasterchecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ QgsRasterChecker::QgsRasterChecker( ) :
mErrMsgStyle = "color: #ff0000;";
}

bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,
bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,
QString theExpectedKey, QString theExpectedUri )
{
bool ok = true;
Expand All @@ -46,14 +46,14 @@ bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,
QgsRasterDataProvider* verifiedProvider = QgsRasterLayer::loadProvider( theVerifiedKey, theVerifiedUri );
if ( !verifiedProvider || !verifiedProvider->isValid() )
{
error( QString( "Cannot load provider %1 with URI: %2" ).arg( theVerifiedKey).arg( theVerifiedUri), mReport );
error( QString( "Cannot load provider %1 with URI: %2" ).arg( theVerifiedKey ).arg( theVerifiedUri ), mReport );
ok = false;
}

QgsRasterDataProvider* expectedProvider = QgsRasterLayer::loadProvider( theExpectedKey, theExpectedUri );
if ( !expectedProvider || !expectedProvider->isValid() )
{
error( QString( "Cannot load provider %1 with URI: %2" ).arg( theExpectedKey).arg( theExpectedUri ), mReport );
error( QString( "Cannot load provider %1 with URI: %2" ).arg( theExpectedKey ).arg( theExpectedUri ), mReport );
ok = false;
}

Expand All @@ -63,7 +63,7 @@ bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,
mReport += QString( "Expected URI: %1<br>" ).arg( theExpectedUri.replace( "&", "&amp;" ) );

mReport += "<br>";
mReport += QString("<table style='%1'>\n").arg( mTabStyle );
mReport += QString( "<table style='%1'>\n" ).arg( mTabStyle );
mReport += compareHead();

compare( "Band count", verifiedProvider->bandCount(), expectedProvider->bandCount(), mReport, ok );
Expand All @@ -86,7 +86,7 @@ bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,
{
bool bandOk = true;
mReport += QString( "<h3>Band %1</h3>\n" ).arg( band );
mReport += QString("<table style='%1'>\n").arg( mTabStyle );
mReport += QString( "<table style='%1'>\n" ).arg( mTabStyle );
mReport += compareHead();

// Data types may differ (?)
Expand Down Expand Up @@ -132,9 +132,9 @@ bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,

mReport += "<table><tr>";
mReport += "<td>Data comparison</td>";
mReport += QString( "<td style='%1 %2 border: 1px solid'>correct&nbsp;value</td>" ).arg( mCellStyle).arg( mOkStyle );
mReport += QString( "<td style='%1 %2 border: 1px solid'>correct&nbsp;value</td>" ).arg( mCellStyle ).arg( mOkStyle );
mReport += "<td></td>";
mReport += QString( "<td style='%1 %2 border: 1px solid'>wrong&nbsp;value<br>expected value</td></tr>").arg( mCellStyle).arg( mErrStyle );
mReport += QString( "<td style='%1 %2 border: 1px solid'>wrong&nbsp;value<br>expected value</td></tr>" ).arg( mCellStyle ).arg( mErrStyle );
mReport += "</tr></table>";
mReport += "<br>";

Expand All @@ -148,7 +148,7 @@ bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,
verifiedProvider->readBlock( band, expectedProvider->extent(), width, height, verifiedData );

// compare data values
QString htmlTable = QString("<table style='%1'>").arg( mTabStyle );
QString htmlTable = QString( "<table style='%1'>" ).arg( mTabStyle );
for ( int row = 0; row < height; row ++ )
{
htmlTable += "<tr>";
Expand All @@ -169,7 +169,7 @@ bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,
allOk = false;
valStr = QString( "%1<br>%2" ).arg( verifiedVal ).arg( expectedVal );
}
htmlTable += QString( "<td style='%1 %2'>%3</td>" ).arg( mCellStyle).arg( cellOk ? mOkStyle : mErrStyle ).arg( valStr );
htmlTable += QString( "<td style='%1 %2'>%3</td>" ).arg( mCellStyle ).arg( cellOk ? mOkStyle : mErrStyle ).arg( valStr );
}
htmlTable += "</tr>";
}
Expand All @@ -187,7 +187,7 @@ bool QgsRasterChecker::runTest( QString theVerifiedKey, QString theVerifiedUri,

void QgsRasterChecker::error( QString theMessage, QString &theReport )
{
theReport += QString( "<font style='%1'>Error: ").arg(mErrMsgStyle);
theReport += QString( "<font style='%1'>Error: " ).arg( mErrMsgStyle );
theReport += theMessage;
theReport += "</font>";
}
Expand All @@ -202,7 +202,7 @@ double QgsRasterChecker::tolerance( double val, int places )
QString QgsRasterChecker::compareHead()
{
QString html;
html += QString( "<tr><th style='%1'>Param name</th><th style='%1'>Verified value</th><th style='%1'>Eexpected value</th><th style='%1'>Difference</th><th style='%1'>Tolerance</th></tr>").arg( mCellStyle );
html += QString( "<tr><th style='%1'>Param name</th><th style='%1'>Verified value</th><th style='%1'>Eexpected value</th><th style='%1'>Difference</th><th style='%1'>Tolerance</th></tr>" ).arg( mCellStyle );
return html;
}

Expand All @@ -229,8 +229,8 @@ void QgsRasterChecker::compare( QString theParamName, double verifiedVal, double
void QgsRasterChecker::compareRow( QString theParamName, QString verifiedVal, QString expectedVal, QString &theReport, bool theOk, QString theDifference, QString theTolerance )
{
theReport += "<tr>\n";
theReport += QString( "<td style='%1'>%2</td><td style='%1 %3'>%4</td><td style='%1'>%5</td>\n" ).arg(mCellStyle).arg( theParamName ).arg( theOk ? mOkStyle : mErrStyle ).arg( verifiedVal ).arg( expectedVal );
theReport += QString( "<td style='%1'>%2</td>\n" ).arg(mCellStyle).arg( theDifference );
theReport += QString( "<td style='%1'>%2</td>\n" ).arg(mCellStyle).arg( theTolerance );
theReport += QString( "<td style='%1'>%2</td><td style='%1 %3'>%4</td><td style='%1'>%5</td>\n" ).arg( mCellStyle ).arg( theParamName ).arg( theOk ? mOkStyle : mErrStyle ).arg( verifiedVal ).arg( expectedVal );
theReport += QString( "<td style='%1'>%2</td>\n" ).arg( mCellStyle ).arg( theDifference );
theReport += QString( "<td style='%1'>%2</td>\n" ).arg( mCellStyle ).arg( theTolerance );
theReport += "</tr>";
}
2 changes: 2 additions & 0 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
case QgsSymbolV2::ScaleArea:
scaledSize = sqrt( scaledSize );
break;
case QgsSymbolV2::ScaleDiameter:
break;
}

double half = scaledSize / 2.0;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void renderComplete( QPainter * );

/** Emitted when canvas finished a refresh request.
\note Added in 2.0 */
\note Added in 2.0 */
void mapCanvasRefreshed();

/** Emitted when the canvas is about to be rendered.
Expand Down
36 changes: 18 additions & 18 deletions src/gui/qgsmessagebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


QgsMessageBar::QgsMessageBar( QWidget *parent )
: QFrame( parent ), mCurrentItem ( NULL )
: QFrame( parent ), mCurrentItem( NULL )
{
QPalette pal = palette();
pal.setBrush( backgroundRole(), pal.window() );
Expand Down Expand Up @@ -66,22 +66,22 @@ void QgsMessageBar::popItem( QgsMessageBarItem *item )
return;

if ( item == mCurrentItem )
{
if ( mCurrentItem )
{
mLayout->removeWidget( mCurrentItem->widget() );
mCurrentItem->widget()->hide();
mCurrentItem = 0;
}

if ( !mList.isEmpty() )
{
pushItem( mList.first() );
}
else
{
hide();
}
{
if ( mCurrentItem )
{
mLayout->removeWidget( mCurrentItem->widget() );
mCurrentItem->widget()->hide();
mCurrentItem = 0;
}

if ( !mList.isEmpty() )
{
pushItem( mList.first() );
}
else
{
hide();
}
}
else
{
Expand All @@ -102,7 +102,7 @@ bool QgsMessageBar::popWidget( QWidget *widget )
return true;
}

foreach( QgsMessageBarItem *item, mList )
foreach ( QgsMessageBarItem *item, mList )
{
if ( item->widget() == widget )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void QgsCptCityColorRampV2Dialog::showEvent( QShowEvent * e )
tabBar->setCurrentIndex( 1 );
mModel = mAuthorsModel;
mBrowserView->setModel( mModel );
}
}
}
if ( modelIndex != QModelIndex() )
{
Expand Down
3 changes: 2 additions & 1 deletion src/gui/symbology-ng/qgsrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ QgsRendererV2DataDefinedMenus::~QgsRendererV2DataDefinedMenus()

void QgsRendererV2DataDefinedMenus::populateMenu( QMenu* menu, const char* slot, QString fieldName, QActionGroup *actionGroup )
{
Q_UNUSED( slot );
QAction* aNo = new QAction( tr( "- no field -" ), actionGroup );
aNo->setCheckable( true );
menu->addAction( aNo );
Expand Down Expand Up @@ -305,4 +306,4 @@ void QgsRendererV2DataDefinedMenus::updateMenu( QActionGroup* actionGroup, QStri
a->setChecked( a->text() == fieldName );
}
}
#endif
#endif
114 changes: 57 additions & 57 deletions tests/src/core/testqgscomposerscalebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,51 +50,51 @@ class TestQgsComposerScaleBar: public QObject

void TestQgsComposerScaleBar::initTestCase()
{
QgsApplication::init();
QgsApplication::initQgis();

//create maplayers from testdata and add to layer registry
QFileInfo rasterFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "landsat.tif" );
mRasterLayer = new QgsRasterLayer( rasterFileInfo.filePath(),
rasterFileInfo.completeBaseName() );
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer->dataProvider(), 2, 3, 4 );
mRasterLayer->setRenderer( rasterRenderer );

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

//create composition with composer map
mMapRenderer = new QgsMapRenderer();
mMapRenderer->setLayerSet( QStringList() << mRasterLayer->id() );

//reproject to WGS84
QgsCoordinateReferenceSystem destCRS;
destCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
mMapRenderer->setDestinationCrs( destCRS );
mMapRenderer->setProjectionsEnabled( true );

mComposition = new QgsComposition( mMapRenderer );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 150, 150 );
mComposerMap->setFrameEnabled( true );
mComposition->addComposerMap( mComposerMap );
mComposerMap->setNewExtent( QgsRectangle( 17.923, 30.160, 18.023, 30.260 ) );

mComposerScaleBar = new QgsComposerScaleBar( mComposition );
mComposerScaleBar->setSceneRect( QRectF( 20, 180, 20, 20 ) );
mComposition->addComposerScaleBar( mComposerScaleBar );
mComposerScaleBar->setComposerMap( mComposerMap );
mComposerScaleBar->setUnits( QgsComposerScaleBar::Meters );
mComposerScaleBar->setNumUnitsPerSegment( 2000 );
mComposerScaleBar->setNumSegmentsLeft( 0 );
mComposerScaleBar->setNumSegments( 2 );
mComposerScaleBar->setHeight( 5 );
QgsApplication::init();
QgsApplication::initQgis();

//create maplayers from testdata and add to layer registry
QFileInfo rasterFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "landsat.tif" );
mRasterLayer = new QgsRasterLayer( rasterFileInfo.filePath(),
rasterFileInfo.completeBaseName() );
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer->dataProvider(), 2, 3, 4 );
mRasterLayer->setRenderer( rasterRenderer );

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

//create composition with composer map
mMapRenderer = new QgsMapRenderer();
mMapRenderer->setLayerSet( QStringList() << mRasterLayer->id() );

//reproject to WGS84
QgsCoordinateReferenceSystem destCRS;
destCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
mMapRenderer->setDestinationCrs( destCRS );
mMapRenderer->setProjectionsEnabled( true );

mComposition = new QgsComposition( mMapRenderer );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 150, 150 );
mComposerMap->setFrameEnabled( true );
mComposition->addComposerMap( mComposerMap );
mComposerMap->setNewExtent( QgsRectangle( 17.923, 30.160, 18.023, 30.260 ) );

mComposerScaleBar = new QgsComposerScaleBar( mComposition );
mComposerScaleBar->setSceneRect( QRectF( 20, 180, 20, 20 ) );
mComposition->addComposerScaleBar( mComposerScaleBar );
mComposerScaleBar->setComposerMap( mComposerMap );
mComposerScaleBar->setUnits( QgsComposerScaleBar::Meters );
mComposerScaleBar->setNumUnitsPerSegment( 2000 );
mComposerScaleBar->setNumSegmentsLeft( 0 );
mComposerScaleBar->setNumSegments( 2 );
mComposerScaleBar->setHeight( 5 );
};

void TestQgsComposerScaleBar::cleanupTestCase()
{
delete mComposition;
delete mMapRenderer;
delete mRasterLayer;
delete mComposition;
delete mMapRenderer;
delete mRasterLayer;
};

void TestQgsComposerScaleBar::init()
Expand All @@ -109,34 +109,34 @@ void TestQgsComposerScaleBar::cleanup()

void TestQgsComposerScaleBar::singleBox()
{
mComposerScaleBar->setStyle( "Single Box" );
QgsCompositionChecker checker( "Composer scalebar singleBox", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_singlebox.png" ) );
QVERIFY( checker.testComposition() );
mComposerScaleBar->setStyle( "Single Box" );
QgsCompositionChecker checker( "Composer scalebar singleBox", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_singlebox.png" ) );
QVERIFY( checker.testComposition() );
};

void TestQgsComposerScaleBar::doubleBox()
{
mComposerScaleBar->setStyle( "Double Box" );
QgsCompositionChecker checker( "Composer scalebar doubleBox", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_doublebox.png" ) );
QVERIFY( checker.testComposition() );
mComposerScaleBar->setStyle( "Double Box" );
QgsCompositionChecker checker( "Composer scalebar doubleBox", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_doublebox.png" ) );
QVERIFY( checker.testComposition() );
};

void TestQgsComposerScaleBar::numeric()
{
mComposerScaleBar->setStyle( "Numeric" );
QgsCompositionChecker checker( "Composer scalebar numeric", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_numeric.png" ) );
QVERIFY( checker.testComposition() );
mComposerScaleBar->setStyle( "Numeric" );
QgsCompositionChecker checker( "Composer scalebar numeric", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_numeric.png" ) );
QVERIFY( checker.testComposition() );
};

void TestQgsComposerScaleBar::tick()
{
mComposerScaleBar->setStyle( "Line Ticks Up" );
QgsCompositionChecker checker( "Composer scalebar numeric", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_numeric.png" ) );
QVERIFY( checker.testComposition() );
mComposerScaleBar->setStyle( "Line Ticks Up" );
QgsCompositionChecker checker( "Composer scalebar numeric", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composerscalebar" + QDir::separator() + "composerscalebar_numeric.png" ) );
QVERIFY( checker.testComposition() );
};

QTEST_MAIN( TestQgsComposerScaleBar )
Expand Down