summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-07-27 21:55:49 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-30 07:43:22 -0700
commit181d2cf364f22c5e673916d884ca5f0742e137ce (patch)
tree3fbf7f47b17e193d29d703daaba2af6d1a11a6ac /core
parentf4f798f8dd43a4da884845af102e0b97dd8409dd (diff)
downloadsubsurface-181d2cf364f22c5e673916d884ca5f0742e137ce.tar.gz
core: activate qPrefProxy
remove Proxy from SettingsObjectWrapper and reference qPrefProxy update files using SettingsObjectWrapper/Proxy to use qPrefProxy this activated qPrefProxy and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core')
-rw-r--r--core/settings/qPref.cpp2
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp122
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h41
3 files changed, 7 insertions, 158 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp
index 49851c29a..aae226d30 100644
--- a/core/settings/qPref.cpp
+++ b/core/settings/qPref.cpp
@@ -18,6 +18,8 @@ void qPref::loadSync(bool doSync)
qPrefCloudStorage::instance()->loadSync(doSync);
qPrefDisplay::instance()->loadSync(doSync);
qPrefDiveComputer::instance()->loadSync(doSync);
+ // qPrefFaceook does not use disk.
+ qPrefProxy::instance()->loadSync(doSync);
}
const QString qPref::canonical_version() const
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index da2a86a68..296414be3 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -4,7 +4,6 @@
#include <QApplication>
#include <QFont>
#include <QDate>
-#include <QNetworkProxy>
#include "core/qthelper.h"
#include "core/prefs-macros.h"
@@ -716,111 +715,6 @@ void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value)
emit thirdTaxonomyCategoryChanged(value);
}
-ProxySettings::ProxySettings(QObject *parent) :
- QObject(parent)
-{
-}
-
-int ProxySettings::type() const
-{
- return prefs.proxy_type;
-}
-
-QString ProxySettings::host() const
-{
- return prefs.proxy_host;
-}
-
-int ProxySettings::port() const
-{
- return prefs.proxy_port;
-}
-
-bool ProxySettings::auth() const
-{
- return prefs.proxy_auth;
-}
-
-QString ProxySettings::user() const
-{
- return prefs.proxy_user;
-}
-
-QString ProxySettings::pass() const
-{
- return prefs.proxy_pass;
-}
-
-void ProxySettings::setType(int value)
-{
- if (value == prefs.proxy_type)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("proxy_type", value);
- prefs.proxy_type = value;
- emit typeChanged(value);
-}
-
-void ProxySettings::setHost(const QString& value)
-{
- if (value == prefs.proxy_host)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("proxy_host", value);
- free((void *)prefs.proxy_host);
- prefs.proxy_host = copy_qstring(value);
- emit hostChanged(value);
-}
-
-void ProxySettings::setPort(int value)
-{
- if (value == prefs.proxy_port)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("proxy_port", value);
- prefs.proxy_port = value;
- emit portChanged(value);
-}
-
-void ProxySettings::setAuth(bool value)
-{
- if (value == prefs.proxy_auth)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("proxy_auth", value);
- prefs.proxy_auth = value;
- emit authChanged(value);
-}
-
-void ProxySettings::setUser(const QString& value)
-{
- if (value == prefs.proxy_user)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("proxy_user", value);
- free((void *)prefs.proxy_user);
- prefs.proxy_user = copy_qstring(value);
- emit userChanged(value);
-}
-
-void ProxySettings::setPass(const QString& value)
-{
- if (value == prefs.proxy_pass)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("proxy_pass", value);
- free((void *)prefs.proxy_pass);
- prefs.proxy_pass = copy_qstring(value);
- emit passChanged(value);
-}
-
-
DivePlannerSettings::DivePlannerSettings(QObject *parent) :
QObject(parent)
{
@@ -1817,7 +1711,7 @@ QObject(parent),
pp_gas(new PartialPressureGasSettings(this)),
facebook(new qPrefFacebook(this)),
geocoding(new GeocodingPreferences(this)),
- proxy(new ProxySettings(this)),
+ proxy(new qPrefProxy(this)),
cloud_storage(new qPrefCloudStorage(this)),
planner_settings(new DivePlannerSettings(this)),
unit_settings(new UnitsSettings(this)),
@@ -1915,20 +1809,10 @@ void SettingsObjectWrapper::load()
GET_BOOL("auto_recalculate_thumbnails", auto_recalculate_thumbnails);
s.endGroup();
- qPrefDisplay::instance()->load();
-
qPrefAnimations::instance()->load();
-
- s.beginGroup("Network");
- GET_INT_DEF("proxy_type", proxy_type, QNetworkProxy::DefaultProxy);
- GET_TXT("proxy_host", proxy_host);
- GET_INT("proxy_port", proxy_port);
- GET_BOOL("proxy_auth", proxy_auth);
- GET_TXT("proxy_user", proxy_user);
- GET_TXT("proxy_pass", proxy_pass);
- s.endGroup();
-
qPrefCloudStorage::instance()->load();
+ qPrefDisplay::instance()->load();
+ qPrefProxy::instance()->load();
// GeoManagement
s.beginGroup("geocoding");
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index a7957f9f1..5afcfccc4 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -229,43 +229,6 @@ private:
const QString group = QStringLiteral("geocoding");
};
-class ProxySettings : public QObject {
- Q_OBJECT
- Q_PROPERTY(int type READ type WRITE setType NOTIFY typeChanged)
- Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged)
- Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged)
- Q_PROPERTY(bool auth READ auth WRITE setAuth NOTIFY authChanged)
- Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged)
- Q_PROPERTY(QString pass READ pass WRITE setPass NOTIFY passChanged)
-
-public:
- ProxySettings(QObject *parent);
- int type() const;
- QString host() const;
- int port() const;
- bool auth() const;
- QString user() const;
- QString pass() const;
-
-public slots:
- void setType(int value);
- void setHost(const QString& value);
- void setPort(int value);
- void setAuth(bool value);
- void setUser(const QString& value);
- void setPass(const QString& value);
-
-signals:
- void typeChanged(int value);
- void hostChanged(const QString& value);
- void portChanged(int value);
- void authChanged(bool value);
- void userChanged(const QString& value);
- void passChanged(const QString& value);
-private:
- const QString group = QStringLiteral("Network");
-};
-
class DivePlannerSettings : public QObject {
Q_OBJECT
Q_PROPERTY(bool last_stop READ lastStop WRITE setLastStop NOTIFY lastStopChanged)
@@ -560,7 +523,7 @@ class SettingsObjectWrapper : public QObject {
Q_PROPERTY(PartialPressureGasSettings* pp_gas MEMBER pp_gas CONSTANT)
Q_PROPERTY(qPrefFacebook* facebook MEMBER facebook CONSTANT)
Q_PROPERTY(GeocodingPreferences* geocoding MEMBER geocoding CONSTANT)
- Q_PROPERTY(ProxySettings* proxy MEMBER proxy CONSTANT)
+ Q_PROPERTY(qPrefProxy* proxy MEMBER proxy CONSTANT)
Q_PROPERTY(qPrefCloudStorage* cloud_storage MEMBER cloud_storage CONSTANT)
Q_PROPERTY(DivePlannerSettings* planner MEMBER planner_settings CONSTANT)
Q_PROPERTY(UnitsSettings* units MEMBER unit_settings CONSTANT)
@@ -580,7 +543,7 @@ public:
PartialPressureGasSettings *pp_gas;
qPrefFacebook *facebook;
GeocodingPreferences *geocoding;
- ProxySettings *proxy;
+ qPrefProxy *proxy;
qPrefCloudStorage *cloud_storage;
DivePlannerSettings *planner_settings;
UnitsSettings *unit_settings;