Skip to content
Permalink
Browse files

Add missing QStringLiterals

  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent a7470b3 commit e4f17f41c36bb255d2b5707942a3dd91752d0c17
@@ -602,7 +602,7 @@ QString QgsAtlasComposition::currentFilename() const
void QgsAtlasComposition::writeXml( QDomElement &elem, QDomDocument &doc ) const
{
QDomElement atlasElem = doc.createElement( QStringLiteral( "Atlas" ) );
atlasElem.setAttribute( QStringLiteral( "enabled" ), mEnabled ? "true" : "false" );
atlasElem.setAttribute( QStringLiteral( "enabled" ), mEnabled ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
if ( !mEnabled )
{
return;
@@ -620,18 +620,18 @@ void QgsAtlasComposition::writeXml( QDomElement &elem, QDomDocument &doc ) const
atlasElem.setAttribute( QStringLiteral( "coverageLayer" ), QLatin1String( "" ) );
}

atlasElem.setAttribute( QStringLiteral( "hideCoverage" ), mHideCoverage ? "true" : "false" );
atlasElem.setAttribute( QStringLiteral( "singleFile" ), mSingleFile ? "true" : "false" );
atlasElem.setAttribute( QStringLiteral( "hideCoverage" ), mHideCoverage ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
atlasElem.setAttribute( QStringLiteral( "singleFile" ), mSingleFile ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
atlasElem.setAttribute( QStringLiteral( "filenamePattern" ), mFilenamePattern );
atlasElem.setAttribute( QStringLiteral( "pageNameExpression" ), mPageNameExpression );

atlasElem.setAttribute( QStringLiteral( "sortFeatures" ), mSortFeatures ? "true" : "false" );
atlasElem.setAttribute( QStringLiteral( "sortFeatures" ), mSortFeatures ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
if ( mSortFeatures )
{
atlasElem.setAttribute( QStringLiteral( "sortKey" ), mSortKeyAttributeName );
atlasElem.setAttribute( QStringLiteral( "sortAscending" ), mSortAscending ? "true" : "false" );
atlasElem.setAttribute( QStringLiteral( "sortAscending" ), mSortAscending ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
}
atlasElem.setAttribute( QStringLiteral( "filterFeatures" ), mFilterFeatures ? "true" : "false" );
atlasElem.setAttribute( QStringLiteral( "filterFeatures" ), mFilterFeatures ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
if ( mFilterFeatures )
{
atlasElem.setAttribute( QStringLiteral( "featureFilter" ), mFeatureFilter );
@@ -44,7 +44,10 @@ QList< QPair<QString, QString> > QgsGPSDetector::availablePorts()

#ifdef Q_OS_LINUX
// look for linux serial devices
Q_FOREACH ( const QString &linuxDev, QStringList() << "/dev/ttyS%1" << "/dev/ttyUSB%1" << "/dev/rfcomm%1" << "/dev/ttyACM%1" )
const QStringList devices { QStringLiteral( "/dev/ttyS%1" ),
QStringLiteral( "/dev/ttyUSB%1" ),
QStringLiteral( "/dev/rfcomm%1" ), QStringLiteral( "/dev/ttyACM%1" ) };
for ( const QString &linuxDev : devices )
{
for ( int i = 0; i < 10; ++i )
{
@@ -644,7 +644,7 @@ QgsFeatureRenderer *QgsCategorizedSymbolRenderer::create( QDomElement &element,
}
}

QDomElement ddsLegendSizeElem = element.firstChildElement( "data-defined-size-legend" );
QDomElement ddsLegendSizeElem = element.firstChildElement( QStringLiteral( "data-defined-size-legend" ) );
if ( !ddsLegendSizeElem.isNull() )
{
r->mDataDefinedSizeLegend.reset( QgsDataDefinedSizeLegend::readXml( ddsLegendSizeElem, context ) );
@@ -656,10 +656,11 @@ QgsFeatureRenderer *QgsCategorizedSymbolRenderer::create( QDomElement &element,

QDomElement QgsCategorizedSymbolRenderer::save( QDomDocument &doc, const QgsReadWriteContext &context )
{
// clazy:skip
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "categorizedSymbol" ) );
rendererElem.setAttribute( QStringLiteral( "symbollevels" ), ( mUsingSymbolLevels ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "symbollevels" ), ( mUsingSymbolLevels ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );
rendererElem.setAttribute( QStringLiteral( "attr" ), mAttrName );

// categories
@@ -722,7 +723,7 @@ QDomElement QgsCategorizedSymbolRenderer::save( QDomDocument &doc, const QgsRead
mOrderBy.save( orderBy );
rendererElem.appendChild( orderBy );
}
rendererElem.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );

if ( mDataDefinedSizeLegend )
{
@@ -67,7 +67,8 @@ QgsCptCityArchive::QgsCptCityArchive( const QString &archiveName, const QString
QgsCptCitySelectionItem *selItem = nullptr;
QDir seldir( mBaseDir + '/' + "selections" );
QgsDebugMsg( "populating selection from " + seldir.path() );
Q_FOREACH ( const QString &selfile, seldir.entryList( QStringList( "*.xml" ), QDir::Files ) )
const QStringList fileList = seldir.entryList( QStringList() << QStringLiteral( "*.xml" ), QDir::Files );
for ( const QString &selfile : fileList )
{
QgsDebugMsg( "file= " + seldir.path() + '/' + selfile );
selItem = new QgsCptCitySelectionItem( nullptr, QFileInfo( selfile ).baseName(),
@@ -460,7 +461,8 @@ void QgsCptCityArchive::initArchives( bool loadAll )
if ( loadAll )
{
QDir dir( baseDir );
Q_FOREACH ( const QString &entry, dir.entryList( QStringList( "cpt-city*" ), QDir::Dirs ) )
const QStringList fileList = dir.entryList( QStringList() << QStringLiteral( "cpt-city*" ), QDir::Dirs );
for ( const QString &entry : fileList )
{
if ( QFile::exists( baseDir + '/' + entry + "/VERSION.xml" ) )
archivesMap[ entry ] = baseDir + '/' + entry;
@@ -381,7 +381,7 @@ QgsSymbolLayer *QgsSimpleFillSymbolLayer::createFromSld( QDomElement &element )
QPointF offset;
QgsSymbolLayerUtils::displacementFromSldElement( element, offset );

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ), QString() );
offset.setX( QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset.x() ) );
offset.setY( QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset.y() ) );
strokeWidth = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, strokeWidth );
@@ -1013,7 +1013,7 @@ QgsSymbolLayer *QgsShapeburstFillSymbolLayer::create( const QgsStringMap &props

//attempt to create color ramp from props
QgsColorRamp *gradientRamp = nullptr;
if ( props.contains( QStringLiteral( "rampType" ) ) && props["rampType"] == QStringLiteral( "cpt-city" ) )
if ( props.contains( QStringLiteral( "rampType" ) ) && props[QStringLiteral( "rampType" )] == QStringLiteral( "cpt-city" ) )
{
gradientRamp = QgsCptCityColorRamp::create( props );
}
@@ -2139,7 +2139,7 @@ QgsSymbolLayer *QgsSVGFillSymbolLayer::createFromSld( QDomElement &element )

QgsSymbolLayerUtils::lineFromSld( graphicElem, penStyle, strokeColor, strokeWidth );

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ) );
size = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, size );
strokeWidth = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, strokeWidth );

@@ -2964,7 +2964,7 @@ QgsSymbolLayer *QgsLinePatternFillSymbolLayer::createFromSld( QDomElement &eleme
offset = std::sqrt( std::pow( vectOffset.x(), 2 ) + std::pow( vectOffset.y(), 2 ) );
}

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ) );
size = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, size );
lineWidth = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, lineWidth );

@@ -169,7 +169,7 @@ void QgsRendererRange::toSld( QDomDocument &doc, QDomElement &element, QgsString
// create the ogc:Filter for the range
QString filterFunc = QStringLiteral( "\"%1\" %2 %3 AND \"%1\" <= %4" )
.arg( attrName.replace( '\"', QLatin1String( "\"\"" ) ),
firstRange ? ">=" : ">",
firstRange ? QStringLiteral( ">=" ) : QStringLiteral( ">" ),
qgsDoubleToString( mLowerValue ),
qgsDoubleToString( mUpperValue ) );
QgsSymbolLayerUtils::createFunctionElement( doc, ruleElem, filterFunc );
@@ -282,7 +282,7 @@ void QgsRendererRangeLabelFormat::saveToDomElement( QDomElement &element )
{
element.setAttribute( QStringLiteral( "format" ), mFormat );
element.setAttribute( QStringLiteral( "decimalplaces" ), mPrecision );
element.setAttribute( QStringLiteral( "trimtrailingzeroes" ), mTrimTrailingZeroes ? "true" : "false" );
element.setAttribute( QStringLiteral( "trimtrailingzeroes" ), mTrimTrailingZeroes ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
}

///////////
@@ -1040,7 +1040,7 @@ QgsFeatureRenderer *QgsGraduatedSymbolRenderer::create( QDomElement &element, co
r->setLabelFormat( labelFormat );
}

QDomElement ddsLegendSizeElem = element.firstChildElement( "data-defined-size-legend" );
QDomElement ddsLegendSizeElem = element.firstChildElement( QStringLiteral( "data-defined-size-legend" ) );
if ( !ddsLegendSizeElem.isNull() )
{
r->mDataDefinedSizeLegend.reset( QgsDataDefinedSizeLegend::readXml( ddsLegendSizeElem, context ) );
@@ -1054,8 +1054,8 @@ QDomElement QgsGraduatedSymbolRenderer::save( QDomDocument &doc, const QgsReadWr
{
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "graduatedSymbol" ) );
rendererElem.setAttribute( QStringLiteral( "symbollevels" ), ( mUsingSymbolLevels ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "symbollevels" ), ( mUsingSymbolLevels ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );
rendererElem.setAttribute( QStringLiteral( "attr" ), mAttrName );
rendererElem.setAttribute( QStringLiteral( "graduatedMethod" ), graduatedMethodStr( mGraduatedMethod ) );

@@ -1075,7 +1075,7 @@ QDomElement QgsGraduatedSymbolRenderer::save( QDomDocument &doc, const QgsReadWr
rangeElem.setAttribute( QStringLiteral( "upper" ), QString::number( range.upperValue(), 'f', 15 ) );
rangeElem.setAttribute( QStringLiteral( "symbol" ), symbolName );
rangeElem.setAttribute( QStringLiteral( "label" ), range.label() );
rangeElem.setAttribute( QStringLiteral( "render" ), range.renderState() ? "true" : "false" );
rangeElem.setAttribute( QStringLiteral( "render" ), range.renderState() ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
rangesElem.appendChild( rangeElem );
i++;
}
@@ -1140,7 +1140,7 @@ QDomElement QgsGraduatedSymbolRenderer::save( QDomDocument &doc, const QgsReadWr
mOrderBy.save( orderBy );
rendererElem.appendChild( orderBy );
}
rendererElem.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );

if ( mDataDefinedSizeLegend )
{
@@ -340,7 +340,7 @@ QDomElement QgsHeatmapRenderer::save( QDomDocument &doc, const QgsReadWriteConte
QDomElement colorRampElem = QgsSymbolLayerUtils::saveColorRamp( QStringLiteral( "[source]" ), mGradientRamp, doc );
rendererElem.appendChild( colorRampElem );
}
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );

if ( mPaintEffect && !QgsPaintEffectRegistry::isDefaultStack( mPaintEffect ) )
mPaintEffect->saveProperties( doc, rendererElem );
@@ -387,10 +387,12 @@ QgsFeatureRenderer *QgsInvertedPolygonRenderer::create( QDomElement &element, co

QDomElement QgsInvertedPolygonRenderer::save( QDomDocument &doc, const QgsReadWriteContext &context )
{
// clazy:skip

QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "invertedPolygonRenderer" ) );
rendererElem.setAttribute( QStringLiteral( "preprocessing" ), preprocessingEnabled() ? "1" : "0" );
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "preprocessing" ), preprocessingEnabled() ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
rendererElem.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );

if ( mSubRenderer )
{
@@ -407,7 +409,7 @@ QDomElement QgsInvertedPolygonRenderer::save( QDomDocument &doc, const QgsReadWr
mOrderBy.save( orderBy );
rendererElem.appendChild( orderBy );
}
rendererElem.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? "1" : "0" ) );
rendererElem.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );

return rendererElem;
}
@@ -355,11 +355,11 @@ QgsStringMap QgsSimpleLineSymbolLayer::properties() const
map[QStringLiteral( "offset" )] = QString::number( mOffset );
map[QStringLiteral( "offset_unit" )] = QgsUnitTypes::encodeUnit( mOffsetUnit );
map[QStringLiteral( "offset_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mOffsetMapUnitScale );
map[QStringLiteral( "use_custom_dash" )] = ( mUseCustomDashPattern ? "1" : "0" );
map[QStringLiteral( "use_custom_dash" )] = ( mUseCustomDashPattern ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
map[QStringLiteral( "customdash" )] = QgsSymbolLayerUtils::encodeRealVector( mCustomDashVector );
map[QStringLiteral( "customdash_unit" )] = QgsUnitTypes::encodeUnit( mCustomDashPatternUnit );
map[QStringLiteral( "customdash_map_unit_scale" )] = QgsSymbolLayerUtils::encodeMapUnitScale( mCustomDashPatternMapUnitScale );
map[QStringLiteral( "draw_inside_polygon" )] = ( mDrawInsidePolygon ? "1" : "0" );
map[QStringLiteral( "draw_inside_polygon" )] = ( mDrawInsidePolygon ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
return map;
}

@@ -462,7 +462,7 @@ QgsSymbolLayer *QgsSimpleLineSymbolLayer::createFromSld( QDomElement &element )
offset = d;
}

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ) );
width = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, width );
offset = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset );

@@ -747,7 +747,7 @@ QgsSymbolLayer *QgsMarkerLineSymbolLayer::create( const QgsStringMap &props )
{
x->setOffsetAlongLineUnit( QgsUnitTypes::decodeRenderUnit( props[QStringLiteral( "offset_along_line_unit" )] ) );
}
if ( props.contains( ( "offset_along_line_map_unit_scale" ) ) )
if ( props.contains( ( QStringLiteral( "offset_along_line_map_unit_scale" ) ) ) )
{
x->setOffsetAlongLineMapUnitScale( QgsSymbolLayerUtils::decodeMapUnitScale( props[QStringLiteral( "offset_along_line_map_unit_scale" )] ) );
}
@@ -1320,7 +1320,7 @@ void QgsMarkerLineSymbolLayer::renderPolylineCentral( const QPolygonF &points, Q
QgsStringMap QgsMarkerLineSymbolLayer::properties() const
{
QgsStringMap map;
map[QStringLiteral( "rotate" )] = ( mRotateMarker ? "1" : "0" );
map[QStringLiteral( "rotate" )] = ( mRotateMarker ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
map[QStringLiteral( "interval" )] = QString::number( mInterval );
map[QStringLiteral( "offset" )] = QString::number( mOffset );
map[QStringLiteral( "offset_along_line" )] = QString::number( mOffsetAlongLine );
@@ -1523,7 +1523,7 @@ QgsSymbolLayer *QgsMarkerLineSymbolLayer::createFromSld( QDomElement &element )
offset = d;
}

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ) );
interval = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, interval );
offset = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset );

