aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/yearlystatisticsmodel.cpp
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-01-18 09:34:54 -0800
commit37c10c8fd62ab85237922b2a267f3cf2b4252d82 (patch)
tree6e3f174f97e51c6106e32b98eb1add7fd551bfa8 /qt-models/yearlystatisticsmodel.cpp
parentb9000208fe72832d85cbb0ffea34d13ef94034cd (diff)
downloadsubsurface-37c10c8fd62ab85237922b2a267f3cf2b4252d82.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/yearlystatisticsmodel.cpp')
-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;
+ }
}