Skip to content
Permalink
Browse files

[Plugin Manager] Make appropriate methods const

  • Loading branch information
borysiasty committed Jun 10, 2013
1 parent 9ca721e commit 039ae695076a7f656ef3e7e0376517f9bed2146e
@@ -26,7 +26,7 @@ class QgsPluginManagerInterface : QObject
virtual void reloadModel() = 0;

//! return given plugin metadata
virtual QMap<QString, QString> * pluginMetadata( QString key ) = 0;
virtual const QMap<QString, QString> * pluginMetadata( QString key ) const = 0;

//! clear the repository listWidget
virtual void clearRepositoryList() = 0;
@@ -72,7 +72,7 @@ void QgsAppPluginManagerInterface::reloadModel()


//! return given plugin metadata
QMap<QString, QString> * QgsAppPluginManagerInterface::pluginMetadata( QString key )
const QMap<QString, QString> * QgsAppPluginManagerInterface::pluginMetadata( QString key ) const
{
return mPluginManager->pluginMetadata( key );
}
@@ -46,7 +46,7 @@ class QgsAppPluginManagerInterface : public QgsPluginManagerInterface
void reloadModel();

//! return given plugin metadata
QMap<QString, QString> * pluginMetadata( QString key );
const QMap<QString, QString> * pluginMetadata( QString key ) const;

//! clear the repository listWidget
void clearRepositoryList();
@@ -188,7 +188,7 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils* pythonUtils )

void QgsPluginManager::loadPlugin( QString id )
{
QMap<QString, QString>* plugin = pluginMetadata( id );
const QMap<QString, QString>* plugin = pluginMetadata( id );

if ( ! plugin )
{
@@ -219,7 +219,7 @@ void QgsPluginManager::loadPlugin( QString id )

void QgsPluginManager::unloadPlugin( QString id )
{
QMap<QString, QString>* plugin = pluginMetadata( id );
const QMap<QString, QString>* plugin = pluginMetadata( id );

if ( ! plugin )
{
@@ -547,7 +547,7 @@ void QgsPluginManager::pluginItemChanged( QStandardItem * item )

void QgsPluginManager::showPluginDetails( QStandardItem * item )
{
QMap<QString, QString> * metadata = pluginMetadata( item->data( PLUGIN_BASE_NAME_ROLE ).toString() );
const QMap<QString, QString> * metadata = pluginMetadata( item->data( PLUGIN_BASE_NAME_ROLE ).toString() );

if ( ! metadata ) return;

@@ -767,9 +767,9 @@ void QgsPluginManager::addPluginMetadata( QString key, QMap<QString, QString> m



QMap<QString, QString>* QgsPluginManager::pluginMetadata( QString key )
const QMap<QString, QString> * QgsPluginManager::pluginMetadata( QString key ) const
{
QMap<QString, QMap<QString, QString> >::iterator it = mPlugins.find( key );
QMap<QString, QMap<QString, QString> >::const_iterator it = mPlugins.find( key );
if ( it != mPlugins.end() )
{
return &it.value();
@@ -1174,7 +1174,7 @@ void QgsPluginManager::on_ckbExperimental_toggled( bool state )

bool QgsPluginManager::isPluginLoaded( QString key )
{
QMap<QString, QString>* plugin = pluginMetadata( key );
const QMap<QString, QString>* plugin = pluginMetadata( key );
if ( plugin->isEmpty() )
{
// No such plugin in the metadata registry
@@ -72,7 +72,7 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
void addPluginMetadata( QString key, QMap<QString, QString> metadata );

//! Return metadata of given plugin
QMap<QString, QString> * pluginMetadata( QString key );
const QMap<QString, QString> * pluginMetadata( QString key ) const;

//! Select one of the vertical tabs programatically
void selectTabItem( int idx );
@@ -67,9 +67,9 @@ void QgsPluginRegistry::setPythonUtils( QgsPythonUtils* pythonUtils )
mPythonUtils = pythonUtils;
}

bool QgsPluginRegistry::isLoaded( QString key )
bool QgsPluginRegistry::isLoaded( QString key ) const
{
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find( key );
QMap<QString, QgsPluginMetadata>::const_iterator it = mPlugins.find( key );
if ( it != mPlugins.end() ) // found a c++ plugin?
return true;

@@ -107,7 +107,7 @@ QgisPlugin *QgsPluginRegistry::plugin( QString key )
return it->plugin();
}

bool QgsPluginRegistry::isPythonPlugin( QString key )
bool QgsPluginRegistry::isPythonPlugin( QString key ) const
{
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
@@ -184,7 +184,7 @@ void QgsPluginRegistry::unloadAll()
}


bool QgsPluginRegistry::checkQgisVersion( QString minVersion, QString maxVersion )
bool QgsPluginRegistry::checkQgisVersion( QString minVersion, QString maxVersion ) const
{
// Parse qgisMinVersion. Must be in form x.y.z or just x.y
QStringList minVersionParts = minVersion.split( '.' );
@@ -593,7 +593,7 @@ bool QgsPluginRegistry::checkPythonPlugin( QString packageName )
return true;
}

bool QgsPluginRegistry::isPythonPluginCompatible( QString packageName )
bool QgsPluginRegistry::isPythonPluginCompatible( QString packageName ) const
{
QString minVersion = mPythonUtils->getPluginMetadata( packageName, "qgisMinimumVersion" );
// try to read qgisMaximumVersion. Note checkQgisVersion can cope with "__error__" value.
@@ -46,7 +46,7 @@ class QgsPluginRegistry
void setQgisInterface( QgisInterface* iface );

//! Check whether this module is loaded
bool isLoaded( QString key );
bool isLoaded( QString key ) const;

//! Retrieve library of the plugin
QString library( QString key );
@@ -55,7 +55,7 @@ class QgsPluginRegistry
QgisPlugin * plugin( QString key );

//! Return whether the plugin is pythonic
bool isPythonPlugin( QString key );
bool isPythonPlugin( QString key ) const;

//! Add a plugin to the map of loaded plugins
void addPlugin( QString key, QgsPluginMetadata metadata );
@@ -88,7 +88,7 @@ class QgsPluginRegistry
void restoreSessionPlugins( QString thePluginDirString );

//! Check whether plugin is compatible with current version of QGIS
bool isPythonPluginCompatible( QString packageName );
bool isPythonPluginCompatible( QString packageName ) const;

//! Returns metadata of all loaded plugins
QList<QgsPluginMetadata*> pluginData();
@@ -104,7 +104,7 @@ class QgsPluginRegistry

//! Check current QGIS version against requested minimal and optionally maximal QGIS version
//! if maxVersion not specified, the default value is assumed: floor(minVersion) + 0.99.99
bool checkQgisVersion( QString minVersion, QString maxVersion = "" );
bool checkQgisVersion( QString minVersion, QString maxVersion = "" ) const;

private:
static QgsPluginRegistry* _instance;
@@ -43,7 +43,7 @@ class GUI_EXPORT QgsPluginManagerInterface : public QObject
virtual void reloadModel() = 0;

//! return given plugin metadata
virtual QMap<QString, QString> * pluginMetadata( QString key ) = 0;
virtual const QMap<QString, QString> * pluginMetadata( QString key ) const = 0;

//! clear the repository listWidget
virtual void clearRepositoryList() = 0;

0 comments on commit 039ae69

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