Main Page   Class Hierarchy   Compound List   File List   Compound Members  

pluginfactory.h

00001 /*
00002  *
00003  * Copyright (C) 2002 George Staikos <staikos@kde.org>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 
00022 
00023 #ifndef _PLUGINFACTORY_H
00024 #define _PLUGINFACTORY_H
00025 
00026 #include <qstring.h>
00027 
00028 #include <qwidget.h>
00029 #include <qmap.h>
00030 #include <qptrlist.h>
00031 
00032 #include <kservice.h>
00033 
00034 class QVSourcePlugin;
00035 class QVMixerPlugin;
00036 class QVOSDPlugin;
00037 class QVMiscPlugin;
00038 class ChannelIOFormat;
00039 class PluginDescPrivate;
00040 
00041 /*
00042  * Internal description of a plugin
00043  */
00044 class PluginDesc
00045 {
00046 public:
00047 
00048     typedef enum { UNKNOWN, VIDEO, CHANNEL, MIXER, OSD, MISC, IMAGEFILTER } PluginType;
00049     PluginDesc();
00050     PluginDesc(const PluginDesc& copy);
00051 
00052     int id;
00053     QString name;
00054     QString author;
00055     QString comment;
00056     QString icon;
00057     QString lib;
00058     QString factory;
00059     KService::Ptr service;
00060     PluginType type;
00061     bool configurable;
00062     bool enabled;
00063 
00064     friend int operator<(const PluginDesc& l, const PluginDesc& r);
00065     friend int operator>(const PluginDesc& l, const PluginDesc& r);
00066     friend int operator==(const PluginDesc& l, const PluginDesc& r);
00067     friend int operator!=(const PluginDesc& l, const PluginDesc& r);
00068 
00069 private:
00070     PluginDescPrivate *d;
00071 };
00072 
00073 
00074 class KConfig;
00075 
00079 class PluginFactory
00080 {
00081 public:
00082     QPtrList<PluginDesc>& videoPlugins();
00083     /* you get to keep this object*/
00084     QVSourcePlugin* getVideoPlugin(const PluginDesc *plugin, QWidget *w);
00085 
00086     QPtrList<PluginDesc>& channelPlugins();
00087     ChannelIOFormat* getChannelPlugin(const PluginDesc *plugin);
00088 
00089     QPtrList<PluginDesc>& mixerPlugins();
00090     QVMixerPlugin* getMixerPlugin(const PluginDesc *plugin);
00091 
00092     QPtrList<PluginDesc>& miscPlugins();
00093     QVMiscPlugin* getMiscPlugin(const PluginDesc *plugin, QWidget *w);
00094 
00095     QPtrList<PluginDesc>& osdPlugins();
00096     /* this object will be destroyed on shutdown */
00097     QVOSDPlugin* getOSDPlugin(const PluginDesc *plugin, QWidget *w);
00098 
00099 
00100     /* you probably don't ever want to call this */
00101     virtual void scanForPlugins();
00102 
00103 protected:
00104     friend class QtVision;
00105     PluginFactory(QtVision *qtv);
00106     virtual ~PluginFactory();
00107 
00108     void doScan(KService::List& plugs, QPtrList<PluginDesc>& list, PluginDesc::PluginType type);
00109 
00110 private:
00111     static int _upid;
00112 
00113     QPtrList<PluginDesc> _videoPlugins;
00114     QPtrList<PluginDesc> _mixerPlugins;
00115     QPtrList<PluginDesc> _osdPlugins;
00116     QPtrList<PluginDesc> _channelPlugins;
00117     QPtrList<PluginDesc> _miscPlugins;
00118 
00119     KConfig *_cfg;
00120     QtVision *_qtv;
00121 };
00122 
00123 
00124 
00125 #endif
00126 

Generated at Thu Jan 30 02:56:02 2003 for QtVision by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001