Subversion Repositories Scribus

Rev

Rev 1667 | Rev 2187 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1549 subik 1
#ifndef _PLUGIN_MANAGER_
2
#define _PLUGIN_MANAGER_
3
 
4
#include <qobject.h>
5
#include <qstring.h>
6
#include <qmap.h>
7
#include "scribus.h"
8
 
9
/**
1552 subik 10
 * \brief PluginManager handles plugin loading, unloading, and running.
1549 subik 11
 *
12
 * It contains methods and attributes for plugin running and its settings
13
 * and returning values.
14
 *
1552 subik 15
 * Derived from Franz's ScribusApp stuff (petr vanek)
16
 *
1549 subik 17
 */
18
class PluginManager : public QObject
19
{
20
        Q_OBJECT
21
 
22
public:
1552 subik 23
        /** \brief Human readable enumertion of the plugin types */
24
        // FIXME: what the hell is type5?
25
        enum PluginType {
26
                Persistent = 4,
27
                Import = 7,
28
                Standard = 6,
29
                Type5 = 5
30
        };
31
 
32
        /**
33
         * \brief PluginData is structure for plugin related informations.
34
         * \param pluginFile path to the share library (with name).
35
         * \param name a string which will be shown at menu
36
         * \param index black magic? FIXME
37
         * \param type PluginType element
38
         * \param menuID id for menu system
39
         * \param actName name of the action for this plugin
40
         * \param actKeySequence menu GUI key combination
41
         * \param actMenu first level menu
42
         * \param actMenuAfterName 2nd level menu
43
         * \param actEnabledOnStartup run it at start FIXME
44
         * \param loadPlugin enable or disable plugin for user
1596 subik 45
         * \param loaded is the plug really loaded?
1552 subik 46
         */
47
        struct PluginData
48
        {
49
                QString pluginFile;// Datei;
50
                QString name;
51
                void *index; //Zeiger;
52
                PluginType type;
53
                int menuID;
54
                QString actName;
2186 cbradney 55
                QString actMenuText;
1552 subik 56
                QString actKeySequence;
57
                QString actMenu;
58
                QString actMenuAfterName;
59
                bool actEnabledOnStartup;
60
                bool loadPlugin;
1596 subik 61
                bool loaded;
1552 subik 62
        };
63
 
1549 subik 64
        PluginManager();
65
        ~PluginManager();
1552 subik 66
        /*! \brief Ininitalization of all plugins. It's called at scribus start. */
1549 subik 67
        void initPlugs();
1552 subik 68
        /*! \brief Run plugin by its id from pluginMap */
1549 subik 69
        void callDLL(int pluginID);
1552 subik 70
        /*! \brief Checks if is the plug in plugin map.
71
         * \return bool
72
         */
1549 subik 73
        bool DLLexists(int pluginID);
1552 subik 74
        /*! unused/obsolete */
1549 subik 75
        void callDLLbyMenu(int pluginID);
1552 subik 76
        /*! \brief Reads available info and fills PluginData structure */
77
        bool DLLname(QString name, QString *pluginName, PluginType *type, void **index, int *idNr, QString *actName, QString *actKeySequence, QString *actMenu, QString *actMenuAfterName, bool *actEnabledOnStartup, bool loadPlugin);
78
        /*! \brief Shutdowns all plugins. Called at scribus quit */
1549 subik 79
        void finalizePlugs();
1552 subik 80
        /*! \brief Shutdowns one plugin.
81
         * \param pluginID key from the pluginMap. Plugin identifier
82
         */
83
        void finalizePlug(int pluginID);
84
        /** \brief Returns human readable plugin type */
85
        QString getPluginType(PluginType aType);
1596 subik 86
        /** \brief Saves plugin preferences */
87
        void savePreferences();
1549 subik 88
 
1552 subik 89
        /*! \brief Input variable to the plug. */
1549 subik 90
        QString dllInput;
1552 subik 91
        /*! \brief Returning variable from the plug. */
1549 subik 92
        QString dllReturn;
93
 
1552 subik 94
        /*! \brief Plugin mapping.
95
         * Each plugin has its record key() -> PluginData */
1549 subik 96
        QMap<int, PluginData> pluginMap;
97
 
1665 craig 98
        /*! \brief Return file extension used for shared libs on this platform */
1667 craig 99
        static QCString platformDllExtension();
1665 craig 100
 
1549 subik 101
public slots:
1552 subik 102
        /*! obsolete */
1549 subik 103
        void callDLLBySlot(int pluginID);
104
 
1552 subik 105
private:
106
        /** \brief Configuration structure */
107
        PrefsContext* prefs;
1549 subik 108
};
109
 
110
#endif