summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2016-01-11 19:40:07 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-11 15:47:07 -0800
commit525fe51f5d49f57929b861f8eaecd83016245f16 (patch)
tree122839eb9e6b09057a20f43ad170693cbd811ffb
parentec01fcda5b75c083581d62f7d84af9f1dcc53bdf (diff)
downloadsubsurface-525fe51f5d49f57929b861f8eaecd83016245f16.tar.gz
Implement the methods for PartialPressureGasSettings
I didn't allowed the build on CMake for those files yet because there will be tons of breackage, so when I finish, I'll allow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--subsurface-core/CMakeLists.txt1
-rw-r--r--subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp88
-rw-r--r--subsurface-core/subsurface-qt/SettingsObjectWrapper.h20
3 files changed, 109 insertions, 0 deletions
diff --git a/subsurface-core/CMakeLists.txt b/subsurface-core/CMakeLists.txt
index decc94d5f..0e060b015 100644
--- a/subsurface-core/CMakeLists.txt
+++ b/subsurface-core/CMakeLists.txt
@@ -84,6 +84,7 @@ set(SUBSURFACE_CORE_LIB_SRCS
#Subsurface Qt have the Subsurface structs QObjectified for easy access via QML.
subsurface-qt/DiveObjectHelper.cpp
+ #subsurface-qt/SettingsObjectWrapper.cpp
${SERIAL_FTDI}
${PLATFORM_SRC}
${BT_CORE_SRC_FILES}
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
new file mode 100644
index 000000000..551db302c
--- /dev/null
+++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -0,0 +1,88 @@
+#include "SettingsObjectWrapper.h"
+#include <QSettings>
+
+static QString tecDetails = QStringLiteral("TecDetails");
+
+short PartialPressureGasSettings::showPo2() const
+{
+ return prefs.pp_graphs.po2;
+}
+
+short PartialPressureGasSettings::showPn2() const
+{
+ return prefs.pp_graphs.pn2;
+}
+
+short PartialPressureGasSettings::showPhe() const
+{
+ return prefs.pp_graphs.phe;
+}
+
+double PartialPressureGasSettings::po2Threshold() const
+{
+ return prefs.pp_graphs.po2_threshold;
+}
+
+double PartialPressureGasSettings::pn2Threshold() const
+{
+ return prefs.pp_graphs.pn2_threshold;
+}
+
+double PartialPressureGasSettings::pheThreshold() const
+{
+ return prefs.pp_graphs.phe_threshold;
+}
+
+void PartialPressureGasSettings::setShowPo2(short value)
+{
+ QSettings s;
+ s.beginGroup(tecDetails);
+ s.setValue("po2graph", value);
+ prefs.pp_graphs.po2 = value;
+ emit showPo2Changed(value);
+}
+
+void PartialPressureGasSettings::setShowPn2(short value)
+{
+ QSettings s;
+ s.beginGroup(tecDetails);
+ s.setValue("pn2graph", value);
+ prefs.pp_graphs.pn2 = value;
+ emit showPn2Changed(value);
+}
+
+void PartialPressureGasSettings::setShowPhe(short value)
+{
+ QSettings s;
+ s.beginGroup(tecDetails);
+ s.setValue("phegraph", value);
+ prefs.pp_graphs.phe = value;
+ emit showPheChanged(value);
+}
+
+void PartialPressureGasSettings::setPo2Threshold(double value)
+{
+ QSettings s;
+ s.beginGroup(tecDetails);
+ s.setValue("po2threshold", value);
+ prefs.pp_graphs.po2_threshold = value;
+ emit po2ThresholdChanged(value);
+}
+
+void PartialPressureGasSettings::setPn2Threshold(double value)
+{
+ QSettings s;
+ s.beginGroup(tecDetails);
+ s.setValue("pn2threshold", value);
+ prefs.pp_graphs.pn2_threshold = value;
+ emit pn2ThresholdChanged(value);
+}
+
+void PartialPressureGasSettings::setPheThreshold(double value)
+{
+ QSettings s;
+ s.beginGroup(tecDetails);
+ s.setValue("phethreshold", value);
+ prefs.pp_graphs.phe_threshold = value;
+ emit pheThresholdChanged(value);
+}
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h
index 94bf30791..f3cf0ec12 100644
--- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h
+++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h
@@ -22,6 +22,26 @@ class PartialPressureGasSettings : public QObject {
Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged)
public:
PartialPressureGasSettings(QObject *parent);
+ short showPo2() const;
+ short showPn2() const;
+ short showPhe() const;
+ double po2Threshold() const;
+ double pn2Threshold() const;
+ double pheThreshold() const;
+public slots:
+ void setShowPo2(short value);
+ void setShowPn2(short value);
+ void setShowPhe(short value);
+ void setPo2Threshold(double value);
+ void setPn2Threshold(double value);
+ void setPheThreshold(double value);
+signals:
+ void showPo2Changed(short value);
+ void showPn2Changed(short value);
+ void showPheChanged(short value);
+ void po2ThresholdChanged(double value);
+ void pn2ThresholdChanged(double value);
+ void pheThresholdChanged(double value);
};
/* Control the state of the Facebook preferences */