mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Remove Facebook from Plugins
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7b1950ca03
commit
66091ff853
4 changed files with 31 additions and 28 deletions
|
@ -384,6 +384,7 @@ else()
|
|||
${SUBSURFACE_TARGET}
|
||||
subsurface_generated_ui
|
||||
subsurface_interface
|
||||
facebook_integration
|
||||
subsurface_profile
|
||||
subsurface_statistics
|
||||
subsurface_models
|
||||
|
|
|
@ -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<QAction*>(sender());
|
||||
ISocialNetworkIntegration *plugin = action->data().value<ISocialNetworkIntegration*>();
|
||||
FacebookPlugin *plugin = action->data().value<FacebookPlugin*>();
|
||||
if (plugin->isConnected())
|
||||
plugin->requestLogoff();
|
||||
else
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
target_link_libraries(facebook_integration ${QT_LIBRARIES})
|
||||
add_dependencies(facebook_integration subsurface_corelib)
|
Loading…
Reference in a new issue