summaryrefslogtreecommitdiffstats
path: root/qt-ui/preferences.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2015-01-13 21:39:05 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-14 07:49:24 +1300
commit25fc8284581e3284cd3601464746c7cd8e5212af (patch)
treed18e433f65b8225152ee0e8e85f01a9d6bc6ee99 /qt-ui/preferences.cpp
parenta0c52237ea60d119ae486c94584de1a24210b7de (diff)
downloadsubsurface-25fc8284581e3284cd3601464746c7cd8e5212af.tar.gz
Ignore QWebView in Android
Ignore QWebView instances in the preferences dialog when compiling under Android, as QWebView is not yet supported under Android. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r--qt-ui/preferences.cpp38
1 files changed, 31 insertions, 7 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 7e718651c..f9f663ae8 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -9,6 +9,10 @@
#include <QNetworkCookieJar>
#include "socialnetworks.h"
+#ifndef Q_OS_ANDROID
+#include <QWebView>
+#endif
+
PreferencesDialog *PreferencesDialog::instance()
{
static PreferencesDialog *dialog = new PreferencesDialog(MainWindow::instance());
@@ -20,6 +24,20 @@ PreferencesDialog *PreferencesDialog::instance()
PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
ui.setupUi(this);
+
+#ifdef Q_OS_ANDROID
+ for (int i = 0; i < ui.listWidget->count(); i++) {
+ if (ui.listWidget->item(i)->text() == "Facebook")
+ delete ui.listWidget->item(i);
+ }
+#else
+ facebookWebView = new QWebView(this);
+ QVBoxLayout fbLayout(ui.facebook_page);
+ fbLayout.addWidget(facebookWebView);
+ fbLayout.addWidget(ui.fbConnected);
+ ui.facebook_page->setLayout(&fbLayout);
+#endif
+
ui.proxyType->clear();
ui.proxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
ui.proxyType->addItem(tr("System proxy"), QNetworkProxy::DefaultProxy);
@@ -28,22 +46,24 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
ui.proxyType->setCurrentIndex(-1);
// Facebook stuff:
+#ifndef Q_OS_ANDROID
FacebookManager *fb = FacebookManager::instance();
if(fb->loggedIn()){
- ui.facebookWebView->setHtml("You are connected on Facebook, yey.");
+ facebookWebView->setHtml("You are connected on Facebook, yey.");
} else {
- ui.facebookWebView->setUrl(fb->connectUrl());
+ facebookWebView->setUrl(fb->connectUrl());
}
- connect(ui.facebookWebView, &QWebView::urlChanged, fb, &FacebookManager::tryLogin);
+ connect(facebookWebView, &QWebView::urlChanged, fb, &FacebookManager::tryLogin);
connect(fb, &FacebookManager::justLoggedIn, this, &PreferencesDialog::facebookLoggedIn);
connect(ui.btnDisconnectFacebook, &QPushButton::clicked, fb, &FacebookManager::logout);
connect(fb, &FacebookManager::justLoggedOut, this, &PreferencesDialog::facebookDisconnect);
+#endif
connect(ui.proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(proxyType_changed(int)));
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
connect(ui.gflow, SIGNAL(valueChanged(int)), this, SLOT(gflowChanged(int)));
connect(ui.gfhigh, SIGNAL(valueChanged(int)), this, SLOT(gfhighChanged(int)));
-// connect(ui.defaultSetpoint, SIGNAL(valueChanged(double)), this, SLOT(defaultSetpointChanged(double)));
+ // connect(ui.defaultSetpoint, SIGNAL(valueChanged(double)), this, SLOT(defaultSetpointChanged(double)));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
@@ -55,15 +75,19 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
void PreferencesDialog::facebookLoggedIn()
{
- ui.facebookWebView->setHtml("We need a better 'you re connected' page. but, YEY. ");
+#ifndef Q_OS_ANDROID
+ facebookWebView->setHtml("We need a better 'you re connected' page. but, YEY. ");
ui.fbConnected->show();
+#endif
}
void PreferencesDialog::facebookDisconnect()
{
- ui.facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
- ui.facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
+#ifndef Q_OS_ANDROID
+ facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
+ facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
ui.fbConnected->hide();
+#endif
}
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""