diff --git a/src/core/snoreserver.cpp b/src/core/snoreserver.cpp index 2f6b585..67b2013 100644 --- a/src/core/snoreserver.cpp +++ b/src/core/snoreserver.cpp @@ -29,7 +29,7 @@ namespace Snore{ -QMap SnoreServer::m_pluginCache = QMap() ; +QHash SnoreServer::m_pluginCache = QHash() ; QString const SnoreServer::version(){ return QString().append(Version::major()).append(".").append(Version::minor()).append(Version::suffix()); @@ -53,7 +53,7 @@ SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) : } -QMap SnoreServer::pluginCache(const QString &pluginPath){ +QHash SnoreServer::pluginCache(const QString &pluginPath){ if(!m_pluginCache.isEmpty()) return m_pluginCache; QSettings cache(SnoreServer::pluginDir(pluginPath).absoluteFilePath("plugin.cache"),QSettings::IniFormat); @@ -62,20 +62,20 @@ QMap SnoreServer::pluginCache(const QString &pluginP return updatePluginCache(pluginPath); - for(int i=0;i< m_pluginCache.size();++i) { + for(int i=0;ipluginFile = cache.value("fileName").toString(); info->pluginName = cache.value("name").toString(); info->pluginType = (SnorePluginInfo::type)cache.value("type").toInt(); - m_pluginCache[info->pluginName] = info; + m_pluginCache.insert(info->pluginName,info); } cache.endArray(); return m_pluginCache; } -QMap SnoreServer::updatePluginCache(const QString &pluginPath){ +QHash SnoreServer::updatePluginCache(const QString &pluginPath){ QSettings cache(SnoreServer::pluginDir(pluginPath).absoluteFilePath("plugin.cache"),QSettings::IniFormat); qDebug()<<"Updating plugin cache"< ( loader.instance()); + m_plugins.insert ( info->pluginName ,plugin ); + switch(info->pluginType){ case SnorePluginInfo::BACKEND:{ - Notification_Backend * nb = qobject_cast ( loader.instance() ); + Notification_Backend * nb = qobject_cast ( plugin ); qDebug() <pluginName<<"is a Notification_Backend"; if ( nb->isPrimaryNotificationBackend() ) { @@ -168,7 +171,7 @@ void SnoreServer::publicatePlugin ( const SnorePluginInfo *info ) break; } case SnorePluginInfo::FRONTEND:{ - Notification_Frontend * nf = qobject_cast (loader.instance()); + Notification_Frontend * nf = qobject_cast (plugin); qDebug() <pluginName<<"is a Notification_Frontend"; if(nf->init( this )) m_frontends.insert(nf->name(),nf); @@ -176,13 +179,10 @@ void SnoreServer::publicatePlugin ( const SnorePluginInfo *info ) nf->deleteLater(); break; } - case SnorePluginInfo::PLUGIN:{ - SnorePlugin *plugin = qobject_cast ( loader.instance()); - plugin->init(this); - m_plugins.insert ( info->pluginName ,plugin ); + case SnorePluginInfo::PLUGIN: qDebug() <pluginName<<"is a SnorePlugin"; - break; - } + plugin->init(this); + break; default: std::cerr<<"Plugin Cache corrupted"< pluginCache(const QString &pluginPath = QString()); - static QMap updatePluginCache(const QString &pluginPath = QString()); + static QHash pluginCache(const QString &pluginPath = QString()); + static QHash updatePluginCache(const QString &pluginPath = QString()); public: SnoreServer (QSystemTrayIcon *trayIcon=0 ); @@ -60,7 +60,7 @@ private: static const QDir &pluginDir(const QString &pluginPath); - static QMap m_pluginCache; + static QHash m_pluginCache; ApplicationsList m_applications; diff --git a/src/snorenotify.cpp b/src/snorenotify.cpp index a45e7de..25ebf35 100644 --- a/src/snorenotify.cpp +++ b/src/snorenotify.cpp @@ -37,9 +37,11 @@ SnoreNotify::SnoreNotify(): m_trayIcon = new TrayIcon(); m_snore = new Snore::SnoreServer(m_trayIcon->trayIcon()); - QMap plugins = SnoreServer::pluginCache(); + QHash plugins = SnoreServer::pluginCache(); + qDebug()<<"Plugins"<pluginFile<pluginName; m_snore->publicatePlugin ( info ); }