summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-08 11:26:22 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-08 08:51:37 -0700
commitab6cac9799192f1478c150b2ce63906901db2b3b (patch)
tree4632ed93a89e1dad204aef3d41e8edab5e7c735c
parent57c4b7c9c170cb0428114a872332869534e9a706 (diff)
downloadsubsurface-ab6cac9799192f1478c150b2ce63906901db2b3b.tar.gz
media: give newly created dive sites a name
When adding a picture with GPS information, a dive site was added if the dive didn't have any. The dive site had the empty string as name, leading to a confusing UI experience. We could catch the empty string at numerous places and replace it by some dummy string. This commit goes the distinctly less invasive route and adds the dive site with the "unnamed dive site" string (translated to the user language) as name. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--commands/command_pictures.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/commands/command_pictures.cpp b/commands/command_pictures.cpp
index 66284fc86..7abe3636b 100644
--- a/commands/command_pictures.cpp
+++ b/commands/command_pictures.cpp
@@ -169,7 +169,8 @@ AddPictures::AddPictures(const std::vector<PictureListForAddition> &pictures) :
struct dive_site *ds = p.d->dive_site;
if (!ds) {
// This dive doesn't yet have a dive site -> add a new dive site.
- dive_site *ds = alloc_dive_site_with_gps("", &it->location);
+ QString name = Command::Base::tr("unnamed dive site");
+ dive_site *ds = alloc_dive_site_with_gps(qPrintable(name), &it->location);
sitesToAdd.emplace_back(ds);
sitesToSet.push_back({ p.d, ds });
} else if (!dive_site_has_gps_location(ds)) {