Skip to content

Commit

Permalink
Code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
borysiasty authored and NathanW2 committed Jun 5, 2013
1 parent 81f0319 commit 53d3ea9
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 560 deletions.
25 changes: 7 additions & 18 deletions python/gui/qgspluginmanagerinterface.sip
@@ -1,6 +1,6 @@
/**
* \class QgsPluginManagerInterface
* \brief Abstract base class to make QgsPluginManager available to plugins.
* \brief Abstract base class to make QgsPluginManager available to pyplugin_installer.
*/
class QgsPluginManagerInterface : QObject
{
Expand All @@ -16,35 +16,24 @@ class QgsPluginManagerInterface : QObject
//! Virtual destructor
~QgsPluginManagerInterface();

//! remove metadata of all python plugins from the registry (c++ plugins stay)
//! remove python plugins from the metadata registry (c++ plugins stay)
virtual void clearPythonPluginMetadata() = 0;

//! add a single plugin to the metadata registry
virtual void addPluginMetadata( QMap<QString,QString> metadata ) = 0;
virtual void addPluginMetadata( QMap<QString, QString> metadata ) = 0;

//! refresh listView model and textView content
//! refresh plugin list model (and metadata browser content if necessary)
virtual void reloadModel() = 0;

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

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

//! add repository to the repository listWidget
virtual void addToRepositoryList( QMap<QString,QString> repository ) = 0;
virtual void addToRepositoryList( QMap<QString, QString> repository ) = 0;

signals:

//! emitted when the Python Plugin Installer should show the fetching repositories window
void fetchingStillInProgress( );

public slots:

//! show the Plugin Manager window when remote repositories are fetched.
//! Display a progress dialog when fetching.
virtual void showPluginManagerWhenReady( ) = 0;

//! promptly show the Plugin Manager window and optionally open tab tabIndex:
//! show the Plugin Manager window and optionally open tab tabIndex
virtual void showPluginManager( int tabIndex = -1 ) = 0;
};
46 changes: 27 additions & 19 deletions src/app/pluginmanager/metadata
@@ -1,29 +1,37 @@
PLUGIN METADATA TAGS
=======================================================
id the key, usually library base name
name
id the key,library base name
name human readable plugin name
description
icon path to installed or available icon
category will be removed?
tags comma separated, spaces allowed
changelog may be multiline
icon path to installed or available icon
category isn't it depreciated?
tags comma separated, spaces allowed
changelog may be multiline
author_name
author_email
homepage url
tracker url
code_repository url
homepage url
tracker url
code_repository url
version_installed
library cpp: path to the installed library | Python: module name
pythonic is plugin pythonic or cpp?
readonly is core plugin?
status not installed | installed | upgradeable | orphan | new | newer *
error NULL | broken | incompatible | dependent
library absolute path to the installed library / module
pythonic true | false (is plugin pythonic or cpp?)
readonly true | false (is core plugin?)
installed true | false
available true | false
status not installed | new | upgradeable | orphan | newer *
error NULL | broken | incompatible | dependent
error_details
experimental choosen version status
experimental choosen version status
version_available
zip_repository the remote repository id
zip_repository the remote repository id
download_url
filename the zip file name
downloads number of dowloads
filename the zip file name to be unpacked
downloads number of dowloads
average_vote
rating_votes number of votes
rating_votes number of votes

* status is only obligatory for Pythin plugins and it must match all the tags:
available, installed. version_available, version_installed.
orphan = installed and not available to download;
new = not installed and seen for the first time;
newer = the installer version is newer than available one.
34 changes: 12 additions & 22 deletions src/app/pluginmanager/qgsapppluginmanagerinterface.cpp
Expand Up @@ -29,14 +29,7 @@ QgsAppPluginManagerInterface::~QgsAppPluginManagerInterface()
}


//! show the Plugin Manager window when remote repositories are fetched.
//! Display a progress dialog when fetching.
void QgsAppPluginManagerInterface::showPluginManagerWhenReady( )
{
}


