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>
This commit is contained in:
Miika Turkia 2016-01-17 21:18:36 +02:00 committed by Dirk Hohndel
parent b9000208fe
commit 37c10c8fd6
3 changed files with 40 additions and 1 deletions

View file

@ -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;
}
}