mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-07 20:44:35 +00:00
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>
This commit is contained in:
parent
ac7830ea91
commit
884e690049
4 changed files with 28 additions and 6 deletions
|
@ -2,14 +2,32 @@
|
||||||
#include "divesite.h"
|
#include "divesite.h"
|
||||||
#include "pref.h"
|
#include "pref.h"
|
||||||
|
|
||||||
QString constructLocationTags(struct dive_site *ds)
|
QString constructLocationTags(struct dive_site *ds, bool for_maintab)
|
||||||
{
|
{
|
||||||
QString locationTag;
|
QString locationTag;
|
||||||
|
|
||||||
if (!ds || !ds->taxonomy.nr)
|
if (!ds || !ds->taxonomy.nr)
|
||||||
return locationTag;
|
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;
|
QString connector;
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (prefs.geocoding.category[i] == TC_NONE)
|
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;
|
return locationTag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QObject>
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#else
|
#else
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -76,7 +77,7 @@ void merge_dive_sites(uint32_t ref, uint32_t *uuids, int count);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
QString constructLocationTags(struct dive_site *ds);
|
QString constructLocationTags(struct dive_site *ds, bool for_maintab);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ void LocationInformationWidget::updateLabels()
|
||||||
ui.diveSiteCoordinates->clear();
|
ui.diveSiteCoordinates->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.locationTags->setText(constructLocationTags(&displayed_dive_site));
|
ui.locationTags->setText(constructLocationTags(&displayed_dive_site, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -458,7 +458,7 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
|
|
||||||
if (ds) {
|
if (ds) {
|
||||||
ui.location->setCurrentDiveSiteUuid(ds->uuid);
|
ui.location->setCurrentDiveSiteUuid(ds->uuid);
|
||||||
ui.locationTags->setText(constructLocationTags(ds));
|
ui.locationTags->setText(constructLocationTags(ds, true));
|
||||||
} else {
|
} else {
|
||||||
ui.location->clear();
|
ui.location->clear();
|
||||||
clear_dive_site(&displayed_dive_site);
|
clear_dive_site(&displayed_dive_site);
|
||||||
|
|
Loading…
Add table
Reference in a new issue