diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2016-08-26 16:21:42 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-08-27 11:40:45 -0700 |
commit | 8f178301d8b93f50c38cd00b7cc47a259e1fed43 (patch) | |
tree | 38befce11977f500050e162d63c1e6dd6d1854e9 /desktop-widgets | |
parent | ad7524fda156507ccfe3e736c40560e734e3dade (diff) | |
download | subsurface-8f178301d8b93f50c38cd00b7cc47a259e1fed43.tar.gz |
Settings update: Use the Settings to store the plannersettings
Instead of settings things manually in the code. (btw,
if we use lambdas the code can be quite smaller)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 84b5e9a4a..d76ef5d17 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -3,6 +3,8 @@ #include "desktop-widgets/mainwindow.h" #include "core/planner.h" #include "core/helpers.h" +#include "core/subsurface-qt/SettingsObjectWrapper.h" + #include "qt-models/cylindermodel.h" #include "qt-models/models.h" #include "profile-widget/profilewidget2.h" @@ -437,50 +439,50 @@ void PlannerSettingsWidget::printDecoPlan() void PlannerSettingsWidget::setAscRate75(int rate) { - prefs.ascrate75 = rate * UNIT_FACTOR; + SettingsObjectWrapper::instance()->planner_settings->setAscrate75(rate * UNIT_FACTOR); } void PlannerSettingsWidget::setAscRate50(int rate) { - prefs.ascrate50 = rate * UNIT_FACTOR; + SettingsObjectWrapper::instance()->planner_settings->setAscrate50(rate * UNIT_FACTOR); } void PlannerSettingsWidget::setAscRateStops(int rate) { - prefs.ascratestops = rate * UNIT_FACTOR; + SettingsObjectWrapper::instance()->planner_settings->setAscratestops(rate * UNIT_FACTOR); } void PlannerSettingsWidget::setAscRateLast6m(int rate) { - prefs.ascratelast6m = rate * UNIT_FACTOR; + SettingsObjectWrapper::instance()->planner_settings->setAscratelast6m(rate * UNIT_FACTOR); } void PlannerSettingsWidget::setDescRate(int rate) { - prefs.descrate = rate * UNIT_FACTOR; + SettingsObjectWrapper::instance()->planner_settings->setDescrate(rate * UNIT_FACTOR); } void PlannerSettingsWidget::setBottomPo2(double po2) { - prefs.bottompo2 = (int) (po2 * 1000.0); + SettingsObjectWrapper::instance()->planner_settings->setBottompo2((int) (po2 * 1000.0)); } void PlannerSettingsWidget::setDecoPo2(double po2) { pressure_t olddecopo2; olddecopo2.mbar = prefs.decopo2; - prefs.decopo2 = (int) (po2 * 1000.0); + SettingsObjectWrapper::instance()->planner_settings->setDecopo2((int) (po2 * 1000.0)); CylindersModel::instance()->updateDecoDepths(olddecopo2); } void PlannerSettingsWidget::setBestmixEND(int depth) { - prefs.bestmixend.mm = units_to_depth(depth); + SettingsObjectWrapper::instance()->planner_settings->setBestmixend(units_to_depth(depth)); } void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks) { - prefs.doo2breaks = dobreaks; + SettingsObjectWrapper::instance()->planner_settings->setDoo2breaks(dobreaks); plannerModel->emitDataChanged(); } |