aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend-shared/plannershared.cpp11
-rw-r--r--backend-shared/plannershared.h4
-rw-r--r--desktop-widgets/diveplanner.cpp4
-rw-r--r--mobile-widgets/qmlinterface.h4
4 files changed, 21 insertions, 2 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);
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index f236ec205..70aaa22e0 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -443,7 +443,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop);
ui.min_switch_duration->setValue(plannerShared::min_switch_duration());
- ui.surface_segment->setValue(prefs.surface_segment / 60);
+ ui.surface_segment->setValue(plannerShared::surface_segment());
ui.recreational_deco->setChecked(prefs.planner_deco_mode == RECREATIONAL);
ui.buehlmann_deco->setChecked(prefs.planner_deco_mode == BUEHLMANN);
ui.vpmb_deco->setChecked(prefs.planner_deco_mode == VPMB);
@@ -481,7 +481,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.o2narcotic, &QAbstractButton::toggled, plannerShared::instance(), &plannerShared::set_o2narcotic);
connect(ui.switch_at_req_stop, &QAbstractButton::toggled, plannerModel, &DivePlannerPointsModel::setSwitchAtReqStop);
connect(ui.min_switch_duration, QOverload<int>::of(&QSpinBox::valueChanged), plannerShared::instance(), &plannerShared::set_min_switch_duration);
- connect(ui.surface_segment, QOverload<int>::of(&QSpinBox::valueChanged), plannerModel, &DivePlannerPointsModel::setSurfaceSegment);
+ connect(ui.surface_segment, QOverload<int>::of(&QSpinBox::valueChanged), plannerShared::instance(), plannerShared::set_surface_segment);
connect(ui.rebreathermode, QOverload<int>::of(&QComboBox::currentIndexChanged), plannerModel, &DivePlannerPointsModel::setRebreatherMode);
connect(ui.rebreathermode, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PlannerSettingsWidget::setBailoutVisibility);
diff --git a/mobile-widgets/qmlinterface.h b/mobile-widgets/qmlinterface.h
index 8f21102ba..9b032505a 100644
--- a/mobile-widgets/qmlinterface.h
+++ b/mobile-widgets/qmlinterface.h
@@ -57,6 +57,7 @@ class QMLInterface : public QObject {
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);
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);
Q_PROPERTY(int bottomsac READ bottomsac WRITE set_bottomsac NOTIFY bottomsacChanged);
Q_PROPERTY(int decosac READ decosac WRITE set_decosac NOTIFY decosacChanged);
@@ -191,6 +192,7 @@ public:
bool switch_at_req_stop() { return prefs.switch_at_req_stop; }
bool doo2breaks() { return plannerShared::doo2breaks(); }
int min_switch_duration() { return plannerShared::min_switch_duration(); }
+ int surface_segment() { return plannerShared::surface_segment(); }
int bottomsac() { return (int)plannerShared::bottomsac(); }
int decosac() { return (int)plannerShared::decosac(); }
@@ -236,6 +238,7 @@ public slots:
void set_switch_at_req_stop(bool value) { DivePlannerPointsModel::instance()->setSwitchAtReqStop(value); }
void set_doo2breaks(bool value) { plannerShared::set_doo2breaks(value); }
void set_min_switch_duration(int value) { plannerShared::set_min_switch_duration(value); }
+ void set_surface_segment(int value) { plannerShared::set_surface_segment(value); }
void set_bottomsac(int value) { plannerShared::set_bottomsac((double)value); }
void set_decosac(int value) { plannerShared::set_decosac((double)value); }
@@ -281,6 +284,7 @@ signals:
void switch_at_req_stopChanged(bool value);
void doo2breaksChanged(bool value);
void min_switch_durationChanged(int value);
+ void surface_segmentChanged(int value);
void bottomsacChanged(int value);
void decosacChanged(int value);