summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar willemferguson <willemferguson@zoology.up.ac.za>2019-11-29 07:08:14 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-03 20:37:57 -0800
commit9006e3d1027279621af5f10f25c5c2c4bf2f5b9c (patch)
treec493695d391efb556f43e9251eb17db0e9e16a5e /core
parent6d7f26f4bf794c0faa79370dd788d90391542d30 (diff)
downloadsubsurface-9006e3d1027279621af5f10f25c5c2c4bf2f5b9c.tar.gz
Desktop: add additional star widgets to Information tab
Provide file I/O for those star widgets that are enabled. The values of the widgets can be stored to and read from either xml or git. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/load-git.c18
-rw-r--r--core/parse-xml.c8
-rw-r--r--core/save-git.c4
-rw-r--r--core/save-xml.c8
4 files changed, 35 insertions, 3 deletions
diff --git a/core/load-git.c b/core/load-git.c
index 8cefc5b9f..c9c195ca6 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -273,6 +273,18 @@ static void parse_dive_rating(char *line, struct membuffer *str, struct git_pars
static void parse_dive_visibility(char *line, struct membuffer *str, struct git_parser_state *state)
{ UNUSED(str); state->active_dive->visibility = get_index(line); }
+static void parse_dive_wavesize(char *line, struct membuffer *str, struct git_parser_state *state)
+{ UNUSED(str); state->active_dive->wavesize = get_index(line); }
+
+static void parse_dive_current(char *line, struct membuffer *str, struct git_parser_state *state)
+{ UNUSED(str); state->active_dive->current = get_index(line); }
+
+static void parse_dive_surge(char *line, struct membuffer *str, struct git_parser_state *state)
+{ UNUSED(str); state->active_dive->surge = get_index(line); }
+
+static void parse_dive_chill(char *line, struct membuffer *str, struct git_parser_state *state)
+{ UNUSED(str); state->active_dive->chill = get_index(line); }
+
static void parse_dive_notrip(char *line, struct membuffer *str, struct git_parser_state *state)
{
UNUSED(str);
@@ -987,9 +999,9 @@ static void divecomputer_parser(char *line, struct membuffer *str, struct git_pa
struct keyword_action dive_action[] = {
#undef D
#define D(x) { #x, parse_dive_ ## x }
- D(airpressure), D(airtemp), D(buddy), D(cylinder), D(divemaster), D(divesiteid), D(duration),
- D(gps), D(location), D(notes), D(notrip), D(rating), D(suit),
- D(tags), D(visibility), D(watertemp), D(weightsystem)
+ 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(tags), D(visibility), D(watertemp), D(wavesize), D(weightsystem)
};
static void dive_parser(char *line, struct membuffer *str, struct git_parser_state *state)
diff --git a/core/parse-xml.c b/core/parse-xml.c
index 79a7b53e0..cd87d27a1 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -1335,6 +1335,14 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str
return;
if (MATCH("visibility.dive", get_rating, &dive->visibility))
return;
+ if (MATCH("wavesize.dive", get_rating, &dive->wavesize))
+ return;
+ if (MATCH("current.dive", get_rating, &dive->current))
+ return;
+ if (MATCH("surge.dive", get_rating, &dive->surge))
+ return;
+ if (MATCH("chill.dive", get_rating, &dive->chill))
+ return;
if (MATCH_STATE("airpressure.dive", pressure, &dive->surface_pressure))
return;
if (MATCH("description.weightsystem", utf8_string, &dive->weightsystems.weightsystems[dive->weightsystems.nr - 1].description))
diff --git a/core/save-git.c b/core/save-git.c
index 9e14784fe..8f27c8b0b 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -433,6 +433,10 @@ static void create_dive_buffer(struct dive *dive, struct membuffer *b)
put_format(b, "duration %u:%02u min\n", FRACTION(dive->dc.duration.seconds, 60));
SAVE("rating", rating);
SAVE("visibility", visibility);
+ SAVE("wavesize", wavesize);
+ SAVE("current", current);
+ SAVE("surge", surge);
+ SAVE("chill", chill);
if (surface_pressure.mbar)
SAVE("airpressure", surface_pressure.mbar);
cond_put_format(dive->notrip, b, "notrip\n");
diff --git a/core/save-xml.c b/core/save-xml.c
index f1fbdc831..2a8ec5fa7 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -490,6 +490,14 @@ void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize)
put_format(b, " rating='%d'", dive->rating);
if (dive->visibility)
put_format(b, " visibility='%d'", dive->visibility);
+ if (dive->wavesize)
+ put_format(b, " wavesize='%d'", dive->wavesize);
+ if (dive->current)
+ put_format(b, " current='%d'", dive->current);
+ if (dive->surge)
+ put_format(b, " surge='%d'", dive->surge);
+ if (dive->chill)
+ put_format(b, " chill='%d'", dive->chill);
save_tags(b, dive->tag_list);
if (dive->dive_site) {
put_format(b, " divesiteid='%8x'", dive->dive_site->uuid);