Skip to content

Commit

Permalink
replace deprecated QLatin1Literal by QLatin1String (#35229)
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Mar 21, 2020
1 parent 11121ae commit e82e98d
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/auth/oauth2/qgsauthoauth2edit.cpp
Expand Up @@ -993,7 +993,7 @@ void QgsAuthOAuth2Edit::parseSoftwareStatement( const QString &path )
if ( !grantTypes.isEmpty( ) )
{
QString grantType = grantTypes[0];
if ( grantType == QLatin1Literal( "authorization_code" ) )
if ( grantType == QLatin1String( "authorization_code" ) )
{
updateGrantFlow( static_cast<int>( QgsAuthOAuth2Config::AuthCode ) );
}
Expand Down Expand Up @@ -1120,10 +1120,10 @@ void QgsAuthOAuth2Edit::registerSoftStatement( const QString &registrationUrl )
QByteArray json = QJsonWrapper::toJson( QVariant( mSoftwareStatement ), &res, &errStr );
QNetworkRequest registerRequest( regUrl );
QgsSetRequestInitiatorClass( registerRequest, QStringLiteral( "QgsAuthOAuth2Edit" ) );
registerRequest.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1Literal( "application/json" ) );
registerRequest.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1String( "application/json" ) );
QNetworkReply *registerReply;
// For testability: use GET if protocol is file://
if ( regUrl.scheme() == QLatin1Literal( "file" ) )
if ( regUrl.scheme() == QLatin1String( "file" ) )
registerReply = QgsNetworkAccessManager::instance()->get( registerRequest );
else
registerReply = QgsNetworkAccessManager::instance()->post( registerRequest, json );
Expand Down
2 changes: 1 addition & 1 deletion src/auth/oauth2/qgso2.cpp
Expand Up @@ -233,7 +233,7 @@ void QgsO2::link()
QUrl url( tokenUrl_ );
QNetworkRequest tokenRequest( url );
QgsSetRequestInitiatorClass( tokenRequest, QStringLiteral( "QgsO2" ) );
tokenRequest.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1Literal( "application/x-www-form-urlencoded" ) );
tokenRequest.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1String( "application/x-www-form-urlencoded" ) );
QNetworkReply *tokenReply = getManager()->post( tokenRequest, payload );

connect( tokenReply, SIGNAL( finished() ), this, SLOT( onTokenReplyFinished() ), Qt::QueuedConnection );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -2983,7 +2983,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
if ( name.isEmpty() )
name = QObject::tr( "Imported from GDAL" );

bool deprecated = name.contains( QLatin1Literal( "(deprecated)" ) );
bool deprecated = name.contains( QLatin1String( "(deprecated)" ) );

sql = QStringLiteral( "SELECT parameters,description,deprecated,noupdate FROM tbl_srs WHERE auth_name='EPSG' AND auth_id='%1'" ).arg( it.key() );
statement = database.prepare( sql, result );
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsopenclutils.cpp
Expand Up @@ -29,9 +29,9 @@
#include <tchar.h>
#endif

QLatin1String QgsOpenClUtils::SETTINGS_GLOBAL_ENABLED_KEY = QLatin1Literal( "OpenClEnabled" );
QLatin1String QgsOpenClUtils::SETTINGS_DEFAULT_DEVICE_KEY = QLatin1Literal( "OpenClDefaultDevice" );
QLatin1String QgsOpenClUtils::LOGMESSAGE_TAG = QLatin1Literal( "OpenCL" );
QLatin1String QgsOpenClUtils::SETTINGS_GLOBAL_ENABLED_KEY = QLatin1String( "OpenClEnabled" );
QLatin1String QgsOpenClUtils::SETTINGS_DEFAULT_DEVICE_KEY = QLatin1String( "OpenClDefaultDevice" );
QLatin1String QgsOpenClUtils::LOGMESSAGE_TAG = QLatin1String( "OpenCL" );
bool QgsOpenClUtils::sAvailable = false;

Q_GLOBAL_STATIC( QString, sSourcePath )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvirtuallayertask.cpp
Expand Up @@ -24,7 +24,7 @@ QgsVirtualLayerTask::QgsVirtualLayerTask( const QgsVirtualLayerDefinition &defin
{
mDefinition.setLazy( true );
QgsVectorLayer::LayerOptions options { QgsCoordinateTransformContext() };
mLayer = qgis::make_unique<QgsVectorLayer>( mDefinition.toString(), QStringLiteral( "layer" ), QLatin1Literal( "virtual" ), options );
mLayer = qgis::make_unique<QgsVectorLayer>( mDefinition.toString(), QStringLiteral( "layer" ), QLatin1String( "virtual" ), options );
}

bool QgsVirtualLayerTask::run()
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspgtablemodel.cpp
Expand Up @@ -468,7 +468,7 @@ QString QgsPgTableModel::layerURI( const QModelIndex &index, const QString &conn
uri.setWkbType( wkbType );
uri.setSrid( srid );
uri.disableSelectAtId( !selectAtId );
uri.setParam( QStringLiteral( "checkPrimaryKeyUnicity" ), checkPrimaryKeyUnicity ? QLatin1Literal( "1" ) : QLatin1Literal( "0" ) );
uri.setParam( QStringLiteral( "checkPrimaryKeyUnicity" ), checkPrimaryKeyUnicity ? QLatin1String( "1" ) : QLatin1String( "0" ) );

QgsDebugMsg( QStringLiteral( "returning uri %1" ).arg( uri.uri( false ) ) );
return uri.uri( false );
Expand Down
Expand Up @@ -292,7 +292,7 @@ QList<QgsSpatiaLiteProviderConnection::TableProperty> QgsSpatiaLiteProviderConne
QgsSpatiaLiteProviderConnection::TableProperty property;
property.setTableName( tableName );
// Create a layer and get information from it
std::unique_ptr< QgsVectorLayer > vl = qgis::make_unique<QgsVectorLayer>( dsUri.uri(), QString(), QLatin1Literal( "spatialite" ) );
std::unique_ptr< QgsVectorLayer > vl = qgis::make_unique<QgsVectorLayer>( dsUri.uri(), QString(), QLatin1String( "spatialite" ) );
if ( vl->isValid() )
{
if ( vl->isSpatial() )
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -2530,7 +2530,7 @@ namespace QgsWms

// create vector layer
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
std::unique_ptr<QgsVectorLayer> layer = qgis::make_unique<QgsVectorLayer>( url, param.mName, QLatin1Literal( "memory" ), options );
std::unique_ptr<QgsVectorLayer> layer = qgis::make_unique<QgsVectorLayer>( url, param.mName, QLatin1String( "memory" ), options );
if ( !layer->isValid() )
{
continue;
Expand Down
8 changes: 4 additions & 4 deletions tests/src/auth/testqgsauthoauth2method.cpp
Expand Up @@ -465,8 +465,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistration()
{
qApp->processEvents();
}
QCOMPARE( dlg.leClientId->text(), QLatin1Literal( "___QGIS_ROCKS___@www.qgis.org" ) );
QCOMPARE( dlg.leClientSecret->text(), QLatin1Literal( "___QGIS_ROCKS______QGIS_ROCKS______QGIS_ROCKS___" ) );
QCOMPARE( dlg.leClientId->text(), QLatin1String( "___QGIS_ROCKS___@www.qgis.org" ) );
QCOMPARE( dlg.leClientSecret->text(), QLatin1String( "___QGIS_ROCKS______QGIS_ROCKS______QGIS_ROCKS___" ) );
}


Expand Down Expand Up @@ -499,8 +499,8 @@ void TestQgsAuthOAuth2Method::testDynamicRegistrationJwt()
{
qApp->processEvents();
}
QCOMPARE( dlg.leClientId->text(), QLatin1Literal( "___QGIS_ROCKS___@www.qgis.org" ) );
QCOMPARE( dlg.leClientSecret->text(), QLatin1Literal( "___QGIS_ROCKS______QGIS_ROCKS______QGIS_ROCKS___" ) );
QCOMPARE( dlg.leClientId->text(), QLatin1String( "___QGIS_ROCKS___@www.qgis.org" ) );
QCOMPARE( dlg.leClientSecret->text(), QLatin1String( "___QGIS_ROCKS______QGIS_ROCKS______QGIS_ROCKS___" ) );
}


Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testqgsogrprovider.cpp
Expand Up @@ -100,7 +100,7 @@ void TestQgsOgrProvider::setupProxy()
settings.setValue( QStringLiteral( "proxy/proxyPassword" ), QStringLiteral( "password" ) );
settings.setValue( QStringLiteral( "proxy/proxyExcludedUrls" ), QStringLiteral( "http://www.myhost.com|http://www.myotherhost.com" ) );
QgsNetworkAccessManager::instance()->setupDefaultProxyAndCache();
QgsVectorLayer vl( mTestDataDir + '/' + QStringLiteral( "lines.shp" ), QStringLiteral( "proxy_test" ), QLatin1Literal( "ogr" ) );
QgsVectorLayer vl( mTestDataDir + '/' + QStringLiteral( "lines.shp" ), QStringLiteral( "proxy_test" ), QLatin1String( "ogr" ) );
QVERIFY( vl.isValid() );
const char *proxyConfig = CPLGetConfigOption( "GDAL_HTTP_PROXY", nullptr );
QCOMPARE( proxyConfig, "myproxyhostname.com:1234" );
Expand All @@ -116,7 +116,7 @@ void TestQgsOgrProvider::setupProxy()
settings.setValue( QStringLiteral( "proxy/proxyUser" ), QStringLiteral( "username" ) );
settings.remove( QStringLiteral( "proxy/proxyPassword" ) );
QgsNetworkAccessManager::instance()->setupDefaultProxyAndCache();
QgsVectorLayer vl( mTestDataDir + '/' + QStringLiteral( "lines.shp" ), QStringLiteral( "proxy_test" ), QLatin1Literal( "ogr" ) );
QgsVectorLayer vl( mTestDataDir + '/' + QStringLiteral( "lines.shp" ), QStringLiteral( "proxy_test" ), QLatin1String( "ogr" ) );
QVERIFY( vl.isValid() );
const char *proxyConfig = CPLGetConfigOption( "GDAL_HTTP_PROXY", nullptr );
QCOMPARE( proxyConfig, "myproxyhostname.com" );
Expand Down Expand Up @@ -167,7 +167,7 @@ class ReadVectorLayer : public QThread
void run() override
{

QgsVectorLayer *vl2 = new QgsVectorLayer( _filePath, QStringLiteral( "thread_test" ), QLatin1Literal( "ogr" ) );
QgsVectorLayer *vl2 = new QgsVectorLayer( _filePath, QStringLiteral( "thread_test" ), QLatin1String( "ogr" ) );

QgsFeature f;
QVERIFY( vl2->getFeatures().nextFeature( f ) );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gui/testqgsdatetimeedit.cpp
Expand Up @@ -57,7 +57,7 @@ void TestQgsDateTimeEdit::init()

vl = qgis::make_unique<QgsVectorLayer>( QStringLiteral( "Point?crs=epsg:4326" ),
QStringLiteral( "myvl" ),
QLatin1Literal( "memory" ) );
QLatin1String( "memory" ) );

// add fields
QList<QgsField> fields;
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gui/testqgsrangewidgetwrapper.cpp
Expand Up @@ -84,7 +84,7 @@ void TestQgsRangeWidgetWrapper::init()
{
vl = qgis::make_unique<QgsVectorLayer>( QStringLiteral( "Point?crs=epsg:4326" ),
QStringLiteral( "myvl" ),
QLatin1Literal( "memory" ) );
QLatin1String( "memory" ) );

// add fields
QList<QgsField> fields;
Expand Down

0 comments on commit e82e98d

Please sign in to comment.