Rename prefs.deco_mode to prefs.planner_deco_mode

This is to avoid confusion with planner.display_deco_mode.
When accessing the "current deco mode" use the decoMode()
helper function.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-01-07 03:11:19 +01:00 committed by Subsurface
parent bb4bf639c3
commit 935734100f
7 changed files with 20 additions and 20 deletions

View file

@ -143,7 +143,7 @@ struct preferences {
short cloud_verification_status; short cloud_verification_status;
bool cloud_background_sync; bool cloud_background_sync;
geocoding_prefs_t geocoding; geocoding_prefs_t geocoding;
enum deco_mode deco_mode; enum deco_mode planner_deco_mode;
short vpmb_conservatism; short vpmb_conservatism;
int time_threshold; int time_threshold;
int distance_threshold; int distance_threshold;

View file

@ -1439,7 +1439,7 @@ extern "C" bool in_planner()
extern "C" enum deco_mode decoMode() extern "C" enum deco_mode decoMode()
{ {
return in_planner() ? prefs.deco_mode : prefs.display_deco_mode; return in_planner() ? prefs.planner_deco_mode : prefs.display_deco_mode;
} }
void init_proxy() void init_proxy()

View file

@ -319,7 +319,7 @@ bool TechnicalDetailsSettings::calcndltts() const
bool TechnicalDetailsSettings::buehlmann() const bool TechnicalDetailsSettings::buehlmann() const
{ {
return (prefs.deco_mode == BUEHLMANN); return (prefs.planner_deco_mode == BUEHLMANN);
} }
int TechnicalDetailsSettings::gflow() const int TechnicalDetailsSettings::gflow() const
@ -524,12 +524,12 @@ void TechnicalDetailsSettings::setCalcndltts(bool value)
void TechnicalDetailsSettings::setBuehlmann(bool value) void TechnicalDetailsSettings::setBuehlmann(bool value)
{ {
if (value == (prefs.deco_mode == BUEHLMANN)) if (value == (prefs.planner_deco_mode == BUEHLMANN))
return; return;
QSettings s; QSettings s;
s.beginGroup(group); s.beginGroup(group);
s.setValue("buehlmann", value); s.setValue("buehlmann", value);
prefs.deco_mode = value ? BUEHLMANN : VPMB; prefs.planner_deco_mode = value ? BUEHLMANN : VPMB;
emit buehlmannChanged(value); emit buehlmannChanged(value);
} }
@ -1277,7 +1277,7 @@ int DivePlannerSettings::decoSac() const
deco_mode DivePlannerSettings::decoMode() const deco_mode DivePlannerSettings::decoMode() const
{ {
return prefs.deco_mode; return prefs.planner_deco_mode;
} }
void DivePlannerSettings::setLastStop(bool value) void DivePlannerSettings::setLastStop(bool value)
@ -1527,13 +1527,13 @@ void DivePlannerSettings::setDecoSac(int value)
void DivePlannerSettings::setDecoMode(deco_mode value) void DivePlannerSettings::setDecoMode(deco_mode value)
{ {
if (value == prefs.deco_mode) if (value == prefs.planner_deco_mode)
return; return;
QSettings s; QSettings s;
s.beginGroup(group); s.beginGroup(group);
s.setValue("deco_mode", value); s.setValue("deco_mode", value);
prefs.deco_mode = value; prefs.planner_deco_mode = value;
emit decoModeChanged(value); emit decoModeChanged(value);
} }
@ -2286,7 +2286,7 @@ void SettingsObjectWrapper::load()
GET_INT("bottomsac", bottomsac); GET_INT("bottomsac", bottomsac);
GET_INT("decosac", decosac); GET_INT("decosac", decosac);
prefs.deco_mode = deco_mode(s.value("deco_mode", default_prefs.deco_mode).toInt()); prefs.planner_deco_mode = deco_mode(s.value("deco_mode", default_prefs.planner_deco_mode).toInt());
s.endGroup(); s.endGroup();
s.beginGroup("DiveComputer"); s.beginGroup("DiveComputer");
@ -2340,7 +2340,7 @@ void SettingsObjectWrapper::sync()
s.setValue("min_switch_duration", prefs.min_switch_duration); s.setValue("min_switch_duration", prefs.min_switch_duration);
s.setValue("bottomsac", prefs.bottomsac); s.setValue("bottomsac", prefs.bottomsac);
s.setValue("decosac", prefs.decosac); s.setValue("decosac", prefs.decosac);
s.setValue("deco_mode", int(prefs.deco_mode)); s.setValue("deco_mode", int(prefs.planner_deco_mode));
s.endGroup(); s.endGroup();
} }

