summaryrefslogtreecommitdiffstats
path: root/backend-shared/plannershared.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-23 17:25:46 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-26 09:58:21 -0800
commit738ee360ba1b22c2be22fd7021205dd9dfae1f3d (patch)
treed9dc54243fb5f923e6085e9d1ad47d1f98fdebad /backend-shared/plannershared.cpp
parentc4d9b737cdf0881a81c6ba635bd9dedbc3a1af26 (diff)
downloadsubsurface-738ee360ba1b22c2be22fd7021205dd9dfae1f3d.tar.gz
desktop-widgets: replace o2narcotic from plannerModel to plannerShared
Use plannerShared setter to update o2narcotic. This will also signal the cylindermodel to calculate a new bestmix. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'backend-shared/plannershared.cpp')
-rw-r--r--backend-shared/plannershared.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/backend-shared/plannershared.cpp b/backend-shared/plannershared.cpp
index fe4e52443..d331f9d2b 100644
--- a/backend-shared/plannershared.cpp
+++ b/backend-shared/plannershared.cpp
@@ -222,3 +222,37 @@ void plannerShared::set_o2narcotic(bool value)
DivePlannerPointsModel::instance()->emitDataChanged();
CylindersModel::instance()->updateBestMixes();
}
+
+double plannerShared::bottompo2()
+{
+ return (qPrefDivePlanner::bottompo2() / 1000.0);
+}
+void plannerShared::set_bottompo2(double value)
+{
+ // NO conversion, this is done in the planner model.
+ qPrefDivePlanner::set_bottompo2((int) (value * 1000.0));
+ CylindersModel::instance()->updateBestMixes();
+}
+
+double plannerShared::decopo2()
+{
+ return qPrefDivePlanner::decopo2() / 1000;
+}
+void plannerShared::set_decopo2(double value)
+{
+ pressure_t olddecopo2;
+ olddecopo2.mbar = prefs.decopo2;
+ qPrefDivePlanner::instance()->set_decopo2((int) (value * 1000.0));
+ CylindersModel::instance()->updateDecoDepths(olddecopo2);
+ CylindersModel::instance()->updateBestMixes();
+}
+
+int plannerShared::bestmixend()
+{
+ return lrint(get_depth_units(prefs.bestmixend.mm, NULL, NULL));
+}
+void plannerShared::set_bestmixend(int value)
+{
+ qPrefDivePlanner::set_bestmixend(units_to_depth(value).mm);
+ CylindersModel::instance()->updateBestMixes();
+}