diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-19 22:42:24 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-19 22:48:31 -0700 |
commit | 11a6b186904eb770bd433521a24e0a8dadedfbc5 (patch) | |
tree | c0b4c96c9a86bb8199f399b76c2c9d29549b7e4d /qt-ui/maintab.cpp | |
parent | e818f0352b4f7a036b34e7f67ba0fd45654e4d63 (diff) | |
download | subsurface-11a6b186904eb770bd433521a24e0a8dadedfbc5.tar.gz |
Display the statistics
This would be correct if the current selection code wasn't broken. Right
now we only add to our internal notion of what is selected - we never
deselect anything.
Once that is fixed, thestatistics should be correctly displayed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 95fd9ffe3..f559ff789 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -139,9 +139,11 @@ void MainTab::updateDiveInfo(int dive) // click on the item and check its objectName, // the access is ui->objectName from here on. volume_t sacVal; + temperature_t temp; struct dive *prevd; struct dive *d = get_dive(dive); + process_selected_dives(); process_all_dives(d, &prevd); currentDive = d; UPDATE_TEXT(d, notes); @@ -172,7 +174,7 @@ void MainTab::updateDiveInfo(int dive) if (prevd) ui->surfaceIntervalText->setText(get_time_string(d->when - (prevd->when + prevd->duration.seconds), 4)); if ((sacVal.mliter = d->sac) > 0) - ui->sacText->setText(get_volume_string(sacVal, TRUE).append("/min")); + ui->sacText->setText(get_volume_string(sacVal, TRUE).append(tr("/min"))); else ui->sacText->clear(); if (d->surface_pressure.mbar) @@ -181,6 +183,29 @@ void MainTab::updateDiveInfo(int dive) else ui->airPressureText->clear(); ui->visibility->setCurrentStars(d->visibility); + ui->maximumDepthAllText->setText(get_depth_string(stats_selection.max_depth, TRUE)); + ui->minimumDepthAllText->setText(get_depth_string(stats_selection.min_depth, TRUE)); + ui->averageDepthAllText->setText(get_depth_string(stats_selection.avg_depth, TRUE)); + ui->maximumSacAllText->setText(get_volume_string(stats_selection.max_sac, TRUE).append(tr("/min"))); + ui->minimumSacAllText->setText(get_volume_string(stats_selection.min_sac, TRUE).append(tr("/min"))); + ui->averageSacAllText->setText(get_volume_string(stats_selection.avg_sac, TRUE).append(tr("/min"))); + ui->divesAllText->setText(QString::number(stats_selection.selection_size)); + temp.mkelvin = stats_selection.max_temp; + ui->maximumTemperatureAllText->setText(get_temperature_string(temp, TRUE)); + temp.mkelvin = stats_selection.min_temp; + ui->minimumTemperatureAllText->setText(get_temperature_string(temp, TRUE)); + if (stats_selection.combined_temp && stats_selection.combined_count) { + const char *unit; + get_temp_units(0, &unit); + ui->averageTemperatureAllText->setText(QString("%1%2").arg(stats_selection.combined_temp / stats_selection.combined_count, 0, 'f', 1).arg(unit)); + } + ui->totalTimeAllText->setText(get_time_string(stats_selection.total_time.seconds, 0)); + int seconds = stats_selection.total_time.seconds; + if (stats_selection.selection_size) + seconds /= stats_selection.selection_size; + ui->averageTimeAllText->setText(get_time_string(seconds, 0)); + ui->longestAllText->setText(get_time_string(stats_selection.longest_time.seconds, 0)); + ui->shortestAllText->setText(get_time_string(stats_selection.shortest_time.seconds, 0)); } else { /* make the fields read-only */ ui->location->setReadOnly(true); |