summaryrefslogtreecommitdiffstats
path: root/sigtools/PluginLoader.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-03-27 03:44:17 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-03-27 03:44:17 -0400
commit6fd11afdde2304a0e8e288c101be0f85a77a52bc (patch)
tree1eeff2a05d4a27f0dd0136314bbace8db54579a7 /sigtools/PluginLoader.cpp
parent5c1308bfa586a6a77f909314ec2e5e7a8c402fad (diff)
downloadsigen-6fd11afdde2304a0e8e288c101be0f85a77a52bc.tar.gz
sigen-6fd11afdde2304a0e8e288c101be0f85a77a52bc.tar.xz
sigen-6fd11afdde2304a0e8e288c101be0f85a77a52bc.zip
Add ctor and dtor to PluginLoader::Private
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();
+ }
+}