mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a0c52237ea
commit
25fc828458
3 changed files with 79 additions and 60 deletions
|
@ -9,6 +9,10 @@
|
||||||
#include <QNetworkCookieJar>
|
#include <QNetworkCookieJar>
|
||||||
#include "socialnetworks.h"
|
#include "socialnetworks.h"
|
||||||
|
|
||||||
|
#ifndef Q_OS_ANDROID
|
||||||
|
#include <QWebView>
|
||||||
|
#endif
|
||||||
|
|
||||||
PreferencesDialog *PreferencesDialog::instance()
|
PreferencesDialog *PreferencesDialog::instance()
|
||||||
{
|
{
|
||||||
static PreferencesDialog *dialog = new PreferencesDialog(MainWindow::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)
|
PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
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->clear();
|
||||||
ui.proxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
|
ui.proxyType->addItem(tr("No proxy"), QNetworkProxy::NoProxy);
|
||||||
ui.proxyType->addItem(tr("System proxy"), QNetworkProxy::DefaultProxy);
|
ui.proxyType->addItem(tr("System proxy"), QNetworkProxy::DefaultProxy);
|
||||||
|
@ -28,22 +46,24 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
|
||||||
ui.proxyType->setCurrentIndex(-1);
|
ui.proxyType->setCurrentIndex(-1);
|
||||||
|
|
||||||
// Facebook stuff:
|
// Facebook stuff:
|
||||||
|
#ifndef Q_OS_ANDROID
|
||||||
FacebookManager *fb = FacebookManager::instance();
|
FacebookManager *fb = FacebookManager::instance();
|
||||||
if(fb->loggedIn()){
|
if(fb->loggedIn()){
|
||||||
ui.facebookWebView->setHtml("You are connected on Facebook, yey.");
|
facebookWebView->setHtml("You are connected on Facebook, yey.");
|
||||||
} else {
|
} 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(fb, &FacebookManager::justLoggedIn, this, &PreferencesDialog::facebookLoggedIn);
|
||||||
connect(ui.btnDisconnectFacebook, &QPushButton::clicked, fb, &FacebookManager::logout);
|
connect(ui.btnDisconnectFacebook, &QPushButton::clicked, fb, &FacebookManager::logout);
|
||||||
connect(fb, &FacebookManager::justLoggedOut, this, &PreferencesDialog::facebookDisconnect);
|
connect(fb, &FacebookManager::justLoggedOut, this, &PreferencesDialog::facebookDisconnect);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(ui.proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(proxyType_changed(int)));
|
connect(ui.proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(proxyType_changed(int)));
|
||||||
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
||||||
connect(ui.gflow, SIGNAL(valueChanged(int)), this, SLOT(gflowChanged(int)));
|
connect(ui.gflow, SIGNAL(valueChanged(int)), this, SLOT(gflowChanged(int)));
|
||||||
connect(ui.gfhigh, SIGNAL(valueChanged(int)), this, SLOT(gfhighChanged(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);
|
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
||||||
connect(close, SIGNAL(activated()), this, SLOT(close()));
|
connect(close, SIGNAL(activated()), this, SLOT(close()));
|
||||||
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
|
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()
|
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();
|
ui.fbConnected->show();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::facebookDisconnect()
|
void PreferencesDialog::facebookDisconnect()
|
||||||
{
|
{
|
||||||
ui.facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
|
#ifndef Q_OS_ANDROID
|
||||||
ui.facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
|
facebookWebView->page()->networkAccessManager()->setCookieJar(new QNetworkCookieJar());
|
||||||
|
facebookWebView->setUrl(FacebookManager::instance()->connectUrl());
|
||||||
ui.fbConnected->hide();
|
ui.fbConnected->hide();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""
|
#define DANGER_GF (gf > 100) ? "* { color: red; }" : ""
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
#include "ui_preferences.h"
|
#include "ui_preferences.h"
|
||||||
|
|
||||||
|
#ifndef Q_OS_ANDROID
|
||||||
|
class QWebView;
|
||||||
|
#endif
|
||||||
|
|
||||||
class QAbstractButton;
|
class QAbstractButton;
|
||||||
|
|
||||||
class PreferencesDialog : public QDialog {
|
class PreferencesDialog : public QDialog {
|
||||||
|
@ -37,6 +41,9 @@ private:
|
||||||
void setUiFromPrefs();
|
void setUiFromPrefs();
|
||||||
Ui::PreferencesDialog ui;
|
Ui::PreferencesDialog ui;
|
||||||
struct preferences oldPrefs;
|
struct preferences oldPrefs;
|
||||||
|
#ifndef Q_OS_ANDROID
|
||||||
|
QWebView *facebookWebView;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PREFERENCES_H
|
#endif // PREFERENCES_H
|
||||||
|
|
|
@ -151,9 +151,9 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_2">
|
<widget class="QWidget" name="defaults_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
@ -351,7 +351,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="units_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
@ -599,7 +599,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_3">
|
<widget class="QWidget" name="graph_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
@ -824,7 +824,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_4">
|
<widget class="QWidget" name="language_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
@ -865,7 +865,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_5">
|
<widget class="QWidget" name="network_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_10">
|
<widget class="QGroupBox" name="groupBox_10">
|
||||||
|
@ -1006,48 +1006,43 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_6">
|
<widget class="QWidget" name="facebook_page">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<widget class="QWidget" name="fbConnected" native="true">
|
||||||
<item>
|
<property name="geometry">
|
||||||
<widget class="QWebView" name="facebookWebView">
|
<rect>
|
||||||
<property name="url">
|
<x>9</x>
|
||||||
<url>
|
<y>355</y>
|
||||||
<string>about:blank</string>
|
<width>265</width>
|
||||||
</url>
|
<height>47</height>
|
||||||
</property>
|
</rect>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="fbConnected" native="true">
|
<layout class="QHBoxLayout" name="connectedLayout">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="connectedLayout">
|
<spacer name="horizontalSpacer_2">
|
||||||
<item>
|
<property name="orientation">
|
||||||
<spacer name="horizontalSpacer_2">
|
<enum>Qt::Horizontal</enum>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Horizontal</enum>
|
<property name="sizeHint" stdset="0">
|
||||||
</property>
|
<size>
|
||||||
<property name="sizeHint" stdset="0">
|
<width>40</width>
|
||||||
<size>
|
<height>20</height>
|
||||||
<width>40</width>
|
</size>
|
||||||
<height>20</height>
|
</property>
|
||||||
</size>
|
</spacer>
|
||||||
</property>
|
</item>
|
||||||
</spacer>
|
<item>
|
||||||
</item>
|
<widget class="QPushButton" name="btnDisconnectFacebook">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QPushButton" name="btnDisconnectFacebook">
|
<string>Disconnect from Facebook</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Disconnect from Facebook</string>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
</layout>
|
||||||
</layout>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1065,13 +1060,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>QWebView</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>QtWebKitWidgets/QWebView</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -1412,8 +1400,8 @@
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="verticalSpeed"/>
|
|
||||||
<buttongroup name="buttonGroup"/>
|
<buttongroup name="buttonGroup"/>
|
||||||
|
<buttongroup name="verticalSpeed"/>
|
||||||
<buttongroup name="buttonGroup_2"/>
|
<buttongroup name="buttonGroup_2"/>
|
||||||
<buttongroup name="buttonGroup_3"/>
|
<buttongroup name="buttonGroup_3"/>
|
||||||
<buttongroup name="buttonGroup_4"/>
|
<buttongroup name="buttonGroup_4"/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue