Skip to content
Permalink
Browse files
QString fixups
  • Loading branch information
nyalldawson committed May 14, 2021
1 parent eb5fd48 commit 7951eb8c50be912cdc43c6b08a12abf5c40a4350
@@ -5293,7 +5293,7 @@ void QgisApp::about()
#else
versionString += tr( "No support" );
#endif
versionString += QStringLiteral( "</td></tr><tr>" );
versionString += QLatin1String( "</td></tr><tr>" );

// spatialite
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">" ).arg( tr( "SpatiaLite version" ) );
@@ -5302,7 +5302,7 @@ void QgisApp::about()
#else
versionString += tr( "No support" );
#endif
versionString += QStringLiteral( "</td></tr><tr>" );
versionString += QLatin1String( "</td></tr><tr>" );

// QWT
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "QWT version" ), QWT_VERSION_STR );
@@ -197,7 +197,7 @@ QString QgsLayerMetadataFormatter::identificationSectionHtml() const
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Language" ) + QStringLiteral( "</td><td>" ) + mMetadata.language() + QStringLiteral( "</td></tr>\n" );

// Abstract
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Abstract" ) + QStringLiteral( "</td><td>" ) + QgsStringUtils::insertLinks( mMetadata.abstract() ).replace( '\n', QStringLiteral( "<br>" ) ) + QStringLiteral( "</td></tr>\n" );
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Abstract" ) + QStringLiteral( "</td><td>" ) + QgsStringUtils::insertLinks( mMetadata.abstract() ).replace( '\n', QLatin1String( "<br>" ) ) + QStringLiteral( "</td></tr>\n" );

