mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-10 08:35:54 +00:00
fixed plugin loading
Conflicts: src/core/plugins/plugins.cpp src/core/plugins/plugins.h
This commit is contained in:
parent
58f95602ce
commit
8522a1fd4f
@ -118,6 +118,26 @@ SnoreSecondaryBackend::~SnoreSecondaryBackend()
|
||||
snoreDebug( SNORE_DEBUG )<<"Deleting"<<name();
|
||||
}
|
||||
|
||||
bool SnoreSecondaryBackend::initialize(SnoreCore *snore)
|
||||
{
|
||||
if(!SnorePlugin::initialize(snore))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
connect( snore->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SnoreSecondaryBackend::deinitialize()
|
||||
{
|
||||
if(SnorePlugin::deinitialize())
|
||||
{
|
||||
disconnect( snore()->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SnoreSecondaryBackend::supportsRichtext()
|
||||
{
|
||||
return m_supportsRichtext;
|
||||
|
@ -92,6 +92,8 @@ class SNORE_EXPORT SnoreSecondaryBackend : public SnorePlugin
|
||||
public:
|
||||
SnoreSecondaryBackend(const QString &name, bool supportsRhichtext);
|
||||
virtual ~SnoreSecondaryBackend();
|
||||
virtual bool initialize(SnoreCore *snore);
|
||||
virtual bool deinitialize();
|
||||
|
||||
|
||||
bool supportsRichtext();
|
||||
|
@ -55,32 +55,39 @@ SnoreCore::~SnoreCore()
|
||||
void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
|
||||
{
|
||||
Q_D(SnoreCore);
|
||||
foreach( PluginContainer *info, PluginContainer::pluginCache(types).values())
|
||||
{
|
||||
switch(info->type())
|
||||
{
|
||||
case SnorePlugin::BACKEND:
|
||||
break;
|
||||
case SnorePlugin::SECONDARY_BACKEND:
|
||||
case SnorePlugin::FRONTEND:
|
||||
case SnorePlugin::PLUGIN:
|
||||
if(!info->load()->initialize( this ))
|
||||
{
|
||||
info->unload();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
snoreDebug( SNORE_WARNING ) << "Plugin Cache corrupted\n" << info->file() << info->type();
|
||||
continue;
|
||||
}
|
||||
snoreDebug( SNORE_DEBUG ) << info->name() << "is a" << info->type();
|
||||
d->m_plugins[info->type()].append(info->name());
|
||||
}
|
||||
foreach( SnorePlugin::PluginTypes type, PluginContainer::types())
|
||||
{
|
||||
qSort(d->m_plugins[type]);
|
||||
if(type!= SnorePlugin::ALL && types && type)
|
||||
{
|
||||
foreach( PluginContainer *info, PluginContainer::pluginCache(type).values())
|
||||
{
|
||||
switch(info->type())
|
||||
{
|
||||
case SnorePlugin::BACKEND:
|
||||
break;
|
||||
case SnorePlugin::SECONDARY_BACKEND:
|
||||
case SnorePlugin::FRONTEND:
|
||||
case SnorePlugin::PLUGIN:
|
||||
if(!info->load()->initialize( this ))
|
||||
{
|
||||
info->unload();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
snoreDebug( SNORE_WARNING ) << "Plugin Cache corrupted\n" << info->file() << info->type();
|
||||
continue;
|
||||
}
|
||||
snoreDebug( SNORE_DEBUG ) << info->name() << "is a" << info->type();
|
||||
d->m_plugins[info->type()].append(info->name());
|
||||
}
|
||||
if(d->m_plugins.contains(type))
|
||||
{
|
||||
qSort(d->m_plugins[type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
snoreDebug( SNORE_INFO ) << "Loaded Plugins:" << d->m_plugins;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user