aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2016-01-14 11:55:31 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-15 05:55:18 -0800
commitf5c69e3a56da437c967a7c1462758fc32f32d332 (patch)
tree12559c2df2c47abf367e40c9412fe1e6682426d1
parent22da63e8396275f6f6e1b3148b0b9680ab0da153 (diff)
downloadsubsurface-f5c69e3a56da437c967a7c1462758fc32f32d332.tar.gz
Settings QObjectification: finish network preferences
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp94
-rw-r--r--subsurface-core/subsurface-qt/SettingsObjectWrapper.h11
2 files changed, 104 insertions, 1 deletions
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
index 73137b8a8..ea91e4361 100644
--- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -548,4 +548,96 @@ void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value)
s.setValue("cat2", value);
prefs.show_average_depth = value;
emit thirdTaxonomyCategoryChanged(value);
-} \ No newline at end of file
+}
+
+ProxySettings::ProxySettings(QObject *parent) :
+ group(QStringLiteral("Network"))
+{
+}
+
+int ProxySettings::type() const
+{
+ return prefs.proxy_type;
+}
+
+QString ProxySettings::host() const
+{
+ return prefs.proxy_host;
+}
+
+int ProxySettings::port() const
+{
+ return prefs.proxy_port;
+}
+
+short 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)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("proxy_type", value);
+ prefs.proxy_type = value;
+ emit typeChanged(value);
+}
+
+void ProxySettings::setHost(const QString& value)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("proxy_host", value);
+ free(prefs.proxy_host);
+ prefs.proxy_host = copy_string(qPrintable(value));;
+ emit hostChanged(value);
+}
+
+void ProxySettings::setPort(int value)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("proxy_port", value);
+ prefs.proxy_port = value;
+ emit portChanged(value);
+}
+
+void ProxySettings::setAuth(short value)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("proxy_auth", value);
+ prefs.proxy_auth = value;
+ emit authChanged(value);
+}
+
+void ProxySettings::setUser(const QString& value)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("proxy_user", value);
+ free(prefs.proxy_user);
+ prefs.proxy_user = copy_string(qPrintable(value));
+ emit userChanged(value);
+}
+
+void ProxySettings::setPass(const QString& value)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("proxy_pass", value);
+ free(prefs.proxy_pass);
+ prefs.proxy_pass = copy_string(qPrintable(value));
+ emit passChanged(value);
+}
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h
index 6098b0df7..0a2da44d1 100644
--- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h
+++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h
@@ -218,6 +218,7 @@ class ProxySettings : public QObject {
Q_PROPERTY(short 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;
@@ -234,6 +235,16 @@ public slots:
void setAuth(short 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(short value);
+ void userChanged(const QString& value);
+ void passChanged(const QString& value);
+private:
+ QString group;
};
class CloudStorageSettings : public QObject {