summaryrefslogtreecommitdiffstats
path: root/sigtools
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-03-26 07:31:03 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-03-26 07:32:33 -0400
commit62ad5bdb02a20117691078bd6ffe0914e68709bf (patch)
treeb14200dbe79249dd1c823c354b41cff13cd61106 /sigtools
parent01819ddc241ed2d346d248ad384a12c52c3011aa (diff)
downloadsigen-62ad5bdb02a20117691078bd6ffe0914e68709bf.tar.gz
sigen-62ad5bdb02a20117691078bd6ffe0914e68709bf.tar.xz
sigen-62ad5bdb02a20117691078bd6ffe0914e68709bf.zip
Use PluginBase in storage in PluginLoader
Diffstat (limited to 'sigtools')
-rw-r--r--sigtools/PluginLoader.cpp8
-rw-r--r--sigtools/PluginLoader.h2
-rw-r--r--sigtools/PluginLoader_p.h13
3 files changed, 20 insertions, 3 deletions
diff --git a/sigtools/PluginLoader.cpp b/sigtools/PluginLoader.cpp
index d6f039e9..051632e6 100644
--- a/sigtools/PluginLoader.cpp
+++ b/sigtools/PluginLoader.cpp
@@ -20,6 +20,7 @@
#include "PluginLoader_p.h"
// Sigencore plugin includes
+#include <sigencore/plugins/PluginBase.h>
#include <sigencore/plugins/ArenaPlugin.h>
#include <sigencore/plugins/CanvasPlugin.h>
@@ -46,6 +47,11 @@ KService::Ptr PluginLoader::service(const QString& type, const QString& name)
return loader->service(type, name);
}
+PluginBase* PluginLoader::plugin(const QString& type, const QString& name)
+{
+ return loader->factory(type, name);
+}
+
ArenaPlugin* PluginLoader::pluginForArena(const QString& arena)
{
return qobject_cast<ArenaPlugin*>(loader->factory("Arena", arena));
@@ -120,7 +126,7 @@ KService::Ptr PluginLoader::Private::service(const QString& type, const QString&
return KService::Ptr();
}
-QObject* PluginLoader::Private::factory(const QString& type, const QString& name)
+PluginBase* PluginLoader::Private::factory(const QString& type, const QString& name)
{
if (!m_available.contains(type))
refresh(type);
diff --git a/sigtools/PluginLoader.h b/sigtools/PluginLoader.h
index c5d96cb5..17e092f6 100644
--- a/sigtools/PluginLoader.h
+++ b/sigtools/PluginLoader.h
@@ -34,6 +34,7 @@ namespace Plugins
{
class ArenaPlugin;
class CanvasPlugin;
+class PluginBase;
}
}
namespace Sigscript
@@ -49,6 +50,7 @@ namespace PluginLoader
SIGTOOLS_EXPORT QStringList availablePlugins(const QString& type, const bool forceLookup = false);
SIGTOOLS_EXPORT KService::Ptr service(const QString& type, const QString& name);
+ SIGTOOLS_EXPORT Sigencore::Plugins::PluginBase* plugin(const QString& type, const QString& name);
SIGTOOLS_EXPORT Sigencore::Plugins::ArenaPlugin* pluginForArena(const QString& arena);
SIGTOOLS_EXPORT Sigencore::Plugins::CanvasPlugin* pluginForCanvas(const QString& canvas);
diff --git a/sigtools/PluginLoader_p.h b/sigtools/PluginLoader_p.h
index d48d57df..acd3125e 100644
--- a/sigtools/PluginLoader_p.h
+++ b/sigtools/PluginLoader_p.h
@@ -28,6 +28,15 @@
#include <QtCore/QObject>
#include <QtCore/QPair>
+// Forward declarations
+namespace Sigencore
+{
+namespace Plugins
+{
+class PluginBase;
+}
+}
+
namespace Sigtools
{
namespace PluginLoader
@@ -39,9 +48,9 @@ class SIGTOOLS_NO_EXPORT Private : public QObject
public:
void refresh(const QString& type);
KService::Ptr service(const QString& type, const QString& name);
- QObject* factory(const QString& type, const QString& name);
+ Sigencore::Plugins::PluginBase* factory(const QString& type, const QString& name);
- typedef QPair<KService::Ptr, QObject*> Service;
+ typedef QPair<KService::Ptr, Sigencore::Plugins::PluginBase*> Service;
typedef QMap<QString, Service> PluginList;
QMap<QString, PluginList> m_available;
};