diff options
-rw-r--r-- | core/dive.c | 39 | ||||
-rw-r--r-- | core/load-git.c | 2 | ||||
-rw-r--r-- | core/pref.h | 2 | ||||
-rw-r--r-- | core/save-git.c | 6 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 16 |
5 files changed, 39 insertions, 26 deletions
diff --git a/core/dive.c b/core/dive.c index 38ed10761..ec6d66e92 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3406,38 +3406,39 @@ void set_userid(char *rUserId) void set_informational_units(char *units) { if (strstr(units, "METRIC")) { - informational_prefs.unit_system = METRIC; + git_prefs.unit_system = METRIC; } else if (strstr(units, "IMPERIAL")) { - informational_prefs.unit_system = IMPERIAL; + git_prefs.unit_system = IMPERIAL; } else if (strstr(units, "PERSONALIZE")) { - informational_prefs.unit_system = PERSONALIZE; + git_prefs.unit_system = PERSONALIZE; if (strstr(units, "METERS")) - informational_prefs.units.length = METERS; + git_prefs.units.length = METERS; if (strstr(units, "FEET")) - informational_prefs.units.length = FEET; + git_prefs.units.length = FEET; if (strstr(units, "LITER")) - informational_prefs.units.volume = LITER; + git_prefs.units.volume = LITER; if (strstr(units, "CUFT")) - informational_prefs.units.volume = CUFT; + git_prefs.units.volume = CUFT; if (strstr(units, "BAR")) - informational_prefs.units.pressure = BAR; + git_prefs.units.pressure = BAR; if (strstr(units, "PSI")) - informational_prefs.units.pressure = PSI; + git_prefs.units.pressure = PSI; if (strstr(units, "PASCAL")) - informational_prefs.units.pressure = PASCAL; + git_prefs.units.pressure = PASCAL; if (strstr(units, "CELSIUS")) - informational_prefs.units.temperature = CELSIUS; + git_prefs.units.temperature = CELSIUS; if (strstr(units, "FAHRENHEIT")) - informational_prefs.units.temperature = FAHRENHEIT; + git_prefs.units.temperature = FAHRENHEIT; if (strstr(units, "KG")) - informational_prefs.units.weight = KG; + git_prefs.units.weight = KG; if (strstr(units, "LBS")) - informational_prefs.units.weight = LBS; + git_prefs.units.weight = LBS; if (strstr(units, "SECONDS")) - informational_prefs.units.vertical_speed_time = SECONDS; + git_prefs.units.vertical_speed_time = SECONDS; if (strstr(units, "MINUTES")) - informational_prefs.units.vertical_speed_time = MINUTES; + git_prefs.units.vertical_speed_time = MINUTES; } + } void set_git_prefs(char *prefs) @@ -3446,6 +3447,12 @@ void set_git_prefs(char *prefs) 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")) + git_prefs.show_ccr_sensors = 1; + if (strstr(prefs, "PO2_GRAPH")) + git_prefs.pp_graphs.po2 = 1; } void average_max_depth(struct diveplan *dive, int *avg_depth, int *max_depth) diff --git a/core/load-git.c b/core/load-git.c index 2b5163b70..d2379e8d4 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -996,7 +996,7 @@ static void trip_parser(char *line, struct membuffer *str, void *_trip) static struct keyword_action settings_action[] = { #undef D #define D(x) { #x, parse_settings_ ## x } - D(autogroup), D(divecomputerid), D(subsurface), D(prefs), D(units), D(userid), D(version) + D(autogroup), D(divecomputerid), D(prefs), D(subsurface), D(units), D(userid), D(version) }; static void settings_parser(char *line, struct membuffer *str, void *_unused) diff --git a/core/pref.h b/core/pref.h index d2df7a8f3..1360fba14 100644 --- a/core/pref.h +++ b/core/pref.h @@ -173,7 +173,7 @@ enum cloud_status { CS_VERIFIED }; -extern struct preferences prefs, default_prefs, informational_prefs, git_prefs; +extern struct preferences prefs, default_prefs, git_prefs; #define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe) diff --git a/core/save-git.c b/core/save-git.c index 0d5a2c74d..d0ae790fa 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -865,6 +865,12 @@ static void save_settings(git_repository *repo, struct dir *tree) put_string(&b, "prefs TANKBAR\n"); if (prefs.dcceiling) put_string(&b, "prefs DCCEILING\n"); + if (prefs.show_ccr_setpoint) + put_string(&b, "prefs SHOW_SETPOINT\n"); + if (prefs.show_ccr_sensors) + put_string(&b, "prefs SHOW_SENSORS\n"); + if (prefs.pp_graphs.po2) + put_string(&b, "prefs PO2_GRAPH\n"); blob_insert(repo, tree, &b, "00-Subsurface"); } diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 422320fdc..a2a635a1b 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -151,10 +151,10 @@ void QMLManager::openLocalThenRemote(QString url) // if we can load from the cache, we know that we have at least a valid email if (credentialStatus() == UNKNOWN) setCredentialStatus(VALID_EMAIL); - prefs.unit_system = informational_prefs.unit_system; - if (informational_prefs.unit_system == IMPERIAL) - informational_prefs.units = IMPERIAL_units; - prefs.units = informational_prefs.units; + prefs.unit_system = git_prefs.unit_system; + if (git_prefs.unit_system == IMPERIAL) + git_prefs.units = IMPERIAL_units; + prefs.units = git_prefs.units; prefs.tankbar = git_prefs.tankbar; prefs.dcceiling = git_prefs.dcceiling; process_dives(false, false); @@ -538,10 +538,10 @@ void QMLManager::revertToNoCloudIfNeeded() void QMLManager::consumeFinishedLoad(timestamp_t currentDiveTimestamp) { - prefs.unit_system = informational_prefs.unit_system; - if (informational_prefs.unit_system == IMPERIAL) - informational_prefs.units = IMPERIAL_units; - prefs.units = informational_prefs.units; + prefs.unit_system = git_prefs.unit_system; + if (git_prefs.unit_system == IMPERIAL) + git_prefs.units = IMPERIAL_units; + prefs.units = git_prefs.units; prefs.tankbar = git_prefs.tankbar; prefs.dcceiling = git_prefs.dcceiling; DiveListModel::instance()->clear(); |