From 66091ff853fe16495c981a5f8deff285cd310358 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 9 Nov 2015 18:05:30 -0200 Subject: Remove Facebook from Plugins Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- desktop-widgets/mainwindow.cpp | 51 +++++++++++++------------ desktop-widgets/mainwindow.h | 1 + desktop-widgets/plugins/facebook/CMakeLists.txt | 6 +-- 3 files changed, 30 insertions(+), 28 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index b532b8501..58778f394 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -55,6 +55,8 @@ #include "subsurface-core/isocialnetworkintegration.h" #include "subsurface-core/pluginmanager.h" +#include "plugins/facebook/facebook_integration.h" + #if defined(FBSUPPORT) #include "socialnetworks.h" #endif @@ -243,30 +245,7 @@ MainWindow::MainWindow() : QMainWindow(), find_all_templates(); #endif - if(PluginManager::instance().socialNetworkIntegrationPlugins().count()) { - QMenu *connections = new QMenu(tr("Connect to")); - Q_FOREACH(ISocialNetworkIntegration *plugin, PluginManager::instance().socialNetworkIntegrationPlugins()){ - QAction *toggle_connection = new QAction(this); - toggle_connection->setText(plugin->socialNetworkName()); - toggle_connection->setIcon(QIcon(plugin->socialNetworkIcon())); - toggle_connection->setData(QVariant::fromValue(plugin)); - connect(toggle_connection, SIGNAL(triggered()), this, SLOT(socialNetworkRequestConnect())); - - QAction *share_on = new QAction(this); - share_on->setText(plugin->socialNetworkName()); - share_on->setIcon(QIcon(plugin->socialNetworkIcon())); - share_on->setData(QVariant::fromValue(plugin)); - ui.menuShare_on->addAction(share_on); - connections->addAction(toggle_connection); - connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload())); - } - ui.menuShare_on->addSeparator(); - ui.menuShare_on->addMenu(connections); - } else { - ui.menubar->removeAction(ui.menuShare_on->menuAction()); - } - - ui.menubar->show(); + setupSocialNetworkMenu(); set_git_update_cb(&updateProgress); } @@ -276,10 +255,32 @@ MainWindow::~MainWindow() m_Instance = NULL; } +void MainWindow::setupSocialNetworkMenu() +{ + QMenu *connections = new QMenu(tr("Connect to")); + FacebookPlugin *facebookPlugin = new FacebookPlugin(); + QAction *toggle_connection = new QAction(this); + toggle_connection->setText(facebookPlugin->socialNetworkName()); + toggle_connection->setIcon(QIcon(facebookPlugin->socialNetworkIcon())); + toggle_connection->setData(QVariant::fromValue(facebookPlugin)); + 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)); + ui.menuShare_on->addAction(share_on); + connections->addAction(toggle_connection); + connect(share_on, SIGNAL(triggered()), this, SLOT(socialNetworkRequestUpload())); + ui.menuShare_on->addSeparator(); + ui.menuShare_on->addMenu(connections); + ui.menubar->show(); +} + void MainWindow::socialNetworkRequestConnect() { QAction *action = qobject_cast(sender()); - ISocialNetworkIntegration *plugin = action->data().value(); + FacebookPlugin *plugin = action->data().value(); if (plugin->isConnected()) plugin->requestLogoff(); else diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index fc63c5740..adf35686e 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -225,6 +225,7 @@ private: bool plannerStateClean(); void setupForAddAndPlan(const char *model); void configureToolbar(); + void setupSocialNetworkMenu(); QDialog *survey; struct dive copyPasteDive; struct dive_components what; diff --git a/desktop-widgets/plugins/facebook/CMakeLists.txt b/desktop-widgets/plugins/facebook/CMakeLists.txt index 3f63a8fac..c0175a26e 100644 --- a/desktop-widgets/plugins/facebook/CMakeLists.txt +++ b/desktop-widgets/plugins/facebook/CMakeLists.txt @@ -1,7 +1,7 @@ set(FACEBOOK_PLUGIN_SRCS facebook_integration.cpp facebookconnectwidget.cpp) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_library(facebook_integration SHARED ${FACEBOOK_PLUGIN_SRCS}) +add_library(facebook_integration STATIC ${FACEBOOK_PLUGIN_SRCS}) -target_link_libraries(facebook_integration subsurface_corelib subsurface_interface ${QT_LIBRARIES}) -add_dependencies(facebook_integration subsurface_corelib subsurface_interface) \ No newline at end of file +target_link_libraries(facebook_integration ${QT_LIBRARIES}) +add_dependencies(facebook_integration subsurface_corelib) \ No newline at end of file -- cgit v1.2.3-70-g09d2