From 8dad3457ef1f412517c4d81f08ebd14680788ec3 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 29 Oct 2015 21:47:08 -0200 Subject: Make the skeleton Facebook plugin and make sure it is loaded Currently we need to copy manually the plugin dynamic library to the /plugins folder. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- subsurface-core/isocialnetworkintegration.h | 2 +- subsurface-core/pluginmanager.cpp | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'subsurface-core') diff --git a/subsurface-core/isocialnetworkintegration.h b/subsurface-core/isocialnetworkintegration.h index 97ff91dc2..778a171b3 100644 --- a/subsurface-core/isocialnetworkintegration.h +++ b/subsurface-core/isocialnetworkintegration.h @@ -68,5 +68,5 @@ public: }; Q_DECLARE_INTERFACE(ISocialNetworkIntegration, "org.subsurface.ISocialNetworkIntegration.v1") - +Q_DECLARE_METATYPE(ISocialNetworkIntegration*); #endif \ No newline at end of file diff --git a/subsurface-core/pluginmanager.cpp b/subsurface-core/pluginmanager.cpp index 290f43df0..5c0f22525 100644 --- a/subsurface-core/pluginmanager.cpp +++ b/subsurface-core/pluginmanager.cpp @@ -3,18 +3,22 @@ #include #include #include +#include static QList _socialNetworks; -PluginManager& PluginManager::instance() { +PluginManager& PluginManager::instance() +{ static PluginManager self; return self; } -PluginManager::PluginManager() { +PluginManager::PluginManager() +{ } -void PluginManager::loadPlugins() { +void PluginManager::loadPlugins() +{ QDir pluginsDir(qApp->applicationDirPath()); #if defined(Q_OS_WIN) @@ -29,19 +33,19 @@ void PluginManager::loadPlugins() { #endif pluginsDir.cd("plugins"); + qDebug() << "Plugins Directory: " << pluginsDir; foreach (const QString& fileName, pluginsDir.entryList(QDir::Files)) { QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); QObject *plugin = loader.instance(); - if(!plugin) { + if(!plugin) continue; - } - if (ISocialNetworkIntegration *social = qobject_cast(plugin)){ + if (ISocialNetworkIntegration *social = qobject_cast(plugin)) _socialNetworks.push_back(social); - } - } + } } -QList PluginManager::socialNetworkIntegrationPlugins() const { +QList PluginManager::socialNetworkIntegrationPlugins() const +{ return _socialNetworks; -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2