enable/disable PluginInterface

This commit is contained in:
alemuntoni 2021-02-08 16:21:22 +01:00
parent 850b1d9473
commit 90302aea75
3 changed files with 33 additions and 2 deletions

View File

@ -1,7 +1,7 @@
#include "plugin_interface.h"
PluginInterface::PluginInterface() :
logstream(nullptr)
logstream(nullptr), enabled(true)
{
}
@ -10,6 +10,26 @@ void PluginInterface::setLog(GLLogStream* log)
this->logstream = log;
}
bool PluginInterface::isEnabled() const
{
return enabled;
}
void PluginInterface::enable()
{
enabled = true;
}
void PluginInterface::disable()
{
enabled = false;
}
QFileInfo PluginInterface::pluginFileInfo() const
{
return plugFileInfo;
}
void PluginInterface::log(const char* s)
{
if(logstream != nullptr) {

View File

@ -25,7 +25,7 @@
#define MESHLAB_PLUGIN_INTERFACE_H
#include <QAction>
#include <QFileInfo>
#include "../../GLLogStream.h"
#include "../../parameters/rich_parameter_list.h"
@ -46,6 +46,8 @@
class PluginInterface
{
public:
friend class PluginManager;
typedef int FilterIDType;
/** the type used to identify plugin actions; there is a one-to-one relation between an ID and an Action.
@ -72,6 +74,12 @@ public:
/// Standard stuff that usually should not be redefined.
void setLog(GLLogStream* log);
bool isEnabled() const;
void enable();
void disable();
QFileInfo pluginFileInfo() const;
// This function must be used to communicate useful information collected in the parsing/saving of the files.
// NEVER EVER use a msgbox to say something to the user.
@ -97,6 +105,8 @@ public:
private:
GLLogStream *logstream;
bool enabled;
QFileInfo plugFileInfo;
};
/************************

View File

@ -251,6 +251,7 @@ bool PluginManager::loadPlugin(const QString& fileName)
//TODO: check in some way also the meshlab version of the plugin
if (ip) { //Classic MeshLab plugin (non Edit...)
ip->plugFileInfo = fin;
bool loadOk = false;
//FilterPlugin
FilterPluginInterface *iFilter = qobject_cast<FilterPluginInterface *>(plugin);