aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/downloadfromdivecomputer.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-08 10:25:38 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-08 07:41:51 -0800
commit76725265fca15461931d9dc0e40ce1f73f903075 (patch)
tree4a7bda7f1d3c1c7d92507263f91188a0f5c780bc /qt-ui/downloadfromdivecomputer.cpp
parentf7abde84afb9e8ae984746a91dc802759d8d82f6 (diff)
downloadsubsurface-76725265fca15461931d9dc0e40ce1f73f903075.tar.gz
Dive d/l selection UI: Display the downloaded dives in a table
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/downloadfromdivecomputer.cpp')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index 6a1650e3c..31d1ddaa0 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -514,9 +514,24 @@ int DiveImportedModel::rowCount(const QModelIndex& model) const
return lastIndex - firstIndex;
}
-QVariant DiveImportedModel::data(const QModelIndex& model, int role) const
+QVariant DiveImportedModel::data(const QModelIndex& index, int role) const
{
-
+ if (!index.isValid())
+ return QVariant();
+
+ if (index.row() + firstIndex > lastIndex)
+ return QVariant();
+
+ struct dive* d = get_dive( index.row() + firstIndex);
+ if (role == Qt::DisplayRole) {
+ switch(index.column()){
+ case 0 : return QVariant(d->when);
+ case 1 : return QVariant(d->duration);
+ case 2 : return QVariant(d->maxdepth);
+ case 3 : return QVariant(d->latitude);
+ case 4 : return QVariant(d->longitude);
+ }
+ }
}
void DiveImportedModel::setImportedDivesIndexes(int first, int last)