From 37c10c8fd62ab85237922b2a267f3cf2b4252d82 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.turkia@gmail.com>
Date: Sun, 17 Jan 2016 21:18:36 +0200
Subject: 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>
---
 qt-models/yearlystatisticsmodel.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'qt-models')

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;
+	}
 }
-- 
cgit v1.2.3-70-g09d2