Skip to content
Permalink
Browse files

replace deprecated QLatin1Literal by QLatin1String (#35229)

  • Loading branch information
3nids committed Mar 21, 2020
1 parent 11121ae commit e82e98d8659bf3c553c74572924822750106ea95
@@ -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 ) );
}
@@ -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 );
@@ -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 );
@@ -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 );
@@ -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 )
@@ -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()
@@ -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 );
@@ -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() )
@@ -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;
@@ -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___" ) );
}


@@ -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___" ) );
}


@@ -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" );
@@ -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" );
@@ -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 ) );
@@ -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;
@@ -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;

0 comments on commit e82e98d

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