diff options
author | jan Iversen <jan@casacondor.com> | 2019-12-12 20:39:38 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-24 06:30:57 +0900 |
commit | dc713000ffe7dd47fe9c989d5ddc41574b3be1c3 (patch) | |
tree | fd14b2de41492d05f3471634c5bc615000a6ce2c /desktop-widgets/diveplanner.cpp | |
parent | f291e5e2d8bed582be989b22ae5ff8635db5f28f (diff) | |
download | subsurface-dc713000ffe7dd47fe9c989d5ddc41574b3be1c3.tar.gz |
desktop-widgets: use share meter/feet funcs. in diveplanner
change the settings variables using UNIT_FACTOR to use
plannerShared instead.
There are no changed functionality, it is simply removing calculations
from the UI.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Diffstat (limited to 'desktop-widgets/diveplanner.cpp')
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index aac81c81e..c471c0496 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -7,6 +7,7 @@ #include "core/units.h" #include "core/settings/qPrefDivePlanner.h" #include "core/gettextfromc.h" +#include "core/plannershared.h" #include "qt-models/cylindermodel.h" #include "qt-models/models.h" @@ -23,8 +24,6 @@ #define MAX_DEPTH M_OR_FT(150, 450) #define MIN_DEPTH M_OR_FT(20, 60) -#define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0) - static DivePlannerPointsModel* plannerModel = DivePlannerPointsModel::instance(); DiveHandler::DiveHandler() : QGraphicsEllipseItem() @@ -543,11 +542,11 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) void PlannerSettingsWidget::updateUnitsUI() { - ui.ascRate75->setValue(lrint(prefs.ascrate75 / UNIT_FACTOR)); - ui.ascRate50->setValue(lrint(prefs.ascrate50 / UNIT_FACTOR)); - ui.ascRateStops->setValue(lrint(prefs.ascratestops / UNIT_FACTOR)); - ui.ascRateLast6m->setValue(lrint(prefs.ascratelast6m / UNIT_FACTOR)); - ui.descRate->setValue(lrint(prefs.descrate / UNIT_FACTOR)); + ui.ascRate75->setValue(plannerShared::ascrate75()); + ui.ascRate50->setValue(plannerShared::ascrate50()); + ui.ascRateStops->setValue(plannerShared::ascratestops()); + ui.ascRateLast6m->setValue(plannerShared::ascratelast6m()); + ui.descRate->setValue(lrint(plannerShared::descrate())); ui.bestmixEND->setValue(lrint(get_depth_units(prefs.bestmixend.mm, NULL, NULL))); } @@ -621,27 +620,27 @@ void PlannerSettingsWidget::printDecoPlan() void PlannerSettingsWidget::setAscrate75(int rate) { - qPrefDivePlanner::instance()->set_ascrate75(lrint(rate * UNIT_FACTOR)); + plannerShared::set_ascrate75(rate); } void PlannerSettingsWidget::setAscrate50(int rate) { - qPrefDivePlanner::instance()->set_ascrate50(lrint(rate * UNIT_FACTOR)); + plannerShared::set_ascrate50(rate); } void PlannerSettingsWidget::setAscratestops(int rate) { - qPrefDivePlanner::instance()->set_ascratestops(lrint(rate * UNIT_FACTOR)); + plannerShared::set_ascratestops(rate); } void PlannerSettingsWidget::setAscratelast6m(int rate) { - qPrefDivePlanner::instance()->set_ascratelast6m(lrint(rate * UNIT_FACTOR)); + plannerShared::set_ascratelast6m(rate); } void PlannerSettingsWidget::setDescrate(int rate) { - qPrefDivePlanner::instance()->set_descrate(lrint(rate * UNIT_FACTOR)); + plannerShared::set_descrate(rate); } void PlannerSettingsWidget::sacFactorChanged(const double factor) |