From c1bc29bd4b05dafb26dbc1f94ed4070b07612f59 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 8 Jan 2015 09:31:18 -0800 Subject: [PATCH] Dive d/l selection UI: show useful data in a useful format We don't get location data from the dive computer (at least not from 99.99% of the dive computers today). And we really need to show the data in a human readable format. Signed-off-by: Dirk Hohndel --- qt-ui/downloadfromdivecomputer.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index 730a7b8a5..94b89ef5b 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -512,7 +512,7 @@ DiveImportedModel::DiveImportedModel(QObject *o) : QAbstractTableModel(o), int DiveImportedModel::columnCount(const QModelIndex& model ) const { - return 5; + return 3; } int DiveImportedModel::rowCount(const QModelIndex& model) const @@ -531,11 +531,9 @@ QVariant DiveImportedModel::data(const QModelIndex& index, int role) const struct dive* d = get_dive( index.row() + firstIndex); if (role == Qt::DisplayRole) { switch(index.column()){ - case 0 : return QVariant((int) d->when); - case 1 : return QVariant(d->duration.seconds); - case 2 : return QVariant(d->maxdepth.mm); - case 3 : return QVariant(d->latitude.udeg); - case 4 : return QVariant(d->longitude.udeg); + case 0 : return QVariant(get_short_dive_date_string(d->when)); + case 1 : return QVariant(get_dive_duration_string(d->duration.seconds, tr("h:"), tr("min"))); + case 2 : return QVariant(get_depth_string(d->maxdepth.mm, true, false)); } } if (role == Qt::CheckStateRole) {