Skip to content
Permalink
Browse files

rename full/relative to global/localized

  • Loading branch information
3nids committed May 15, 2020
1 parent 7460747 commit b67f6bf2d9d47a9178324b7bc1dc0e54201a7edf
@@ -34,14 +34,14 @@ The resolving of the file paths happens in QgsPathResolver.

~QgsLocalizedDataPathRegistry();

QString fullPath( const QString &relativePath ) const;
QString globalPath( const QString &localizedPath ) const;
%Docstring
Returns the full path if the file has been found in one of the paths, an empty string otherwise
Returns the global path if the file has been found in one of the paths, an empty string otherwise
%End

QString relativePath( const QString &fullPath ) const;
QString localizedPath( const QString &globalPath ) const;
%Docstring
Returns the relative path if the file has been found in one of the path, an empty string otherwise
Returns the localized path if the file has been found in one of the path, an empty string otherwise
%End

QStringList paths() const;
@@ -26,7 +26,7 @@ QgsLocalizedDataPathRegistry::QgsLocalizedDataPathRegistry()
readFromSettings();
}

QString QgsLocalizedDataPathRegistry::fullPath( const QString &relativePath ) const
QString QgsLocalizedDataPathRegistry::globalPath( const QString &relativePath ) const
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Read );

@@ -37,7 +37,7 @@ QString QgsLocalizedDataPathRegistry::fullPath( const QString &relativePath ) co
return QString();
}

QString QgsLocalizedDataPathRegistry::relativePath( const QString &fullPath ) const
QString QgsLocalizedDataPathRegistry::localizedPath( const QString &fullPath ) const
{
QgsReadWriteLocker locker( mLock, QgsReadWriteLocker::Read );

@@ -45,11 +45,11 @@ class CORE_EXPORT QgsLocalizedDataPathRegistry

~QgsLocalizedDataPathRegistry() = default;

//! Returns the full path if the file has been found in one of the paths, an empty string otherwise
QString fullPath( const QString &relativePath ) const;
//! Returns the global path if the file has been found in one of the paths, an empty string otherwise
QString globalPath( const QString &localizedPath ) const;

//! Returns the relative path if the file has been found in one of the path, an empty string otherwise
QString relativePath( const QString &fullPath ) const;
//! Returns the localized path if the file has been found in one of the path, an empty string otherwise
QString localizedPath( const QString &globalPath ) const;

//! Returns a list of registered localized paths
QStringList paths() const;
@@ -53,7 +53,7 @@ QString QgsPathResolver::readPath( const QString &f ) const
if ( src.startsWith( QLatin1String( "localized:" ) ) )
{
// strip away "localized:" prefix, replace with actual inbuilt data folder path
return QgsApplication::localizedDataPathRegistry()->fullPath( src.mid( 10 ) ) ;
return QgsApplication::localizedDataPathRegistry()->globalPath( src.mid( 10 ) ) ;
}

if ( mBaseFileName.isNull() )
@@ -191,9 +191,9 @@ QString QgsPathResolver::writePath( const QString &src ) const
return src;
}

QString basemapPath = QgsApplication::localizedDataPathRegistry()->relativePath( src );
if ( !basemapPath.isEmpty() )
return QStringLiteral( "localized:" ) + basemapPath;
QString localizedPath = QgsApplication::localizedDataPathRegistry()->localizedPath( src );
if ( !localizedPath.isEmpty() )
return QStringLiteral( "localized:" ) + localizedPath;

if ( src.startsWith( QgsApplication::pkgDataPath() + QStringLiteral( "/resources" ) ) )
{

0 comments on commit b67f6bf

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