summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmpluginmanager.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmpluginmanager.h
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpovmodeler/pmpluginmanager.h')
-rw-r--r--kpovmodeler/pmpluginmanager.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/kpovmodeler/pmpluginmanager.h b/kpovmodeler/pmpluginmanager.h
new file mode 100644
index 00000000..9424e014
--- /dev/null
+++ b/kpovmodeler/pmpluginmanager.h
@@ -0,0 +1,113 @@
+/*
+**************************************************************************
+ description
+ --------------------
+ copyright : (C) 2003 by Andreas Zehender
+ email : zehender@kde.org
+**************************************************************************
+
+**************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+**************************************************************************/
+
+#ifndef PMPLUGINMANAGER_H
+#define PMPLUGINMANAGER_H
+
+#include <kstaticdeleter.h>
+
+#include <qstring.h>
+#include <qptrlist.h>
+
+class PMPart;
+
+/**
+ * Plugin info for one plugin
+ */
+class PMPluginInfo
+{
+public:
+ /**
+ * Default constructor
+ */
+ PMPluginInfo( const QString& name, const QString& description,
+ bool enabled )
+ {
+ m_name = name;
+ m_description = description;
+ m_enabled = enabled;
+ }
+ /**
+ * Returns the plugin name
+ */
+ QString name( ) const { return m_name; }
+ /**
+ * Returns the plugin description (i18n'ed)
+ */
+ QString description( ) const { return m_description; }
+ /**
+ * Returns true if the plugin is enabled
+ */
+ bool enabled( ) const { return m_enabled; }
+ /**
+ * Enables/disables the plugin
+ */
+ void enable( bool en ) { m_enabled = en; }
+private:
+ QString m_name, m_description;
+ bool m_enabled;
+};
+
+/**
+ * Manager class for plugins.
+ *
+ * Stores a list of available plugins and loads and unloads plugins.
+ */
+class PMPluginManager
+{
+public:
+ /**
+ * Destructor
+ */
+ ~PMPluginManager( );
+ /**
+ * Returns the instance (singleton)
+ */
+ static PMPluginManager* theManager( );
+
+ /**
+ * Registers a part instance and loads the plugins for that part
+ */
+ void registerPart( PMPart* p );
+ /**
+ * Removes a part instance
+ */
+ void removePart( PMPart* p );
+
+ /**
+ * Returns a list of available plugins
+ */
+ QPtrList<PMPluginInfo> plugins( ) const { return m_plugins; }
+ /**
+ * Loads and unloads plugins for all parts when plugins were activated or
+ * deactivated
+ */
+ void updatePlugins( );
+private:
+ /**
+ * Constructor
+ */
+ PMPluginManager( );
+
+ QPtrList<PMPluginInfo> m_plugins;
+ QPtrList<PMPart> m_parts;
+
+ static PMPluginManager* s_pInstance;
+ static KStaticDeleter<PMPluginManager> s_staticDeleter;
+};
+
+#endif