Commit 9dfebaa5 authored by Julien Wintz's avatar Julien Wintz
Browse files

Output error string on plugin load/unload failure.

parent aad1fd07
...@@ -24,8 +24,9 @@ template <typename T> dtkCorePluginFactory<T>::~dtkCorePluginFactory(void) ...@@ -24,8 +24,9 @@ template <typename T> dtkCorePluginFactory<T>::~dtkCorePluginFactory(void)
} }
#pragma mark - // /////////////////////////////////////////////////////////////////
#pragma mark Type creator registration // Type creator registration
// /////////////////////////////////////////////////////////////////
template <typename T> void dtkCorePluginFactory<T>::record(const QString& key, creator func) template <typename T> void dtkCorePluginFactory<T>::record(const QString& key, creator func)
{ {
...@@ -37,8 +38,9 @@ template <typename T> void dtkCorePluginFactory<T>::record(const QString& key, c ...@@ -37,8 +38,9 @@ template <typename T> void dtkCorePluginFactory<T>::record(const QString& key, c
this->creators.insert(key, func); this->creators.insert(key, func);
} }
#pragma mark - // /////////////////////////////////////////////////////////////////
#pragma mark Type creator invokation // Type creator invokation
// /////////////////////////////////////////////////////////////////
template <typename T> T *dtkCorePluginFactory<T>::create(const QString& key) template <typename T> T *dtkCorePluginFactory<T>::create(const QString& key)
{ {
...@@ -48,8 +50,9 @@ template <typename T> T *dtkCorePluginFactory<T>::create(const QString& key) ...@@ -48,8 +50,9 @@ template <typename T> T *dtkCorePluginFactory<T>::create(const QString& key)
return this->creators.value(key)(); return this->creators.value(key)();
} }
#pragma mark - // /////////////////////////////////////////////////////////////////
#pragma mark Type creator inspection // Type creator inspection
// /////////////////////////////////////////////////////////////////
template <typename T> QStringList dtkCorePluginFactory<T>::keys(void) template <typename T> QStringList dtkCorePluginFactory<T>::keys(void)
{ {
......
...@@ -87,8 +87,9 @@ template <typename T> dtkCorePluginManager<T>::~dtkCorePluginManager(void) ...@@ -87,8 +87,9 @@ template <typename T> dtkCorePluginManager<T>::~dtkCorePluginManager(void)
d = NULL; d = NULL;
} }
#pragma mark - // /////////////////////////////////////////////////////////////////
#pragma Manager Management // Manager Management
// /////////////////////////////////////////////////////////////////
template <typename T> void dtkCorePluginManager<T>::initialize(const QString& path) template <typename T> void dtkCorePluginManager<T>::initialize(const QString& path)
{ {
...@@ -107,8 +108,9 @@ template <typename T> void dtkCorePluginManager<T>::uninitialize(void) ...@@ -107,8 +108,9 @@ template <typename T> void dtkCorePluginManager<T>::uninitialize(void)
this->unload(path); this->unload(path);
} }
#pragma mark - // /////////////////////////////////////////////////////////////////
#pragma Plugin Management // Plugin Management
// /////////////////////////////////////////////////////////////////
template <typename T> void dtkCorePluginManager<T>::scan(const QString& path) template <typename T> void dtkCorePluginManager<T>::scan(const QString& path)
{ {
...@@ -142,6 +144,7 @@ template <typename T> void dtkCorePluginManager<T>::load(const QString& path) ...@@ -142,6 +144,7 @@ template <typename T> void dtkCorePluginManager<T>::load(const QString& path)
T *plugin = qobject_cast<T *>(loader->instance()); T *plugin = qobject_cast<T *>(loader->instance());
if(!plugin) { if(!plugin) {
qDebug() << loader->errorString();
delete loader; delete loader;
return; return;
} }
...@@ -158,16 +161,19 @@ template <typename T> void dtkCorePluginManager<T>::unload(const QString& path) ...@@ -158,16 +161,19 @@ template <typename T> void dtkCorePluginManager<T>::unload(const QString& path)
T *plugin = qobject_cast<T *>(loader->instance()); T *plugin = qobject_cast<T *>(loader->instance());
if (plugin) if (plugin)
plugin->uninitialize(); plugin->uninitialize();
if(loader->unload()) { if(loader->unload()) {
d->loaders.remove(path); d->loaders.remove(path);
delete loader; delete loader;
} else {
qDebug() << loader->errorString();
} }
} }
#pragma mark - // /////////////////////////////////////////////////////////////////
#pragma Plugin Queries // Plugin Queries
// /////////////////////////////////////////////////////////////////
template <typename T> QStringList dtkCorePluginManager<T>::plugins(void) template <typename T> QStringList dtkCorePluginManager<T>::plugins(void)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment