diff options
-rw-r--r-- | backend-shared/plannershared.cpp | 58 | ||||
-rw-r--r-- | backend-shared/plannershared.h | 34 |
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() {} }; |