aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-17 08:43:49 +1300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-17 08:43:49 +1300
commitabddb3ecb9d93d44bb0071ea369c98499105b9f0 (patch)
tree9af53a4fad1c975460968a84dc5ced6634e2770b /qt-ui
parent0d619d569bd0b57028eceb16147ea08e850fc946 (diff)
downloadsubsurface-abddb3ecb9d93d44bb0071ea369c98499105b9f0.tar.gz
Make Facebook support a config option
By default it is turned off, turn on by calling qmake with CONFIG+=FBSUPPORT. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp7
-rw-r--r--qt-ui/preferences.cpp9
2 files changed, 13 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 492753d25..629b36ad7 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -16,7 +16,10 @@
#include "qthelper.h"
#include "display.h"
#include "divepicturewidget.h"
+
+#if defined(FBSUPPORT)
#include "socialnetworks.h"
+#endif
#include <QLabel>
#include <QCompleter>
@@ -190,11 +193,15 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.photosView->setSelectionMode(QAbstractItemView::SingleSelection);
connect(deletePhoto, SIGNAL(triggered(bool)), this, SLOT(removeSelectedPhotos()));
+#if defined(FBSUPPORT)
FacebookManager *fb = FacebookManager::instance();
connect(fb, &FacebookManager::justLoggedIn, ui.facebookPublish, &QPushButton::show);
connect(fb, &FacebookManager::justLoggedOut, ui.facebookPublish, &QPushButton::hide);
connect(ui.facebookPublish, &QPushButton::clicked, fb, &FacebookManager::sendDive);
ui.facebookPublish->setVisible(fb->loggedIn());
+#else
+ ui.facebookPublish->setVisible(false);
+#endif
acceptingEdit = false;
}
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index f9f663ae8..a6fe549ba 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -7,7 +7,10 @@
#include <QShortcut>
#include <QNetworkProxy>
#include <QNetworkCookieJar>
+
+#if defined(FBSUPPORT)
#include "socialnetworks.h"
+#endif
#ifndef Q_OS_ANDROID
#include <QWebView>
@@ -25,7 +28,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
{
ui.setupUi(this);
-#ifdef Q_OS_ANDROID
+#if defined(Q_OS_ANDROID) || !defined(FBSUPPORT)
for (int i = 0; i < ui.listWidget->count(); i++) {
if (ui.listWidget->item(i)->text() == "Facebook")
delete ui.listWidget->item(i);
@@ -46,7 +49,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
ui.proxyType->setCurrentIndex(-1);
// Facebook stuff:
-#ifndef Q_OS_ANDROID
+#if !defined(Q_OS_ANDROID) && defined(FBSUPPRORT)
FacebookManager *fb = FacebookManager::instance();
if(fb->loggedIn()){
facebookWebView->setHtml("You are connected on Facebook, yey.");
@@ -83,7 +86,7 @@ void PreferencesDialog::facebookLoggedIn()
void PreferencesDialog::facebookDisconnect()
{
-#ifndef Q_OS_ANDROID
+#if !defined(Q_OS_ANDROID) && defined(FBSUPPORT)
facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
ui.fbConnected->hide();