summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2017-03-21 17:52:29 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-03-24 09:35:00 -0700
commitd6003209d6abf715a00802debcd25b145154c8b1 (patch)
treef3e5c891df0142a04a1d56e551d950fa245d15dc /core
parent6e38619970fa09fa93f086d819dd44353e70ab45 (diff)
downloadsubsurface-d6003209d6abf715a00802debcd25b145154c8b1.tar.gz
Subsurface-mobile: do send decimal GPS to Google
Sending nicely readable formatted coordinates to Google Maps does not result in a correctly positioned map. Google likes unreadable decimal format. Little hacky solution. Added a gps_decimal attribute, populate that with the standard function for format a coordinate to string, but reset the preferences value temporarly so that it always converts it to decimal style. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core')
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp12
-rw-r--r--core/subsurface-qt/DiveObjectHelper.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index 9814f9a6a..e77d3a186 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -109,6 +109,18 @@ QString DiveObjectHelper::gps() const
struct dive_site *ds = get_dive_site_by_uuid(m_dive->dive_site_uuid);
return ds ? QString(printGPSCoords(ds->latitude.udeg, ds->longitude.udeg)) : QString();
}
+
+QString DiveObjectHelper::gps_decimal() const
+{
+ bool savep = prefs.coordinates_traditional;
+ QString val;
+
+ prefs.coordinates_traditional = false;
+ val = gps();
+ prefs.coordinates_traditional = savep;
+ return(val);
+}
+
QString DiveObjectHelper::duration() const
{
return get_dive_duration_string(m_dive->duration.seconds, QObject::tr("h:"), QObject::tr("min"));
diff --git a/core/subsurface-qt/DiveObjectHelper.h b/core/subsurface-qt/DiveObjectHelper.h
index 8650f7a98..81887d356 100644
--- a/core/subsurface-qt/DiveObjectHelper.h
+++ b/core/subsurface-qt/DiveObjectHelper.h
@@ -18,6 +18,7 @@ class DiveObjectHelper : public QObject {
Q_PROPERTY(int timestamp READ timestamp CONSTANT)
Q_PROPERTY(QString location READ location CONSTANT)
Q_PROPERTY(QString gps READ gps CONSTANT)
+ Q_PROPERTY(QString gps_decimal READ gps_decimal CONSTANT)
Q_PROPERTY(QString duration READ duration CONSTANT)
Q_PROPERTY(bool noDive READ noDive CONSTANT)
Q_PROPERTY(QString depth READ depth CONSTANT)
@@ -60,6 +61,7 @@ public:
QString time() const;
QString location() const;
QString gps() const;
+ QString gps_decimal() const;
QString duration() const;
bool noDive() const;
QString depth() const;