Skip to content
Permalink
Browse files
QString fixups
  • Loading branch information
nyalldawson committed Oct 21, 2021
1 parent 39a7ad3 commit 72e94dcf71c691a348b4548a1b6735751903f6ed
@@ -334,7 +334,7 @@ QVariantMap QgsConvertGpsDataAlgorithm::processAlgorithm( const QVariantMap &par
{
throw QgsProcessingException( QObject::tr( "Unknown GPSBabel format “%1”. Valid formats are: %2" )
.arg( formatName,
QgsApplication::gpsBabelFormatRegistry()->importFormatNames().join( QStringLiteral( ", " ) ) ) );
QgsApplication::gpsBabelFormatRegistry()->importFormatNames().join( QLatin1String( ", " ) ) ) );
}

switch ( featureType )
@@ -550,7 +550,7 @@ QVariantMap QgsDownloadGpsDataAlgorithm::processAlgorithm( const QVariantMap &pa
{
throw QgsProcessingException( QObject::tr( "Unknown GPSBabel device “%1”. Valid devices are: %2" )
.arg( deviceName,
QgsApplication::gpsBabelFormatRegistry()->deviceNames().join( QStringLiteral( ", " ) ) ) );
QgsApplication::gpsBabelFormatRegistry()->deviceNames().join( QLatin1String( ", " ) ) ) );
}

const QString portName = parameterAsString( parameters, QStringLiteral( "PORT" ), context );
@@ -569,7 +569,7 @@ QVariantMap QgsDownloadGpsDataAlgorithm::processAlgorithm( const QVariantMap &pa
{
throw QgsProcessingException( QObject::tr( "Unknown port “%1”. Valid ports are: %2" )
.arg( portName,
validPorts.join( QStringLiteral( ", " ) ) ) );
validPorts.join( QLatin1String( ", " ) ) ) );
}

switch ( featureType )
@@ -785,7 +785,7 @@ QVariantMap QgsUploadGpsDataAlgorithm::processAlgorithm( const QVariantMap &para
{
throw QgsProcessingException( QObject::tr( "Unknown GPSBabel device “%1”. Valid devices are: %2" )
.arg( deviceName,
QgsApplication::gpsBabelFormatRegistry()->deviceNames().join( QStringLiteral( ", " ) ) ) );
QgsApplication::gpsBabelFormatRegistry()->deviceNames().join( QLatin1String( ", " ) ) ) );
}

const QString portName = parameterAsString( parameters, QStringLiteral( "PORT" ), context );
@@ -804,7 +804,7 @@ QVariantMap QgsUploadGpsDataAlgorithm::processAlgorithm( const QVariantMap &para
{
throw QgsProcessingException( QObject::tr( "Unknown port “%1”. Valid ports are: %2" )
.arg( portName,
validPorts.join( QStringLiteral( ", " ) ) ) );
validPorts.join( QLatin1String( ", " ) ) ) );
}


@@ -443,7 +443,7 @@ QStringList QgsRasterCalcNode::cleanRasterReferences()
{

QString layerRef( r->toString() );
if ( layerRef.at( 0 ) == QStringLiteral( "\"" ) && layerRef.at( layerRef.size() - 1 ) == QStringLiteral( "\"" ) )
if ( layerRef.at( 0 ) == QLatin1String( "\"" ) && layerRef.at( layerRef.size() - 1 ) == QLatin1String( "\"" ) )
{
layerRef.remove( 0, 1 );
layerRef.chop( 1 );
@@ -57,7 +57,7 @@ QgsNewMeshLayerDialog::QgsNewMeshLayerDialog( QWidget *parent, Qt::WindowFlags f
const QStringList filters = mDriverFileFilters.values();
mFormatComboBox->setCurrentIndex( -1 );
mFileWidget->setStorageMode( QgsFileWidget::SaveFile );
mFileWidget->setFilter( filters.join( QStringLiteral( ";;" ) ) );
mFileWidget->setFilter( filters.join( QLatin1String( ";;" ) ) );
mMeshProjectComboBox->setFilters( QgsMapLayerProxyModel::MeshLayer );

connect( mFormatComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
@@ -943,7 +943,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
sInstance = this;
QgsRuntimeProfiler *profiler = QgsApplication::profiler();

QColor splashTextColor = Qgis::releaseName() == QStringLiteral( "Master" ) ? QColor( 93, 153, 51 ) : Qt::black;
QColor splashTextColor = Qgis::releaseName() == QLatin1String( "Master" ) ? QColor( 93, 153, 51 ) : Qt::black;

startProfile( tr( "Create user profile manager" ) );
mUserProfileManager = new QgsUserProfileManager( QString(), this );
@@ -214,9 +214,9 @@ QgsFeatureList QgsClipboard::stringToFeatureList( const QString &string, const Q
QgsAttributes attrs;
QgsGeometry geom;
QString attrVal;
bool isFirstLine {string.startsWith( QStringLiteral( "wkt_geom" ) )};
bool isFirstLine {string.startsWith( QLatin1String( "wkt_geom" ) )};
// it seems there is no other way to check for header
const bool hasHeader{string.startsWith( QStringLiteral( "wkt_geom" ) )};
const bool hasHeader{string.startsWith( QLatin1String( "wkt_geom" ) )};
QgsGeometry geometry;
bool setFields {fields.isEmpty()};
QgsFields fieldsFromClipboard;
@@ -232,7 +232,7 @@ QgsFeatureList QgsClipboard::stringToFeatureList( const QString &string, const Q

if ( isFirstLine ) // ... name
{
if ( attrVal != QStringLiteral( "wkt_geom" ) ) // ignore this one
if ( attrVal != QLatin1String( "wkt_geom" ) ) // ignore this one
{
fieldsFromClipboard.append( QgsField{attrVal, QVariant::String } );
}
@@ -160,7 +160,7 @@ QgsFieldItem::QgsFieldItem( QgsDataItem *parent, const QgsField &field )
}
if ( ! constraintsText.isEmpty() )
{
setToolTip( QStringLiteral( "<ul><li>%1</li></ul>" ).arg( constraintsText.join( QStringLiteral( "</li><li>" ) ) ) );
setToolTip( QStringLiteral( "<ul><li>%1</li></ul>" ).arg( constraintsText.join( QLatin1String( "</li><li>" ) ) ) );
}
}

@@ -43,7 +43,7 @@ QgsProviderSublayerItem::QgsProviderSublayerItem( QgsDataItem *parent, const QSt
mToolTip = details.uri();

// no children, except for sqlite, which gets special handling because of the unusual situation with the spatialite provider
setState( details.driverName() == QStringLiteral( "SQLite" ) ? Qgis::BrowserItemState::NotPopulated : Qgis::BrowserItemState::Populated );
setState( details.driverName() == QLatin1String( "SQLite" ) ? Qgis::BrowserItemState::NotPopulated : Qgis::BrowserItemState::Populated );
}

QVector<QgsDataItem *> QgsProviderSublayerItem::createChildren()
@@ -234,7 +234,7 @@ QString QgsBabelFormatRegistry::importFileFilter() const
for ( auto it = descriptionToString.constBegin(); it != descriptionToString.constEnd(); ++it )
res << it.value();

return res.join( QStringLiteral( ";;" ) );
return res.join( QLatin1String( ";;" ) );
}

QStringList QgsBabelFormatRegistry::deviceNames() const
@@ -211,5 +211,5 @@ QString QgsAction::html() const
<b>Action:</b><br>
<pre>%6</pre>
</p>
)html" ).arg( mDescription, mShortTitle, typeText, actionScopes().values().join( QStringLiteral( ", " ) ), mCommand )};
)html" ).arg( mDescription, mShortTitle, typeText, actionScopes().values().join( QLatin1String( ", " ) ), mCommand )};
};
@@ -127,7 +127,7 @@ QString QgsCommandLineUtils::allVersions( )
versionString += QStringLiteral( "OS %1\n" ).arg( QSysInfo::prettyProductName() );

#ifdef QGISDEBUG
versionString += QStringLiteral( "This copy of QGIS writes debugging output.\n" );
versionString += QLatin1String( "This copy of QGIS writes debugging output.\n" );
#endif

return versionString;
@@ -438,7 +438,7 @@ bool QgsFileUtils::renameDataset( const QString &oldPath, const QString &newPath
}
if ( !res )
{
error = QObject::tr( "Destination files already exist %1" ).arg( errors.join( QStringLiteral( ", " ) ) );
error = QObject::tr( "Destination files already exist %1" ).arg( errors.join( QLatin1String( ", " ) ) );
return false;
}

@@ -463,7 +463,7 @@ bool QgsFileUtils::renameDataset( const QString &oldPath, const QString &newPath
}
if ( !res )
{
error = QObject::tr( "Could not rename %1" ).arg( errors.join( QStringLiteral( ", " ) ) );
error = QObject::tr( "Could not rename %1" ).arg( errors.join( QLatin1String( ", " ) ) );
}

return res;
@@ -2352,7 +2352,7 @@ QString QgsMapLayer::generalHtmlMetadata() const
if ( dataProvider() )
metadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Provider" ) + QStringLiteral( "</td><td>%1" ).arg( dataProvider()->name() ) + QStringLiteral( "</td></tr>\n" );

metadata += QStringLiteral( "</table>\n<br><br>" );
metadata += QLatin1String( "</table>\n<br><br>" );
return metadata;
}

