Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/plugin.h
00001 /**********************************************************************
00002   Plugin - Avogadro Plugin Interface Base Class
00003 
00004   Copyright (C) 2008 Tim Vandermeersch
00005   Copyright (C) 2008 Donald Ephraim Curtis
00006 
00007   This file is part of the Avogadro molecular editor project.
00008   For more information, see <http://avogadro.openmolecules.net/>
00009 
00010   Avogadro is free software; you can redistribute it and/or modify
00011   it under the terms of the GNU General Public License as published by
00012   the Free Software Foundation; either version 2 of the License, or
00013   (at your option) any later version.
00014 
00015   Avogadro is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018   GNU General Public License for more details.
00019 
00020   You should have received a copy of the GNU General Public License
00021   along with this program; if not, write to the Free Software
00022   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00023   02110-1301, USA.
00024  **********************************************************************/
00025 
00026 #ifndef PLUGIN_H
00027 #define PLUGIN_H
00028 
00029 #include <avogadro/global.h>
00030 
00031 #include <QObject>
00032 #include <QSettings> // do not remove!!
00033 
00034 namespace Avogadro {
00035 
00045   /*class A_EXPORT PluginMeta*/
00046   /*{*/
00047     /*public:*/
00048       /*QString className();*/
00049       /*QString type();*/
00050   /*}*/
00051 
00052   //class PluginPrivate;
00053   class A_EXPORT Plugin : public QObject
00054   {
00055     Q_OBJECT
00056 
00057     public:
00058       enum Type
00059       {
00060         EngineType = 0,
00061         ToolType,
00062         ExtensionType,
00063         ColorType,
00064         OtherType,
00065         TypeCount // this needs to be last always
00066       };
00067 
00068     public:
00072       Plugin(QObject *parent = NULL);
00073 
00077       virtual ~Plugin();
00078 
00082       virtual Plugin::Type type() const = 0;
00083 
00087       virtual QString identifier() const = 0;
00088 
00092       virtual QString name() const = 0;
00093 
00097       virtual QString description() const;
00098 
00104       virtual QString license() const;
00105 
00110       virtual QWidget *settingsWidget();
00111 
00115       virtual void writeSettings(QSettings &settings) const;
00116 
00120       virtual void readSettings(QSettings &settings);
00121 
00122     protected:
00123       //PluginPrivate *const d;
00124   };
00125 
00132   class A_EXPORT PluginFactory
00133   {
00134     public:
00138       virtual ~PluginFactory() {}
00139 
00143       virtual Plugin *createInstance(QObject *parent=0) = 0;
00144 
00148       virtual Plugin::Type type() const = 0;
00149 
00153       virtual QString identifier() const = 0;
00154 
00158       virtual QString name() const = 0;
00159 
00163       virtual QString description() const = 0;
00164   };
00165 
00166 } // end namespace Avogadro
00167 
00168 Q_DECLARE_METATYPE(Avogadro::Plugin*)
00169 Q_DECLARE_INTERFACE(Avogadro::PluginFactory,
00170                     "net.sourceforge.avogadro.pluginfactory/1.5")
00171 
00172 #endif