Commit c93bc323 authored by Mathieu Westphal's avatar Mathieu Westphal

Adding support for showing Plugin description

This adds support for plugin description in the plugin manager
parent 37e1c130
......@@ -739,6 +739,7 @@ ENDMACRO()
# html/css/png/jpg files that comprise of the documentation for the plugin. In
# addition, CMake will automatically generate documentation for any proxies
# defined in XMLs for this plugin.
# DESCRIPTION (optional) : A description of the plugin, to be shown in the plugin manager
# EULA (optional) :- a text file with the text for the EULA for the plugin.
# the user is required to accept the EULA before the plugin
# can be loaded.
......@@ -758,6 +759,7 @@ ENDMACRO()
# [REQUIRED_ON_CLIENT]
# [REQUIRED_PLUGINS pluginname1 pluginname2]
# [CS_KITS kit1 kit2...]
# [DESCRIPTION description]
# [EULA eulafile]
# [EXCLUDE_FROM_DEFAULT_TARGET]
# )
......@@ -779,6 +781,7 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
SET(ARG_AUTOLOAD)
SET(ARG_CS_KITS)
SET(ARG_DOCUMENTATION_DIR)
SET(ARG_DESCRIPTION)
SET(ARG_EULA)
SET(PLUGIN_NAME "${NAME}")
......@@ -787,6 +790,7 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
SET(PLUGIN_REQUIRED_ON_CLIENT 1)
SET(PLUGIN_REQUIRED_PLUGINS)
SET(HAVE_REQUIRED_PLUGINS 0)
SET(PLUGIN_DESCRIPTION)
SET(BINARY_RESOURCES_INIT)
SET(QRC_RESOURCES_INIT)
SET(EXTRA_INCLUDES)
......@@ -804,7 +808,7 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
PV_PLUGIN_PARSE_ARGUMENTS(ARG
"DOCUMENTATION_DIR;SERVER_MANAGER_SOURCES;SERVER_MANAGER_XML;SERVER_SOURCES;PYTHON_MODULES;GUI_INTERFACES;GUI_RESOURCES;GUI_RESOURCE_FILES;GUI_SOURCES;SOURCES;REQUIRED_PLUGINS;REQUIRED_ON_SERVER;REQUIRED_ON_CLIENT;EXCLUDE_FROM_DEFAULT_TARGET;AUTOLOAD;CS_KITS;EULA"
"DOCUMENTATION_DIR;SERVER_MANAGER_SOURCES;SERVER_MANAGER_XML;SERVER_SOURCES;PYTHON_MODULES;GUI_INTERFACES;GUI_RESOURCES;GUI_RESOURCE_FILES;GUI_SOURCES;SOURCES;REQUIRED_PLUGINS;REQUIRED_ON_SERVER;REQUIRED_ON_CLIENT;EXCLUDE_FROM_DEFAULT_TARGET;AUTOLOAD;CS_KITS;DESCRIPTION;EULA"
"" ${ARGN} )
PV_PLUGIN_LIST_CONTAINS(reqired_server_arg "REQUIRED_ON_SERVER" ${ARGN})
......@@ -829,6 +833,10 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
SET(HAVE_REQUIRED_PLUGINS 1)
ENDIF()
IF(ARG_DESCRIPTION)
SET(PLUGIN_DESCRIPTION "${ARG_DESCRIPTION}")
ENDIF()
IF(ARG_SERVER_MANAGER_SOURCES OR ARG_SERVER_MANAGER_XML)
ADD_SERVER_MANAGER_EXTENSION(SM_SRCS ${NAME} ${VERSION} "${ARG_SERVER_MANAGER_XML}"
${ARG_SERVER_MANAGER_SOURCES})
......
......@@ -109,6 +109,17 @@ public:
return "@PLUGIN_REQUIRED_PLUGINS@";
}
/**
* Returns a description of this plugin.
*/
const char* GetDescription() override
{
return "@PLUGIN_DESCRIPTION@";
}
/**
* Returns EULA for the plugin, if any. If none, this will return nullptr.
*/
const char* GetEULA() override;
// Description:
......
......@@ -80,6 +80,11 @@ public:
*/
virtual const char* GetRequiredPlugins() = 0;
/**
* Returns a description of this plugin.
*/
virtual const char* GetDescription() = 0;
/**
* Returns EULA for the plugin, if any. If none, this will return nullptr.
*/
......
......@@ -121,6 +121,11 @@ public:
// Returns a ';' separated list of plugin names required by this plugin.
const char* GetRequiredPlugins() override { return ""; }
/**
* Returns a description of this plugin.
*/
const char* GetDescription() override { return ""; }
// Description:
// Obtain the server-manager configuration xmls, if any.
void GetXMLs(std::vector<std::string>& xmls) override { xmls.push_back(this->XML); }
......
......@@ -33,6 +33,7 @@ public:
std::string Name;
std::string FileName;
std::string RequiredPlugins;
std::string Description;
std::string Version;
std::string StatusMessage;
bool AutoLoadForce;
......@@ -81,6 +82,12 @@ public:
}
this->RequiredPlugins = temp_ptr;
if (!stream.GetArgument(0, offset++, &temp_ptr))
{
return false;
}
this->Description = temp_ptr;
if (!stream.GetArgument(0, offset++, &temp_ptr))
{
return false;
......@@ -113,8 +120,8 @@ public:
void operator<<(vtkClientServerStream& stream, const vtkItem& item)
{
stream << item.Name.c_str() << item.FileName.c_str() << item.RequiredPlugins.c_str()
<< item.Version.c_str() << item.AutoLoad << item.Loaded << item.RequiredOnClient
<< item.RequiredOnServer;
<< item.Description.c_str() << item.Version.c_str() << item.AutoLoad << item.Loaded
<< item.RequiredOnClient << item.RequiredOnServer;
}
}
......@@ -224,6 +231,7 @@ void vtkPVPluginsInformation::CopyFromObject(vtkObject*)
item.RequiredPlugins = plugin->GetRequiredPlugins();
item.RequiredOnClient = plugin->GetRequiredOnClient();
item.RequiredOnServer = plugin->GetRequiredOnServer();
item.Description = plugin->GetDescription();
item.Version = plugin->GetPluginVersionString();
}
else
......@@ -338,6 +346,16 @@ const char* vtkPVPluginsInformation::GetRequiredPlugins(unsigned int cc)
return NULL;
}
//----------------------------------------------------------------------------
const char* vtkPVPluginsInformation::GetDescription(unsigned int cc)
{
if (cc < this->GetNumberOfPlugins())
{
return (*this->Internals)[cc].Description.c_str();
}
return NULL;
}
//----------------------------------------------------------------------------
bool vtkPVPluginsInformation::GetRequiredOnServer(unsigned int cc)
{
......
......@@ -46,6 +46,7 @@ public:
const char* GetRequiredPlugins(unsigned int);
bool GetRequiredOnServer(unsigned int);
bool GetRequiredOnClient(unsigned int);
const char* GetDescription(unsigned int);
bool GetAutoLoad(unsigned int);
//@}
......
......@@ -49,6 +49,7 @@ public:
bool GetRequiredOnServer() override { return true; }
bool GetRequiredOnClient() override { return false; }
const char* GetRequiredPlugins() override { return ""; }
const char* GetDescription() override { return ""; }
const char* GetEULA() override { return nullptr; }
//@}
......
......@@ -38,6 +38,7 @@ class vtkPVInitializerPlugin : public vtkPVPlugin,
bool GetRequiredOnServer() override { return false; }
bool GetRequiredOnClient() override { return false; }
const char* GetRequiredPlugins() override { return ""; }
const char* GetDescription() override { return ""; }
void GetBinaryResources(std::vector<std::string>&) override { }
const char* GetEULA() override { return nullptr; }
......
......@@ -347,6 +347,17 @@ void pqPluginDialog::addInfoNodes(QTreeWidgetItem* pluginNode, vtkPVPluginsInfor
QTreeWidgetItem* infoNode = new QTreeWidgetItem(pluginNode, infoText);
infoNode->setFlags(infoFlags);
// Description
if (strlen(plInfo->GetDescription(index)) > 0)
{
infoText.clear();
infoText << tr("Description");
infoText << tr(plInfo->GetDescription(index));
infoNode = new QTreeWidgetItem(pluginNode, infoText);
infoNode->setFlags(infoFlags);
infoNode->setToolTip(ValueCol, tr(plInfo->GetDescription(index)));
}
// Location
infoText.clear();
infoText << tr("Location") << tr(plInfo->GetPluginFileName(index));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment