summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-models/divelistmodel.cpp3
-rw-r--r--qt-models/divelistmodel.h1
-rw-r--r--subsurface-core/qthelper.cpp13
-rw-r--r--subsurface-core/qthelper.h4
4 files changed, 21 insertions, 0 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index ccd5b8afd..114cd6d1f 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -77,6 +77,8 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
return dive.sac();
else if (role == DiveLocationRole)
return dive.location();
+ else if (role == DiveGPSRole)
+ return dive.gps();
else if (role == DiveNotesRole)
return dive.notes();
else if (role == DiveBuddyRole)
@@ -107,6 +109,7 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
roles[DiveGasRole] = "gas";
roles[DiveSacRole] = "sac";
roles[DiveLocationRole] = "location";
+ roles[DiveGPSRole] = "gps";
roles[DiveNotesRole] = "notes";
roles[DiveBuddyRole] = "buddy";
roles[DiveMasterRole] = "divemaster";
diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h
index a19d1b365..b75a0f182 100644
--- a/qt-models/divelistmodel.h
+++ b/qt-models/divelistmodel.h
@@ -26,6 +26,7 @@ public:
DiveGasRole,
DiveSacRole,
DiveLocationRole,
+ DiveGPSRole,
DiveNotesRole,
DiveBuddyRole,
DiveMasterRole,
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp
index d55e8438f..25d5b4233 100644
--- a/subsurface-core/qthelper.cpp
+++ b/subsurface-core/qthelper.cpp
@@ -80,6 +80,10 @@ QString Dive::location() const
return m_location;
}
+QString Dive::gps() const
+{
+ return m_gps;
+}
QString Dive::duration() const
{
return m_duration;
@@ -222,6 +226,15 @@ void Dive::put_location()
}
}
+void Dive::put_gps()
+{
+ struct dive_site *ds = get_dive_site_by_uuid(dive->dive_site_uuid);
+ if (ds)
+ m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0);
+ else
+ m_gps = QString();
+}
+
void Dive::put_depth()
{
m_depth = get_depth_string(dive->dc.maxdepth.mm, true, true);
diff --git a/subsurface-core/qthelper.h b/subsurface-core/qthelper.h
index 5b3e5bdee..0049e9bbd 100644
--- a/subsurface-core/qthelper.h
+++ b/subsurface-core/qthelper.h
@@ -18,6 +18,7 @@ private:
timestamp_t m_timestamp;
QString m_time;
QString m_location;
+ QString m_gps;
QString m_duration;
QString m_depth;
QString m_divemaster;
@@ -38,6 +39,7 @@ private:
void put_date_time();
void put_timestamp();
void put_location();
+ void put_gps();
void put_duration();
void put_depth();
void put_divemaster();
@@ -63,6 +65,7 @@ public:
m_rating = dive->rating;
put_date_time();
put_location();
+ put_gps();
put_duration();
put_depth();
put_divemaster();
@@ -89,6 +92,7 @@ public:
timestamp_t timestamp() const;
QString time() const;
QString location() const;
+ QString gps() const;
QString duration() const;
QString depth() const;
QString divemaster() const;