Skip to content
Permalink
Browse files

rename QgsBasemapPathRegistry to QgsLocalizedDataPathRegistry

  • Loading branch information
3nids committed May 15, 2020
1 parent 74c2ccc commit 360827ade0049d9f4e4c1d35bc55214d4f01b4c3
@@ -859,9 +859,13 @@ Returns registry of available project storage implementations.
.. versionadded:: 3.2
%End

static QgsBasemapPathRegistry *basemapPathRegistry() /KeepReference/;
static QgsLocalizedDataPathRegistry *localizedDataPathRegistry() /KeepReference/;
%Docstring
Returns the registry of basemaps paths
Returns the registry of data repositories
These are used as paths for basemaps, logos, etc. which can be referenced
differently across work stations.

.. seealso:: :py:class:`QgsLocalizedDataPathRegistry`

.. versionadded:: 3.14
%End
@@ -1,7 +1,7 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsbasemappathregistry.h *
* src/core/qgslocalizeddatapathregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -11,28 +11,28 @@



class QgsBasemapPathRegistry
class QgsLocalizedDataPathRegistry
{
%Docstring
A registry class to hold paths of basemaps
A registry class to hold localized data paths which can be used for basemaps, logos, etc.
Paths are meant to be absolute paths and are stored by order of preference.

If a layer from one of the paths is loaded, it will be saved as basemap in the project file.
For instance, if you have C:\my_maps in your basemap paths,
C:\my_maps\my_country\ortho.tif will be save in your project as basemap:my_country\ortho.tif
If a layer from one of the paths is loaded, it will be saved as localized in the project file.
For instance, if you have C:\my_maps in your localized paths,
C:\my_maps\my_country\ortho.tif will be save in your project as localized:my_country\ortho.tif

The resolving of the file paths happens in QgsPathResolver.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsbasemappathregistry.h"
#include "qgslocalizeddatapathregistry.h"
%End
public:
QgsBasemapPathRegistry();
QgsLocalizedDataPathRegistry();

~QgsBasemapPathRegistry();
~QgsLocalizedDataPathRegistry();

QString fullPath( const QString &relativePath ) const;
%Docstring
@@ -46,30 +46,30 @@ Returns the relative path if the file has been found in one of the path, an empt

QStringList paths() const;
%Docstring
Returns a list of registered basemap paths
Returns a list of registered localized paths
%End


void registerPath( const QString &path, int position = -1 );
%Docstring
Registers a basemap path
Registers a localized path
If ``position`` is given, the path is inserted at the given position in the list
Since the paths are stored by order of preference, lower positions in the list take precedence.
%End

void unregisterPath( const QString &path );
%Docstring
Unregisters a basemap path
Unregisters a localized path
%End

private:
QgsBasemapPathRegistry( const QgsBasemapPathRegistry &other );
QgsLocalizedDataPathRegistry( const QgsLocalizedDataPathRegistry &other );
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsbasemappathregistry.h *
* src/core/qgslocalizeddatapathregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -15,7 +15,6 @@
%Include auto_generated/qgsattributes.sip
%Include auto_generated/qgsattributetableconfig.sip
%Include auto_generated/qgsauxiliarystorage.sip
%Include auto_generated/qgsbasemappathregistry.sip
%Include auto_generated/qgsbearingutils.sip
%Include auto_generated/qgsblockingnetworkrequest.sip
%Include auto_generated/qgsbookmarkmanager.sip
@@ -100,6 +99,7 @@
%Include auto_generated/qgslegendsettings.sip
%Include auto_generated/qgslegendstyle.sip
%Include auto_generated/qgslocaldefaultsettings.sip
%Include auto_generated/qgslocalizeddatapathregistry.sip
%Include auto_generated/qgslogger.sip
%Include auto_generated/qgsmapdecoration.sip
%Include auto_generated/qgsmaphittest.sip
@@ -40,7 +40,7 @@
#include "qgsnumericformatwidget.h"

#include "qgsattributetablefiltermodel.h"
#include "qgsbasemappathregistry.h"
#include "qgslocalizeddatapathregistry.h"
#include "qgsrasterformatsaveoptionswidget.h"
#include "qgsrasterpyramidsoptionswidget.h"
#include "qgsdatumtransformtablewidget.h"
@@ -309,20 +309,19 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
connect( mBtnAddTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::addTemplatePath );
connect( mBtnRemoveTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::removeTemplatePath );

// basemap paths
connect( mBasemapPathAddButton, &QAbstractButton::clicked, this, &QgsOptions::addBasemapPath );
connect( mBasemapPathRemoveButton, &QAbstractButton::clicked, this, &QgsOptions::removeBasemapPath );
connect( mBasemapPathUpButton, &QAbstractButton::clicked, this, &QgsOptions::moveBasemapPathUp );
connect( mBasemapPathDownButton, &QAbstractButton::clicked, this, &QgsOptions::moveBasemapPathDown );
// localized data paths
connect( mLocalizedDataPathAddButton, &QAbstractButton::clicked, this, &QgsOptions::addLocalizedDataPath );
connect( mLocalizedDataPathRemoveButton, &QAbstractButton::clicked, this, &QgsOptions::removeLocalizedDataPath );
connect( mLocalizedDataPathUpButton, &QAbstractButton::clicked, this, &QgsOptions::moveLocalizedDataPathUp );
connect( mLocalizedDataPathDownButton, &QAbstractButton::clicked, this, &QgsOptions::moveLocalizedDataPathDown );

// basemap paths
const QStringList basemapPaths = QgsApplication::basemapPathRegistry()->paths();
for ( const QString &path : basemapPaths )
const QStringList localizedPaths = QgsApplication::localizedDataPathRegistry()->paths();
for ( const QString &path : localizedPaths )
{
QListWidgetItem *newItem = new QListWidgetItem( mBasemapPathListWidget );
QListWidgetItem *newItem = new QListWidgetItem( mLocalizedDataPathListWidget );
newItem->setText( path );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mBasemapPathListWidget->addItem( newItem );
mLocalizedDataPathListWidget->addItem( newItem );
}

//paths hidden from browser
@@ -1427,9 +1426,9 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "Layout/searchPathsForTemplates" ), pathsList, QgsSettings::Core );

