summaryrefslogtreecommitdiffstats
path: root/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2016-01-13 17:09:46 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-15 05:53:28 -0800
commit9b37c6dfa142b73315f59980dc9aeed7c00a19c6 (patch)
tree7c63b9a7aa60bff69d8aac177de5223095db564f /subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
parent0dba3c4e4a33b5ba566244d9dcea64c903f4ac7c (diff)
downloadsubsurface-9b37c6dfa142b73315f59980dc9aeed7c00a19c6.tar.gz
Settings QObjectification: Facebook settings
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp')
-rw-r--r--subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
index ccb38b6c3..7745f375b 100644
--- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -1,5 +1,7 @@
#include "SettingsObjectWrapper.h"
#include <QSettings>
+#include "../dive.h" // TODO: remove copy_string from dive.h
+
static QString tecDetails = QStringLiteral("TecDetails");
@@ -398,3 +400,60 @@ void TechnicalDetailsSettings::setShowAverageDepth(short value)
prefs.show_average_depth = value;
emit showAverageDepthChanged(value);
}
+
+FacebookSettings::FacebookSettings(QObject *parent) :
+ group(QStringLiteral("WebApps")),
+ subgroup(QStringLiteral("Facebook"))
+{
+}
+
+QString FacebookSettings::accessToken() const
+{
+ return QString(prefs.facebook.access_token);
+}
+
+QString FacebookSettings::userId() const
+{
+ return QString(prefs.facebook.user_id);
+}
+
+QString FacebookSettings::albumId() const
+{
+ return QString(prefs.facebook.album_id);
+}
+
+void FacebookSettings::setAccessToken (const QString& value)
+{
+#if SAVE_FB_CREDENTIALS
+ QSettings s;
+ s.beginGroup(group);
+ s.beginGroup(subgroup);
+ s.setValue("ConnectToken", value);
+#endif
+ prefs.facebook.access_token = copy_string(qPrintable(value));
+ emit accessTokenChanged(value);
+}
+
+void FacebookSettings::setUserId(const QString& value)
+{
+#if SAVE_FB_CREDENTIALS
+ QSettings s;
+ s.beginGroup(group);
+ s.beginGroup(subgroup);
+ s.setValue("UserId", value);
+#endif
+ prefs.facebook.user_id = copy_string(qPrintable(value));
+ emit userIdChanged(value);
+}
+
+void FacebookSettings::setAlbumId(const QString& value)
+{
+#if SAVE_FB_CREDENTIALS
+ QSettings s;
+ s.beginGroup(group);
+ s.beginGroup(subgroup);
+ s.setValue("AlbumId", value);
+#endif
+ prefs.facebook.album_id = copy_string(qPrintable(value));
+ emit albumIdChanged(value);
+} \ No newline at end of file