Skip to content
Permalink
Browse files

Fix clazy QString multi-arg warnings

  • Loading branch information
nyalldawson committed Feb 2, 2018
1 parent a08c05b commit ef7e7c5432ebd98ac32d8368726d51bd9f700ffd
@@ -110,7 +110,7 @@ void QgsFileDownloaderAlgorithm::sendProgressFeedback()
if ( mTotal.isEmpty() )
mFeedback->pushInfo( tr( "%1 downloaded." ).arg( mReceived ) );
else
mFeedback->pushInfo( tr( "%1 of %2 downloaded." ).arg( mReceived ).arg( mTotal ) );
mFeedback->pushInfo( tr( "%1 of %2 downloaded." ).arg( mReceived, mTotal ) );
}
}

@@ -152,7 +152,7 @@ QVariantMap QgsMergeVectorAlgorithm::processAlgorithm( const QVariantMap &parame
if ( destField.type() != sourceField.type() )
{
throw QgsProcessingException( QObject::tr( "%1 field in layer %2 has different data type than in other layers (%3 instead of %4)" )
.arg( sourceField.name(), vl->name() ).arg( sourceField.typeName() ).arg( destField.typeName() ) );
.arg( sourceField.name(), vl->name(), sourceField.typeName(), destField.typeName() ) );
}
break;
}
@@ -166,15 +166,15 @@ QVariantMap QgsRasterLayerUniqueValuesReportAlgorithm::processAlgorithm( const Q

QTextStream out( &file );
out << QString( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/></head><body>\n" );
out << QString( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Analyzed file" ) ).arg( mSource ).arg( QObject::tr( "band" ) ).arg( band );
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "Extent" ) ).arg( mExtent.toString() );
out << QObject::tr( "<p>%1: %2 (%3)</p>\n" ).arg( QObject::tr( "Projection" ) ).arg( mCrs.description() ).arg( mCrs.authid() );
out << QString( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Analyzed file" ), mSource, QObject::tr( "band" ) ).arg( band );
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "Extent" ), mExtent.toString() );
out << QObject::tr( "<p>%1: %2 (%3)</p>\n" ).arg( QObject::tr( "Projection" ), mCrs.description(), mCrs.authid() );
out << QObject::tr( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Width in pixels" ) ).arg( mLayerWidth ).arg( QObject::tr( "units per pixel" ) ).arg( mRasterUnitsPerPixelX );
out << QObject::tr( "<p>%1: %2 (%3 %4)</p>\n" ).arg( QObject::tr( "Height in pixels" ) ).arg( mLayerHeight ).arg( QObject::tr( "units per pixel" ) ).arg( mRasterUnitsPerPixelY );
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "Total pixel count" ) ).arg( layerSize );
if ( mHasNoDataValue )
out << QObject::tr( "<p>%1: %2</p>\n" ).arg( QObject::tr( "NODATA pixel count" ) ).arg( noDataCount );
out << QString( "<table><tr><td>%1</td><td>%2</td><td>%3 (%4)</td></tr>\n" ).arg( QObject::tr( "Value" ) ).arg( QObject::tr( "Pixel count" ) ).arg( QObject::tr( "Area" ) ).arg( areaUnit );
out << QString( "<table><tr><td>%1</td><td>%2</td><td>%3 (%4)</td></tr>\n" ).arg( QObject::tr( "Value" ), QObject::tr( "Pixel count" ), QObject::tr( "Area" ), areaUnit );

for ( double key : sortedUniqueValues.keys() )
{
@@ -52,7 +52,7 @@ void QgsGeometryContainedCheck::collectErrors( QList<QgsGeometryCheckError *> &e
}
else if ( !errMsg.isEmpty() )
{
messages.append( tr( "Contained check failed for (%1, %2): %3" ).arg( layerFeatureB.id() ).arg( layerFeatureA.id() ).arg( errMsg ) );
messages.append( tr( "Contained check failed for (%1, %2): %3" ).arg( layerFeatureB.id(), layerFeatureA.id(), errMsg ) );
}
}
}
@@ -72,7 +72,7 @@ void QgsGeometryDuplicateCheck::collectErrors( QList<QgsGeometryCheckError *> &e
}
else if ( !errMsg.isEmpty() )
{
messages.append( tr( "Duplicate check failed for (%1, %2): %3" ).arg( layerFeatureA.id() ).arg( layerFeatureB.id() ).arg( errMsg ) );
messages.append( tr( "Duplicate check failed for (%1, %2): %3" ).arg( layerFeatureA.id(), layerFeatureB.id(), errMsg ) );
}
delete diffGeom;
}
@@ -64,7 +64,7 @@ void QgsGeometryOverlapCheck::collectErrors( QList<QgsGeometryCheckError *> &err
}
else if ( !errMsg.isEmpty() )
{
messages.append( tr( "Overlap check between features %1 and %2 %3" ).arg( layerFeatureA.id() ).arg( layerFeatureB.id() ).arg( errMsg ) );
messages.append( tr( "Overlap check between features %1 and %2 %3" ).arg( layerFeatureA.id(), layerFeatureB.id(), errMsg ) );
}
delete interGeom;
}
@@ -903,9 +903,7 @@ void QgsDwgImporter::addLayer( const DRW_Layer &data )
if ( OGR_L_CreateFeature( layer, f.get() ) != OGRERR_NONE )
{
LOG( QObject::tr( "Could not add %3 %1 [%2]" )
.arg( data.name.c_str() )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "layer" ) )
.arg( data.name.c_str(), QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "layer" ) )
);
}
}
@@ -1105,9 +1103,7 @@ void QgsDwgImporter::addDimStyle( const DRW_Dimstyle &data )
if ( OGR_L_CreateFeature( layer, f.get() ) != OGRERR_NONE )
{
LOG( QObject::tr( "Could not add %3 %1 [%2]" )
.arg( data.name.c_str() )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "dimension style" ) )
.arg( data.name.c_str(), QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "dimension style" ) )
);
}
}
@@ -1139,9 +1135,7 @@ void QgsDwgImporter::addTextStyle( const DRW_Textstyle &data )
if ( OGR_L_CreateFeature( layer, f.get() ) != OGRERR_NONE )
{
LOG( QObject::tr( "Could not add %3 %1 [%2]" )
.arg( data.name.c_str() )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "text style" ) )
.arg( data.name.c_str(), QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "text style" ) )
);
}
}
@@ -1202,8 +1196,7 @@ void QgsDwgImporter::addBlock( const DRW_Block &data )
if ( !createFeature( layer, f.get(), p ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "block" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "block" ) )
);
}
}
@@ -1263,8 +1256,7 @@ void QgsDwgImporter::addPoint( const DRW_Point &data )
if ( !createFeature( layer, f, p ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "point" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
);
}
}
@@ -1317,8 +1309,7 @@ void QgsDwgImporter::addArc( const DRW_Arc &data )
if ( !createFeature( layer, f, c ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "arc" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "arc" ) )
);
}
}
@@ -1348,8 +1339,7 @@ void QgsDwgImporter::addCircle( const DRW_Circle &data )
if ( !createFeature( layer, f, c ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "circle" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "circle" ) )
);
}
}
@@ -1500,8 +1490,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
if ( !createFeature( layer, f, cc ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "line string" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
);
}

@@ -1572,8 +1561,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
if ( !createFeature( layer, f, poly ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "polygon" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
);
}
}
@@ -1619,8 +1607,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
if ( !createFeature( layer, f, cc ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "line string" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
);
}
}
@@ -1701,8 +1688,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
if ( !createFeature( layer, f, cc ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "line string" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
);
}

@@ -1778,8 +1764,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
if ( !createFeature( layer, f, poly ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "polygon" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
);
}
}
@@ -1825,8 +1810,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
if ( !createFeature( layer, f, cc ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "line string" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
);
}
}
@@ -2067,8 +2051,7 @@ void QgsDwgImporter::addSpline( const DRW_Spline *data )
if ( !createFeature( layer, f, l ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "spline" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "spline" ) )
);
}
}
@@ -2109,8 +2092,7 @@ void QgsDwgImporter::addInsert( const DRW_Insert &data )
if ( !createFeature( layer, f, p ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "point" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
);
}
}
@@ -2161,8 +2143,7 @@ void QgsDwgImporter::addSolid( const DRW_Solid &data )
if ( !createFeature( layer, f, poly ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "polygon" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
);
}
}
@@ -2197,8 +2178,7 @@ void QgsDwgImporter::addMText( const DRW_MText &data )
if ( !createFeature( layer, f, p ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "point" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
);
}
}
@@ -2236,8 +2216,7 @@ void QgsDwgImporter::addText( const DRW_Text &data )
if ( !createFeature( layer, f, p ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "point" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "point" ) )
);
}
}
@@ -2369,8 +2348,7 @@ void QgsDwgImporter::addHatch( const DRW_Hatch *pdata )
if ( !createFeature( layer, f, p ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "polygon" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "polygon" ) )
);
}
}
@@ -2399,8 +2377,7 @@ void QgsDwgImporter::addLine( const DRW_Line &data )
if ( !createFeature( layer, f, l ) )
{
LOG( QObject::tr( "Could not add %2 [%1]" )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) )
.arg( QObject::tr( "line string" ) )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ), QObject::tr( "line string" ) )
);
}
}
@@ -6842,7 +6842,7 @@ void QgisApp::saveAsRasterFile( QgsRasterLayer *rasterLayer )
emit layerSavedAs( rlWeakPointer, fileName );

