mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-19 19:48:07 +00:00
fixes
This commit is contained in:
parent
fb830b9c2a
commit
22c80b007c
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace Snore{
|
namespace Snore{
|
||||||
|
|
||||||
QMap<QString,SnorePluginInfo*> SnoreServer::m_pluginCache = QMap<QString,SnorePluginInfo*>() ;
|
QHash<QString,SnorePluginInfo*> SnoreServer::m_pluginCache = QHash<QString,SnorePluginInfo*>() ;
|
||||||
|
|
||||||
QString const SnoreServer::version(){
|
QString const SnoreServer::version(){
|
||||||
return QString().append(Version::major()).append(".").append(Version::minor()).append(Version::suffix());
|
return QString().append(Version::major()).append(".").append(Version::minor()).append(Version::suffix());
|
||||||
@ -53,7 +53,7 @@ SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) :
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, SnorePluginInfo *> SnoreServer::pluginCache(const QString &pluginPath){
|
QHash<QString, SnorePluginInfo *> SnoreServer::pluginCache(const QString &pluginPath){
|
||||||
if(!m_pluginCache.isEmpty())
|
if(!m_pluginCache.isEmpty())
|
||||||
return m_pluginCache;
|
return m_pluginCache;
|
||||||
QSettings cache(SnoreServer::pluginDir(pluginPath).absoluteFilePath("plugin.cache"),QSettings::IniFormat);
|
QSettings cache(SnoreServer::pluginDir(pluginPath).absoluteFilePath("plugin.cache"),QSettings::IniFormat);
|
||||||
@ -62,20 +62,20 @@ QMap<QString, SnorePluginInfo *> SnoreServer::pluginCache(const QString &pluginP
|
|||||||
return updatePluginCache(pluginPath);
|
return updatePluginCache(pluginPath);
|
||||||
|
|
||||||
|
|
||||||
for(int i=0;i< m_pluginCache.size();++i) {
|
for(int i=0;i<size;++i) {
|
||||||
cache.setArrayIndex(i);
|
cache.setArrayIndex(i);
|
||||||
SnorePluginInfo *info = new SnorePluginInfo();
|
SnorePluginInfo *info = new SnorePluginInfo();
|
||||||
info->pluginFile = cache.value("fileName").toString();
|
info->pluginFile = cache.value("fileName").toString();
|
||||||
info->pluginName = cache.value("name").toString();
|
info->pluginName = cache.value("name").toString();
|
||||||
info->pluginType = (SnorePluginInfo::type)cache.value("type").toInt();
|
info->pluginType = (SnorePluginInfo::type)cache.value("type").toInt();
|
||||||
m_pluginCache[info->pluginName] = info;
|
m_pluginCache.insert(info->pluginName,info);
|
||||||
}
|
}
|
||||||
cache.endArray();
|
cache.endArray();
|
||||||
|
|
||||||
return m_pluginCache;
|
return m_pluginCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, SnorePluginInfo *> SnoreServer::updatePluginCache(const QString &pluginPath){
|
QHash<QString, SnorePluginInfo *> SnoreServer::updatePluginCache(const QString &pluginPath){
|
||||||
QSettings cache(SnoreServer::pluginDir(pluginPath).absoluteFilePath("plugin.cache"),QSettings::IniFormat);
|
QSettings cache(SnoreServer::pluginDir(pluginPath).absoluteFilePath("plugin.cache"),QSettings::IniFormat);
|
||||||
qDebug()<<"Updating plugin cache"<<cache.fileName();
|
qDebug()<<"Updating plugin cache"<<cache.fileName();
|
||||||
|
|
||||||
@ -146,9 +146,12 @@ void SnoreServer::publicatePlugin ( const SnorePluginInfo *info )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SnorePlugin *plugin = qobject_cast<SnorePlugin*> ( loader.instance());
|
||||||
|
m_plugins.insert ( info->pluginName ,plugin );
|
||||||
|
|
||||||
switch(info->pluginType){
|
switch(info->pluginType){
|
||||||
case SnorePluginInfo::BACKEND:{
|
case SnorePluginInfo::BACKEND:{
|
||||||
Notification_Backend * nb = qobject_cast<Notification_Backend *> ( loader.instance() );
|
Notification_Backend * nb = qobject_cast<Notification_Backend *> ( plugin );
|
||||||
qDebug() <<info->pluginName<<"is a Notification_Backend";
|
qDebug() <<info->pluginName<<"is a Notification_Backend";
|
||||||
if ( nb->isPrimaryNotificationBackend() )
|
if ( nb->isPrimaryNotificationBackend() )
|
||||||
{
|
{
|
||||||
@ -168,7 +171,7 @@ void SnoreServer::publicatePlugin ( const SnorePluginInfo *info )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SnorePluginInfo::FRONTEND:{
|
case SnorePluginInfo::FRONTEND:{
|
||||||
Notification_Frontend * nf = qobject_cast<Notification_Frontend*> (loader.instance());
|
Notification_Frontend * nf = qobject_cast<Notification_Frontend*> (plugin);
|
||||||
qDebug() <<info->pluginName<<"is a Notification_Frontend";
|
qDebug() <<info->pluginName<<"is a Notification_Frontend";
|
||||||
if(nf->init( this ))
|
if(nf->init( this ))
|
||||||
m_frontends.insert(nf->name(),nf);
|
m_frontends.insert(nf->name(),nf);
|
||||||
@ -176,13 +179,10 @@ void SnoreServer::publicatePlugin ( const SnorePluginInfo *info )
|
|||||||
nf->deleteLater();
|
nf->deleteLater();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SnorePluginInfo::PLUGIN:{
|
case SnorePluginInfo::PLUGIN:
|
||||||
SnorePlugin *plugin = qobject_cast<SnorePlugin*> ( loader.instance());
|
|
||||||
plugin->init(this);
|
|
||||||
m_plugins.insert ( info->pluginName ,plugin );
|
|
||||||
qDebug() <<info->pluginName<<"is a SnorePlugin";
|
qDebug() <<info->pluginName<<"is a SnorePlugin";
|
||||||
break;
|
plugin->init(this);
|
||||||
}
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr<<"Plugin Cache corrupted"<<std::endl ;
|
std::cerr<<"Plugin Cache corrupted"<<std::endl ;
|
||||||
break;
|
break;
|
||||||
|
@ -32,8 +32,8 @@ class SNORE_EXPORT SnoreServer:public QObject
|
|||||||
public:
|
public:
|
||||||
static const QString version();
|
static const QString version();
|
||||||
static const QString snoreTMP();
|
static const QString snoreTMP();
|
||||||
static QMap<QString,SnorePluginInfo*> pluginCache(const QString &pluginPath = QString());
|
static QHash<QString,SnorePluginInfo*> pluginCache(const QString &pluginPath = QString());
|
||||||
static QMap<QString,SnorePluginInfo*> updatePluginCache(const QString &pluginPath = QString());
|
static QHash<QString,SnorePluginInfo*> updatePluginCache(const QString &pluginPath = QString());
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SnoreServer (QSystemTrayIcon *trayIcon=0 );
|
SnoreServer (QSystemTrayIcon *trayIcon=0 );
|
||||||
@ -60,7 +60,7 @@ private:
|
|||||||
static const QDir &pluginDir(const QString &pluginPath);
|
static const QDir &pluginDir(const QString &pluginPath);
|
||||||
|
|
||||||
|
|
||||||
static QMap<QString,SnorePluginInfo*> m_pluginCache;
|
static QHash<QString,SnorePluginInfo*> m_pluginCache;
|
||||||
ApplicationsList m_applications;
|
ApplicationsList m_applications;
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,9 +37,11 @@ SnoreNotify::SnoreNotify():
|
|||||||
m_trayIcon = new TrayIcon();
|
m_trayIcon = new TrayIcon();
|
||||||
m_snore = new Snore::SnoreServer(m_trayIcon->trayIcon());
|
m_snore = new Snore::SnoreServer(m_trayIcon->trayIcon());
|
||||||
|
|
||||||
QMap<QString,SnorePluginInfo*> plugins = SnoreServer::pluginCache();
|
QHash<QString,SnorePluginInfo*> plugins = SnoreServer::pluginCache();
|
||||||
|
qDebug()<<"Plugins"<<plugins.keys();
|
||||||
foreach ( SnorePluginInfo *info, plugins.values())
|
foreach ( SnorePluginInfo *info, plugins.values())
|
||||||
{
|
{
|
||||||
|
qDebug()<<"Grr loading "<< info->pluginFile<<info->pluginName;
|
||||||
m_snore->publicatePlugin ( info );
|
m_snore->publicatePlugin ( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user