summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-10-16 15:52:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-17 06:12:07 -0400
commit884e690049f091f43567d6bf77634463af14cd93 (patch)
tree2d59dbb2dfd458f14a4cdc8bdc9d3b3f581789ad
parentac7830ea9147d23a623eb0c80279d6a6e42c95bc (diff)
downloadsubsurface-884e690049f091f43567d6bf77634463af14cd93.tar.gz
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 <sfuchs@gmx.de>
-rw-r--r--core/divesite.cpp27
-rw-r--r--core/divesite.h3
-rw-r--r--desktop-widgets/locationinformation.cpp2
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp2
4 files changed, 28 insertions, 6 deletions
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 = "<small><small>(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("<small><small>") + QObject::tr("No dive site layout categories set in preferences!") +
+ QString("</small></small>");
+ return locationTag;
+ }
+ else if (!prefs_set)
+ return locationTag;
+
+ if (for_maintab)
+ locationTag = QString("<small><small>(") + QObject::tr("Tags") + QString(": ");
+ else
+ locationTag = QString("<small><small>");
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 += ")</small></small>";
+ if (for_maintab)
+ locationTag += ")</small></small>";
+ else
+ locationTag += "</small></small>";
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 <QString>
+#include <QObject>
extern "C" {
#else
#include <stdbool.h>
@@ -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
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index b455175a2..78126b172 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -114,7 +114,7 @@ void LocationInformationWidget::updateLabels()
ui.diveSiteCoordinates->clear();
}
- ui.locationTags->setText(constructLocationTags(&displayed_dive_site));
+ ui.locationTags->setText(constructLocationTags(&displayed_dive_site, false));
}
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 62d818183..c2a0c7e81 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -458,7 +458,7 @@ void MainTab::updateDiveInfo(bool clear)
if (ds) {
ui.location->setCurrentDiveSiteUuid(ds->uuid);
- ui.locationTags->setText(constructLocationTags(ds));
+ ui.locationTags->setText(constructLocationTags(ds, true));
} else {
ui.location->clear();
clear_dive_site(&displayed_dive_site);