messageBar()->pushMessage( tr( "Saving Done" ),
tr( "Successfully saved raster layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString() ).arg( QDir::toNativeSeparators( newFilename ) ),
tr( "Successfully saved raster layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString(), QDir::toNativeSeparators( newFilename ) ),
QgsMessageBar::SUCCESS, messageTimeout() );
} );

@@ -7045,7 +7045,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer *vlayer, bool symbologyOpt
}
this->emit layerSavedAs( vlayer, vectorFilename );
this->messageBar()->pushMessage( tr( "Saving Done" ),
tr( "Successfully saved vector layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString() ).arg( QDir::toNativeSeparators( newFilename ) ),
tr( "Successfully saved vector layer to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( QFileInfo( newFilename ).path() ).toString(), QDir::toNativeSeparators( newFilename ) ),
QgsMessageBar::SUCCESS, messageTimeout() );
}
);
@@ -10081,7 +10081,7 @@ QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const Q
else
{
QString message = layer->dataProvider()->error().message( QgsErrorMessage::Text );
QString msg = tr( "The layer %1 is not a valid layer and can not be added to the map. Reason: %2" ).arg( vectorLayerPath ).arg( message );
QString msg = tr( "The layer %1 is not a valid layer and can not be added to the map. Reason: %2" ).arg( vectorLayerPath, message );
messageBar()->pushMessage( tr( "Layer is not valid" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );

delete layer;
@@ -95,8 +95,7 @@ bool Qgs2To3Migration::requiresMigration()
}
else
{
QString msg = QString( "Can not open %1" ).arg( migrationFile.fileName() );
QgsDebugMsg( msg );
QgsDebugMsg( QString( "Can not open %1" ).arg( migrationFile.fileName() ) );
mMigrationFileVersion = settingsMigrationVersion;
}

@@ -368,7 +368,7 @@ QString QgsAuxiliaryLayer::nameFromProperty( const QgsPropertyDefinition &def, b
fieldName = QString( "%1_%2" ).arg( fieldName, def.name().toLower() );

if ( !def.comment().isEmpty() )
fieldName = QString( "%1_%2" ).arg( fieldName ).arg( def.comment() );
fieldName = QString( "%1_%2" ).arg( fieldName, def.comment() );

if ( joined )
fieldName = QString( "%1%2" ).arg( AS_JOINPREFIX, fieldName );
@@ -665,15 +665,20 @@ bool QgsAuxiliaryStorage::exec( const QString &sql, sqlite3 *handler )

void QgsAuxiliaryStorage::debugMsg( const QString &sql, sqlite3 *handler )
{
#ifdef QGISDEBUG
const QString err = QString::fromUtf8( sqlite3_errmsg( handler ) );
const QString msg = QObject::tr( "Unable to execute" );
const QString errMsg = QObject::tr( "%1 '%2': %3" ).arg( msg ).arg( sql ).arg( err );
const QString errMsg = QObject::tr( "%1 '%2': %3" ).arg( msg, sql, err );
QgsDebugMsg( errMsg );
#else
Q_UNUSED( sql );
Q_UNUSED( handler );
#endif
}

bool QgsAuxiliaryStorage::createTable( const QString &type, const QString &table, sqlite3 *handler )
{
const QString sql = QStringLiteral( "CREATE TABLE IF NOT EXISTS '%1' ( '%2' %3 )" ).arg( table ).arg( AS_JOINFIELD ).arg( type );
const QString sql = QStringLiteral( "CREATE TABLE IF NOT EXISTS '%1' ( '%2' %3 )" ).arg( table, AS_JOINFIELD, type );

if ( !exec( sql, handler ) )
return false;
@@ -1261,7 +1261,7 @@ void QgsAttributeForm::init()
}
else
{
w = new QLabel( QStringLiteral( "<p style=\"color: red; font-style: italic;\">%1</p>" ).arg( tr( "Failed to create widget with type '%1'" ) ).arg( widgetSetup.type() ) );
w = new QLabel( QStringLiteral( "<p style=\"color: red; font-style: italic;\">%1</p>" ).arg( tr( "Failed to create widget with type '%1'" ), widgetSetup.type() ) );
}


0 comments on commit ef7e7c5

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