Mobile: Fix Configuration of Ceiling Display.

Fix the configuration of the deco ceilings in the mobile version:
- make the settings work;
- remove reading of the dive computer ceiling from git;
- hide the gradient factor in the profile when the calculated ceiling is
  not shown;
- when the calculated ceiling is disabled in the settings, disable
  editing of the gradient factor.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-02-05 01:20:50 +13:00
parent 2036c68972
commit df1974a244
7 changed files with 14 additions and 9 deletions

View file

@ -1,4 +1,5 @@
desktop: add a button linking to the 'Contribute' page
mobile: fix configuration of decompression ceiling and gradient factors
desktop: fix gas switches in UDDF exports
core: allow of up to 6 O2 sensors (and corresponding voting logic)
desktop: add divemode as a possible dive list column

View file

@ -3048,8 +3048,6 @@ void set_git_prefs(const char *prefs)
{
if (strstr(prefs, "TANKBAR"))
git_prefs.tankbar = 1;
if (strstr(prefs, "DCCEILING"))
git_prefs.dcceiling = 1;
if (strstr(prefs, "SHOW_SETPOINT"))
git_prefs.show_ccr_setpoint = 1;
if (strstr(prefs, "SHOW_SENSORS"))

View file

@ -121,6 +121,8 @@ extern struct divecomputer *get_dive_dc(struct dive *dive, int nr);
extern const struct divecomputer *get_dive_dc_const(const struct dive *dive, int nr);
extern timestamp_t dive_endtime(const struct dive *dive);
extern void set_git_prefs(const char *prefs);
extern struct dive *make_first_dc(const struct dive *d, int dc_number);
extern struct dive *clone_delete_divecomputer(const struct dive *d, int dc_number);
void split_divecomputer(const struct dive *src, int num, struct dive **out1, struct dive **out2);

View file

@ -227,7 +227,6 @@ extern void subsurface_OS_pref_setup();
extern void copy_prefs(struct preferences *src, struct preferences *dest);
extern void set_informational_units(const char *units);
extern void set_git_prefs(const char *prefs);
#ifdef __cplusplus
}

View file

@ -628,9 +628,11 @@ TemplatePage {
}
}
TemplateLabel {
enabled: PrefTechnicalDetails.calcceiling
text: qsTr("GFLow")
}
TemplateSpinBox {
enabled: PrefTechnicalDetails.calcceiling
id: gfLow
from: 10
to: 150
@ -645,9 +647,11 @@ TemplatePage {
}
}
TemplateLabel {
enabled: PrefTechnicalDetails.calcceiling
text: qsTr("GFHigh")
}
TemplateSpinBox {
enabled: PrefTechnicalDetails.calcceiling
id: gfHigh
from: 10
to: 150

View file

@ -405,7 +405,6 @@ void QMLManager::openLocalThenRemote(QString url)
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_VERIFIED);
qPrefUnits::set_unit_system(git_prefs.unit_system);
qPrefTechnicalDetails::set_tankbar(git_prefs.tankbar);
qPrefTechnicalDetails::set_dcceiling(git_prefs.dcceiling);
qPrefTechnicalDetails::set_show_ccr_setpoint(git_prefs.show_ccr_setpoint);
qPrefTechnicalDetails::set_show_ccr_sensors(git_prefs.show_ccr_sensors);
qPrefPartialPressureGas::set_po2(git_prefs.pp_graphs.po2);
@ -878,7 +877,6 @@ void QMLManager::consumeFinishedLoad()
git_prefs.units = SI_units;
prefs.units = git_prefs.units;
prefs.tankbar = git_prefs.tankbar;
prefs.dcceiling = git_prefs.dcceiling;
prefs.show_ccr_setpoint = git_prefs.show_ccr_setpoint;
prefs.show_ccr_sensors = git_prefs.show_ccr_sensors;
prefs.pp_graphs.po2 = git_prefs.pp_graphs.po2;

View file

@ -218,6 +218,11 @@ void ProfileScene::updateVisibility(bool diveHasHeartBeat, bool simplified)
return;
bool ppGraphs = ppGraphsEnabled(currentdc, simplified);
diveCeiling->setVisible(prefs.calcceiling);
for (DiveCalculatedTissue *tissue: allTissues)
tissue->setVisible(prefs.calcalltissues && prefs.calcceiling);
reportedCeiling->setVisible(prefs.dcceiling);
if (simplified) {
pn2GasItem->setVisible(false);
po2GasItem->setVisible(ppGraphs);
@ -231,6 +236,8 @@ void ProfileScene::updateVisibility(bool diveHasHeartBeat, bool simplified)
ccrsensor2GasItem->setVisible(ppGraphs && prefs.show_ccr_sensors && (currentdc->no_o2sensors > 1));
ccrsensor3GasItem->setVisible(ppGraphs && prefs.show_ccr_sensors && (currentdc->no_o2sensors > 1));
ocpo2GasItem->setVisible((currentdc->divemode == PSCR) && prefs.show_scr_ocpo2);
// No point to show the gradient factor if we're not showing the calculated ceiling that is derived from it
decoModelParameters->setVisible(prefs.calcceiling);
} else {
pn2GasItem->setVisible(prefs.pp_graphs.pn2);
po2GasItem->setVisible(prefs.pp_graphs.po2);
@ -246,15 +253,11 @@ void ProfileScene::updateVisibility(bool diveHasHeartBeat, bool simplified)
heartBeatItem->setVisible(prefs.hrgraph && diveHasHeartBeat);
diveCeiling->setVisible(prefs.calcceiling);
decoModelParameters->setVisible(prefs.decoinfo);
for (DiveCalculatedTissue *tissue: allTissues)
tissue->setVisible(prefs.calcalltissues && prefs.calcceiling);
percentageItem->setVisible(prefs.percentagegraph);
meanDepthItem->setVisible(prefs.show_average_depth);
reportedCeiling->setVisible(prefs.dcceiling);
tankItem->setVisible(prefs.tankbar);
temperatureItem->setVisible(true);
}