mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Store the tag names instead of an opaque number
And as we need the names for that, simplify the way we show the tags in the Dive Info tab (and mark them for translation while we are at it). In the process I renamed the constants to DTAG_ from DTYPE_ (and made their nature as being just bits more obvious). Also mark the box on the Info tab "Dive Tags", not "Dive Type". Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ed3f67bc33
commit
9e4f9fad19
6 changed files with 100 additions and 68 deletions
19
save-xml.c
19
save-xml.c
|
@ -391,6 +391,22 @@ static void save_events(FILE *f, struct event *ev)
|
|||
}
|
||||
}
|
||||
|
||||
static void save_tags(FILE *f, int tags)
|
||||
{
|
||||
int i, more = 0;
|
||||
|
||||
fprintf(f, " tags='");
|
||||
for (i = 0; i < DTAG_NR; i++) {
|
||||
if (tags & (1 << i)) {
|
||||
if (more)
|
||||
fprintf(f, ", ");
|
||||
fprintf(f, "%s", dtag_names[i]);
|
||||
more = 1;
|
||||
}
|
||||
}
|
||||
fprintf(f, "'");
|
||||
}
|
||||
|
||||
static void show_date(FILE *f, timestamp_t when)
|
||||
{
|
||||
struct tm tm;
|
||||
|
@ -452,7 +468,8 @@ void save_dive(FILE *f, struct dive *dive)
|
|||
if (dive->visibility)
|
||||
fprintf(f, " visibility='%d'", dive->visibility);
|
||||
if (dive->dive_tags)
|
||||
fprintf(f, " tags='%d'", dive->dive_tags);
|
||||
save_tags(f, dive->dive_tags);
|
||||
|
||||
show_date(f, dive->when);
|
||||
fprintf(f, " duration='%u:%02u min'>\n",
|
||||
FRACTION(dive->dc.duration.seconds, 60));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue