From 5cc9959bb25d10c41515f1d51d76415bbe1f6653 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Wed, 16 Jul 2014 14:58:39 +0200 Subject: [PATCH] remove broken overkill plugin cache --- src/core/plugins/plugincontainer.cpp | 53 +++------------------------- src/core/plugins/plugincontainer.h | 13 ------- 2 files changed, 5 insertions(+), 61 deletions(-) diff --git a/src/core/plugins/plugincontainer.cpp b/src/core/plugins/plugincontainer.cpp index 6a1ed95..93d9b05 100644 --- a/src/core/plugins/plugincontainer.cpp +++ b/src/core/plugins/plugincontainer.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include using namespace Snore; @@ -120,7 +120,6 @@ void PluginContainer::updatePluginCache() } list.clear(); } - cache().remove(""); QList plugins; @@ -150,58 +149,16 @@ void PluginContainer::updatePluginCache() snoreDebug( SNORE_DEBUG ) << "added" << info->name() << "to cache"; } } - cache().setValue("version",Version::revision()); - cache().setValue("buildtime",Version::buildTime()); - cache().setValue("pluginPath",pluginDir().absolutePath()); - - cache().beginWriteArray("plugins"); - for(int i=0;i< plugins.size();++i) - { - cache().setArrayIndex(i); - cache().setValue("fileName",plugins[i]->file()); - cache().setValue("name", plugins[i]->name()); - cache().setValue("type",(int)plugins[i]->type()); - } - cache().endArray(); - cache().sync(); -} - -void PluginContainer::loadPluginCache() -{ - int size = cache().beginReadArray("plugins"); - for(int i=0;iname(), info); - } - else - { - snoreDebug( SNORE_WARNING ) << "Cache Corrupted" << fileName << cache().value("name").toString() << type; - cache().endArray(); - updatePluginCache(); - return; - } - } - cache().endArray(); } const QHash PluginContainer::pluginCache(SnorePlugin::PluginTypes type) { if(s_pluginCache.isEmpty()) { - if(cache().value("version").toString() != Version::revision() || qgetenv("LIBSNORE_FORCE_CHACHE_UPDATE").toInt() == 1) - { - updatePluginCache(); - } - else - { - loadPluginCache(); - } + QTime time; + time.start(); + updatePluginCache(); + snoreDebug( SNORE_DEBUG ) << "Plugins loaded in:" << time.elapsed(); } QHash out; diff --git a/src/core/plugins/plugincontainer.h b/src/core/plugins/plugincontainer.h index bfd1add..4817b8c 100644 --- a/src/core/plugins/plugincontainer.h +++ b/src/core/plugins/plugincontainer.h @@ -59,7 +59,6 @@ private: static QHash s_pluginCache; void static updatePluginCache(); - void static loadPluginCache(); static const QDir &pluginDir(); static inline const QStringList pluginExtentions() { @@ -96,18 +95,6 @@ private: return out; } - static inline QSettings &cache() - { - static QSettings *_cache = NULL; - if(_cache == NULL) - { - _cache = new QSettings("SnoreNotify","libsnore"); - snoreDebug( SNORE_DEBUG ) << _cache->fileName(); - _cache->beginGroup( SnoreCorePrivate::computeHash(pluginDir().absolutePath().toLatin1())); - } - return *_cache; - } - QString m_pluginFile; QString m_pluginName; SnorePlugin::PluginTypes m_pluginType;