View file

@ -86,7 +86,7 @@ struct preferences default_prefs = {
.locale = { .locale = {
.use_system_language = true, .use_system_language = true,
}, },
.deco_mode = BUEHLMANN, .planner_deco_mode = BUEHLMANN,
.vpmb_conservatism = 3, .vpmb_conservatism = 3,
.distance_threshold = 1000, .distance_threshold = 1000,
.time_threshold = 600, .time_threshold = 600,

View file

@ -303,10 +303,10 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.drop_stone_mode->setChecked(prefs.drop_stone_mode); ui.drop_stone_mode->setChecked(prefs.drop_stone_mode);
ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop); ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop);
ui.min_switch_duration->setValue(prefs.min_switch_duration / 60); ui.min_switch_duration->setValue(prefs.min_switch_duration / 60);
ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL); ui.recreational_deco->setChecked(prefs.planner_deco_mode == RECREATIONAL);
ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN); ui.buehlmann_deco->setChecked(prefs.planner_deco_mode == BUEHLMANN);
ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB); ui.vpmb_deco->setChecked(prefs.planner_deco_mode == VPMB);
disableDecoElements((int) prefs.deco_mode); disableDecoElements((int) prefs.planner_deco_mode);
// should be the same order as in dive_comp_type! // should be the same order as in dive_comp_type!
rebreather_modes << tr("Open circuit") << tr("CCR") << tr("pSCR"); rebreather_modes << tr("Open circuit") << tr("CCR") << tr("pSCR");

View file

@ -485,8 +485,8 @@ void DivePlannerPointsModel::setDisplayTransitions(bool value)
void DivePlannerPointsModel::setDecoMode(int mode) void DivePlannerPointsModel::setDecoMode(int mode)
{ {
prefs.deco_mode = deco_mode(mode); prefs.planner_deco_mode = deco_mode(mode);
emit recreationChanged(mode == int(prefs.deco_mode)); emit recreationChanged(mode == int(prefs.planner_deco_mode));
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1)); emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
} }

View file

@ -32,7 +32,7 @@ void setupPrefsVpmb()
prefs.ascratelast6m = prefs.ascrate50; prefs.ascratelast6m = prefs.ascrate50;
prefs.descrate = 99000 / 60; prefs.descrate = 99000 / 60;
prefs.last_stop = false; prefs.last_stop = false;
prefs.deco_mode = VPMB; prefs.planner_deco_mode = VPMB;
prefs.vpmb_conservatism = 0; prefs.vpmb_conservatism = 0;
} }
@ -284,7 +284,7 @@ void TestPlan::testMetric()
setupPrefs(); setupPrefs();
prefs.unit_system = METRIC; prefs.unit_system = METRIC;
prefs.units.length = units::METERS; prefs.units.length = units::METERS;
prefs.deco_mode = BUEHLMANN; prefs.planner_deco_mode = BUEHLMANN;
struct diveplan testPlan = {}; struct diveplan testPlan = {};
setupPlan(&testPlan); setupPlan(&testPlan);
@ -320,7 +320,7 @@ void TestPlan::testImperial()
setupPrefs(); setupPrefs();
prefs.unit_system = IMPERIAL; prefs.unit_system = IMPERIAL;
prefs.units.length = units::FEET; prefs.units.length = units::FEET;
prefs.deco_mode = BUEHLMANN; prefs.planner_deco_mode = BUEHLMANN;
struct diveplan testPlan = {}; struct diveplan testPlan = {};
setupPlan(&testPlan); setupPlan(&testPlan);