small cleanup

This commit is contained in:
Patrick von Reth 2013-07-24 15:14:46 +02:00
parent de7993413d
commit 7e903ad093
3 changed files with 11 additions and 7 deletions

View File

@ -72,6 +72,11 @@ SnorePlugin *PluginContainer::load()
return m_instance;
}
void PluginContainer::unload()
{
m_instance->deleteLater();
}
const QString & PluginContainer::file()
{
return m_pluginFile;

View File

@ -48,6 +48,7 @@ public:
PluginContainer(QString fileName,QString pluginName,PluginType type);
~PluginContainer();
SnorePlugin *load();
void unload();
const QString &file();
const QString &name();
PluginContainer::PluginType type();

View File

@ -86,9 +86,8 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types )
}
case PluginContainer::SECONDARY_BACKEND:
{
SnoreSecondaryBackend *nb = qobject_cast<SnoreSecondaryBackend *> ( info->load() );
if(!nb->init( this )){
nb->deleteLater();
if(!info->load()->init( this )){
info->unload();
break;
}
m_secondaryNotificationBackends.append(info->name());
@ -96,10 +95,9 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types )
}
case PluginContainer::FRONTEND:
{
SnoreFrontend * nf = qobject_cast<SnoreFrontend*> (info->load());
qDebug() <<info->name()<<"is a Notification_Frontend";
if(!nf->init( this )){
nf->deleteLater();
if(!info->load()->init( this )){
info->unload();
break;
}
m_Frontends.append(info->name());
@ -109,7 +107,7 @@ void SnoreCore::loadPlugins ( PluginContainer::PluginTypes types )
{
qDebug() <<info->name()<<"is a SnorePlugin";
if(!info->load()->init(this)){
info->load()->deleteLater();
info->unload();
break;
}
m_plugins.append(info->name());