aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-01 21:41:42 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2018-08-08 14:29:50 +0200
commit21243ec4f7e2b2d886ac550142afee4c0df65924 (patch)
tree684a092f482e478f2e586a996d4c967a0fe90779 /qt-models
parent357510b9cd1eec9fdd598ebd6103f62f30e29807 (diff)
downloadsubsurface-21243ec4f7e2b2d886ac550142afee4c0df65924.tar.gz
core: activate qPrefDivePlanner
remove DivePlanner from SettingsObjectWrapper and reference qPrefDivePlanner update files using SettingsObjectWrapper/DivePlanner to use qPrefDivePlanner this activated qPrefDivePlanner and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplannermodel.cpp66
1 files changed, 23 insertions, 43 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 52c87071e..c26cac76a 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -427,30 +427,26 @@ void DivePlannerPointsModel::emitDataChanged()
void DivePlannerPointsModel::setBottomSac(double sac)
{
diveplan.bottomsac = units_to_sac(sac);
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setBottomSac(diveplan.bottomsac);
+ qPrefDivePlanner::instance()->set_bottomsac(diveplan.bottomsac);
emitDataChanged();
}
void DivePlannerPointsModel::setDecoSac(double sac)
{
diveplan.decosac = units_to_sac(sac);
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDecoSac(diveplan.decosac);
+ qPrefDivePlanner::instance()->set_decosac(diveplan.decosac);
emitDataChanged();
}
void DivePlannerPointsModel::setSacFactor(double factor)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setSacFactor((int) round(factor * 100));
+ qPrefDivePlanner::instance()->set_sacfactor((int) round(factor * 100));
emitDataChanged();
}
void DivePlannerPointsModel::setProblemSolvingTime(int minutes)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setProblemSolvingTime(minutes);
+ qPrefDivePlanner::instance()->set_problemsolvingtime(minutes);
emitDataChanged();
}
@@ -508,110 +504,96 @@ int DivePlannerPointsModel::getSurfacePressure()
void DivePlannerPointsModel::setLastStop6m(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setLastStop(value);
+ qPrefDivePlanner::instance()->set_last_stop(value);
emitDataChanged();
}
void DivePlannerPointsModel::setAscrate75(int rate)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setAscrate75(lrint(rate * UNIT_FACTOR));
+ qPrefDivePlanner::instance()->set_ascrate75(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
void DivePlannerPointsModel::setAscrate50(int rate)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setAscrate50(lrint(rate * UNIT_FACTOR));
+ qPrefDivePlanner::instance()->set_ascrate50(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
void DivePlannerPointsModel::setAscratestops(int rate)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setAscratestops(lrint(rate * UNIT_FACTOR));
+ qPrefDivePlanner::instance()->set_ascratestops(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
void DivePlannerPointsModel::setAscratelast6m(int rate)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setAscratelast6m(lrint(rate * UNIT_FACTOR));
+ qPrefDivePlanner::instance()->set_ascratelast6m(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
void DivePlannerPointsModel::setDescrate(int rate)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDescrate(lrint(rate * UNIT_FACTOR));
+ qPrefDivePlanner::instance()->set_descrate(lrint(rate * UNIT_FACTOR));
emitDataChanged();
}
void DivePlannerPointsModel::setVerbatim(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setVerbatimPlan(value);
+ qPrefDivePlanner::instance()->set_verbatim_plan(value);
emitDataChanged();
}
void DivePlannerPointsModel::setDisplayRuntime(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDisplayRuntime(value);
+ qPrefDivePlanner::instance()->set_display_runtime(value);
emitDataChanged();
}
void DivePlannerPointsModel::setDisplayDuration(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDisplayDuration(value);
+ qPrefDivePlanner::instance()->set_display_duration(value);
emitDataChanged();
}
void DivePlannerPointsModel::setDisplayTransitions(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDisplayTransitions(value);
+ qPrefDivePlanner::instance()->set_display_transitions(value);
emitDataChanged();
}
void DivePlannerPointsModel::setDisplayVariations(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDisplayVariations(value);
+ qPrefDivePlanner::instance()->set_display_variations(value);
emitDataChanged();
}
void DivePlannerPointsModel::setDecoMode(int mode)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDecoMode(deco_mode(mode));
+ qPrefDivePlanner::instance()->set_planner_deco_mode(deco_mode(mode));
emit recreationChanged(mode == int(prefs.planner_deco_mode));
emitDataChanged();
}
void DivePlannerPointsModel::setSafetyStop(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setSafetyStop(value);
+ qPrefDivePlanner::instance()->set_safetystop(value);
emitDataChanged();
}
void DivePlannerPointsModel::setReserveGas(int reserve)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
+ auto planner = qPrefDivePlanner::instance();
if (prefs.units.pressure == units::BAR)
- planner->setReserveGas(reserve * 1000);
+ planner->set_reserve_gas(reserve * 1000);
else
- planner->setReserveGas(psi_to_mbar(reserve));
+ planner->set_reserve_gas(psi_to_mbar(reserve));
emitDataChanged();
}
void DivePlannerPointsModel::setDropStoneMode(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setDropStoneMode(value);
+ qPrefDivePlanner::instance()->set_drop_stone_mode(value);
if (prefs.drop_stone_mode) {
/* Remove the first entry if we enable drop_stone_mode */
if (rowCount() >= 2) {
@@ -633,15 +615,13 @@ void DivePlannerPointsModel::setDropStoneMode(bool value)
void DivePlannerPointsModel::setSwitchAtReqStop(bool value)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setSwitchAtRequiredStop(value);
+ qPrefDivePlanner::instance()->set_switch_at_req_stop(value);
emitDataChanged();
}
void DivePlannerPointsModel::setMinSwitchDuration(int duration)
{
- auto planner = SettingsObjectWrapper::instance()->planner_settings;
- planner->setMinSwitchDuration(duration * 60);
+ qPrefDivePlanner::instance()->set_min_switch_duration(duration * 60);
emitDataChanged();
}