@@ -728,7 +728,7 @@ QgsRasterDataProvider::VirtualRasterParameters QgsRasterDataProvider::decodeVirt

for ( const auto &item : query.queryItems() )
{
if ( !( item.first.mid( item.first.indexOf( ':' ), -1 ) == QStringLiteral( ":uri" ) ) )
if ( !( item.first.mid( item.first.indexOf( ':' ), -1 ) == QLatin1String( ":uri" ) ) )
{
continue;
}
@@ -70,9 +70,9 @@ QVariantMap QgsVectorTileProviderMetadata::decodeUri( const QString &uri ) const
if ( dsUri.hasParam( QStringLiteral( "serviceType" ) ) )
uriComponents.insert( QStringLiteral( "serviceType" ), dsUri.param( QStringLiteral( "serviceType" ) ) );

if ( uriComponents[ QStringLiteral( "type" ) ] == QStringLiteral( "mbtiles" ) ||
( uriComponents[ QStringLiteral( "type" ) ] == QStringLiteral( "xyz" ) &&
!dsUri.param( QStringLiteral( "url" ) ).startsWith( QStringLiteral( "http" ) ) ) )
if ( uriComponents[ QStringLiteral( "type" ) ] == QLatin1String( "mbtiles" ) ||
( uriComponents[ QStringLiteral( "type" ) ] == QLatin1String( "xyz" ) &&
!dsUri.param( QStringLiteral( "url" ) ).startsWith( QLatin1String( "http" ) ) ) )
{
uriComponents.insert( QStringLiteral( "path" ), dsUri.param( QStringLiteral( "url" ) ) );
}
@@ -743,7 +743,7 @@ void QgsExpressionTreeView::loadExpressionsFromJson( const QJsonDocument &expres
QMessageBox::information( this,
tr( "Skipped Expression Imports" ),
QStringLiteral( "%1\n%2" ).arg( tr( "The following expressions have been skipped:" ),
skippedExpressionLabelsQuoted.join( QStringLiteral( ", " ) ) ) );
skippedExpressionLabelsQuoted.join( QLatin1String( ", " ) ) ) );
}
}

@@ -405,23 +405,23 @@ void QgsMssqlProvider::loadFields()

