From 25fc8284581e3284cd3601464746c7cd8e5212af Mon Sep 17 00:00:00 2001 From: "Joseph W. Joshua" Date: Tue, 13 Jan 2015 21:39:05 +0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/preferences.cpp | 38 +++++++++++++++++---- qt-ui/preferences.h | 7 ++++ qt-ui/preferences.ui | 94 ++++++++++++++++++++++----------------------------- 3 files changed, 79 insertions(+), 60 deletions(-) (limited to 'qt-ui') 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 #include "socialnetworks.h" +#ifndef Q_OS_ANDROID +#include +#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; }" : "" diff --git a/qt-ui/preferences.h b/qt-ui/preferences.h index 72c379181..842597732 100644 --- a/qt-ui/preferences.h +++ b/qt-ui/preferences.h @@ -6,6 +6,10 @@ #include "ui_preferences.h" +#ifndef Q_OS_ANDROID + class QWebView; +#endif + class QAbstractButton; class PreferencesDialog : public QDialog { @@ -37,6 +41,9 @@ private: void setUiFromPrefs(); Ui::PreferencesDialog ui; struct preferences oldPrefs; + #ifndef Q_OS_ANDROID + QWebView *facebookWebView; + #endif }; #endif // PREFERENCES_H diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui index 2572990fa..2bcc684d7 100644 --- a/qt-ui/preferences.ui +++ b/qt-ui/preferences.ui @@ -151,9 +151,9 @@ - 2 + 5 - + @@ -351,7 +351,7 @@ - + @@ -599,7 +599,7 @@ - + @@ -824,7 +824,7 @@ - + @@ -865,7 +865,7 @@ - + @@ -1006,48 +1006,43 @@ - - - - - - - about:blank - - - - - - - + + + + + 9 + 355 + 265 + 47 + + + + + - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Disconnect from Facebook - - - - + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Disconnect from Facebook + + - - - + + + @@ -1065,13 +1060,6 @@ - - - QWebView - QWidget -
QtWebKitWidgets/QWebView
-
-
@@ -1412,8 +1400,8 @@ - + -- cgit v1.2.3-70-g09d2