diff options
author | jan Iversen <jan@casacondor.com> | 2020-01-10 22:51:28 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-01-25 17:13:20 -0800 |
commit | ff360d28f5a8f95a0a8186ca601f8eb38c1192bf (patch) | |
tree | 2e5ee36952cef1d640d812d5ed3f2cf9b099b74a /backend-shared | |
parent | 995340b68a71c70e5de3c421ddfe69e81cacaf36 (diff) | |
download | subsurface-ff360d28f5a8f95a0a8186ca601f8eb38c1192bf.tar.gz |
diveplanner: add surface_segment to plannershared
Add surface_segment to plannerShared and then
update desktop-widgets.
Signed-off-by: jan Iversen <jan@casacondor.com>
desktop-widgets: use plannerShared for surface_segment
Change getter/setter for surface_segment to plannerShared, in
order to share the conversion with mobile diveplanner
Signed-off-by: jan Iversen <jan@casacondor.com>
Diffstat (limited to 'backend-shared')
-rw-r--r-- | backend-shared/plannershared.cpp | 11 | ||||
-rw-r--r-- | backend-shared/plannershared.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/backend-shared/plannershared.cpp b/backend-shared/plannershared.cpp index b39aa556c..9c2305e42 100644 --- a/backend-shared/plannershared.cpp +++ b/backend-shared/plannershared.cpp @@ -61,6 +61,17 @@ void plannerShared::set_min_switch_duration(int value) DivePlannerPointsModel::instance()->setMinSwitchDuration(value); } +int plannerShared::surface_segment() +{ + return qPrefDivePlanner::surface_segment() / 60; +} +void plannerShared::set_surface_segment(int value) +{ + // NO conversion, this is done in the planner model. + DivePlannerPointsModel::instance()->setSurfaceSegment(value); + emit instance()->surface_segmentChanged(surface_segment()); +} + double plannerShared::bottomsac() { return (qPrefUnits::volume() == units::LITER) ? diff --git a/backend-shared/plannershared.h b/backend-shared/plannershared.h index fb8f0916f..912c09b9b 100644 --- a/backend-shared/plannershared.h +++ b/backend-shared/plannershared.h @@ -21,6 +21,7 @@ class plannerShared: public QObject { Q_PROPERTY(bool dobailout READ dobailout WRITE set_dobailout NOTIFY dobailoutChanged); Q_PROPERTY(bool doo2breaks READ doo2breaks WRITE set_doo2breaks NOTIFY doo2breaksChanged); Q_PROPERTY(int min_switch_duration READ min_switch_duration WRITE set_min_switch_duration NOTIFY min_switch_durationChanged); + Q_PROPERTY(int surface_segment READ surface_segment WRITE set_surface_segment NOTIFY surface_segmentChanged); // Gas data Q_PROPERTY(double bottomsac READ bottomsac WRITE set_bottomsac NOTIFY bottomsacChanged); @@ -40,6 +41,7 @@ public: static bool dobailout(); static bool doo2breaks(); static int min_switch_duration(); + static int surface_segment(); // Gas data static double bottomsac(); @@ -58,6 +60,7 @@ public slots: static void set_dobailout(bool value); static void set_doo2breaks(bool value); static void set_min_switch_duration(int value); + static void set_surface_segment(int value); // Gas data static void set_bottomsac(double value); @@ -75,6 +78,7 @@ signals: void dobailoutChanged(bool value); void doo2breaksChanged(bool value); void min_switch_durationChanged(int value); + void surface_segmentChanged(int value); // Gas data void bottomsacChanged(double value); |