File indexing completed on 2024-04-14 14:35:54

0001 /************************************************************************
0002  *                                  *
0003  *  This file is part of Kooka, a scanning/OCR application using    *
0004  *  Qt <http://www.qt.io> and KDE Frameworks <http://www.kde.org>.  *
0005  *                                  *
0006  *  Copyright (C) 2018 Jonathan Marten <jjm@keelhaul.me.uk>     *
0007  *                                  *
0008  *  Kooka is free software; you can redistribute it and/or modify it    *
0009  *  under the terms of the GNU Library General Public License as    *
0010  *  published by the Free Software Foundation and appearing in the  *
0011  *  file COPYING included in the packaging of this file;  either    *
0012  *  version 2 of the License, or (at your option) any later version.    *
0013  *                                  *
0014  *  As a special exception, permission is given to link this program    *
0015  *  with any version of the KADMOS OCR/ICR engine (a product of     *
0016  *  reRecognition GmbH, Kreuzlingen), and distribute the resulting  *
0017  *  executable without including the source code for KADMOS in the  *
0018  *  source distribution.                        *
0019  *                                  *
0020  *  This program is distributed in the hope that it will be useful, *
0021  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  *
0022  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
0023  *  GNU General Public License for more details.            *
0024  *                                  *
0025  *  You should have received a copy of the GNU General Public       *
0026  *  License along with this program;  see the file COPYING.  If     *
0027  *  not, see <http://www.gnu.org/licenses/>.                *
0028  *                                  *
0029  ************************************************************************/
0030 
0031 #ifndef ABSTRACTPLUGIN_H
0032 #define ABSTRACTPLUGIN_H
0033 
0034 #include <qobject.h>
0035 
0036 #include "kookacore_export.h"
0037 
0038 
0039 struct KOOKACORE_EXPORT AbstractPluginInfo
0040 {
0041     QString key;                    // plugin unique key
0042     QString name;                   // user visible name of plugin
0043     QString icon;                   // icon name to accompany it
0044     QString description;                // comment, with rich text markup
0045 };
0046 
0047 
0048 /**
0049  * @short Base class of all plugins
0050  *
0051  *
0052  * @author Jonathan Marten
0053  **/
0054 
0055 class AbstractPlugin;
0056 Q_DECLARE_INTERFACE(AbstractPlugin, "org.kde.kooka.AbstractPlugin")
0057 
0058 
0059 class KOOKACORE_EXPORT AbstractPlugin : public QObject
0060 {
0061     Q_OBJECT
0062     Q_INTERFACES(AbstractPlugin)
0063 
0064 public:
0065     const AbstractPluginInfo *pluginInfo() const    { return (mPluginInfo); }
0066     void setParentWidget(QWidget *w)            { mParentWidget = w; }
0067 
0068 protected:
0069     // Only subclasses can use these to create and destroy plugin objects.
0070     explicit AbstractPlugin(QObject *pnt);
0071     virtual ~AbstractPlugin();
0072 
0073     QWidget *parentWidget() const           { return (mParentWidget); }
0074 
0075 private:
0076     // Only the PluginManager can create, destroy and set information for plugins.
0077     friend class PluginManager;
0078     AbstractPluginInfo *mPluginInfo;
0079 
0080     QWidget *mParentWidget;
0081 };
0082 
0083 #endif                          // ABSTRACTPLUGIN_H