From f8ef707dd235817a50559fc4ddd67c644573ec74 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Wed, 19 Oct 2016 20:56:01 +0200 Subject: [PATCH] Add country information to TeX export To: subsurface@subsurface-divelog.org This is a bit ugly since it does a regexp match on divesite.notes but what can I do... Signed-off-by: Robert C. Helling --- desktop-widgets/divelogexportdialog.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index 9d3d271..5be1e53 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -264,7 +264,13 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o struct tm tm; utc_mkdate(dive->when, &tm); - dive_site *site = get_dive_site_by_uuid(dive->dive_site_uuid);; + dive_site *site = get_dive_site_by_uuid(dive->dive_site_uuid); + QRegExp ct("countrytag: (\\w+)"); + QString country; + if (ct.indexIn(site->notes) >= 0) + country = ct.cap(1); + else + country = ""; pressure_t delta_p = {.mbar = 0}; @@ -284,7 +290,7 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o put_format(&buf, "\\def\\number{%d}\n", dive->number); put_format(&buf, "\\def\\place{%s}\n", site->name); put_format(&buf, "\\def\\spot{}\n"); - put_format(&buf, "\\def\\country{}\n"); + put_format(&buf, "\\def\\country{%s}\n", country.toUtf8().data()); put_format(&buf, "\\def\\entrance{}\n"); put_format(&buf, "\\def\\time{%u:%02u}\n", FRACTION(dive->duration.seconds, 60)); put_format(&buf, "\\def\\depth{%u.%01um}\n", FRACTION(dive->maxdepth.mm / 100, 10)); -- 2.8.4 (Apple Git-73)