aboutsummaryrefslogtreecommitdiffstats
path: root/backend-shared
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-14 20:29:16 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-26 08:38:27 -0800
commitb877dd973cd787464875f0329c6472bf7f508e01 (patch)
treee4bb753e19f02330c5e253e2864f9e7f1a35a44f /backend-shared
parentd90a2ca0089e782372085a870135340948f08899 (diff)
downloadsubsurface-b877dd973cd787464875f0329c6472bf7f508e01.tar.gz
plannerShared: add variables from plannerModel
the variables are set through set functions in DivePlannerPointsModel, but read via getters from qPrefDivePlanner. Variables: planner_deco_mode reserveGas safetyStop gflow gfhigh vpmb_conservatism Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'backend-shared')
-rw-r--r--backend-shared/plannershared.cpp58
-rw-r--r--backend-shared/plannershared.h34
2 files changed, 90 insertions, 2 deletions
diff --git a/backend-shared/plannershared.cpp b/backend-shared/plannershared.cpp
index ff95b9e0e..2420fdedc 100644
--- a/backend-shared/plannershared.cpp
+++ b/backend-shared/plannershared.cpp
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include "plannershared.h"
-#include "core/pref.h"
#include "core/settings/qPrefDivePlanner.h"
-
+#include "core/settings/qPrefTechnicalDetails.h"
+#include "qt-models/diveplannermodel.h"
plannerShared *plannerShared::instance()
{
@@ -59,3 +59,57 @@ void plannerShared::set_descrate(int value)
qPrefDivePlanner::set_descrate(value * TO_MM_BY_SEC);
}
+// Planning values
+deco_mode plannerShared::planner_deco_mode()
+{
+ return qPrefDivePlanner::planner_deco_mode();
+}
+void plannerShared::set_planner_deco_mode(deco_mode value)
+{
+ DivePlannerPointsModel::instance()->setDecoMode(value);
+}
+
+int plannerShared::reserve_gas()
+{
+ return qPrefDivePlanner::reserve_gas();
+}
+void plannerShared::set_reserve_gas(int value)
+{
+ DivePlannerPointsModel::instance()->setReserveGas(value);
+}
+
+bool plannerShared::safetystop()
+{
+ return qPrefDivePlanner::safetystop();
+}
+void plannerShared::set_safetystop(bool value)
+{
+ DivePlannerPointsModel::instance()->setSafetyStop(value);
+}
+
+int plannerShared::gflow()
+{
+ return qPrefTechnicalDetails::gflow();
+}
+void plannerShared::set_gflow(int value)
+{
+ DivePlannerPointsModel::instance()->setGFLow(value);
+}
+
+int plannerShared::gfhigh()
+{
+ return qPrefTechnicalDetails::gflow();
+}
+void plannerShared::set_gfhigh(int value)
+{
+ DivePlannerPointsModel::instance()->setGFHigh(value);
+}
+
+int plannerShared::vpmb_conservatism()
+{
+ return qPrefTechnicalDetails::vpmb_conservatism();
+}
+void plannerShared::set_vpmb_conservatism(int value)
+{
+ DivePlannerPointsModel::instance()->setVpmbConservatism(value);
+}
diff --git a/backend-shared/plannershared.h b/backend-shared/plannershared.h
index 136eb9cdf..b38b31f1d 100644
--- a/backend-shared/plannershared.h
+++ b/backend-shared/plannershared.h
@@ -2,6 +2,7 @@
#ifndef PLANNERSHARED_H
#define PLANNERSHARED_H
#include <QObject>
+#include "core/pref.h"
// This is a shared class (mobile/desktop), and contains the core of the diveplanner
// without UI entanglement.
@@ -22,6 +23,15 @@ class plannerShared: public QObject {
Q_PROPERTY(int ascrate50 READ ascrate50 WRITE set_ascrate50 NOTIFY ascrate50Changed);
Q_PROPERTY(int ascrate75 READ ascrate75 WRITE set_ascrate75 NOTIFY ascrate75Changed);
Q_PROPERTY(int descrate READ descrate WRITE set_descrate NOTIFY descrateChanged);
+
+ // Planning data
+ Q_PROPERTY(deco_mode planner_deco_mode READ planner_deco_mode WRITE set_planner_deco_mode NOTIFY planner_deco_modeChanged);
+ Q_PROPERTY(int reserve_gas READ reserve_gas WRITE set_reserve_gas NOTIFY reserve_gasChanged);
+ Q_PROPERTY(bool safetystop READ safetystop WRITE set_safetystop NOTIFY safetystopChanged);
+ Q_PROPERTY(int gflow READ gflow WRITE set_gflow NOTIFY gflowChanged);
+ Q_PROPERTY(int gfhigh READ gfhigh WRITE set_gfhigh NOTIFY gfhighChanged);
+ Q_PROPERTY(int vpmb_conservatism READ vpmb_conservatism WRITE set_vpmb_conservatism NOTIFY vpmb_conservatismChanged);
+
public:
static plannerShared *instance();
@@ -32,6 +42,14 @@ public:
static int ascrate75();
static int descrate();
+ // Planning data
+ static deco_mode planner_deco_mode();
+ static int reserve_gas();
+ static bool safetystop();
+ static int gflow();
+ static int gfhigh();
+ static int vpmb_conservatism();
+
public slots:
// Ascend/Descend data, converted to meter/feet depending on user selection
static void set_ascratelast6m(int value);
@@ -40,6 +58,14 @@ public slots:
static void set_ascrate75(int value);
static void set_descrate(int value);
+ // Planning data
+ static void set_planner_deco_mode(deco_mode value);
+ static void set_reserve_gas(int value);
+ static void set_safetystop(bool value);
+ static void set_gflow(int value);
+ static void set_gfhigh(int value);
+ static void set_vpmb_conservatism(int value);
+
signals:
// Ascend/Descend data, converted to meter/feet depending on user selection
void ascratelast6mChanged(int value);
@@ -48,6 +74,14 @@ signals:
void ascrate75Changed(int value);
void descrateChanged(int value);
+ // Planning data
+ void planner_deco_modeChanged(deco_mode value);
+ void reserve_gasChanged(int value);
+ void safetystopChanged(bool value);
+ void gflowChanged(int value);
+ void gfhighChanged(int value);
+ void vpmb_conservatismChanged(int value);
+
private:
plannerShared() {}
};