From 0a7e673c5f4a0268f2969a905646669850dc14e7 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Mon, 23 Dec 2019 13:04:19 +0100 Subject: [PATCH] plannerShared: add variables that reference qPrefDivePlanner These are simple pass-through functions (normally optimized away by the compiler), and serve to make a consistent backend interface which have a simpler use especially in QML. Signed-off-by: Jan Iversen Signed-off-by: Dirk Hohndel --- backend-shared/plannershared.cpp | 10 ++++++++++ backend-shared/plannershared.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/backend-shared/plannershared.cpp b/backend-shared/plannershared.cpp index bdfc7b399..d5b5156ab 100644 --- a/backend-shared/plannershared.cpp +++ b/backend-shared/plannershared.cpp @@ -150,3 +150,13 @@ void plannerShared::set_switch_at_req_stop(bool value) { DivePlannerPointsModel::instance()->setSwitchAtReqStop(value); } + +bool plannerShared::doo2breaks() +{ + return qPrefDivePlanner::doo2breaks(); +} +void plannerShared::set_doo2breaks(bool value) +{ + qPrefDivePlanner::set_doo2breaks(value); + DivePlannerPointsModel::instance()->emitDataChanged(); +} diff --git a/backend-shared/plannershared.h b/backend-shared/plannershared.h index 7e2f57184..65cb28d95 100644 --- a/backend-shared/plannershared.h +++ b/backend-shared/plannershared.h @@ -35,6 +35,7 @@ class plannerShared: public QObject { Q_PROPERTY(bool drop_stone_mode READ drop_stone_mode WRITE set_drop_stone_mode NOTIFY drop_stone_modeChanged); Q_PROPERTY(bool last_stop READ last_stop WRITE set_last_stop NOTIFY last_stopChanged); Q_PROPERTY(bool switch_at_req_stop READ switch_at_req_stop WRITE set_switch_at_req_stop NOTIFY switch_at_req_stopChanged); + Q_PROPERTY(bool doo2breaks READ doo2breaks WRITE set_doo2breaks NOTIFY doo2breaksChanged); public: static plannerShared *instance(); @@ -57,6 +58,7 @@ public: static bool drop_stone_mode(); static bool last_stop(); static bool switch_at_req_stop(); + static bool doo2breaks(); public slots: // Ascend/Descend data, converted to meter/feet depending on user selection @@ -77,6 +79,7 @@ public slots: static void set_drop_stone_mode(bool value); static void set_last_stop(bool value); static void set_switch_at_req_stop(bool value); + static void set_doo2breaks(bool value); signals: // Ascend/Descend data, converted to meter/feet depending on user selection @@ -97,6 +100,7 @@ signals: void drop_stone_modeChanged(bool value); void last_stopChanged(bool value); void switch_at_req_stopChanged(bool value); + void doo2breaksChanged(bool value); private: plannerShared() {}