Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FEATURE] add option to show/hide deprecated plugins in plugin manager
  • Loading branch information
alexbruy committed Sep 13, 2013
1 parent 8a27c76 commit 6d5df7c
Show file tree
Hide file tree
Showing 4 changed files with 440 additions and 325 deletions.
2 changes: 2 additions & 0 deletions python/pyplugin_installer/installer_data.py
Expand Up @@ -713,12 +713,14 @@ def rebuild(self):
self.mPlugins[i] = self.localCache[i].copy()
settings = QSettings()
allowExperimental = settings.value(settingsGroup+"/allowExperimental", False, type=bool)
allowDeprecated = settings.value(settingsGroup+"/allowDeprecated", False, type=bool)
for i in self.repoCache.values():
for j in i:
plugin=j.copy() # do not update repoCache elements!
key = plugin["id"]
# check if the plugin is allowed and if there isn't any better one added already.
if (allowExperimental or not plugin["experimental"]) \
and (allowDeprecated or not plugin["deprecated"]) \
and not (self.mPlugins.has_key(key) and self.mPlugins[key]["version_available"] and compareVersions(self.mPlugins[key]["version_available"], plugin["version_available"]) < 2):
# The mPlugins dict contains now locally installed plugins.
# Now, add the available one if not present yet or update it if present already.
Expand Down
15 changes: 15 additions & 0 deletions src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -187,6 +187,12 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils* pythonUtils )
ckbExperimental->setChecked( true );
}

if ( settings.value( settingsGroup + "/allowDeprecated", false ).toBool() )
{
ckbDeprecated->setChecked( true );
}


int interval = settings.value( settingsGroup + "/checkOnStartInterval", "" ).toInt( );
int indx = mCheckingOnStartIntervals.indexOf( interval ); // if none found, just use -1 index.
comboInterval->setCurrentIndex( indx );
Expand Down Expand Up @@ -1236,6 +1242,15 @@ void QgsPluginManager::on_ckbExperimental_toggled( bool state )
QgsPythonRunner::run( "pyplugin_installer.instance().exportPluginsToManager()" );
}

void QgsPluginManager::on_ckbDeprecated_toggled( bool state )
{
QString settingsGroup;
QgsPythonRunner::eval( "pyplugin_installer.instance().exportSettingsGroup()", settingsGroup );
QSettings settings;
settings.setValue( settingsGroup + "/allowDeprecated", QVariant( state ) );
QgsPythonRunner::run( "pyplugin_installer.installer_data.plugins.rebuild()" );
QgsPythonRunner::run( "pyplugin_installer.instance().exportPluginsToManager()" );
}


// PRIVATE METHODS ///////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/app/pluginmanager/qgspluginmanager.h
Expand Up @@ -153,6 +153,9 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
//! Reload plugin metadata registry after allowing/disallowing experimental plugins
void on_ckbExperimental_toggled( bool state );

//! Reload plugin metadata registry after allowing/disallowing deprecated plugins
void on_ckbDeprecated_toggled( bool state );

//! Open help browser
void on_buttonBox_helpRequested( ) { QgsContextHelp::run( metaObject()->className() ); }

Expand Down

0 comments on commit 6d5df7c

Please sign in to comment.