mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
cleanup: remove use of QRegExp in TeX export
Qt 6 will drop support for QRegExp. When looking at replacing this use of a QRegExp it seemed like a much better idea to simply switch to utilizing the taxonomy data instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ba1564fddb
commit
b2d5350bb1
1 changed files with 5 additions and 8 deletions
|
@ -16,6 +16,7 @@
|
|||
#include "core/pref.h"
|
||||
#include "core/sample.h"
|
||||
#include "core/selection.h"
|
||||
#include "core/taxonomy.h"
|
||||
#include "exportfuncs.h"
|
||||
|
||||
// Default implementation of the export callback: do nothing / never cancel
|
||||
|
@ -119,14 +120,10 @@ void export_TeX(const char *filename, bool selected_only, bool plain, ExportCall
|
|||
struct tm tm;
|
||||
utc_mkdate(dive->when, &tm);
|
||||
|
||||
const char *country = NULL;
|
||||
dive_site *site = dive->dive_site;
|
||||
QRegExp ct("countrytag: (\\w+)");
|
||||
QString country;
|
||||
if (site && ct.indexIn(site->notes) >= 0)
|
||||
country = ct.cap(1);
|
||||
else
|
||||
country = "";
|
||||
|
||||
if (site)
|
||||
country = taxonomy_get_country(&site->taxonomy);
|
||||
pressure_t delta_p = {.mbar = 0};
|
||||
|
||||
QString star = "*";
|
||||
|
@ -158,7 +155,7 @@ void export_TeX(const char *filename, bool selected_only, bool plain, ExportCall
|
|||
site ? put_format(&buf, "\\def\\%sgpslat{%f}\n", ssrf, site->location.lat.udeg / 1000000.0) : put_format(&buf, "\\def\\%sgpslat{}\n", ssrf);
|
||||
site ? put_format(&buf, "\\def\\%sgpslon{%f}\n", ssrf, site->location.lon.udeg / 1000000.0) : put_format(&buf, "\\def\\gpslon{}\n");
|
||||
put_format(&buf, "\\def\\%scomputer{%s}\n", ssrf, dive->dc.model);
|
||||
put_format(&buf, "\\def\\%scountry{%s}\n", ssrf, qPrintable(country));
|
||||
put_format(&buf, "\\def\\%scountry{%s}\n", ssrf, country ?: "");
|
||||
put_format(&buf, "\\def\\%stime{%u:%02u}\n", ssrf, FRACTION(dive->duration.seconds, 60));
|
||||
|
||||
put_format(&buf, "\n%% Dive Profile Details:\n");
|
||||
|
|
Loading…
Reference in a new issue