mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Settings QObjectification: Facebook settings
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0dba3c4e4a
commit
9b37c6dfa1
2 changed files with 82 additions and 6 deletions
|
@ -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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue