mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Handle notes in replan
Upon replanning a dive, we want to delete the old dive plan in the notes and replace it with the actual. This fixes a problem when we failed to detect the old plan due to the deco model name appearing in the disclaimer that was used as a marker for the notes. This patch also adds translation markers for the deco model name strings.. Fixes #285 Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
622ab2286a
commit
eefa390e5f
3 changed files with 6 additions and 6 deletions
|
|
@ -41,7 +41,7 @@ extern void reset_regression();
|
||||||
|
|
||||||
pressure_t first_ceiling_pressure, max_bottom_ceiling_pressure = {};
|
pressure_t first_ceiling_pressure, max_bottom_ceiling_pressure = {};
|
||||||
|
|
||||||
const char *disclaimer;
|
char *disclaimer;
|
||||||
int plot_depth = 0;
|
int plot_depth = 0;
|
||||||
#if DEBUG_PLAN
|
#if DEBUG_PLAN
|
||||||
void dump_plan(struct diveplan *diveplan)
|
void dump_plan(struct diveplan *diveplan)
|
||||||
|
|
@ -555,9 +555,9 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
||||||
plan_display_transitions = prefs.display_transitions;
|
plan_display_transitions = prefs.display_transitions;
|
||||||
|
|
||||||
if (decoMode() == VPMB) {
|
if (decoMode() == VPMB) {
|
||||||
deco = "VPM-B";
|
deco = translate("gettextFromC", "VPM-B");
|
||||||
} else {
|
} else {
|
||||||
deco = "BUHLMANN";
|
deco = translate("gettextFromC", "BUHLMANN");
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE %s "
|
snprintf(buf, sizeof(buf), translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE %s "
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ extern bool diveplan_empty(struct diveplan *diveplan);
|
||||||
extern void free_dps(struct diveplan *diveplan);
|
extern void free_dps(struct diveplan *diveplan);
|
||||||
extern struct dive *planned_dive;
|
extern struct dive *planned_dive;
|
||||||
extern char *cache_data;
|
extern char *cache_data;
|
||||||
extern const char *disclaimer;
|
extern char *disclaimer;
|
||||||
extern double plangflow, plangfhigh;
|
extern double plangflow, plangfhigh;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -894,8 +894,8 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
|
||||||
add_dive_to_trip(copy, current_dive->divetrip);
|
add_dive_to_trip(copy, current_dive->divetrip);
|
||||||
record_dive(copy);
|
record_dive(copy);
|
||||||
QString oldnotes(current_dive->notes);
|
QString oldnotes(current_dive->notes);
|
||||||
if (oldnotes.indexOf(QString(disclaimer)) >= 0)
|
if (oldnotes.indexOf(QString(disclaimer).left(40)) >= 0)
|
||||||
oldnotes.truncate(oldnotes.indexOf(QString(disclaimer)));
|
oldnotes.truncate(oldnotes.indexOf(QString(displayed_dive.notes).left(40)));
|
||||||
if (did_deco)
|
if (did_deco)
|
||||||
oldnotes.append(displayed_dive.notes);
|
oldnotes.append(displayed_dive.notes);
|
||||||
displayed_dive.notes = strdup(oldnotes.toUtf8().data());
|
displayed_dive.notes = strdup(oldnotes.toUtf8().data());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue