diff options
author | Joseph W. Joshua <joejoshw@gmail.com> | 2015-01-13 21:39:05 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-14 07:49:24 +1300 |
commit | 25fc8284581e3284cd3601464746c7cd8e5212af (patch) | |
tree | d18e433f65b8225152ee0e8e85f01a9d6bc6ee99 /qt-ui | |
parent | a0c52237ea60d119ae486c94584de1a24210b7de (diff) | |
download | subsurface-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')
-rw-r--r-- | qt-ui/preferences.cpp | 38 | ||||
-rw-r--r-- | qt-ui/preferences.h | 7 | ||||
-rw-r--r-- | qt-ui/preferences.ui | 94 |
3 files changed, 79 insertions, 60 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; }" : "" 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 @@ </sizepolicy> </property> <property name="currentIndex"> - <number>2</number> + <number>5</number> </property> - <widget class="QWidget" name="page_2"> + <widget class="QWidget" name="defaults_page"> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QGroupBox" name="groupBox_2"> @@ -351,7 +351,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page"> + <widget class="QWidget" name="units_page"> <layout class="QVBoxLayout" name="verticalLayout"> <item> <layout class="QHBoxLayout" name="horizontalLayout"> @@ -599,7 +599,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_3"> + <widget class="QWidget" name="graph_page"> <layout class="QVBoxLayout" name="verticalLayout_5"> <item> <widget class="QGroupBox" name="groupBox_4"> @@ -824,7 +824,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_4"> + <widget class="QWidget" name="language_page"> <layout class="QVBoxLayout" name="verticalLayout_6"> <item> <layout class="QHBoxLayout" name="horizontalLayout_6"> @@ -865,7 +865,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_5"> + <widget class="QWidget" name="network_page"> <layout class="QVBoxLayout" name="verticalLayout_15"> <item> <widget class="QGroupBox" name="groupBox_10"> @@ -1006,48 +1006,43 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_6"> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> - <widget class="QWebView" name="facebookWebView"> - <property name="url"> - <url> - <string>about:blank</string> - </url> - </property> - </widget> - </item> - <item> - <widget class="QWidget" name="fbConnected" native="true"> - <layout class="QVBoxLayout" name="verticalLayout_9"> + <widget class="QWidget" name="facebook_page"> + <widget class="QWidget" name="fbConnected" native="true"> + <property name="geometry"> + <rect> + <x>9</x> + <y>355</y> + <width>265</width> + <height>47</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <layout class="QHBoxLayout" name="connectedLayout"> <item> - <layout class="QHBoxLayout" name="connectedLayout"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnDisconnectFacebook"> - <property name="text"> - <string>Disconnect from Facebook</string> - </property> - </widget> - </item> - </layout> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="btnDisconnectFacebook"> + <property name="text"> + <string>Disconnect from Facebook</string> + </property> + </widget> </item> </layout> - </widget> - </item> - </layout> + </item> + </layout> + </widget> </widget> </widget> </item> @@ -1065,13 +1060,6 @@ </item> </layout> </widget> - <customwidgets> - <customwidget> - <class>QWebView</class> - <extends>QWidget</extends> - <header>QtWebKitWidgets/QWebView</header> - </customwidget> - </customwidgets> <resources/> <connections> <connection> @@ -1412,8 +1400,8 @@ </connection> </connections> <buttongroups> - <buttongroup name="verticalSpeed"/> <buttongroup name="buttonGroup"/> + <buttongroup name="verticalSpeed"/> <buttongroup name="buttonGroup_2"/> <buttongroup name="buttonGroup_3"/> <buttongroup name="buttonGroup_4"/> |