From 884e690049f091f43567d6bf77634463af14cd93 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Mon, 16 Oct 2017 15:52:13 +0200 Subject: Tags for geo references: Nicer look, translations and warning message For the geo references tags update the following: - Nicer look w/o "Tags:" text and brackets when inside location UI - Translation for "Tags:" - Warning message when no dive site layout categories are set Signed-off-by: Stefan Fuchs --- core/divesite.cpp | 27 ++++++++++++++++++++++++--- core/divesite.h | 3 ++- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/divesite.cpp b/core/divesite.cpp index 293656c6a..0f0641c28 100644 --- a/core/divesite.cpp +++ b/core/divesite.cpp @@ -2,14 +2,32 @@ #include "divesite.h" #include "pref.h" -QString constructLocationTags(struct dive_site *ds) +QString constructLocationTags(struct dive_site *ds, bool for_maintab) { QString locationTag; if (!ds || !ds->taxonomy.nr) return locationTag; - locationTag = "(tags: "; + /* Check if the user set any of the 3 geocoding categories */ + bool prefs_set = false; + for (int i = 0; i < 3; i++) { + if (prefs.geocoding.category[i] != TC_NONE) + prefs_set = true; + } + + if (!prefs_set && !for_maintab) { + locationTag = QString("") + QObject::tr("No dive site layout categories set in preferences!") + + QString(""); + return locationTag; + } + else if (!prefs_set) + return locationTag; + + if (for_maintab) + locationTag = QString("(") + QObject::tr("Tags") + QString(": "); + else + locationTag = QString(""); QString connector; for (int i = 0; i < 3; i++) { if (prefs.geocoding.category[i] == TC_NONE) @@ -26,6 +44,9 @@ QString constructLocationTags(struct dive_site *ds) } } - locationTag += ")"; + if (for_maintab) + locationTag += ")"; + else + locationTag += ""; return locationTag; } diff --git a/core/divesite.h b/core/divesite.h index a731f0841..9f6b8f527 100644 --- a/core/divesite.h +++ b/core/divesite.h @@ -8,6 +8,7 @@ #ifdef __cplusplus #include +#include extern "C" { #else #include @@ -76,7 +77,7 @@ void merge_dive_sites(uint32_t ref, uint32_t *uuids, int count); #ifdef __cplusplus } -QString constructLocationTags(struct dive_site *ds); +QString constructLocationTags(struct dive_site *ds, bool for_maintab); #endif -- cgit v1.2.3-70-g09d2