diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2013-11-24 03:09:34 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-23 22:07:18 -0800 |
commit | ce525bd28518cc3c625b5e005bc7eb5e3c460c29 (patch) | |
tree | a8d09fd1b88b9bb8e9e674a9ca70042d59f5e65e /qt-ui | |
parent | 66cdb3689a3bac0a56d9d8d38c01379fa4c3fda9 (diff) | |
download | subsurface-ce525bd28518cc3c625b5e005bc7eb5e3c460c29.tar.gz |
Adding trip based statistics
This adds trip based statistics to the Yearly Statistics
view.
Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/models.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index ae156cbbc..8dfdb5c1f 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -1364,7 +1364,13 @@ QVariant YearStatisticsItem::data(int column, int role) const return ret; } switch(column) { - case YEAR: ret = stats_interval.period; break; + case YEAR: + if (stats_interval.is_trip) { + ret = stats_interval.location; + } else { + ret = stats_interval.period; + } + break; case DIVES: ret = stats_interval.selection_size; break; case TOTAL_TIME: ret = get_time_string(stats_interval.total_time.seconds, 0); break; case AVERAGE_TIME: ret = get_minutes(stats_interval.total_time.seconds / stats_interval.selection_size); break; @@ -1409,7 +1415,7 @@ QVariant YearlyStatisticsModel::headerData(int section, Qt::Orientation orientat if (role == Qt::DisplayRole && orientation == Qt::Horizontal) { switch(section) { - case YEAR: val = tr("Year \n > Month"); break; + case YEAR: val = tr("Year \n > Month / Trip"); break; case DIVES: val = tr("#"); break; case TOTAL_TIME: val = tr("Duration \n Total"); break; case AVERAGE_TIME: val = tr("\nAverage"); break; @@ -1447,6 +1453,18 @@ void YearlyStatisticsModel::update_yearly_stats() rootItem->children.append(item); item->parent = rootItem; } + + + if (stats_by_trip != NULL ) { + YearStatisticsItem *item = new YearStatisticsItem(stats_by_trip[0]); + for (i = 1; stats_by_trip != NULL && stats_by_trip[i].is_trip; ++i) { + YearStatisticsItem *iChild = new YearStatisticsItem(stats_by_trip[i]); + item->children.append(iChild); + iChild->parent = item; + } + rootItem->children.append(item); + item->parent = rootItem; + } } /*################################################################# |