//! promptly show the Plugin Manager window and optionally open tab tabIndex:
//! show the Plugin Manager window and optionally open tab tabIndex
void QgsAppPluginManagerInterface::showPluginManager( int tabIndex )
{
mPluginManager->getCppPluginDescriptions();
Expand All @@ -45,43 +38,41 @@ void QgsAppPluginManagerInterface::showPluginManager( int tabIndex )
//! switch to tab, if specified ( -1 means not specified )
if ( tabIndex > -1 )
{
mPluginManager->selectTabItem( tabIndex );
mPluginManager->selectTabItem( tabIndex );
}

mPluginManager->exec();
}


//! remove metadata of all python plugins from the registry (c++ plugins stay)
//! remove python plugins from the metadata registry (c++ plugins stay)
void QgsAppPluginManagerInterface::clearPythonPluginMetadata()
{
mPluginManager->clearPythonPluginMetadata();
}


//! add a single plugin to the metadata registry
void QgsAppPluginManagerInterface::addPluginMetadata( QMap<QString,QString> metadata )
void QgsAppPluginManagerInterface::addPluginMetadata( QMap<QString, QString> metadata )
{
if ( metadata.isEmpty() || !metadata.contains("id") )
if ( metadata.isEmpty() || !metadata.contains( "id" ) )
{
QgsDebugMsg( "Warning: incomplete metadata" );
return;
QgsDebugMsg( "Warning: incomplete metadata" );
return;
}
mPluginManager->addPluginMetadata( metadata.value("id"), metadata );
mPluginManager->addPluginMetadata( metadata.value( "id" ), metadata );
}


//! refresh listView model and textView content
//! refresh plugin list model (and metadata browser content if necessary)
void QgsAppPluginManagerInterface::reloadModel()
{
mPluginManager->reloadModelData();
}




//! get given plugin metadata
QMap<QString,QString> * QgsAppPluginManagerInterface::pluginMetadata( QString key )
//! return given plugin metadata
QMap<QString, QString> * QgsAppPluginManagerInterface::pluginMetadata( QString key )
{
return mPluginManager->pluginMetadata( key );
}
Expand All @@ -95,8 +86,7 @@ void QgsAppPluginManagerInterface::clearRepositoryList()


//! add repository to the repository listWidget
void QgsAppPluginManagerInterface::addToRepositoryList( QMap<QString,QString> repository )
void QgsAppPluginManagerInterface::addToRepositoryList( QMap<QString, QString> repository )
{
mPluginManager->addToRepositoryList( repository );
}

20 changes: 7 additions & 13 deletions src/app/pluginmanager/qgsapppluginmanagerinterface.h
Expand Up @@ -22,7 +22,7 @@

/** \ingroup gui
* QgsPluginManagerInterface
* Abstract base class to make QgsPluginManager available to plugins.
* Abstract base class to make QgsPluginManager available to pyplugin_installer.
*/
class QgsAppPluginManagerInterface : public QgsPluginManagerInterface
{
Expand All @@ -36,31 +36,25 @@ class QgsAppPluginManagerInterface : public QgsPluginManagerInterface
//! Destructor
~QgsAppPluginManagerInterface();

//! remove metadata of all python plugins from the registry (c++ plugins stay)
//! remove python plugins from the metadata registry (c++ plugins stay)
void clearPythonPluginMetadata();

//! add a single plugin to the metadata registry
void addPluginMetadata( QMap<QString,QString> metadata );
void addPluginMetadata( QMap<QString, QString> metadata );

//! refresh listView model and textView content
//! refresh plugin list model (and metadata browser content if necessary)
void reloadModel();

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

//! clear the repository listWidget
void clearRepositoryList();

//! add repository to the repository listWidget
void addToRepositoryList( QMap<QString,QString> repository );
void addToRepositoryList( QMap<QString, QString> repository );

public slots:

//! show the Plugin Manager window when remote repositories are fetched.
//! Display a progress dialog when fetching.
void showPluginManagerWhenReady( );

//! promptly show the Plugin Manager window and optionally open tab tabIndex:
//! show the Plugin Manager window and optionally open tab tabIndex
void showPluginManager( int tabIndex = -1 );

private:
Expand Down

0 comments on commit 53d3ea9

Please sign in to comment.