mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:23:23 +00:00
Core: introduce invalid flag for dives
Implement reading/writing the flag from/to XML/git. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ef821d7d94
commit
329641fdcd
5 changed files with 14 additions and 1 deletions
|
@ -172,6 +172,7 @@ struct dive {
|
|||
bool selected;
|
||||
bool hidden_by_filter;
|
||||
struct full_text_cache *full_text; /* word cache for full text search */
|
||||
bool invalid;
|
||||
};
|
||||
|
||||
/* For the top-level list: an entry is either a dive or a trip */
|
||||
|
|
|
@ -283,6 +283,13 @@ static void parse_dive_notrip(char *line, struct membuffer *str, struct git_pars
|
|||
state->active_dive->notrip = true;
|
||||
}
|
||||
|
||||
static void parse_dive_invalid(char *line, struct membuffer *str, struct git_parser_state *state)
|
||||
{
|
||||
UNUSED(str);
|
||||
UNUSED(line);
|
||||
state->active_dive->invalid = true;
|
||||
}
|
||||
|
||||
static void parse_site_description(char *line, struct membuffer *str, struct git_parser_state *state)
|
||||
{ UNUSED(line); state->active_site->description = detach_cstring(str); }
|
||||
|
||||
|
@ -1039,7 +1046,7 @@ struct keyword_action dive_action[] = {
|
|||
#undef D
|
||||
#define D(x) { #x, parse_dive_ ## x }
|
||||
D(airpressure), D(airtemp), D(buddy), D(chill), D(current), D(cylinder), D(divemaster), D(divesiteid), D(duration),
|
||||
D(gps), D(location), D(notes), D(notrip), D(rating), D(suit), D(surge),
|
||||
D(gps), D(invalid), D(location), D(notes), D(notrip), D(rating), D(suit), D(surge),
|
||||
D(tags), D(visibility), D(watersalinity), D(watertemp), D(wavesize), D(weightsystem)
|
||||
};
|
||||
|
||||
|
|
|
@ -1381,6 +1381,8 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str
|
|||
return;
|
||||
if (MATCH_STATE("water.divetemperature", temperature, &dive->watertemp))
|
||||
return;
|
||||
if (MATCH("invalid", get_bool, &dive->invalid))
|
||||
return;
|
||||
|
||||
nonmatch("dive", name, buf);
|
||||
}
|
||||
|
|
|
@ -442,6 +442,7 @@ static void create_dive_buffer(struct dive *dive, struct membuffer *b)
|
|||
if (surface_pressure.mbar)
|
||||
SAVE("airpressure", surface_pressure.mbar);
|
||||
cond_put_format(dive->notrip, b, "notrip\n");
|
||||
cond_put_format(dive->invalid, b, "invalid\n");
|
||||
save_tags(b, dive->tag_list);
|
||||
if (dive->dive_site)
|
||||
put_format(b, "divesiteid %08x\n", dive->dive_site->uuid);
|
||||
|
|
|
@ -498,6 +498,8 @@ void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize)
|
|||
put_format(b, " surge='%d'", dive->surge);
|
||||
if (dive->chill)
|
||||
put_format(b, " chill='%d'", dive->chill);
|
||||
if (dive->invalid)
|
||||
put_format(b, " invalid");
|
||||
save_tags(b, dive->tag_list);
|
||||
if (dive->dive_site)
|
||||
put_format(b, " divesiteid='%8x'", dive->dive_site->uuid);
|
||||
|
|
Loading…
Add table
Reference in a new issue