summaryrefslogtreecommitdiff
path: root/PluginsManager.h
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2017-11-24 23:24:09 +0000
committerThomas Preud'homme <robotux@celest.fr>2017-11-24 23:24:09 +0000
commitb3c8bdcc0d1e4b2ab298847a7902b6d60410a5bc (patch)
tree8fce8a51adfb245db8ab2a76831661780c0c713e /PluginsManager.h
parente297dbd8052ef4e66f069e2dd1865ae7fa8af28e (diff)
New upstream version 1.2.3.6
Diffstat (limited to 'PluginsManager.h')
-rw-r--r--PluginsManager.h215
1 files changed, 112 insertions, 103 deletions
diff --git a/PluginsManager.h b/PluginsManager.h
index 7c2d035..9b3ecc9 100644
--- a/PluginsManager.h
+++ b/PluginsManager.h
@@ -1,9 +1,7 @@
/** \file PluginsManager.h
\brief Define the class to manage and load the plugins
\author alpha_one_x86
-\version 0.3
-\date 2010
-\licence GPL3, see the file COPYING */
+\licence GPL3, see the file COPYING */
#ifndef PLUGINS_MANAGER_H
#define PLUGINS_MANAGER_H
@@ -21,15 +19,17 @@
#include <QCryptographicHash>
#include <QString>
#include <QSemaphore>
+#include <QRegularExpression>
+#include <QThread>
#include "Environment.h"
-#include "Singleton.h"
#include "OptionEngine.h"
#include "ResourcesManager.h"
#include "PluginInformation.h"
+#ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
#include "QXzDecodeThread.h"
#include "QTarDecode.h"
-#include "AuthPlugin.h"
+#endif
namespace Ui {
class PluginOptions;
@@ -38,106 +38,115 @@ namespace Ui {
/** \brief Define the class to manage and load the resources linked with the themes
This class provide a core load and manage the resources */
-class PluginsManager : public QThread, public Singleton<PluginsManager>
+class PluginsManager : public QThread
{
- Q_OBJECT
- friend class Singleton<PluginsManager>;
- public:
- /// \brief to get plugins of type specific
- QList<PluginsAvailable> getPluginsByCategory(const PluginType &type);
- /** \brief to get plugins */
- QList<PluginsAvailable> getPlugins();
- /// \brief get translated text
- //QString getTranslatedText(PluginsAvailable plugin,QString informationName,QString mainShortName);
- //QString getTranslatedText(PluginsAvailable plugin,QString informationName);
- /// \brief transform short plugin name into file name
- static QString getResolvedPluginName(const QString &name);
- static bool isSamePlugin(const PluginsAvailable &pluginA,const PluginsAvailable &pluginB);
- void lockPluginListEdition();
- void unlockPluginListEdition();
- bool allPluginHaveBeenLoaded();
- /// \brief to load the get dom specific
- QString getDomSpecific(const QDomElement &root,const QString &name,const QList<QPair<QString,QString> > &listChildAttribute);
- QString getDomSpecific(const QDomElement &root,const QString &name);
- /// \brief set current language
- void setLanguage(const QString &language);
- /// \brief Enumeration of plugin add backend
- enum ImportBackend
- {
- ImportBackend_File, //import plugin from local file
- ImportBackend_Internet //import plugin form internet
- };
- private:
- /// \brief Create the manager and load the defaults variables
- PluginsManager();
- /// \brief Destroy the language manager
- ~PluginsManager();
- /// \brief get informations text
- //QString getInformationText(PluginsAvailable plugin,QString informationName);
- //for the options
- OptionEngine *options;
- /// \brief Store the object of resources manager
- ResourcesManager *resources;
- /// \brief List of plugins
- QList<PluginsAvailable> pluginsList;
- QMultiMap<PluginType,PluginsAvailable> pluginsListIndexed;
- /// \brief to load the multi-language balise
- void loadBalise(const QDomElement &root,const QString &name,QList<QStringList> *informations,QString *errorString,bool needHaveOneEntryMinimum=true,bool multiLanguage=false,bool englishNeedBeFound=false);
- /// \brief check the dependencies
- void checkDependencies();
- /// \brief get the version
- QString getPluginVersion(const QString &pluginName);
- /// \brief To compare version
- bool compareVersion(const QString &versionA,const QString &sign,const QString &versionB);
- /// \brief plugin information windows
- PluginInformation pluginInformationWindows;
- /// \brief list of cat plugin type
- //QStringList catPlugin;
- QStringList englishPluginType;
- QList<QTreeWidgetItem *> catItemList;
- /// \brief store the current mainShortName
- QString mainShortName;
- /// \brief load the plugin list
- void loadPluginList();
- QAction *backendMenuFile; ///< Pointer on the file backend menu
- bool importingPlugin;
- void lunchDecodeThread(const QByteArray &data);
- QXzDecodeThread decodeThread;
- void loadPluginXml(PluginsAvailable * thePlugin,const QByteArray &xml);
- AuthPlugin *checkPluginThread;
- QStringList readPluginPath;
- bool loadPluginInformation(const QString &path);
- QSemaphore editionSemList;
- bool stopIt;
- bool pluginLoaded;
- QString language;
- void excuteTheFileBackendLoader();
- QString categoryToString(const PluginType &category);
- QString categoryToTranslation(const PluginType &category);
- //temp variable
- int index,loop_size,sub_index,loop_sub_size;
- private slots:
- /// \brief show the information
- void showInformationDoubleClick();
- void decodingFinished();
- void newAuthPath(const QString &path);
- void post_operation();
+ Q_OBJECT
+ public:
+ /// \brief to get plugins of type specific
+ QList<PluginsAvailable> getPluginsByCategory(const PluginType &type) const;
+ /** \brief to get plugins */
+ QList<PluginsAvailable> getPlugins(bool withError=false) const;
+ /// \brief get translated text
+ //QString getTranslatedText(PluginsAvailable plugin,QString informationName,QString mainShortName);
+ //QString getTranslatedText(PluginsAvailable plugin,QString informationName);
+ /// \brief transform short plugin name into file name
+ static QString getResolvedPluginName(const QString &name);
+ static bool isSamePlugin(const PluginsAvailable &pluginA,const PluginsAvailable &pluginB);
+ void lockPluginListEdition();
+ void unlockPluginListEdition();
+ bool allPluginHaveBeenLoaded() const;
+ /// \brief to load the get dom specific
+ QString getDomSpecific(const QDomElement &root,const QString &name,const QList<QPair<QString,QString> > &listChildAttribute) const;
+ QString getDomSpecific(const QDomElement &root,const QString &name) const;
+ /// \brief set current language
+ void setLanguage(const QString &language);
+ /// \brief Enumeration of plugin add backend
+ enum ImportBackend
+ {
+ ImportBackend_File, //import plugin from local file
+ ImportBackend_Internet //import plugin form internet
+ };
+ static PluginsManager *pluginsManager;
+ /// \brief Create the manager and load the defaults variables
+ PluginsManager();
+ /// \brief Destroy the language manager
+ ~PluginsManager();
+ /// \brief To compare version
+ static bool compareVersion(const QString &versionA,const QString &sign,const QString &versionB);
+ private:
+ /// \brief List of plugins
+ QList<PluginsAvailable> pluginsList;
+ QMultiMap<PluginType,PluginsAvailable> pluginsListIndexed;
+ /// \brief to load the multi-language balise
+ void loadBalise(const QDomElement &root,const QString &name,QList<QStringList> *informations,QString *errorString,bool needHaveOneEntryMinimum=true,bool multiLanguage=false,bool englishNeedBeFound=false);
+ /// \brief get the version
+ QString getPluginVersion(const QString &pluginName) const;
+ /// \brief list of cat plugin type
+ //QStringList catPlugin;
+ QStringList englishPluginType;
+ QList<QTreeWidgetItem *> catItemList;
+ /// \brief store the current mainShortName
+ QString mainShortName;
+ /// \brief load the plugin list
+ void loadPluginList();
+ #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
+ QAction *backendMenuFile; ///< Pointer on the file backend menu
+ bool importingPlugin;
+ void lunchDecodeThread(const QByteArray &data);
+ QXzDecodeThread decodeThread;
+ void executeTheFileBackendLoader();
+ #endif
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ /// \brief check the dependencies, return number of error
+ quint32 checkDependencies();
+ #endif
+ void loadPluginXml(PluginsAvailable * thePlugin,const QByteArray &xml);
+ QStringList readPluginPath;
+ bool loadPluginInformation(const QString &path);
+ QSemaphore editionSemList;
+ bool stopIt;
+ bool pluginLoaded;
+ QString language;
+ QString categoryToString(const PluginType &category) const;
+ QString categoryToTranslation(const PluginType &category);
+ QRegularExpression regexp_to_clean_1,regexp_to_clean_2,regexp_to_clean_3,regexp_to_clean_4,regexp_to_clean_5;
+ QRegularExpression regexp_to_dep_1,regexp_to_dep_2,regexp_to_dep_3,regexp_to_dep_4,regexp_to_dep_5,regexp_to_dep_6;
+ PluginInformation *pluginInformation;
+ private slots:
+ /// \brief show the information
+ void showInformationDoubleClick();
+ #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
+ void decodingFinished();
+ #endif
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ void newAuthPath(const QString &path);
+ #endif
+ void post_operation();
/* public slots:
- /// \brief to refresh the plugin list
- void refreshPluginList(QString mainShortName="en");*/
- signals:
- void pluginListingIsfinish();
- void onePluginAdded(const PluginsAvailable&);
- void onePluginWillBeRemoved(const PluginsAvailable&); // when will be really removed
- void onePluginWillBeUnloaded(const PluginsAvailable&);//just unload to quit the application
- void needLangToRefreshPluginList();
- void newLanguageLoaded();
- protected:
- void run();
- public slots: //do gui action
- void showInformation(const QString &path);
- void removeThePluginSelected(const QString &path);
- void addPlugin(const ImportBackend &backend);
+ /// \brief to refresh the plugin list
+ void refreshPluginList(QString mainShortName="en");*/
+ signals:
+ void pluginListingIsfinish() const;
+ void onePluginAdded(const PluginsAvailable&) const;
+ void onePluginInErrorAdded(const PluginsAvailable&) const;
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
+ void onePluginWillBeRemoved(const PluginsAvailable&) const; // when will be really removed
+ void onePluginWillBeUnloaded(const PluginsAvailable&) const;//just unload to quit the application
+ #endif
+ void needLangToRefreshPluginList() const;
+ void newLanguageLoaded() const;
+ #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
+ void manuallyAdded(const PluginsAvailable&) const;
+ #endif
+ protected:
+ void run();
+ public slots: //do gui action
+ void showInformation(const QString &path);
+ #ifdef ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
+ void removeThePluginSelected(const QString &path);
+ void addPlugin(const ImportBackend &backend);
+ void tryLoadPlugin(const QString &file);
+ #endif
};
/// \brief to do structure comparaison