summaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt/SettingsObjectWrapper.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2016-08-10 18:10:15 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-08-27 11:40:44 -0700
commitdb8e8957abc8b8dc407a94835e686f649c9643a6 (patch)
tree5c21bd7e9a4174704e1c53752146c1229464b2bc /core/subsurface-qt/SettingsObjectWrapper.cpp
parentb264c3e36704c83a6c9353fe5eac3dc0eb3c9a80 (diff)
downloadsubsurface-db8e8957abc8b8dc407a94835e686f649c9643a6.tar.gz
Settings update: Add "Dive Computer" settings to SettingsObjectWrapper
For some reason, the dive computer settings weren't in the settings prefs. This moves it, makes the boilerplate on Settings ObjectWrapper and make things compile. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/subsurface-qt/SettingsObjectWrapper.cpp')
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp62
1 files changed, 61 insertions, 1 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 6d66c9864..7c6001984 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -6,6 +6,65 @@
#include "../dive.h" // TODO: remove copy_string from dive.h
+DiveComputerSettings::DiveComputerSettings(QObject *parent):
+ QObject(parent), group(QStringLiteral("DiveComputer"))
+{
+}
+
+QString DiveComputerSettings::dc_vendor() const
+{
+ return prefs.dive_computer.vendor;
+}
+
+QString DiveComputerSettings::dc_product() const
+{
+ return prefs.dive_computer.product;
+}
+
+QString DiveComputerSettings::dc_device() const
+{
+ return prefs.dive_computer.device;
+}
+
+int DiveComputerSettings::downloadMode() const
+{
+ return prefs.dive_computer.download_mode;
+}
+
+void DiveComputerSettings::setVendor(const QString& vendor)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("dive_computer_vendor", vendor);
+ free(prefs.dive_computer.vendor);
+ prefs.dive_computer.vendor = copy_string(qPrintable(vendor));
+}
+
+void DiveComputerSettings::setProduct(const QString& product)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("dive_computer_product", product);
+ free(prefs.dive_computer.product);
+ prefs.dive_computer.product = copy_string(qPrintable(product));
+}
+
+void DiveComputerSettings::setDevice(const QString& device)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("dive_computer_device", device);
+ free(prefs.dive_computer.device);
+ prefs.dive_computer.device = copy_string(qPrintable(device));
+}
+
+void DiveComputerSettings::setDownloadMode(int mode)
+{
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("dive_computer_download_mode", mode);
+ prefs.dive_computer.download_mode = mode;
+}
UpdateManagerSettings::UpdateManagerSettings(QObject *parent) : QObject(parent), group("UpdateManager")
{
@@ -1679,7 +1738,8 @@ QObject(parent),
language_settings(new LanguageSettingsObjectWrapper(this)),
animation_settings(new AnimationsSettingsObjectWrapper(this)),
location_settings(new LocationServiceSettingsObjectWrapper(this)),
- update_manager_settings(new UpdateManagerSettings(this))
+ update_manager_settings(new UpdateManagerSettings(this)),
+ dive_computer_settings(new DiveComputerSettings(this))
{
}