summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-01-17 21:18:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-26 09:16:55 +0100
commit403d6dcfb016a5886a9e6baab34c9868dad2aaf0 (patch)
treeb5885cb37239a17fdf2ae30366d4c1056d4977ff /qt-models
parentb73f56bc43dac5d43d3d8fe16c9d40ed5987ab1d (diff)
downloadsubsurface-403d6dcfb016a5886a9e6baab34c9868dad2aaf0.tar.gz
Add dive type to statistics window
This adds dive type based division to the "yearly statistics" window. Thus people can see the stats from individually from OC, CCR, PSCR and freedive. See #949 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/yearlystatisticsmodel.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/qt-models/yearlystatisticsmodel.cpp b/qt-models/yearlystatisticsmodel.cpp
index 47d9891f2..1cc5a9087 100644
--- a/qt-models/yearlystatisticsmodel.cpp
+++ b/qt-models/yearlystatisticsmodel.cpp
@@ -202,4 +202,18 @@ void YearlyStatisticsModel::update_yearly_stats()
rootItem->children.append(item);
item->parent = rootItem;
}
+
+ /* Show the statistic sorted by dive type */
+ if (stats_by_type != NULL && stats_by_type[0].selection_size) {
+ YearStatisticsItem *item = new YearStatisticsItem(stats_by_type[0]);
+ for (i = 1; i <= sizeof(dive_comp_type) + 1; ++i) {
+ if (stats_by_type[i].selection_size == 0)
+ continue;
+ YearStatisticsItem *iChild = new YearStatisticsItem(stats_by_type[i]);
+ item->children.append(iChild);
+ iChild->parent = item;
+ }
+ rootItem->children.append(item);
+ item->parent = rootItem;
+ }
}