// if we don't have an explicitly set geometry column name, and this is a geometry column, then use it
// but if we DO have an explicitly set geometry column name, then load the other information if this is that column
if ( ( mGeometryColName.isEmpty() && ( sqlTypeName == QStringLiteral( "geometry" ) || sqlTypeName == QStringLiteral( "geography" ) ) )
if ( ( mGeometryColName.isEmpty() && ( sqlTypeName == QLatin1String( "geometry" ) || sqlTypeName == QLatin1String( "geography" ) ) )
|| colName == mGeometryColName )
{
mGeometryColName = colName;
mGeometryColType = sqlTypeName;
mParser.mIsGeography = sqlTypeName == QStringLiteral( "geography" );
mParser.mIsGeography = sqlTypeName == QLatin1String( "geography" );
}
else
{
const QVariant::Type sqlType = DecodeSqlType( sqlTypeName );
if ( sqlTypeName == QStringLiteral( "int identity" ) || sqlTypeName == QStringLiteral( "bigint identity" ) )
if ( sqlTypeName == QLatin1String( "int identity" ) || sqlTypeName == QLatin1String( "bigint identity" ) )
{
mPrimaryKeyType = PktInt;
mPrimaryKeyAttrs << mAttributeFields.size();
isIdentity = true;
}
else if ( sqlTypeName == QStringLiteral( "int" ) || sqlTypeName == QStringLiteral( "bigint" ) )
else if ( sqlTypeName == QLatin1String( "int" ) || sqlTypeName == QLatin1String( "bigint" ) )
{
pkCandidates << colName;
}
@@ -447,7 +447,7 @@ void QgsMssqlProvider::loadFields()
sqlType,
sqlTypeName,
query.value( QStringLiteral( "PRECISION" ) ).toInt(),
sqlTypeName == QStringLiteral( "decimal" ) ? query.value( QStringLiteral( "SCALE" ) ).toInt() : -1 );
sqlTypeName == QLatin1String( "decimal" ) ? query.value( QStringLiteral( "SCALE" ) ).toInt() : -1 );
}
else if ( sqlType == QVariant::Date || sqlType == QVariant::DateTime || sqlType == QVariant::Time )
{
@@ -981,7 +981,7 @@ bool QgsOracleProvider::uniqueData( QString query, QString colName )
// This is tricky: in case of SQL query layers we have a generated uid in the form "qgis_generated_uid_%1_" which cannot be quoted as identifier.

QString sql = QString( "SELECT (SELECT count(distinct %1) FROM %2)-(SELECT count(%1) FROM %2) FROM dual" )
.arg( colName.startsWith( QStringLiteral( "qgis_generated_uid_" ) ) ? colName : quotedIdentifier( colName ), mQuery );
.arg( colName.startsWith( QLatin1String( "qgis_generated_uid_" ) ) ? colName : quotedIdentifier( colName ), mQuery );

if ( !exec( qry, sql, QVariantList() ) || !qry.next() )
{
@@ -230,7 +230,7 @@ void QgsQuickMapSettings::onReadProject( const QDomDocument &doc )
QDomNode node = nodes.item( 0 );
QDomElement element = node.toElement();

if ( element.hasAttribute( QStringLiteral( "name" ) ) && element.attribute( QStringLiteral( "name" ) ) == QStringLiteral( "theMapCanvas" ) )
if ( element.hasAttribute( QStringLiteral( "name" ) ) && element.attribute( QStringLiteral( "name" ) ) == QLatin1String( "theMapCanvas" ) )
{
foundTheMapCanvas = true;
mMapSettings.readXml( node );
@@ -132,9 +132,9 @@ void TestQgisAppPython::pythonPluginDependencyOrder()
QVERIFY( mQgisApp->mPythonUtils->pluginList().contains( QStringLiteral( "dependent_plugin_1" ) ) );
QVERIFY( mQgisApp->mPythonUtils->pluginList().contains( QStringLiteral( "dependent_plugin_2" ) ) );

const int indexIndependentPlugin = mQgisApp->mPythonUtils->pluginList().indexOf( QStringLiteral( "PluginPathTest" ) );
const int indexDependentPlugin1 = mQgisApp->mPythonUtils->pluginList().indexOf( QStringLiteral( "dependent_plugin_1" ) );
const int indexDependentPlugin2 = mQgisApp->mPythonUtils->pluginList().indexOf( QStringLiteral( "dependent_plugin_2" ) );
const int indexIndependentPlugin = mQgisApp->mPythonUtils->pluginList().indexOf( QLatin1String( "PluginPathTest" ) );
const int indexDependentPlugin1 = mQgisApp->mPythonUtils->pluginList().indexOf( QLatin1String( "dependent_plugin_1" ) );
const int indexDependentPlugin2 = mQgisApp->mPythonUtils->pluginList().indexOf( QLatin1String( "dependent_plugin_2" ) );

// Dependent plugins should appear in this list after their dependencies,
// since that's the order in which they'll be loaded to QGIS
@@ -123,7 +123,7 @@ void TestQgsMeshEditor::startStopEditing()
datasetGroupIndex = meshLayerQuadTriangle->datasetGroupsIndexes().at( 0 );
meta = meshLayerQuadTriangle->datasetGroupMetadata( datasetGroupIndex );
QVERIFY( meta.dataType() == QgsMeshDatasetGroupMetadata::DataOnVertices );
QVERIFY( meta.name() == QStringLiteral( "vertices Z value" ) );
QVERIFY( meta.name() == QLatin1String( "vertices Z value" ) );
QCOMPARE( meta.isTemporal(), false );
QCOMPARE( meta.isScalar(), true );
QCOMPARE( meta.minimum(), 10.0 );
@@ -153,7 +153,7 @@ void TestQgsMeshEditor::startStopEditing()
datasetGroupIndex = meshLayerQuadTriangle->datasetGroupsIndexes().at( 0 );
meta = meshLayerQuadTriangle->datasetGroupMetadata( datasetGroupIndex );
QVERIFY( meta.dataType() == QgsMeshDatasetGroupMetadata::DataOnVertices );
QVERIFY( meta.name() == QStringLiteral( "vertices Z value" ) );
QVERIFY( meta.name() == QLatin1String( "vertices Z value" ) );
QCOMPARE( meta.isTemporal(), false );
QCOMPARE( meta.isScalar(), true );
QCOMPARE( meta.minimum(), 10.0 );
@@ -175,7 +175,7 @@ void TestQgsMeshEditor::startStopEditing()
datasetGroupIndex = meshLayerQuadTriangle->datasetGroupsIndexes().at( 0 );
meta = meshLayerQuadTriangle->datasetGroupMetadata( datasetGroupIndex );
QVERIFY( meta.dataType() == QgsMeshDatasetGroupMetadata::DataOnVertices );
QVERIFY( meta.name() == QStringLiteral( "Bed Elevation" ) );
QVERIFY( meta.name() == QLatin1String( "Bed Elevation" ) );
QCOMPARE( meta.isTemporal(), false );
QCOMPARE( meta.isScalar(), true );
QCOMPARE( meta.minimum(), 10.0 );
@@ -84,7 +84,7 @@ class QgsTestExternalStorageFetchedContent

QgsTestExternalStorageFetchedContent( QString url )
: QgsExternalStorageFetchedContent()
, mCached( url.endsWith( QStringLiteral( "cached.txt" ) ) )
, mCached( url.endsWith( QLatin1String( "cached.txt" ) ) )
, mUrl( mCached ? SAMPLE_IMAGE : url )
{
}
@@ -66,7 +66,7 @@ class QgsTestExternalStorageStoredContent : public QgsExternalStorageStoredConte

QgsTestExternalStorageStoredContent( const QString &filePath, const QString &url )
: QgsExternalStorageStoredContent(),
mUrl( filePath.endsWith( QStringLiteral( "mydir" ) ) ? url + "mydir/" : url )
mUrl( filePath.endsWith( QLatin1String( "mydir" ) ) ? url + "mydir/" : url )
{}

void store() override

0 comments on commit 72e94dc

Please sign in to comment.