summaryrefslogtreecommitdiffstats
path: root/sigtools/PluginLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigtools/PluginLoader.cpp')
-rw-r--r--sigtools/PluginLoader.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/sigtools/PluginLoader.cpp b/sigtools/PluginLoader.cpp
index dc2608ab..b28d0a0c 100644
--- a/sigtools/PluginLoader.cpp
+++ b/sigtools/PluginLoader.cpp
@@ -91,6 +91,19 @@ Canvas* PluginLoader::loadCanvas(const QString& name, GameWrapper* game, Config*
return NULL;
}
+PluginLoader::Private::Private()
+{
+ if (!KGlobal::dirs()->resourceDirs("sigmod").size())
+ KGlobal::dirs()->addResourceType("sigmod", "data", "sigmod/");
+}
+
+PluginLoader::Private::~Private()
+{
+ QStringList types = m_available.keys();
+ foreach (const QString& type, types)
+ clean(type);
+}
+
void PluginLoader::Private::refresh(const QString& type)
{
QList<Service> curServices = m_available[type].values();
@@ -210,3 +223,22 @@ Game* PluginLoader::Private::game(const QString& name)
return m_games[name];
return NULL;
}
+
+void PluginLoader::Private::clean(const QString& type)
+{
+ // TODO fix this
+ QStringList curServices = m_available[type].keys();
+ foreach (const QString& service, curServices)
+ {
+ if (m_available[type][service].second && !m_available[type][service].second->classesUsedCount())
+ {
+ delete m_available[type][service].second;
+ m_available[type].remove(service);
+ }
+ }
+ if (type == "Sigmod")
+ {
+ qDeleteAll(m_games.values());
+ m_games.clear();
+ }
+}