pathsList.clear();
for ( int r = 0; r < mBasemapPathListWidget->count(); r++ )
pathsList << mBasemapPathListWidget->item( r )->text();
QgsApplication::basemapPathRegistry()->setPaths( pathsList );
for ( int r = 0; r < mLocalizedDataPathListWidget->count(); r++ )
pathsList << mLocalizedDataPathListWidget->item( r )->text();
QgsApplication::localizedDataPathRegistry()->setPaths( pathsList );

pathsList.clear();
for ( int i = 0; i < mListHiddenBrowserPaths->count(); ++i )
@@ -2550,12 +2549,12 @@ void QgsOptions::addColor()
mTreeCustomColors->addColor( newColor, QgsSymbolLayerUtils::colorToName( newColor ) );
}

void QgsOptions::removeBasemapPath()
void QgsOptions::removeLocalizedDataPath()
{
qDeleteAll( mBasemapPathListWidget->selectedItems() );
qDeleteAll( mLocalizedDataPathListWidget->selectedItems() );
}

void QgsOptions::addBasemapPath()
void QgsOptions::addLocalizedDataPath()
{
QString myDir = QFileDialog::getExistingDirectory(
this,
@@ -2566,35 +2565,35 @@ void QgsOptions::addBasemapPath()

if ( ! myDir.isEmpty() )
{
QListWidgetItem *newItem = new QListWidgetItem( mBasemapPathListWidget );
QListWidgetItem *newItem = new QListWidgetItem( mLocalizedDataPathListWidget );
newItem->setText( myDir );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mBasemapPathListWidget->addItem( newItem );
mBasemapPathListWidget->setCurrentItem( newItem );
mLocalizedDataPathListWidget->addItem( newItem );
mLocalizedDataPathListWidget->setCurrentItem( newItem );
}
}

void QgsOptions::moveBasemapPathUp()
void QgsOptions::moveLocalizedDataPathUp()
{
QList<QListWidgetItem *> selectedItems = mBasemapPathListWidget->selectedItems();
QList<QListWidgetItem *> selectedItems = mLocalizedDataPathListWidget->selectedItems();
QList<QListWidgetItem *>::iterator itemIt = selectedItems.begin();
for ( ; itemIt != selectedItems.end(); ++itemIt )
{
int row = mBasemapPathListWidget->row( *itemIt );
mBasemapPathListWidget->takeItem( row );
mBasemapPathListWidget->insertItem( row - 1, *itemIt );
int row = mLocalizedDataPathListWidget->row( *itemIt );
mLocalizedDataPathListWidget->takeItem( row );
mLocalizedDataPathListWidget->insertItem( row - 1, *itemIt );
}
}

void QgsOptions::moveBasemapPathDown()
void QgsOptions::moveLocalizedDataPathDown()
{
QList<QListWidgetItem *> selectedItems = mBasemapPathListWidget->selectedItems();
QList<QListWidgetItem *> selectedItems = mLocalizedDataPathListWidget->selectedItems();
QList<QListWidgetItem *>::iterator itemIt = selectedItems.begin();
for ( ; itemIt != selectedItems.end(); ++itemIt )
{
int row = mBasemapPathListWidget->row( *itemIt );
mBasemapPathListWidget->takeItem( row );
mBasemapPathListWidget->insertItem( row + 1, *itemIt );
int row = mLocalizedDataPathListWidget->row( *itemIt );
mLocalizedDataPathListWidget->takeItem( row );
mLocalizedDataPathListWidget->insertItem( row + 1, *itemIt );
}
}

@@ -242,10 +242,10 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
void addColor();

private slots:
void removeBasemapPath();
void addBasemapPath();
void moveBasemapPathUp();
void moveBasemapPathDown();
void removeLocalizedDataPath();
void addLocalizedDataPath();
void moveLocalizedDataPathUp();
void moveLocalizedDataPathDown();

private:
QgsSettings *mSettings = nullptr;
@@ -224,7 +224,6 @@ SET(QGIS_CORE_SRCS
qgsattributetableconfig.cpp
qgsattributeeditorelement.cpp
qgsauxiliarystorage.cpp
qgsbasemappathregistry.cpp
qgsbearingutils.cpp
qgsblockingnetworkrequest.cpp
qgsbookmarkmanager.cpp
@@ -307,6 +306,7 @@ SET(QGIS_CORE_SRCS
qgslegendstyle.cpp
qgslocaldefaultsettings.cpp
qgslocalec.cpp
qgslocalizeddatapathregistry.cpp
qgslogger.cpp
qgsmapdecoration.cpp
qgsmaphittest.cpp
@@ -762,7 +762,6 @@ SET(QGIS_CORE_HDRS
qgsattributes.h
qgsattributetableconfig.h
qgsauxiliarystorage.h
qgsbasemappathregistry.h
qgsbearingutils.h
qgsblockingnetworkrequest.h
qgsbookmarkmanager.h
@@ -856,6 +855,7 @@ SET(QGIS_CORE_HDRS
qgslegendstyle.h
qgslocaldefaultsettings.h
qgslocalec.h
qgslocalizeddatapathregistry.h
qgslogger.h
qgsmapdecoration.h
qgsmaphittest.h
@@ -15,7 +15,7 @@

#include "qgsapplication.h"
#include "qgsauthmanager.h"
#include "qgsbasemappathregistry.h"
#include "qgslocalizeddatapathregistry.h"
#include "qgsdataitemproviderregistry.h"
#include "qgsexception.h"
#include "qgsgeometry.h"
@@ -2236,16 +2236,16 @@ QgsProjectStorageRegistry *QgsApplication::projectStorageRegistry()
return members()->mProjectStorageRegistry;
}

QgsBasemapPathRegistry *QgsApplication::basemapPathRegistry()
QgsLocalizedDataPathRegistry *QgsApplication::localizedDataPathRegistry()
{
return members()->mBasemapPathRegistry;
return members()->mLocalizedDataPathRegistry;
}

QgsApplication::ApplicationMembers::ApplicationMembers()
{
// don't use initializer lists or scoped pointers - as more objects are added here we
// will need to be careful with the order of creation/destruction
mBasemapPathRegistry = new QgsBasemapPathRegistry();
mLocalizedDataPathRegistry = new QgsLocalizedDataPathRegistry();
mMessageLog = new QgsMessageLog();
mProfiler = new QgsRuntimeProfiler();

@@ -2423,7 +2423,7 @@ QgsApplication::ApplicationMembers::~ApplicationMembers()
delete mNumericFormatRegistry;
delete mBookmarkManager;
delete mConnectionRegistry;
delete mBasemapPathRegistry;
delete mLocalizedDataPathRegistry;
}

QgsApplication::ApplicationMembers *QgsApplication::members()
@@ -32,7 +32,7 @@ class QgsFieldFormatterRegistry;
class QgsColorSchemeRegistry;
class QgsPaintEffectRegistry;
class QgsProjectStorageRegistry;
class QgsBasemapPathRegistry;
class QgsLocalizedDataPathRegistry;
class QgsRendererRegistry;
class QgsSvgCache;
class QgsImageCache;
@@ -791,10 +791,13 @@ class CORE_EXPORT QgsApplication : public QApplication
static QgsProjectStorageRegistry *projectStorageRegistry() SIP_KEEPREFERENCE;

/**
* Returns the registry of basemaps paths
* Returns the registry of data repositories
* These are used as paths for basemaps, logos, etc. which can be referenced
* differently across work stations.
* \see QgsLocalizedDataPathRegistry
* \since QGIS 3.14
*/
static QgsBasemapPathRegistry *basemapPathRegistry() SIP_KEEPREFERENCE;
static QgsLocalizedDataPathRegistry *localizedDataPathRegistry() SIP_KEEPREFERENCE;

/**
* This string is used to represent the value `NULL` throughout QGIS.
@@ -920,7 +923,7 @@ class CORE_EXPORT QgsApplication : public QApplication
QgsActionScopeRegistry *mActionScopeRegistry = nullptr;
QgsAnnotationRegistry *mAnnotationRegistry = nullptr;
QgsColorSchemeRegistry *mColorSchemeRegistry = nullptr;
QgsBasemapPathRegistry *mBasemapPathRegistry = nullptr;
QgsLocalizedDataPathRegistry *mLocalizedDataPathRegistry = nullptr;
QgsNumericFormatRegistry *mNumericFormatRegistry = nullptr;
QgsFieldFormatterRegistry *mFieldFormatterRegistry = nullptr;
QgsGpsConnectionRegistry *mGpsConnectionRegistry = nullptr;

0 comments on commit 360827a

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