summaryrefslogtreecommitdiffstats
path: root/qt-models/diveplannermodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/diveplannermodel.cpp')
-rw-r--r--qt-models/diveplannermodel.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 4c60e6736..482647575 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -10,6 +10,8 @@
#include <QApplication>
#include <QTextDocument>
+#define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0)
+
/* TODO: Port this to CleanerTableModel to remove a bit of boilerplate and
* use the signal warningMessage() to communicate errors to the MainWindow.
*/
@@ -494,6 +496,41 @@ void DivePlannerPointsModel::setLastStop6m(bool value)
emitDataChanged();
}
+void DivePlannerPointsModel::setAscrate75(int rate)
+{
+ auto planner = SettingsObjectWrapper::instance()->planner_settings;
+ planner->setAscrate75(lrint(rate * UNIT_FACTOR));
+ emitDataChanged();
+}
+
+void DivePlannerPointsModel::setAscrate50(int rate)
+{
+ auto planner = SettingsObjectWrapper::instance()->planner_settings;
+ planner->setAscrate50(lrint(rate * UNIT_FACTOR));
+ emitDataChanged();
+}
+
+void DivePlannerPointsModel::setAscratestops(int rate)
+{
+ auto planner = SettingsObjectWrapper::instance()->planner_settings;
+ planner->setAscratestops(lrint(rate * UNIT_FACTOR));
+ emitDataChanged();
+}
+
+void DivePlannerPointsModel::setAscratelast6m(int rate)
+{
+ auto planner = SettingsObjectWrapper::instance()->planner_settings;
+ planner->setAscratelast6m(lrint(rate * UNIT_FACTOR));
+ emitDataChanged();
+}
+
+void DivePlannerPointsModel::setDescrate(int rate)
+{
+ auto planner = SettingsObjectWrapper::instance()->planner_settings;
+ planner->setDescrate(lrint(rate * UNIT_FACTOR));
+ emitDataChanged();
+}
+
void DivePlannerPointsModel::setVerbatim(bool value)
{
auto planner = SettingsObjectWrapper::instance()->planner_settings;