diff options
author | Robert C. Helling <helling@atdotde.de> | 2016-10-19 20:56:01 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-10-20 21:19:17 -0700 |
commit | 02389c95cb59821c15479a6b56251b89dfc57e20 (patch) | |
tree | 8d011311140a299c8d95514ca2eb5f742fa280d1 | |
parent | 0ea0272806e6a651782f17ecb75fd1345e2ca8cb (diff) | |
download | subsurface-02389c95cb59821c15479a6b56251b89dfc57e20.tar.gz |
Add country information to TeX export
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 <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/divelogexportdialog.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index 6121bd9eb..4a1e87d86 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 ? 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)); |