@@ -1194,7 +1194,7 @@ QgsSymbolLayer *QgsSimpleMarkerSymbolLayer::createFromSld( QDomElement &element

Shape shape = decodeShape( name );

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ) );
size = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, size );
offset.setX( QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset.x() ) );
offset.setY( QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset.y() ) );
@@ -2223,7 +2223,7 @@ QgsSymbolLayer *QgsSvgMarkerSymbolLayer::createFromSld( QDomElement &element )
if ( !QgsSymbolLayerUtils::externalGraphicFromSld( graphicElem, path, mimeType, fillColor, size ) )
return nullptr;

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ) );
size = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, size );

if ( mimeType != QLatin1String( "image/svg+xml" ) )
@@ -2883,7 +2883,7 @@ QgsSymbolLayer *QgsFontMarkerSymbolLayer::createFromSld( QDomElement &element )
QPointF offset;
QgsSymbolLayerUtils::displacementFromSldElement( graphicElem, offset );

QString uom = element.attribute( QStringLiteral( "uom" ), "" );
QString uom = element.attribute( QStringLiteral( "uom" ) );
offset.setX( QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset.x() ) );
offset.setY( QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, offset.y() ) );
size = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, size );
@@ -124,7 +124,7 @@ QgsMarkerSymbol *QgsPointClusterRenderer::clusterSymbol()
QDomElement QgsPointClusterRenderer::save( QDomDocument &doc, const QgsReadWriteContext &context )
{
QDomElement rendererElement = doc.createElement( RENDERER_TAG_NAME );
rendererElement.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? "1" : "0" ) );
rendererElement.setAttribute( QStringLiteral( "forceraster" ), ( mForceRaster ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );
rendererElement.setAttribute( QStringLiteral( "type" ), QStringLiteral( "pointCluster" ) );
rendererElement.setAttribute( QStringLiteral( "tolerance" ), QString::number( mTolerance ) );
rendererElement.setAttribute( QStringLiteral( "toleranceUnit" ), QgsUnitTypes::encodeUnit( mToleranceUnit ) );
@@ -150,7 +150,7 @@ QDomElement QgsPointClusterRenderer::save( QDomDocument &doc, const QgsReadWrite
mOrderBy.save( orderBy );
rendererElement.appendChild( orderBy );
}
rendererElement.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? "1" : "0" ) );
rendererElement.setAttribute( QStringLiteral( "enableorderby" ), ( mOrderByEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) ) );

return rendererElement;
}

0 comments on commit e4f17f4

Please sign in to comment.
You can’t perform that action at this time.