mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add gas consumption statistic for selected dives
We already did a list of gases and volume consumed for the selected dive on the Dive Info tab, but did not provide that same data on the Stats tab for all the selected dives. I arbitrary limited this to eight gases (as the list can get quite long when you select a lot of dives). The gases are sorted by volume consumed. Fixes #535 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0102604645
commit
8a0d852a7c
4 changed files with 81 additions and 14 deletions
|
@ -530,6 +530,23 @@ void MainTab::updateDiveInfo(int dive)
|
|||
ui.timeLimits->setAverage(get_time_string(seconds, 0));
|
||||
ui.timeLimits->setMaximum(get_time_string(stats_selection.longest_time.seconds, 0));
|
||||
ui.timeLimits->setMinimum(get_time_string(stats_selection.shortest_time.seconds, 0));
|
||||
// now let's get some gas use statistics
|
||||
QVector<QPair<QString, int> > gasUsed;
|
||||
QString gasUsedString;
|
||||
QPair<QString, int> topGases[8] = { };
|
||||
volume_t vol;
|
||||
selectedDivesGasUsed(gasUsed);
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (gasUsed.isEmpty())
|
||||
break;
|
||||
QPair<QString, int> gasPair = gasUsed.last();
|
||||
gasUsed.pop_back();
|
||||
vol.mliter = gasPair.second;
|
||||
gasUsedString.append(gasPair.first).append(": ").append(get_volume_string(vol, true)).append("\n");
|
||||
}
|
||||
if (!gasUsed.isEmpty())
|
||||
gasUsedString.append("...");
|
||||
ui.gasConsumption->setText(gasUsedString);
|
||||
} else {
|
||||
/* clear the fields */
|
||||
clearInfo();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue