The providers plugin path can be changed in the applications.

This commit is contained in:
George Shegunov 2015-07-10 21:59:50 +03:00 committed by Matthias Kuhn
parent 0a7e3f5e2b
commit 9fdab87056
2 changed files with 17 additions and 3 deletions

View File

@ -69,6 +69,12 @@ QgsProviderRegistry::QgsProviderRegistry( const QString& pluginPath )
QString mLibraryDirectory = baseDir + "/lib";
#endif
mLibraryDirectory = pluginPath;
init();
}
void QgsProviderRegistry::init()
{
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
@ -220,7 +226,7 @@ QgsProviderRegistry::QgsProviderRegistry( const QString& pluginPath )
// typedef for the unload dataprovider function
typedef void cleanupProviderFunction_t();
QgsProviderRegistry::~QgsProviderRegistry()
void QgsProviderRegistry::clean()
{
QgsMapLayerRegistry::instance()->removeAllMapLayers();
@ -242,6 +248,11 @@ QgsProviderRegistry::~QgsProviderRegistry()
}
}
QgsProviderRegistry::~QgsProviderRegistry()
{
clean();
}
/** Convenience function for finding any existing data providers that match "providerKey"
@ -313,13 +324,13 @@ QString QgsProviderRegistry::pluginList( bool asHTML ) const
return list;
}
void QgsProviderRegistry::setLibraryDirectory( QDir const & path )
{
mLibraryDirectory = path;
clean();
init();
}
QDir const & QgsProviderRegistry::libraryDirectory() const
{
return mLibraryDirectory;

View File

@ -172,6 +172,9 @@ class CORE_EXPORT QgsProviderRegistry
/** Ctor private since instance() creates it */
QgsProviderRegistry( const QString& pluginPath );
void init();
void clean();
/** Associative container of provider metadata handles */
Providers mProviders;