diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-11-09 18:14:20 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-09 18:00:56 -0800 |
commit | f5f2c37184f7ab4e5712b4c74d4456ca6da87eb8 (patch) | |
tree | 4d6e459481d5d8036e1ad889ada2a8e14448b1f7 | |
parent | 66091ff853fe16495c981a5f8deff285cd310358 (diff) | |
download | subsurface-f5f2c37184f7ab4e5712b4c74d4456ca6da87eb8.tar.gz |
Remove the PluginSystem
But keep the Interface so it's still userfull to create a new
SocialNetwork when needed, but it will be part of the code,
and not a plugin.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 7 | ||||
-rw-r--r-- | desktop-widgets/plugins/facebook/facebook_integration.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/plugins/facebook/facebook_integration.h | 4 | ||||
-rw-r--r-- | subsurface-core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | subsurface-core/isocialnetworkintegration.h | 7 |
5 files changed, 11 insertions, 10 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 58778f394..41d0fd592 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -260,15 +260,16 @@ void MainWindow::setupSocialNetworkMenu() QMenu *connections = new QMenu(tr("Connect to")); FacebookPlugin *facebookPlugin = new FacebookPlugin(); QAction *toggle_connection = new QAction(this); + QObject *obj = qobject_cast<QObject*>(facebookPlugin); toggle_connection->setText(facebookPlugin->socialNetworkName()); toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); - toggle_connection->setData(QVariant::fromValue(facebookPlugin)); + toggle_connection->setData(QVariant::fromValue(obj)); connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect())); QAction *share_on = new QAction(this); share_on->setText(facebookPlugin->socialNetworkName()); share_on->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); - share_on->setData(QVariant::fromValue(facebookPlugin)); + share_on->setData(QVariant::fromValue(obj)); ui.menuShare_on->addAction(share_on); connections->addAction(toggle_connection); connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload())); @@ -280,7 +281,7 @@ void MainWindow::setupSocialNetworkMenu() void MainWindow::socialNetworkRequestConnect() { QAction *action = qobject_cast<QAction*>(sender()); - FacebookPlugin *plugin = action->data().value<FacebookPlugin*>(); + ISocialNetworkIntegration *plugin = qobject_cast<ISocialNetworkIntegration*>(action->data().value<QObject*>()); if (plugin->isConnected()) plugin->requestLogoff(); else diff --git a/desktop-widgets/plugins/facebook/facebook_integration.cpp b/desktop-widgets/plugins/facebook/facebook_integration.cpp index f817f9df8..21ad6f733 100644 --- a/desktop-widgets/plugins/facebook/facebook_integration.cpp +++ b/desktop-widgets/plugins/facebook/facebook_integration.cpp @@ -3,7 +3,7 @@ #include <QDebug> -FacebookPlugin::FacebookPlugin(QObject* parent): QObject(parent), +FacebookPlugin::FacebookPlugin(QObject* parent) : fbConnectWidget(new FacebookConnectWidget()), fbUploadDialog(new SocialNetworkDialog()) { diff --git a/desktop-widgets/plugins/facebook/facebook_integration.h b/desktop-widgets/plugins/facebook/facebook_integration.h index 714f636fc..40b16917d 100644 --- a/desktop-widgets/plugins/facebook/facebook_integration.h +++ b/desktop-widgets/plugins/facebook/facebook_integration.h @@ -8,10 +8,8 @@ class FacebookConnectWidget; class SocialNetworkDialog; class FacebookManager; -class FacebookPlugin : public QObject, public ISocialNetworkIntegration { +class FacebookPlugin : public ISocialNetworkIntegration { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.subsurface.plugins.ISocialNetworkIntegration") - Q_INTERFACES(ISocialNetworkIntegration) public: explicit FacebookPlugin(QObject* parent = 0); virtual bool isConnected(); diff --git a/subsurface-core/CMakeLists.txt b/subsurface-core/CMakeLists.txt index b05dbe003..6b2eac933 100644 --- a/subsurface-core/CMakeLists.txt +++ b/subsurface-core/CMakeLists.txt @@ -79,6 +79,7 @@ set(SUBSURFACE_CORE_LIB_SRCS color.cpp pluginmanager.cpp imagedownloader.cpp + isocialnetworkintegration.cpp ${SERIAL_FTDI} ${PLATFORM_SRC} ${BT_CORE_SRC_FILES} diff --git a/subsurface-core/isocialnetworkintegration.h b/subsurface-core/isocialnetworkintegration.h index 0a38f951f..70ea3d9ab 100644 --- a/subsurface-core/isocialnetworkintegration.h +++ b/subsurface-core/isocialnetworkintegration.h @@ -10,8 +10,11 @@ * We bundle facebook integration as an example. */ -class ISocialNetworkIntegration { +class ISocialNetworkIntegration : public QObject { + Q_OBJECT public: + ISocialNetworkIntegration(QObject* parent = 0); + /*! * @name socialNetworkName * @brief The name of this social network @@ -67,6 +70,4 @@ public: virtual void requestUpload() = 0; }; -Q_DECLARE_INTERFACE(ISocialNetworkIntegration, "org.subsurface.ISocialNetworkIntegration.v1") -Q_DECLARE_METATYPE(ISocialNetworkIntegration*); #endif
\ No newline at end of file |