// Categories
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Categories" ) + QStringLiteral( "</td><td>" ) + mMetadata.categories().join( QLatin1String( ", " ) ) + QStringLiteral( "</td></tr>\n" );
@@ -3272,7 +3272,7 @@ QString QgsProcessingParameterGeometry::asPythonString( const QgsProcessing::Pyt

if ( ! mAllowMultipart )
{
code += QStringLiteral( ", allowMultipart=False" );
code += QLatin1String( ", allowMultipart=False" );
}

QgsProcessingContext c;
@@ -1295,7 +1295,7 @@ QgsProjectionFactors QgsCoordinateReferenceSystem::factors( const QgsPoint &poin

// we have to make a transformation object corresponding to the crs
QString projString = toProj();
projString.replace( QStringLiteral( "+type=crs" ), QString() );
projString.replace( QLatin1String( "+type=crs" ), QString() );

QgsProjUtils::proj_pj_unique_ptr transformation( proj_create( QgsProjContext::get(), projString.toUtf8().constData() ) );
if ( !transformation )
@@ -1334,7 +1334,7 @@ QgsProjOperation QgsCoordinateReferenceSystem::operation() const

// we have to make a transformation object corresponding to the crs
QString projString = toProj();
projString.replace( QStringLiteral( "+type=crs" ), QString() );
projString.replace( QLatin1String( "+type=crs" ), QString() );

QgsProjUtils::proj_pj_unique_ptr transformation( proj_create( QgsProjContext::get(), projString.toUtf8().constData() ) );
if ( !transformation )
@@ -203,7 +203,7 @@ QgsMemoryProvider::QgsMemoryProvider( const QString &uri, const ProviderOptions
//array
subType = type;
type = type == QVariant::String ? QVariant::StringList : QVariant::List;
typeName += QStringLiteral( "list" );
typeName += QLatin1String( "list" );
}
}
if ( !name.isEmpty() )
@@ -2158,7 +2158,7 @@ void QgsMapLayer::invalidateWgs84Extent()
QString QgsMapLayer::crsHtmlMetadata() const
{
QString metadata = QStringLiteral( "<h1>" ) + tr( "Coordinate Reference System (CRS)" ) + QStringLiteral( "</h1>\n<hr>\n" );
metadata += QStringLiteral( "<table class=\"list-view\">\n" );
metadata += QLatin1String( "<table class=\"list-view\">\n" );

// Identifier
const QgsCoordinateReferenceSystem c = crs();
@@ -1059,7 +1059,7 @@ QStringList QgsOfflineEditing::convertStringToStringList( const QString &string
QStringList stringList = string.split( QRegularExpression( "(?<!\\\\)\\s*,\\s*" ) );
for ( QString &string : stringList )
{
string.replace( QStringLiteral( "\\," ), QStringLiteral( "," ) );
string.replace( QLatin1String( "\\," ), QLatin1String( "," ) );
}
return stringList;
}
@@ -1069,9 +1069,9 @@ QString QgsOfflineEditing::convertStringListToString( const QStringList &stringL
QStringList modifiedStringList = stringList;
for ( QString &string : modifiedStringList )
{
string.replace( QStringLiteral( "," ), QStringLiteral( "\\," ) );
string.replace( QLatin1String( "," ), QLatin1String( "\\," ) );
}
return modifiedStringList.join( QStringLiteral( "," ) );
return modifiedStringList.join( QLatin1Char( ',' ) );
}

QVariantList QgsOfflineEditing::convertStringToList( const QString &string, QVariant::Type type )
@@ -243,7 +243,7 @@ void QgsVectorFileWriter::init( QString vectorFileName,
{
for ( const QString &layerOption : layerOptions )
{
if ( layerOption.startsWith( QStringLiteral( "FID=" ) ) )
if ( layerOption.startsWith( QLatin1String( "FID=" ) ) )
{
fidFieldName = layerOption.mid( 4 );
break;
@@ -302,7 +302,7 @@ QColor QgsTextBackgroundSettings::fillColor() const
void QgsTextBackgroundSettings::setFillColor( const QColor &color )
{
d->fillColor = color;
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QStringLiteral( "SimpleFill" ) )
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QLatin1String( "SimpleFill" ) )
{
qgis::down_cast< QgsSimpleFillSymbolLayer * >( d->fillSymbol->symbolLayers().at( 0 ) )->setColor( color );
}
@@ -316,7 +316,7 @@ QColor QgsTextBackgroundSettings::strokeColor() const
void QgsTextBackgroundSettings::setStrokeColor( const QColor &color )
{
d->strokeColor = color;
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QStringLiteral( "SimpleFill" ) )
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QLatin1String( "SimpleFill" ) )
{
qgis::down_cast< QgsSimpleFillSymbolLayer * >( d->fillSymbol->symbolLayers().at( 0 ) )->setStrokeColor( color );
}
@@ -330,7 +330,7 @@ double QgsTextBackgroundSettings::strokeWidth() const
void QgsTextBackgroundSettings::setStrokeWidth( double width )
{
d->strokeWidth = width;
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QStringLiteral( "SimpleFill" ) )
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QLatin1String( "SimpleFill" ) )
{
QgsSimpleFillSymbolLayer *fill = qgis::down_cast< QgsSimpleFillSymbolLayer * >( d->fillSymbol->symbolLayers().at( 0 ) );
fill->setStrokeWidth( width );
@@ -346,7 +346,7 @@ QgsUnitTypes::RenderUnit QgsTextBackgroundSettings::strokeWidthUnit() const
void QgsTextBackgroundSettings::setStrokeWidthUnit( QgsUnitTypes::RenderUnit units )
{
d->strokeWidthUnits = units;
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QStringLiteral( "SimpleFill" ) )
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QLatin1String( "SimpleFill" ) )
{
qgis::down_cast< QgsSimpleFillSymbolLayer * >( d->fillSymbol->symbolLayers().at( 0 ) )->setStrokeWidthUnit( units );
}
@@ -360,7 +360,7 @@ QgsMapUnitScale QgsTextBackgroundSettings::strokeWidthMapUnitScale() const
void QgsTextBackgroundSettings::setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale )
{
d->strokeWidthMapUnitScale = scale;
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QStringLiteral( "SimpleFill" ) )
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QLatin1String( "SimpleFill" ) )
{
qgis::down_cast< QgsSimpleFillSymbolLayer * >( d->fillSymbol->symbolLayers().at( 0 ) )->setStrokeWidthMapUnitScale( scale );
}
@@ -374,7 +374,7 @@ Qt::PenJoinStyle QgsTextBackgroundSettings::joinStyle() const
void QgsTextBackgroundSettings::setJoinStyle( Qt::PenJoinStyle style )
{
d->joinStyle = style;
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QStringLiteral( "SimpleFill" ) )
if ( d->fillSymbol && d->fillSymbol->symbolLayers().at( 0 )->layerType() == QLatin1String( "SimpleFill" ) )
{
qgis::down_cast< QgsSimpleFillSymbolLayer * >( d->fillSymbol->symbolLayers().at( 0 ) )->setPenJoinStyle( style );
}
@@ -651,11 +651,11 @@ void QgsTextBackgroundSettings::readXml( const QDomElement &elem, const QgsReadW
{
const QDomElement symbolElement = symbols.at( i ).toElement();
const QString symbolElementName = symbolElement.attribute( QStringLiteral( "name" ) );
if ( symbolElementName == QStringLiteral( "markerSymbol" ) )
if ( symbolElementName == QLatin1String( "markerSymbol" ) )
{
setMarkerSymbol( QgsSymbolLayerUtils::loadSymbol< QgsMarkerSymbol >( symbolElement, context ) );
}
else if ( symbolElementName == QStringLiteral( "fillSymbol" ) )
else if ( symbolElementName == QLatin1String( "fillSymbol" ) )
{
setFillSymbol( QgsSymbolLayerUtils::loadSymbol< QgsFillSymbol >( symbolElement, context ) );
}
@@ -720,7 +720,7 @@ QDomElement QgsTextBackgroundSettings::writeXml( QDomDocument &doc, const QgsRea

void QgsTextBackgroundSettings::upgradeDataDefinedProperties( QgsPropertyCollection &properties )
{
if ( !d->fillSymbol || d->fillSymbol->symbolLayers().at( 0 )->layerType() != QStringLiteral( "SimpleFill" ) )
if ( !d->fillSymbol || d->fillSymbol->symbolLayers().at( 0 )->layerType() != QLatin1String( "SimpleFill" ) )
return;
QgsSimpleFillSymbolLayer *fill = qgis::down_cast< QgsSimpleFillSymbolLayer * >( d->fillSymbol->symbolLayers().at( 0 ) );

@@ -61,7 +61,7 @@ QgsPointCloudSourceSelect::QgsPointCloudSourceSelect( QWidget *parent, Qt::Windo

void QgsPointCloudSourceSelect::addButtonClicked()
{
if ( mDataSourceType == QStringLiteral( "file" ) )
if ( mDataSourceType == QLatin1String( "file" ) )
{
if ( mPath.isEmpty() )
{
@@ -82,7 +82,7 @@ void QgsPointCloudSourceSelect::addButtonClicked()
emit addPointCloudLayer( path, QFileInfo( path ).baseName(), preferredProviders.at( 0 ).metadata()->key() ) ;
}
}
else if ( mDataSourceType == QStringLiteral( "remote" ) )
else if ( mDataSourceType == QLatin1String( "remote" ) )
{
if ( mPath.isEmpty() )
{
@@ -92,7 +92,7 @@ void QgsPointCloudSourceSelect::addButtonClicked()
return;
}

if ( !mPath.endsWith( QStringLiteral( "/ept.json" ) ) )
if ( !mPath.endsWith( QLatin1String( "/ept.json" ) ) )
{
QMessageBox::information( this,
tr( "Add Point Cloud Layers" ),
@@ -304,7 +304,7 @@ QString QgsPictureSourceLineEditBase::fileFilter() const
{
formatsFilter.append( QString( QStringLiteral( "*.%1" ) ).arg( QString( format ) ) );
}
return QString( "%1 (%2);;%3 (*.*)" ).arg( tr( "Images" ), formatsFilter.join( QStringLiteral( " " ) ), tr( "All files" ) );
return QString( "%1 (%2);;%3 (*.*)" ).arg( tr( "Images" ), formatsFilter.join( QLatin1Char( ' ' ) ), tr( "All files" ) );
}
DEFAULT_BUILTIN_UNREACHABLE
}
@@ -1000,7 +1000,7 @@ void QgsProjectionSelectionTreeWidget::updateBoundsPreview()
properties << tr( "Method: %1" ).arg( operation.description() );

const QString propertiesString = QStringLiteral( "<dt><b>%1</b></dt><dd><ul><li>%2</li></ul></dd>" ).arg( tr( "Properties" ),
properties.join( QStringLiteral( "</li><li>" ) ) );
properties.join( QLatin1String( "</li><li>" ) ) );

const QString extentHtml = QStringLiteral( "<dt><b>%1</b></dt><dd>%2</dd>" ).arg( tr( "Extent" ), extentString );
const QString wktString = QStringLiteral( "<dt><b>%1</b></dt><dd><code>%2</code></dd>" ).arg( tr( "WKT" ), currentCrs.toWkt( QgsCoordinateReferenceSystem::WKT_PREFERRED, true ).replace( '\n', QLatin1String( "<br>" ) ).replace( ' ', QLatin1String( "&nbsp;" ) ) );
@@ -409,7 +409,7 @@ void QgsProjectionSelectionWidget::updateWarning()
warning += QStringLiteral( "<li>%1</li>" ).arg( id );
}

warning += QStringLiteral( "</ul>" );
warning += QLatin1String( "</ul>" );
}

mWarningLabel->setToolTip( warning );
@@ -243,7 +243,7 @@ class TcpServerWorker: public QObject
}

const QString protocol { firstLinePieces.at( 2 )};
if ( protocol != QStringLiteral( "HTTP/1.0" ) && protocol != QStringLiteral( "HTTP/1.1" ) )
if ( protocol != QLatin1String( "HTTP/1.0" ) && protocol != QLatin1String( "HTTP/1.1" ) )
{
throw HttpException( QStringLiteral( "HTTP error unsupported protocol: %1" ).arg( protocol ) );
}
@@ -325,19 +325,19 @@ QString QgsServerProjectUtils::serviceUrl( const QString &service, const QgsServ
}

QgsServerRequest::RequestHeader header = QgsServerRequest::RequestHeader::X_QGIS_SERVICE_URL;
if ( serviceUpper == QStringLiteral( "WMS" ) )
if ( serviceUpper == QLatin1String( "WMS" ) )
{
header = QgsServerRequest::RequestHeader::X_QGIS_WMS_SERVICE_URL;
}
else if ( serviceUpper == QStringLiteral( "WFS" ) )
else if ( serviceUpper == QLatin1String( "WFS" ) )
{
header = QgsServerRequest::RequestHeader::X_QGIS_WFS_SERVICE_URL;
}
else if ( serviceUpper == QStringLiteral( "WCS" ) )
else if ( serviceUpper == QLatin1String( "WCS" ) )
{
header = QgsServerRequest::RequestHeader::X_QGIS_WCS_SERVICE_URL;
}
else if ( serviceUpper == QStringLiteral( "WMTS" ) )
else if ( serviceUpper == QLatin1String( "WMTS" ) )
{
header = QgsServerRequest::RequestHeader::X_QGIS_WMTS_SERVICE_URL;
}
@@ -574,19 +574,19 @@ bool QgsServerSettings::logProfile()
QString QgsServerSettings::serviceUrl( const QString &service ) const
{
QString result;
if ( service.compare( QStringLiteral( "WMS" ) ) )
if ( service.compare( QLatin1String( "WMS" ) ) )
{
result = value( QgsServerSettingsEnv::QGIS_SERVER_WMS_SERVICE_URL ).toString();
}
else if ( service.compare( QStringLiteral( "WFS" ) ) )
else if ( service.compare( QLatin1String( "WFS" ) ) )
{
result = value( QgsServerSettingsEnv::QGIS_SERVER_WFS_SERVICE_URL ).toString();
}
else if ( service.compare( QStringLiteral( "WCS" ) ) )
else if ( service.compare( QLatin1String( "WCS" ) ) )
{
result = value( QgsServerSettingsEnv::QGIS_SERVER_WCS_SERVICE_URL ).toString();
}
else if ( service.compare( QStringLiteral( "WMTS" ) ) )
else if ( service.compare( QLatin1String( "WMTS" ) ) )
{
result = value( QgsServerSettingsEnv::QGIS_SERVER_WMTS_SERVICE_URL ).toString();
}
@@ -83,11 +83,11 @@ void TestQgsSettingsRegistry::getSettingsEntriesWithDynamicKeys()
settingsRegistry.addSettingsEntry( &settingsEntryDouble );

QCOMPARE( settingsRegistry.settingsEntry( settingsEntryBoolKey ), &settingsEntryBool );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryBoolKey.replace( QStringLiteral( "%1" ), QStringLiteral( "1st" ) ) ), &settingsEntryBool );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryBoolKey.replace( QLatin1String( "%1" ), QLatin1String( "1st" ) ) ), &settingsEntryBool );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryIntegerKey ), &settingsEntryInteger );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryIntegerKey.replace( QStringLiteral( "%1" ), QStringLiteral( "Second" ) ) ), &settingsEntryInteger );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryIntegerKey.replace( QLatin1String( "%1" ), QLatin1String( "Second" ) ) ), &settingsEntryInteger );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryDoubleKey ), &settingsEntryDouble );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryDoubleKey.replace( QStringLiteral( "%1" ), QStringLiteral( "1st" ) ).replace( QStringLiteral( "%2" ), QStringLiteral( "2nd" ) ) ), &settingsEntryDouble );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryDoubleKey.replace( QLatin1String( "%1" ), QLatin1String( "1st" ) ).replace( QLatin1String( "%2" ), QLatin1String( "2nd" ) ) ), &settingsEntryDouble );
QCOMPARE( settingsRegistry.settingsEntry( settingsEntryInexisting ), nullptr );
}

0 comments on commit 7951eb8

Please sign in to comment.