summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-08 23:13:30 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-08 23:13:30 -0800
commit249a2c2c0907fd0444b5c926ff8c965c6fb3776a (patch)
tree34b00f128f66c93abec3440c4092b874b2bc6697
parentb34a507d514b491b8060d4e21484ba5d5c3ca461 (diff)
downloadsubsurface-249a2c2c0907fd0444b5c926ff8c965c6fb3776a.tar.gz
Gps list: include the time_t timestamp in the model
Just having the string means we lost the unique value that we can use as key to indentify a specific GPS fix. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-mobile/qml/GpsList.qml2
-rw-r--r--qt-models/gpslistmodel.cpp5
-rw-r--r--qt-models/gpslistmodel.h3
3 files changed, 7 insertions, 3 deletions
diff --git a/qt-mobile/qml/GpsList.qml b/qt-mobile/qml/GpsList.qml
index baa65e3b9..24b389b23 100644
--- a/qt-mobile/qml/GpsList.qml
+++ b/qt-mobile/qml/GpsList.qml
@@ -52,7 +52,7 @@ MobileComponents.Page {
font.pointSize: subsurfaceTheme.smallPointSize
}
MobileComponents.Label {
- text: when
+ text: date
width: Math.max(parent.width / 5, paintedWidth) // helps vertical alignment throughout listview
font.pointSize: subsurfaceTheme.smallPointSize
}
diff --git a/qt-models/gpslistmodel.cpp b/qt-models/gpslistmodel.cpp
index 2c6fe6b5c..23349b00e 100644
--- a/qt-models/gpslistmodel.cpp
+++ b/qt-models/gpslistmodel.cpp
@@ -46,6 +46,8 @@ QVariant GpsListModel::data(const QModelIndex &index, int role) const
if (role == GpsDateRole)
return get_short_dive_date_string(gt.when);
+ else if (role == GpsWhenRole)
+ return gt.when;
else if (role == GpsNameRole)
return gt.name;
else if (role == GpsLatitudeRole)
@@ -58,7 +60,8 @@ QVariant GpsListModel::data(const QModelIndex &index, int role) const
QHash<int, QByteArray> GpsListModel::roleNames() const
{
QHash<int, QByteArray> roles;
- roles[GpsDateRole] = "when";
+ roles[GpsDateRole] = "date";
+ roles[GpsWhenRole] = "when";
roles[GpsNameRole] = "name";
roles[GpsLatitudeRole] = "latitude";
roles[GpsLongitudeRole] = "longitude";
diff --git a/qt-models/gpslistmodel.h b/qt-models/gpslistmodel.h
index 91a15540f..870540b4f 100644
--- a/qt-models/gpslistmodel.h
+++ b/qt-models/gpslistmodel.h
@@ -14,7 +14,8 @@ public:
GpsDateRole = Qt::UserRole + 1,
GpsNameRole,
GpsLatitudeRole,
- GpsLongitudeRole
+ GpsLongitudeRole,
+ GpsWhenRole
};
static GpsListModel *instance();