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>
This commit is contained in:
Dirk Hohndel 2016-01-08 23:13:30 -08:00
parent b34a507d51
commit 249a2c2c09
3 changed files with 7 additions and 3 deletions

View file

@ -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
}

View file

@ -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";

View file

@ -14,7 +14,8 @@ public:
GpsDateRole = Qt::UserRole + 1,
GpsNameRole,
GpsLatitudeRole,
GpsLongitudeRole
GpsLongitudeRole,
GpsWhenRole
};
static GpsListModel *instance();